Dropped deprecated return values in floating_ip_info and assert remaining fields
Attributes such as location and tenant_id are computed by OpenStack
SDK. We do not return these fields in floating_ip_info because e.g.
tenant_id has been marked as deprecated and is a copy of the
project_id field.
Ref.: 70a06d9990
Added an assertion to CI which checks that all advertised fields
are returned by floating_ip_info. This helps with detecting breaking
changes in future updates.
Change-Id: I62e4681cd57f82054f68efe1dc59be2cca118135
This commit is contained in:
parent
1ec9afe2ca
commit
41ad425d23
@ -9,3 +9,13 @@
|
||||
that:
|
||||
- fips is success
|
||||
- fips is not changed
|
||||
|
||||
- name: assert fields
|
||||
when: fips.floating_ips|length > 0
|
||||
assert:
|
||||
that:
|
||||
# allow new fields to be introduced but prevent fields from being removed
|
||||
- '["created_at", "description", "dns_domain", "dns_name", "fixed_ip_address", "floating_ip_address",
|
||||
"floating_network_id", "id", "name", "port_details", "port_id", "project_id", "qos_policy_id",
|
||||
"revision_number", "router_id", "status", "subnet_id", "tags", "updated_at"]|
|
||||
difference(fips.floating_ips.0.keys())|length == 0'
|
||||
|
@ -165,7 +165,6 @@ class FloatingIPInfoModule(OpenStackModule):
|
||||
router = self.params['router']
|
||||
status = self.params['status']
|
||||
|
||||
data = []
|
||||
query = {}
|
||||
if description:
|
||||
query['description'] = description
|
||||
@ -194,15 +193,8 @@ class FloatingIPInfoModule(OpenStackModule):
|
||||
if status:
|
||||
query['status'] = status.upper()
|
||||
|
||||
for raw in self.conn.network.ips(**query):
|
||||
dt = raw.to_dict()
|
||||
dt.pop('location')
|
||||
data.append(dt)
|
||||
|
||||
self.exit_json(
|
||||
changed=False,
|
||||
floating_ips=data
|
||||
)
|
||||
ips = [ip.to_dict(computed=False) for ip in self.conn.network.ips(**query)]
|
||||
self.exit_json(changed=False, floating_ips=ips)
|
||||
|
||||
|
||||
def main():
|
||||
|
Loading…
x
Reference in New Issue
Block a user