Refactored port and port_info modules
Define port's module attribute 'name' as a required attribute because this parameter is used to find, update and delete ports. Technically, a name is not required to create a port, but idempotency cannot be implemented without an identifier to refer to a port. In this collection we use resource names to find and identify resources. We do not offer a dedicated id attribute in most modules. Use port's module attribute 'network' when finding, creating, updating or deleting ports if the user provided this attribute. This allows to reduce ambiguity when equal names are used across different networks. Added 'description' parameter to port module. Renamed port's module attributes 'vnic_type' to 'binding_vnic_type' and 'admin_state_up' to 'is_admin_state_up' to match openstacksdk's attribute names which are used e.g. in module results. Added aliases for the old attribute names to keep backward compatibility. Renamed port_info's module attribute 'port' to 'name' and added the former as an alias to be consistent with other *_info modules. Dropped default=None and required=False from argument_spec of port module because those are the default in Ansible [1][2]. Dropped 'id' field from port module's results to be consistent across other modules. Use 'port.id' instead. Sorted argument specs and documentation of the port module and marked attributes which are not updatable. Updated RETURN fields documentation for the module results of both port and port_info modules. Added integration tests to check the update mechanism of the port module. Added assertions for module results to catch future changes in the openstacksdk and our Ansible modules. Dropped openstacksdk version check since we require a recent release anyway. Fixed indentation in integration tests. Merged integration tests of port_info module into port module, because the former does not create any ports and assumes that ports have been created earlier. [1] https://docs.ansible.com/ansible/latest/dev_guide/developing_modules_documenting.html [2] https://github.com/ansible/ansible/blob/61af59c8082cff068424d1012271daa0aac97288/lib/ansible/module_utils/common/parameters.py#L489 Signed-off-by:Jakob Meng <code@jakobmeng.de> Change-Id: Iacca78649f8e01ae95649d8d462f5d0a1740405e
Showing
- .zuul.yaml 0 additions, 1 deletion.zuul.yaml
- ci/roles/port/defaults/main.yml 44 additions, 6 deletionsci/roles/port/defaults/main.yml
- ci/roles/port/tasks/main.yml 236 additions, 91 deletionsci/roles/port/tasks/main.yml
- ci/roles/port_info/tasks/main.yml 0 additions, 72 deletionsci/roles/port_info/tasks/main.yml
- ci/run-collection.yml 0 additions, 1 deletionci/run-collection.yml
- plugins/modules/port.py 559 additions, 386 deletionsplugins/modules/port.py
- plugins/modules/port_info.py 79 additions, 64 deletionsplugins/modules/port_info.py
Loading
Please register or sign in to comment