codeaffen / phpipam-ansible-modules

Ansible Modules to manage phpIPAM installations
https://codeaffen.org/projects/phpipam-ansible-modules
GNU General Public License v3.0
22 stars 10 forks source link

Module failure for phpipam v1.6 #115

Closed Swaeltjie closed 9 months ago

Swaeltjie commented 12 months ago

Describe the bug I have deployed phpIPAM IP address management [v1.6.0] dbversion 39 using php v8.2. When running a basic playbook to just add a subnet, i get an error as per below:

- name: Subnet module tests
  hosts: localhost
  gather_facts: false
  tasks:
  - name: "Create a subnet"
    codeaffen.phpipam.subnet:
      username: "admin"
      password: "mypassword"
      server_url: "http://localhost"
      cidr: "192.0.2.128/26"
      validate_certs: false
      app_id: "ansible"
      section: "Customers"
      state: present
The full traceback is:
Traceback (most recent call last):
  File "/Users/myuser/.ansible/tmp/ansible-tmp-1701953976.2923598-86153-236914147207910/AnsiballZ_subnet.py", line 107, in <module>
    _ansiballz_main()
  File "/Users/myuser/.ansible/tmp/ansible-tmp-1701953976.2923598-86153-236914147207910/AnsiballZ_subnet.py", line 99, in _ansiballz_main
    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
  File "/Users/myuser/.ansible/tmp/ansible-tmp-1701953976.2923598-86153-236914147207910/AnsiballZ_subnet.py", line 47, in invoke_module
    runpy.run_module(mod_name='ansible_collections.codeaffen.phpipam.plugins.modules.subnet', init_globals=dict(_module_fqn='ansible_collections.codeaffen.phpipam.plugins.modules.subnet', _modlib_path=modlib_path),
  File "<frozen runpy>", line 226, in run_module
  File "<frozen runpy>", line 98, in _run_module_code
  File "<frozen runpy>", line 88, in _run_code
  File "/var/folders/z5/8gjws59117v_1sbh43ncnnq80000gq/T/ansible_codeaffen.phpipam.subnet_payload_fe0qvq2d/ansible_codeaffen.phpipam.subnet_payload.zip/ansible_collections/codeaffen/phpipam/plugins/modules/subnet.py", line 258, in <module>
  File "/var/folders/z5/8gjws59117v_1sbh43ncnnq80000gq/T/ansible_codeaffen.phpipam.subnet_payload_fe0qvq2d/ansible_codeaffen.phpipam.subnet_payload.zip/ansible_collections/codeaffen/phpipam/plugins/modules/subnet.py", line 253, in main
  File "/opt/homebrew/Cellar/python@3.11/3.11.6_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/contextlib.py", line 137, in __enter__
    return next(self.gen)
           ^^^^^^^^^^^^^^
  File "/var/folders/z5/8gjws59117v_1sbh43ncnnq80000gq/T/ansible_codeaffen.phpipam.subnet_payload_fe0qvq2d/ansible_codeaffen.phpipam.subnet_payload.zip/ansible_collections/codeaffen/phpipam/plugins/module_utils/phpipam_helper.py", line 99, in api_connection
  File "/var/folders/z5/8gjws59117v_1sbh43ncnnq80000gq/T/ansible_codeaffen.phpipam.subnet_payload_fe0qvq2d/ansible_codeaffen.phpipam.subnet_payload.zip/ansible_collections/codeaffen/phpipam/plugins/module_utils/phpipam_helper.py", line 111, in connect
  File "/opt/homebrew/lib/python3.11/site-packages/phpypam/core/api.py", line 70, in __init__
    self._login()
  File "/opt/homebrew/lib/python3.11/site-packages/phpypam/core/api.py", line 132, in _login
    resp = self._query(method=POST, auth=_auth)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/phpypam/core/api.py", line 124, in _query
    raise PHPyPAMException(code=result['code'], message=result['message'])
phpypam.core.exceptions.PHPyPAMException
fatal: [localhost]: FAILED! => {
    "changed": false,
    "module_stderr": "Traceback (most recent call last):\n  File \"/Users/myuser/.ansible/tmp/ansible-tmp-1701953976.2923598-86153-236914147207910/AnsiballZ_subnet.py\", line 107, in <module>\n    _ansiballz_main()\n  File \"/Users/myuser/.ansible/tmp/ansible-tmp-1701953976.2923598-86153-236914147207910/AnsiballZ_subnet.py\", line 99, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/Users/myuser/.ansible/tmp/ansible-tmp-1701953976.2923598-86153-236914147207910/AnsiballZ_subnet.py\", line 47, in invoke_module\n    runpy.run_module(mod_name='ansible_collections.codeaffen.phpipam.plugins.modules.subnet', init_globals=dict(_module_fqn='ansible_collections.codeaffen.phpipam.plugins.modules.subnet', _modlib_path=modlib_path),\n  File \"<frozen runpy>\", line 226, in run_module\n  File \"<frozen runpy>\", line 98, in _run_module_code\n  File \"<frozen runpy>\", line 88, in _run_code\n  File \"/var/folders/z5/8gjws59117v_1sbh43ncnnq80000gq/T/ansible_codeaffen.phpipam.subnet_payload_fe0qvq2d/ansible_codeaffen.phpipam.subnet_payload.zip/ansible_collections/codeaffen/phpipam/plugins/modules/subnet.py\", line 258, in <module>\n  File \"/var/folders/z5/8gjws59117v_1sbh43ncnnq80000gq/T/ansible_codeaffen.phpipam.subnet_payload_fe0qvq2d/ansible_codeaffen.phpipam.subnet_payload.zip/ansible_collections/codeaffen/phpipam/plugins/modules/subnet.py\", line 253, in main\n  File \"/opt/homebrew/Cellar/python@3.11/3.11.6_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/contextlib.py\", line 137, in __enter__\n    return next(self.gen)\n           ^^^^^^^^^^^^^^\n  File \"/var/folders/z5/8gjws59117v_1sbh43ncnnq80000gq/T/ansible_codeaffen.phpipam.subnet_payload_fe0qvq2d/ansible_codeaffen.phpipam.subnet_payload.zip/ansible_collections/codeaffen/phpipam/plugins/module_utils/phpipam_helper.py\", line 99, in api_connection\n  File \"/var/folders/z5/8gjws59117v_1sbh43ncnnq80000gq/T/ansible_codeaffen.phpipam.subnet_payload_fe0qvq2d/ansible_codeaffen.phpipam.subnet_payload.zip/ansible_collections/codeaffen/phpipam/plugins/module_utils/phpipam_helper.py\", line 111, in connect\n  File \"/opt/homebrew/lib/python3.11/site-packages/phpypam/core/api.py\", line 70, in __init__\n    self._login()\n  File \"/opt/homebrew/lib/python3.11/site-packages/phpypam/core/api.py\", line 132, in _login\n    resp = self._query(method=POST, auth=_auth)\n           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/opt/homebrew/lib/python3.11/site-packages/phpypam/core/api.py\", line 124, in _query\n    raise PHPyPAMException(code=result['code'], message=result['message'])\nphpypam.core.exceptions.PHPyPAMException\n",
    "module_stdout": "",
    "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
    "rc": 1
}

I'm using the latest version of the Galaxy colection:

ansible-galaxy collection list|grep phpipam codeaffen.phpipam 1.7.0

python -V Python 3.11.6

To Reproduce Steps to reproduce the behavior:

  1. Run playbook against phpIPAM v1.6

Expected behavior Subnet to be added

Versions:

Additional context Add any other context about the problem here.

cmeissner commented 12 months ago

@Swaeltjie thank you for bringing this to our attention. With the nightly container image, I can't reproduce the issue. So I would assume a local problem. Can you please run our tests against your installation and double-check the results against the containerized setup we use for our tests?

cmeissner commented 9 months ago

This issue will be closed soon. You can avoid it by leaving a new comment.

cmeissner commented 9 months ago

Issue closed due to inactivity.