Class: Yast::SetupDhcp
- Inherits:
-
Object
- Object
- Yast::SetupDhcp
- Includes:
- Logger, Singleton
- Defined in:
- src/lib/network/clients/inst_setup_dhcp.rb
Instance Method Summary collapse
- #main ⇒ Object
-
#set_dhcp_hostname! ⇒ Object
Write the DHCLIENT_SET_HOSTNAME in /etc/sysconfig/network/dhcp based on linuxrc sethostname cmdline option if provided or the default value defined in the control file if not.
-
#set_dhcp_hostname? ⇒ Boolean
Check if set of DHCLIENT_SET_HOSTNAME in /etc/sysconfig/network/dhcp has been disable by linuxrc cmdline.
-
#set_hostname_used? ⇒ Boolean
Check whether the linuxrc sethostname option has been used or not.
Instance Method Details
#main ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'src/lib/network/clients/inst_setup_dhcp.rb', line 32 def main nac = NetworkAutoconfiguration.instance set_dhcp_hostname! if Stage.initial if Yast::NetworkService.wicked? if !nac.any_iface_active? nac.configure_dhcp else log.info("Automatic DHCP configuration not started - an interface is already configured") end else log.info("Network is not managed by wicked, skipping DHCP setup") end :next end |
#set_dhcp_hostname! ⇒ Object
Write the DHCLIENT_SET_HOSTNAME in /etc/sysconfig/network/dhcp based on linuxrc sethostname cmdline option if provided or the default value defined in the control file if not.
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'src/lib/network/clients/inst_setup_dhcp.rb', line 62 def set_dhcp_hostname! set_dhcp_hostname = set_hostname_used? ? set_dhcp_hostname? : DNS.default_dhcp_hostname log.info("Write dhcp hostname default: #{set_dhcp_hostname}") DNS.dhcp_hostname = set_dhcp_hostname ? :any : :none SCR.Write( Yast::Path.new(".sysconfig.network.dhcp.DHCLIENT_SET_HOSTNAME"), (DNS.dhcp_hostname == :any) ? "yes" : "no" ) # Flush cache SCR.Write( Yast::Path.new(".sysconfig.network.dhcp"), nil ) end |
#set_dhcp_hostname? ⇒ Boolean
Check if set of DHCLIENT_SET_HOSTNAME in /etc/sysconfig/network/dhcp has been disable by linuxrc cmdline
53 54 55 56 57 |
# File 'src/lib/network/clients/inst_setup_dhcp.rb', line 53 def set_dhcp_hostname? set_hostname = Linuxrc.InstallInf("SetHostname") log.info("SetHostname: #{set_hostname}") set_hostname != "0" end |
#set_hostname_used? ⇒ Boolean
Check whether the linuxrc sethostname option has been used or not
82 83 84 |
# File 'src/lib/network/clients/inst_setup_dhcp.rb', line 82 def set_hostname_used? Linuxrc.InstallInf("SetHostnameUsed") == "1" end |