opengear / opengear.om

Ansible Network Collection for Opengear OM
GNU General Public License v3.0
5 stars 7 forks source link

Ports Argparse missing name and portnum #8

Closed ecrosswhite closed 4 months ago

ecrosswhite commented 10 months ago

I found that attempting to modify a port-config I would get an error;

FAILED! => {"changed": false, "msg": "Unsupported parameters for (basic.py) module: config.ports.name, config.ports.portnum. Supported parameters include: baudrate, databits, escape_char, id, ip_alias, kernel_debug, label, logging_level, mode, parity, pinout, power, sessions, stopbits, terminal_emulation."}

My task was very basic for testing;

- name: Modify ports
  opengear.om.om_ports:
    config:
      ports:
        - id: "ports-43"
          label: "label test"
    state:
      merged

Digging in I found that collections/ansible_collections/opengear/om/plugins/module_utils/network/om/argspec/ports/ports.py needed to have a couple of additions as the facts module seems to return these values when doing a comparison. Forgive my ignorance as I'm still new to this. I worked around the issue by adding to argument_spec variable, config.options.ports.options section;

'name': {'type': 'str'}, 'portnum': {'type': 'str'},

Following the addition I was able to run my playbook successfully.

mattwit commented 5 months ago

@ecrosswhite Can you create a pull request with your updated _collections/ansible_collections/opengear/om/plugins/moduleutils/network/om/argspec/ports/ports.py

OR post a code snippet here.

Thanks!

ecrosswhite commented 5 months ago

@mattwit Added a pull request to add the items mentioned, https://github.com/opengear/opengear.om/pull/13

Thank you!

mattwit commented 4 months ago

Merged PR #13. Closing.