Browse Source

Add an alias for "port" when handling firewall rules

This change adds an internal alias for port to dport. This is done to
allow legacy config to operate as expected should a user have overrides
with the puppet legacy option. Should the action plugin encounter a
rule with the deprecated option a notice will be printed on screen
containing the rule and and information on how to convert it so that
functionality isn't lost on a future release.

Change-Id: I0643345a144a4b4c94c11465e9f8a82f13da146d
Signed-off-by: Kevin Carter <kecarter@redhat.com>
changes/53/772753/1
Kevin Carter 4 months ago
parent
commit
dcd18fa053
No known key found for this signature in database GPG Key ID: CE94BD890A47B20A
1 changed files with 13 additions and 2 deletions
  1. +13
    -2
      tripleo_ansible/ansible_plugins/action/tripleo_iptables.py

+ 13
- 2
tripleo_ansible/ansible_plugins/action/tripleo_iptables.py View File

@ -242,9 +242,20 @@ class ActionModule(ActionBase):
}
)
if 'dport' in rule:
# NOTE(cloudnull): while dport is the only supported option,
# port has been added as an ailias to ensure
# our legacy configs remain functional.
if 'dport' in rule or 'port' in rule:
dport_rule_data = versioned_rule_data.copy()
dports = rule['dport']
dports = rule.get('dport', 'port')
if 'port' in rule:
DISPLAY.v(
'The use of "port" is deprecated and will be'
' removed in a future release. Please convert'
' all uses of "port" to "dport".'
)
if not isinstance(dports, list):
dports = [dports]


Loading…
Cancel
Save