Class: Y2Network::Widgets::FirewallZone

Inherits:
CWM::CustomWidget
  • Object
show all
Includes:
Y2Firewall::Helpers::Interfaces
Defined in:
src/lib/y2network/widgets/firewall_zone.rb

Overview

This widget offers a checkbox for enabling the firewalld interface ZONE mapping through the ifcfg file and a selection list for choose the ZONE to be used.

Instance Method Summary collapse

Constructor Details

#initialize(builder) ⇒ FirewallZone

Constructor


38
39
40
41
42
# File 'src/lib/y2network/widgets/firewall_zone.rb', line 38

def initialize(builder)
  textdomain "network"
  @builder = builder
  @interface = Y2Firewall::Firewalld::Interface.new(builder.name)
end

Instance Method Details

#contentsObject

See Also:

  • CWM::AbstractWidget

60
61
62
63
64
65
# File 'src/lib/y2network/widgets/firewall_zone.rb', line 60

def contents
  # TRANSLATORS: firewall is not installed label
  return Label(_("Firewall is not installed.")) unless installed?

  Left(zones_widget)
end

#helpObject

See Also:

  • CWM::AbstractWidget

84
85
86
87
88
89
90
91
92
93
94
# File 'src/lib/y2network/widgets/firewall_zone.rb', line 84

def help
  help_text =
    # TRANSLATORS: Firewall ZONE widget help description
    _("<p><b><big>FIREWALL ZONE</big></b></p>" \
      "<p>A network zone defines the level of trust for network connections. " \
      "The selected ZONE will be added to the ifcfg as well as the firewalld " \
      "permanent configuration.</p>")

  help_text += zones_help if installed?
  help_text
end

#initObject

See Also:

  • CWM::AbstractWidget

52
53
54
55
56
57
# File 'src/lib/y2network/widgets/firewall_zone.rb', line 52

def init
  return unless installed?

  populate_select(firewall_zones)
  select_zone(@builder.firewall_zone) if installed?
end

#labelString

See Also:

  • CWM::AbstractWidget

46
47
48
49
# File 'src/lib/y2network/widgets/firewall_zone.rb', line 46

def label
  # TRANSLATORS: label for Firewall ZONE assignment
  _("Assign Interface to Firewall &Zone")
end

#storeString?

Stores the current value

See Also:

  • CWM::AbstractWidget

79
80
81
# File 'src/lib/y2network/widgets/firewall_zone.rb', line 79

def store
  @builder.firewall_zone = value
end

#valueString?

It returns the current ZONE selection or nil in case of not enabled the management through the ifcfg files.


71
72
73
# File 'src/lib/y2network/widgets/firewall_zone.rb', line 71

def value
  selected_zone
end