Skip to content

Commit

Permalink
Code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
mchf committed Jul 11, 2017
1 parent 77bfcd8 commit 01e19ae
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
9 changes: 4 additions & 5 deletions src/modules/DNS.rb
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ def Read
return true if @initialized == true

@dhcp_hostname = dhclient_set_hostname
@write_hostname = write_hostname_to_hosts
@write_hostname = get_write_hostname_to_hosts

@resolv_conf_policy = Convert.to_string(
SCR.Read(path(".sysconfig.network.config.NETCONFIG_DNS_POLICY"))
Expand Down Expand Up @@ -365,7 +365,6 @@ def Write(gui: true)
# Progress step 3/3
ProgressNextStage(_("Updating /etc/resolv.conf ...")) if gui
update_sysconfig_config
Builtins.sleep(0) if gui

Progress.NextStage if gui
@modified = false
Expand Down Expand Up @@ -646,7 +645,7 @@ def empty?

# Updates /etc/sysconfig/network/dhcp
def update_sysconfig_dhcp
if dhclient_set_hostname != @dhcp_hostname || write_hostname_to_hosts != @write_hostname
if dhclient_set_hostname != @dhcp_hostname || get_write_hostname_to_hosts != @write_hostname
log.info("dhcp_hostname=#{@dhcp_hostname}")
log.info("write_hostname=#{@write_hostname}")

Expand All @@ -659,7 +658,7 @@ def update_sysconfig_dhcp
SCR.Write(
path(".sysconfig.network.dhcp.WRITE_HOSTNAME_TO_HOSTS"),
@write_hostname ? "yes" : "no"
) if !@write_hostname
) if !@write_hostname.nil?
SCR.Write(path(".sysconfig.network.dhcp"), nil)
else
log.info("No update for /etc/sysconfig/network/dhcp")
Expand Down Expand Up @@ -724,7 +723,7 @@ def dhclient_set_hostname
#
# return {true, false, nil} "yes" => true, "no" => false, otherwise or not
# present => nil
def write_hostname_to_hosts
def get_write_hostname_to_hosts
SYSCFG_TO_BOOL[SCR.Read(path(".sysconfig.network.dhcp.WRITE_HOSTNAME_TO_HOSTS"))]
end

Expand Down
2 changes: 1 addition & 1 deletion src/modules/Lan.rb
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ def Write(gui: true)
return false if Abort()
# Progress step 3 - multiple devices may be present, really plural
ProgressNextStage(_("Writing device configuration..."))
LanItems.write
LanItems.write(gui: gui)
Builtins.sleep(sl)

return false if Abort()
Expand Down

0 comments on commit 01e19ae

Please sign in to comment.