Skip to content

Commit

Permalink
Load dhcp_set_hostname default from the control file.
Browse files Browse the repository at this point in the history
  • Loading branch information
teclator committed Sep 25, 2017
1 parent 42addbd commit 672c8ff
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 6 deletions.
28 changes: 27 additions & 1 deletion src/lib/network/clients/inst_setup_dhcp.rb
Expand Up @@ -5,8 +5,15 @@ class SetupDhcp
include Singleton
include Logger

def initialize
Yast.import "Linuxrc"
Yast.import "DNS"
end

def main
nac = Yast::NetworkAutoconfiguration.instance
nac = NetworkAutoconfiguration.instance
set_dhcp_hostname! if set_dhcp_hostname? && Stage.initial

if !nac.any_iface_active?
nac.configure_dhcp
else
Expand All @@ -17,5 +24,24 @@ def main
# warning: possibly useless use of a literal in void context
:next
end

def set_dhcp_hostname?
set_hostname = Linuxrc.InstallInf("SetHostname")
log.info("SetHostname: #{set_hostname}")
set_hostname != 0
end

def set_dhcp_hostname!
DNS.dhcp_hostname = DNS.default_dhcp_hostname
log.info("Write dhcp hostname default: #{DNS.dhcp_hostname}")
SCR.Write(
Yast::Path.new(".sysconfig.network.dhcp.DHCLIENT_SET_HOSTNAME"),
DNS.dhcp_hostname ? "yes" : "no"
)
SCR.Write(
Yast::Path.new(".sysconfig.network.dhcp"),
nil
)
end
end
end
5 changes: 0 additions & 5 deletions src/lib/network/network_autoconfiguration.rb
Expand Up @@ -88,11 +88,6 @@ def configure_dns
DNS.Read # handles NetworkConfig too
DNS.ProposeHostname # generate random hostname, if none known so far

# FIXME: after SLE12: DNS.default_dhcp_hostname should be private (setting
# default values is not something for an API), but that would need some
# refactoring of this part.
DNS.dhcp_hostname = DNS.default_dhcp_hostname

# get default value, from control.xml
DNS.write_hostname = DNS.DefaultWriteHostname

Expand Down

0 comments on commit 672c8ff

Please sign in to comment.