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>
This commit is contained in:
parent
5b6456792f
commit
dcd18fa053
@ -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()
|
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):
|
if not isinstance(dports, list):
|
||||||
dports = [dports]
|
dports = [dports]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user