cyberark / ansible-security-automation-collection

CyberArk Ansible Security Automation Collection
MIT License
60 stars 39 forks source link

Certified cyberark_account collection module throws urllib a missing attribute quote error in python3 #30

Open jamesmarshall24 opened 3 years ago

jamesmarshall24 commented 3 years ago

Summary

Provide brief overview and context for the discovered bug. Using the cyberark_account certified collection throws an error stating the urllib is missing the attribute quote

Steps to Reproduce

  1. Install version of collection from certified content: ansible-galaxy collection install cyberark.pas:1.0.5
  2. Write a playbook with contents similar to the following:

    - name: Logon to CyberArk Vault using PAS Web Services SDK
      cyberark.pas.cyberark_authentication:
        api_base_url: "http://components.cyberark.local"
        validate_certs: no
        username: "bizdev"
        password: "Cyberark1"
    
    - name: Creating an Account using the PAS WebServices SDK
      cyberark.pas.cyberark_account:
        logging_level: DEBUG
        identified_by: "address,username"
        safe: "Test"
        address: "cyberark.local"
        username: "administrator-x"
        platform_id: WinServerLocal
        secret: "@N&Ibl3!"
        platform_account_properties:
            LogonDomain: "cyberark"
            OwnerName: "ansible_user"
        secret_management:
            automatic_management_enabled: true
        state: present
        cyberark_session: "{{ cyberark_session }}"
      register: cyberarkaction
  3. Run the playbook

Expected Results

Module runs successfully and the account is created

Actual Results

Traceback (most recent call last):
  File "/var/lib/awx/.ansible/tmp/ansible-tmp-1621636925.806195-27-106588692905683/AnsiballZ_cyberark_account.py", line 102, in <module>
    _ansiballz_main()
  File "/var/lib/awx/.ansible/tmp/ansible-tmp-1621636925.806195-27-106588692905683/AnsiballZ_cyberark_account.py", line 94, in _ansiballz_main
    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
  File "/var/lib/awx/.ansible/tmp/ansible-tmp-1621636925.806195-27-106588692905683/AnsiballZ_cyberark_account.py", line 40, in invoke_module
    runpy.run_module(mod_name='ansible_collections.cyberark.pas.plugins.modules.cyberark_account', init_globals=None, run_name='__main__', alter_sys=True)
  File "/usr/lib64/python3.6/runpy.py", line 205, in run_module
    return _run_module_code(code, init_globals, run_name, mod_spec)
  File "/usr/lib64/python3.6/runpy.py", line 96, in _run_module_code
    mod_name, mod_spec, pkg_name, script_name)
  File "/usr/lib64/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/tmp/ansible_cyberark.pas.cyberark_account_payload_0sethuqa/ansible_cyberark.pas.cyberark_account_payload.zip/ansible_collections/cyberark/pas/plugins/modules/cyberark_account.py", line 1378, in <module>
  File "/tmp/ansible_cyberark.pas.cyberark_account_payload_0sethuqa/ansible_cyberark.pas.cyberark_account_payload.zip/ansible_collections/cyberark/pas/plugins/modules/cyberark_account.py", line 1326, in main
  File "/tmp/ansible_cyberark.pas.cyberark_account_payload_0sethuqa/ansible_cyberark.pas.cyberark_account_payload.zip/ansible_collections/cyberark/pas/plugins/modules/cyberark_account.py", line 1108, in get_account
AttributeError: module 'urllib' has no attribute 'quote'

Reproducible

Version/Tag number

What version of the product are you running? Any version info that you can share is helpful. For example, you might give the version from Docker logs, the Docker tag, a specific download URL, the output of the /info route, etc. 1.0.5

Environment setup

Additional Information

Using the upstream version of the collection 1.0.7 results in a new error with api_base_url #31