Influxdb_database module TypeError: __init__() got an unexpected keyword argument 'proxies'?

Hi,

I have this Ansible task that used to work when my team was using a 1.X InfluxDB. We are upgrading InfluxDB to 2.X and now the task fails. Here is the task:

- name: InfluxDB | Create InfluxDB database
  influxdb_database:
    database_name: "{{ cluster_name }}"
    hostname: localhost
  when: cluster_name is defined

Error message:

TypeError: __init__() got an unexpected keyword argument 'proxies'

And here is the full error it is getting with InfluxDB 2.X:

TASK [influxdb : InfluxDB | Create InfluxDB database] **************************
An exception occurred during task execution. To see the full traceback, use -vvv. 
The error was: TypeError: __init__() got an unexpected keyword argument 'proxies'
fatal: [molecule-host]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n  File \"/root/.ansible/tmp/ansible-tmp-1707431296.2575212-2406850-175229074445029/AnsiballZ_influxdb_database.py\", line 100, in <module>\n
_ansiballz_main()\n  File \"/root/.ansible/tmp/ansible-tmp-1707431296.2575212-2406850-175229074445029/AnsiballZ_influxdb_database.py\", line 92, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/root/.ansible/tmp/ansible-tmp-1707431296.2575212-2406850-175229074445029/AnsiballZ_influxdb_database.py\", line 40, in invoke_module\n
runpy.run_module(mod_name='ansible_collections.community.general.plugins.modules.influxdb_database', 
init_globals=dict(_module_fqn='ansible_collections.community.general.plugins.modules.influxdb_database', _modlib_path=modlib_path),\n  File \"/opt/rh/rh-
python38/root/usr/lib64/python3.8/runpy.py\", line 207, in run_module\n    return _run_module_code(code, init_globals, run_name, mod_spec)\n  File \"/opt/rh/rh-python38/root/usr/lib64/python3.8/runpy.py\", line 97, in _run_module_code\n    _run_code(code, mod_globals, init_globals,\n  File \"/opt/rh/rh-python38/root/usr/lib64/python3.8/runpy.py\", line 87, in _run_code\n    exec(code, 
run_globals)\n  File 
\"/tmp/ansible_community.general.influxdb_database_payload_lhnge8uk/ansible_community.general.influxdb_database_payload.zip/ansible_collections/community/general/plugins/modules/influxdb_database.py\", line 142, in <module>\n  File \"/tmp/ansible_community.general.influxdb_database_payload_lhnge8uk/ansible_community.general.influxdb_database_payload.zip/ansible_collections/community/general/plugins/modules/influxdb_database.py\", line 124, in main\n  File \"/tmp/ansible_community.general.influxdb_database_payload_lhnge8uk/ansible_community.general.influxdb_database_payload.zip/ansible_collections/community/general/plugins/module_utils/influxdb.py\", line 92, in connect_to_influxdb\nTypeError: __init__() got an unexpected keyword argument 'proxies'\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}

I guess you updated the Python influxdb library as well, and the version you are using is not compatible to the code in community.general.

1 Like