Class: Y2Firewall::Firewalld::ZoneReader
- Inherits:
-
Object
- Object
- Y2Firewall::Firewalld::ZoneReader
- Includes:
- Yast::Logger
- Defined in:
- library/network/src/lib/y2firewall/firewalld/zone_reader.rb
Overview
Class to help parsing firewall-cmd --list-all-zones output
Constant Summary collapse
- BOOLEAN_ATTRIBUTES =
["icmp-block-inversion", "masquerade"].freeze
Instance Attribute Summary collapse
-
#zone_entries ⇒ Hash<String,Hash>
Stores the parsed configuration for eac zone indexed by its name.
-
#zone_names ⇒ Array<String] configured zone names
Array<String] configured zone names.
-
#zones_definition ⇒ String
Zones definition to be parsed for initializing the zone objects.
Instance Method Summary collapse
-
#initialize(zone_names, zones_definition) ⇒ ZoneReader
constructor
Constructor.
-
#read ⇒ Array<Y2Firewall::Firewalld::Zone>
It reads the zone definition instantiating the defined zones and settings their attributes.
Constructor Details
#initialize(zone_names, zones_definition) ⇒ ZoneReader
Constructor
46 47 48 49 50 |
# File 'library/network/src/lib/y2firewall/firewalld/zone_reader.rb', line 46 def initialize(zone_names, zones_definition) @zone_names = zone_names @zones_definition = zones_definition @zone_entries = {} end |
Instance Attribute Details
#zone_entries ⇒ Hash<String,Hash>
Returns stores the parsed configuration for eac zone indexed by its name.
34 35 36 |
# File 'library/network/src/lib/y2firewall/firewalld/zone_reader.rb', line 34 def zone_entries @zone_entries end |
#zone_names ⇒ Array<String] configured zone names
Returns Array<String] configured zone names.
31 32 33 |
# File 'library/network/src/lib/y2firewall/firewalld/zone_reader.rb', line 31 def zone_names @zone_names end |
#zones_definition ⇒ String
Returns zones definition to be parsed for initializing the zone objects.
37 38 39 |
# File 'library/network/src/lib/y2firewall/firewalld/zone_reader.rb', line 37 def zones_definition @zones_definition end |
Instance Method Details
#read ⇒ Array<Y2Firewall::Firewalld::Zone>
It reads the zone definition instantiating the defined zones and settings their attributes.
56 57 58 59 60 61 |
# File 'library/network/src/lib/y2firewall/firewalld/zone_reader.rb', line 56 def read return [] if !@zone_names || @zone_names.empty? parse_zones initialize_zones end |