Module: Yast::NetworkLanDhcpInclude

Defined in:
src/include/network/lan/dhcp.rb

Instance Method Summary collapse

Instance Method Details

#initDhclientOptions(_key) ⇒ Object



86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'src/include/network/lan/dhcp.rb', line 86

def initDhclientOptions(_key)
  UI.ChangeWidget(
    Id(:clientid),
    :Value,
    Ops.get_string(NetworkConfig.DHCP, "DHCLIENT_CLIENT_ID", "")
  )
  UI.ChangeWidget(
    Id(:hostname),
    :Value,
    Ops.get_string(NetworkConfig.DHCP, "DHCLIENT_HOSTNAME_OPTION", "")
  )
  UI.ChangeWidget(
    Id(:no_defaultroute),
    :Value,
    Ops.get_boolean(NetworkConfig.DHCP, "DHCLIENT_SET_DEFAULT_ROUTE", true)
  )

  disable_unconfigureable_items(
    [:clientid, :hostname, :no_defaultroute],
    false
  )

  nil
end

#initialize_network_lan_dhcp(include_target) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'src/include/network/lan/dhcp.rb', line 29

def initialize_network_lan_dhcp(include_target)
  Yast.import "UI"

  textdomain "network"

  Yast.import "NetworkConfig"

  Yast.include include_target, "network/routines.rb"
  Yast.include include_target, "network/lan/help.rb"

  # Details dialog contents
  @contents =
    # Frame label
    Frame(
      _("DHCP Client Options"),
      VBox(
        Left(
          InputField(
            Id(:clientid),
            Opt(:hstretch),
            _("DHCP Client &Identifier")
          )
        ),
        VSpacing(0.49),
        # TextEntry label
        Left(
          InputField(Id(:hostname), Opt(:hstretch), _("&Hostname to Send"))
        ),
        VSpacing(0.49),
        Left(
          HBox(
            CheckBox(
              Id(:no_defaultroute),
              _("Change Default Route via DHCP")
            )
          )
        )
      )
    )

  @widget_descr_dhclient = {
    "DHCLIENT_OPTIONS" => {
      "widget"        => :custom,
      "custom_widget" => @contents,
      "help"          => Ops.get_string(@help, "dhclient_help", ""),
      "init"          => fun_ref(
        method(:initDhclientOptions),
        "void (string)"
      ),
      "store"         => fun_ref(
        method(:storeDhclientOptions),
        "void (string, map)"
      )
    }
  }
end

#storeDhclientOptions(_key, _event) ⇒ Object



111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# File 'src/include/network/lan/dhcp.rb', line 111

def storeDhclientOptions(_key, _event)
  Ops.set(
    NetworkConfig.DHCP,
    "DHCLIENT_SET_DEFAULT_ROUTE",
    UI.QueryWidget(Id(:no_defaultroute), :Value) == true
  )
  Ops.set(
    NetworkConfig.DHCP,
    "DHCLIENT_CLIENT_ID",
    UI.QueryWidget(Id(:clientid), :Value)
  )
  Ops.set(
    NetworkConfig.DHCP,
    "DHCLIENT_HOSTNAME_OPTION",
    UI.QueryWidget(Id(:hostname), :Value)
  )

  nil
end