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 be9825b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 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
4 changes: 1 addition & 3 deletions src/modules/LanItems.rb
Original file line number Diff line number Diff line change
Expand Up @@ -693,8 +693,7 @@ def WriteUdevRules
nil
end

# TODO: make subcalls gui dependent where needed
def write(gui: false)
def write
renamed_items = @Items.keys.select { |item_id| renamed?(item_id) }
renamed_items.each do |item_id|
devmap = GetDeviceMap(item_id)
Expand All @@ -708,7 +707,6 @@ def write(gui: false)
# FIXME: hack: no "netcard" filter as biosdevname names it diferently (bnc#712232)
NetworkInterfaces.Write("")
end
alias_method :Write, :write

# Exports configuration for use in AY profile
#
Expand Down

0 comments on commit be9825b

Please sign in to comment.