F5Networks / f5-ansible-next

Collection for managing BIG-IP NEXT devices
1 stars 0 forks source link

Using a provider name that contains a space character results in failure #4

Closed dstokesf5 closed 3 months ago

dstokesf5 commented 4 months ago
COMPONENT NAME

f5networks.next.cm_next_provider

Environment

ANSIBLE VERSION
ansible 2.10.8
  config file = None
  configured module search path = ['/home/ubuntu/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0]
BIGIP VERSION
->Platform Details
  Hostname:..........central-manager
  Release:...........20.3.0
  Platform Version:..0.2.13
  App Version:.......0.26.2
  BuildDate:.........2024.04.07    
  Flavor:............Small
  K8s Platform:......v1.27.7+k3s1

******************
Platform Details :
******************
Hostname         : bigip-next-0
Release             : 20.2.1
App Version      : 2.402.0
K3s Platform     : v1.28.5+k3s1
CONFIGURATION

"N/A"

OS / ENVIRONMENT

"N/A"

SUMMARY

Using a provider name that contains a space character results in failure.

STEPS TO REPRODUCE
---
- name: Configure Central Manager Infrastructure
  become: false
  hosts: "all"
  gather_facts: false
  connection: httpapi
  collections:
    - f5networks.next
  vars:
    ansible_host: "192.0.2.0"
    ansible_user: "admin"
    ansible_httpapi_password: "{{ lookup('env', 'admin_password') }}"
    ansible_httpapi_port: 443
    ansible_network_os: "f5networks.next.cm"
    ansible_httpapi_use_ssl: true
    ansible_httpapi_validate_certs: false
  tasks:
    - name: "Create vSphere Provider"
      cm_next_provider:
        name: "Provider Demo"
        type: "vsphere"
        address: "{{ lookup('env', 'vsphere_host') }}"
        username: "{{ lookup('env', 'vsphere_user') }}"
        password: "{{ lookup('env', 'vsphere_password') }}"
EXPECTED RESULTS

I expect the provider to be created successfully since CM supports space characters in provider names.

ACTUAL RESULTS
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ansible.module_utils.connection.ConnectionError: URL can't contain control characters. "/api/device/v1/providers/vsphere?filter=name+eq+'Provider Demo'" (found at least ' ')
fatal: [192.0.2.0]: FAILED! => {"ansible_facts": {"discovered_interpreter_python": "/usr/bin/python3"}, "changed": false, "module_stderr": "Traceback (most recent call last):\n  File \"/home/ubuntu/.ansible/tmp/ansible-local-274766q_osn66e/ansible-tmp-1712596246.1983263-274769-94838128676413/AnsiballZ_cm_next_provider.py\", line 102, in <module>\n    _ansiballz_main()\n  File \"/home/ubuntu/.ansible/tmp/ansible-local-274766q_osn66e/ansible-tmp-1712596246.1983263-274769-94838128676413/AnsiballZ_cm_next_provider.py\", line 94, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/home/ubuntu/.ansible/tmp/ansible-local-274766q_osn66e/ansible-tmp-1712596246.1983263-274769-94838128676413/AnsiballZ_cm_next_provider.py\", line 40, in invoke_module\n    runpy.run_module(mod_name='ansible_collections.f5networks.next.plugins.modules.cm_next_provider', init_globals=None, run_name='__main__', alter_sys=True)\n  File \"/usr/lib/python3.10/runpy.py\", line 224, in run_module\n    return _run_module_code(code, init_globals, run_name, mod_spec)\n  File \"/usr/lib/python3.10/runpy.py\", line 96, in _run_module_code\n    _run_code(code, mod_globals, init_globals,\n  File \"/usr/lib/python3.10/runpy.py\", line 86, in _run_code\n    exec(code, run_globals)\n  File \"/tmp/ansible_cm_next_provider_payload_7bipmk0f/ansible_cm_next_provider_payload.zip/ansible_collections/f5networks/next/plugins/modules/cm_next_provider.py\", line 566, in <module>\n  File \"/tmp/ansible_cm_next_provider_payload_7bipmk0f/ansible_cm_next_provider_payload.zip/ansible_collections/f5networks/next/plugins/modules/cm_next_provider.py\", line 559, in main\n  File \"/tmp/ansible_cm_next_provider_payload_7bipmk0f/ansible_cm_next_provider_payload.zip/ansible_collections/f5networks/next/plugins/modules/cm_next_provider.py\", line 344, in exec_module\n  File \"/tmp/ansible_cm_next_provider_payload_7bipmk0f/ansible_cm_next_provider_payload.zip/ansible_collections/f5networks/next/plugins/modules/cm_next_provider.py\", line 356, in present\n  File \"/tmp/ansible_cm_next_provider_payload_7bipmk0f/ansible_cm_next_provider_payload.zip/ansible_collections/f5networks/next/plugins/modules/cm_next_provider.py\", line 426, in exists\n  File \"/tmp/ansible_cm_next_provider_payload_7bipmk0f/ansible_cm_next_provider_payload.zip/ansible_collections/f5networks/next/plugins/module_utils/client.py\", line 21, in wrap\n  File \"/tmp/ansible_cm_next_provider_payload_7bipmk0f/ansible_cm_next_provider_payload.zip/ansible_collections/f5networks/next/plugins/module_utils/client.py\", line 44, in get\n  File \"/tmp/ansible_cm_next_provider_payload_7bipmk0f/ansible_cm_next_provider_payload.zip/ansible/module_utils/connection.py\", line 195, in __rpc__\nansible.module_utils.connection.ConnectionError: URL can't contain control characters. \"/api/device/v1/providers/vsphere?filter=name+eq+'Provider Demo'\" (found at least ' ')\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}
pgouband commented 4 months ago

Hi,

Thanks for reporting. Added to the backlog and internal tracking ID for this request is: INFRAANO-1531.

urohit011 commented 3 months ago

Fixed in the latest release