Makes security_group_rule_info compatible with new sdk version

- Changed get_security_group_rule to find_security_group_rule as
  get_security_group_rule throws an exception if the rule is not
  found
- Updated docs
- Updated tests
- Renamed ethertype to ether_type to match openstacksdk's attribute
  names and added the former as an alias to keep backward compat
- Renamed rule to id to match openstacksdk's attribute names and
  added the former as an alias to keep backward compat

Change-Id: Ieb99f875c990e11623c81e482013d0ecb8e61055
This commit is contained in:
anbanerj
2022-06-16 13:35:45 +02:00
committed by Rafael Castillo
parent 2d0656f072
commit fb0fb529b7
2 changed files with 109 additions and 87 deletions

View File

@@ -22,11 +22,31 @@
remote_ip_prefix: 0.0.0.0/0
register: rule
- name: Assert return fields
- name: Assert return fields for security_group_rule
assert:
that: item in rule.rule
loop: "{{ expected_fields }}"
- name: Fetch all security group rule
openstack.cloud.security_group_rule_info:
cloud: "{{ cloud }}"
register: all_rules
- name: Assert return fields security_group_rule_info
assert:
that: item in all_rules.security_group_rules[0]
loop: "{{ expected_fields }}"
- name: Fetch security group rule based on rule
openstack.cloud.security_group_rule_info:
cloud: "{{ cloud }}"
id: "{{ rule.rule.id }}"
register: filter_by_rule
- name: Assert return fields security_group_rule_info
assert:
that: filter_by_rule.security_group_rules|length != 0
- name: Assert changed
assert:
that: rule is changed