Dropped extra interfaces_info attribute from routers_info module
routers_info's interfaces_info attribute is not provided by openstacksdk, it is added to each router resource by the routers_info module after retrieving the routers list. To get the required data list_router_interfaces() [1] is being called for each router resource which then retrieves all ports for each router. This requires extra api calls which might be useless because we do not know whether the user actually cares about the ports. For getting ports of a router we have the openstack.cloud.ports module. So instead of proactively retrieving the router ports we drop the interfaces_info attribute. The interfaces_info attribute was introduced because retrieving interfaces via openstacksdk and openstack.cloud modules was complex in the past [2]. Nowadays, using openstack.cloud.ports Ansible and Jinja2 filters retrieving ip addresses of a router is straight forward. In case someone still needs the old interfaces_info attribute, one can refer to the module example to see how it could be reproduced. But in general, retrieving the router interfaces is much easier as can be seen in the updated integration tests. [1] https://opendev.org/openstack/openstacksdk/src/commit/3f81d0001dd994cde990d38f6e2671ee0694d7d5/openstack/cloud/_network.py#L1926 [2] https://review.opendev.org/c/openstack/ansible-collections-openstack/+/703927/6/plugins/modules/os_routers_info.py Change-Id: I7fbdf11d07c95421d3aee800bfeebb88ea829817
Showing
- ci/roles/router/tasks/main.yml 148 additions, 36 deletionsci/roles/router/tasks/main.yml
- plugins/modules/routers_info.py 71 additions, 24 deletionsplugins/modules/routers_info.py
- tests/unit/modules/cloud/openstack/test_routers_info.py 4 additions, 83 deletionstests/unit/modules/cloud/openstack/test_routers_info.py
Loading
Please register or sign in to comment