Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pfsense_interface] Always return ifname - even when creating a new i… #105

Merged
merged 1 commit into from
Jan 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions plugins/module_utils/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,6 @@ def _params_to_obj(self):
else:
self.target_elt = self._get_interface_elt_by_display_name(self.obj['descr'])

if self.target_elt is not None:
self.result['ifname'] = self.target_elt.tag

return obj

def _validate_params(self):
Expand Down Expand Up @@ -214,6 +211,7 @@ def _copy_and_add_target(self):
""" create the XML target_elt """
self.pfsense.copy_dict_to_element(self.obj, self.target_elt)
self.setup_interface_cmds += "interface_configure('{0}', true);\n".format(self.target_elt.tag)
self.result['ifname'] = self.target_elt.tag

def _copy_and_update_target(self):
""" update the XML target_elt """
Expand All @@ -229,6 +227,7 @@ def _copy_and_update_target(self):
else:
self.setup_interface_cmds += "interface_bring_down('{0}', true);\n".format(self.target_elt.tag)

self.result['ifname'] = self.target_elt.tag
return (before, changed)

def _create_target(self):
Expand Down Expand Up @@ -326,6 +325,7 @@ def _pre_remove_target_elt(self):
self._remove_all_rules(self.target_elt.tag)

self.setup_interface_pre_cmds += "interface_bring_down('{0}');\n".format(self.target_elt.tag)
self.result['ifname'] = self.target_elt.tag

def _remove_all_rules(self, interface):
""" delete all interface rules """
Expand Down