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 <>
This commit is contained in:
Kevin Carter 2021-01-27 11:56:46 -06:00
parent 5b6456792f
commit dcd18fa053
No known key found for this signature in database
GPG Key ID: CE94BD890A47B20A
1 changed files with 13 additions and 2 deletions

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:
'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]