Skip to content

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

@amcginlay

Description

@amcginlay

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions