Module: Y2Firewall::Helpers::Interfaces
- Included in:
- Yast::CWMFirewallInterfacesClass
- Defined in:
- library/network/src/lib/y2firewall/helpers/interfaces.rb
Overview
Set of helpers methods for operating with NetworkInterfaces and firewalld zones.
Instance Method Summary collapse
-
#default_interfaces ⇒ Array<String>
Return the name of interfaces which belongs to the default zone.
-
#default_zone ⇒ Y2Firewall::Firewalld::Zone
Convenience method to return the default zone object.
-
#firewalld ⇒ Y2Firewall::Firewalld
Return an instance of Y2Firewall::Firewalld.
-
#interface_zone(name) ⇒ String?
Return the zone name for a given interface from the firewalld instance instead of from the API.
-
#known_interfaces ⇒ Array<Y2Firewall::Firewalld::Interface>
Return an array with all the known (sysconfig configured) firewalld interfaces.
-
#unknown_interfaces ⇒ Array<Y2Firewall::Firewalld::Interface>
Return an array with all the interfaces configured in some firewalld zone but not configured in sysconfig.
Instance Method Details
#default_interfaces ⇒ Array<String>
Return the name of interfaces which belongs to the default zone
45 46 47 |
# File 'library/network/src/lib/y2firewall/helpers/interfaces.rb', line 45 def default_interfaces known_interfaces.reject(&:zone).map(&:name) end |
#default_zone ⇒ Y2Firewall::Firewalld::Zone
Convenience method to return the default zone object
61 62 63 |
# File 'library/network/src/lib/y2firewall/helpers/interfaces.rb', line 61 def default_zone @default_zone ||= firewalld.find_zone(firewalld.default_zone) end |
#firewalld ⇒ Y2Firewall::Firewalld
Return an instance of Y2Firewall::Firewalld
38 39 40 |
# File 'library/network/src/lib/y2firewall/helpers/interfaces.rb', line 38 def firewalld Y2Firewall::Firewalld.instance end |
#interface_zone(name) ⇒ String?
Return the zone name for a given interface from the firewalld instance instead of from the API.
54 55 56 |
# File 'library/network/src/lib/y2firewall/helpers/interfaces.rb', line 54 def interface_zone(name) Y2Firewall::Firewalld::Interface.new(name).zone end |
#known_interfaces ⇒ Array<Y2Firewall::Firewalld::Interface>
Return an array with all the known (sysconfig configured) firewalld interfaces.
69 70 71 72 73 |
# File 'library/network/src/lib/y2firewall/helpers/interfaces.rb', line 69 def known_interfaces return @known_interfaces if @known_interfaces @known_interfaces = Y2Firewall::Firewalld::Interface.known end |
#unknown_interfaces ⇒ Array<Y2Firewall::Firewalld::Interface>
Return an array with all the interfaces configured in some firewalld zone but not configured in sysconfig.
79 80 81 |
# File 'library/network/src/lib/y2firewall/helpers/interfaces.rb', line 79 def unknown_interfaces Y2Firewall::Firewalld::Interface.unknown end |