Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

connection_cloud.set_policy() fails to add a 2nd issuing template to an existing application #124

Closed
amcginlay opened this issue May 29, 2023 · 0 comments · Fixed by #127
Labels
bug Something isn't working

Comments

@amcginlay
Copy link

PROBLEM SUMMARY
connection_cloud.set_policy() fails to add a 2nd issuing template to an existing application

STEPS TO REPRODUCE

api_key = environ.get('VAAS_APIKEY')
ps = PolicySpecification(policy=Policy(), defaults=Defaults())

connector = venafi_connection(api_key=api_key)
connector.set_policy('test-app-1234\\test-cit-1234', ps)              # <- new app, new cit ... works
connector.set_policy('test-app-1234\\test-cit-5678', ps)              # <- existing app, new cit ... fails

EXPECTED RESULTS
Expect test-app-1234 to have both test-cit-1234 and test-cit-5678 assigned

ACTUAL RESULTS

Exception has occurred: TypeError
argument of type 'NoneType' is not iterable
  File "/Users/alan.mcginlay/src/venafi/vcert-python/vcert/policy/pm_cloud.py", line 870, in get_cit_data_from_response
    if 'certificateIssuingTemplates' in data:
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/alan.mcginlay/src/venafi/vcert-python/vcert/connection_cloud.py", line 658, in set_policy
    cit_id, cit_name = get_cit_data_from_response(cit_data)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/alan.mcginlay/src/venafi/vcert-python/vcert/set_policy_vaas.py", line 43, in main
    connector.set_policy('test-app-1234\\test-cit-5678', ps)              # <- existing app, new cit ... fails
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/alan.mcginlay/src/venafi/vcert-python/vcert/set_policy_vaas.py", line 116, in <module>
    main()
TypeError: argument of type 'NoneType' is not iterable

FIX
In cloud_connection.py, line 658 uses the wrong variable.
Change:

cit_id, cit_name = get_cit_data_from_response(cit_data)

To:

cit_id, cit_name = get_cit_data_from_response(resp_cit_data)
@amcginlay amcginlay added the bug Something isn't working label May 29, 2023
amcginlay added a commit to paulternate/cf-venafi-automation that referenced this issue May 31, 2023
@rvelaVenafi rvelaVenafi linked a pull request Jun 1, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant