Skip to content

Instantly share code, notes, and snippets.

@kellinm
Last active November 22, 2021 05:35
Show Gist options
  • Save kellinm/18dc51a6c5b5fbc204965f68cea49e94 to your computer and use it in GitHub Desktop.
Save kellinm/18dc51a6c5b5fbc204965f68cea49e94 to your computer and use it in GitHub Desktop.
Naive FirewallD Ansible Module Patch proof of concept
221,225d220
< from firewall.core.fw_nm import nm_is_imported, \
< nm_set_zone_of_connection, \
< nm_get_connection_of_interface, \
< nm_get_zone_of_connection
<
464d458
< nm_set_zone_of_connection(self.zone, interface)
505,513d498
< if nm_is_imported():
< try:
< connection = nm_get_connection_of_interface(interface)
< except Exception:
< pass
< else:
< if connection is not None:
< if self.zone != nm_get_zone_of_connection(connection):
< nm_set_zone_of_connection(self.zone, connection)
523,534d507
< def try_set_zone_of_interface(_zone, interface):
< if nm_is_imported():
< try:
< connection = nm_get_connection_of_interface(interface)
< except Exception:
< pass
< else:
< if connection is not None:
< if _zone != nm_get_zone_of_connection(connection):
< nm_set_zone_of_connection(_zone, connection)
< return True
< return False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment