Skip to content

Run into KeyError: 'section' error when using address module #41

@cmeissner

Description

@cmeissner

Describe the bug

When calling address module we run into a KeyError. The module is complaining about section which is not there.

To Reproduce

  • following variable is set:
address:
  ipaddress: 172.16.0.1
  subnet: 172.16.0.0/24
  is_gateway: yes
  • run the following ansible task with -vvv:
- name: "Ensure state of ip address: {{ name }}"
  address:
    server_url: "{{ phpipam_server_url }}"
    app_id: "{{ phpipam_app_id }}"
    username: "{{ phpipam_username }}"
    password: "{{ phpipam_password }}"
    subnet: "{{ address.subnet }}"
    ipaddress: "{{ address.ipaddress }}"
    is_gateway: "{{ address.is_gateway | default(omit) }}"
    description: "{{ address.description | default(omit) }}"
    mac_address: "{{ address.mac_address | default(omit) }}"
    owner: "{{ address.owner | default(omit) }}"
    tag: "{{ address.tag | default(omit) }}"
    ignore_ptr: "{{ address.ignore_ptr | default(omit) }}"
    ptr: "{{ address.ptr | default(omit) }}"
    device: "{{ address.device | default(omit) }}"
    port: "{{ address.port | default(omit) }}"
    note: "{{ address.note | default(omit) }}"
    exclude_ping: "{{ address.exclude_ping | default(omit) }}"
    state: "{{ address.state | default('present') }}"
  • See following error:
  File "/var/folders/dn/t64yh4j91fscbqw3rd2_frt9pq8rlt/T/ansible_address_payload_trd382xu/ansible_address_payload.zip/ansible_collections/codeaffen/phpipam/plugins/modules/address.py", line 157, in <module>
  File "/var/folders/dn/t64yh4j91fscbqw3rd2_frt9pq8rlt/T/ansible_address_payload_trd382xu/ansible_address_payload.zip/ansible_collections/codeaffen/phpipam/plugins/modules/address.py", line 153, in main
  File "/var/folders/dn/t64yh4j91fscbqw3rd2_frt9pq8rlt/T/ansible_address_payload_trd382xu/ansible_address_payload.zip/ansible_collections/codeaffen/phpipam/plugins/module_utils/phpipam_helper.py", line 505, in run
  File "/var/folders/dn/t64yh4j91fscbqw3rd2_frt9pq8rlt/T/ansible_address_payload_trd382xu/ansible_address_payload.zip/ansible_collections/codeaffen/phpipam/plugins/module_utils/phpipam_helper.py", line 254, in _auto_resolve_entities
  File "/var/folders/dn/t64yh4j91fscbqw3rd2_frt9pq8rlt/T/ansible_address_payload_trd382xu/ansible_address_payload.zip/ansible_collections/codeaffen/phpipam/plugins/module_utils/phpipam_helper.py", line 214, in _resolve_entity
KeyError: 'section'

Expected behavior

The Address should be managed.

Versions:

  • Ansible: 2.9.15
  • phpipam-ansible-modules: 1.3.0
  • phpypam: 1.0.0

Additional context

This behavior can be observed since v1.3.0 of codeaffen.phpipam

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