Skip to content

Commit

Permalink
Ensure Host entries are read before write.
Browse files Browse the repository at this point in the history
  • Loading branch information
teclator committed Sep 29, 2017
1 parent db308f4 commit 923eb70
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/modules/Host.rb
Expand Up @@ -95,13 +95,14 @@ def EnsureHostnameResolvable

fqhostname = Hostname.MergeFQ(DNS.hostname, DNS.domain)
set_names(local_ip, ["#{fqhostname} #{DNS.hostname}"])
@modified = true
elsif @hosts.include_ip?(local_ip)
# Do not add it if product default says no
# and remove 127.0.02 entry if it exists

@hosts.delete_by_ip(local_ip)
@modified = true
end
@modified = true

nil
end
Expand Down
3 changes: 3 additions & 0 deletions src/modules/Lan.rb
Expand Up @@ -558,6 +558,9 @@ def Write
# reload/restart network before this to put correct resolv.conf from dhcp-backup
orig = Progress.set(false)
DNS.Write
# Ensure that the /etc/hosts has been read to no blank out it (bsc#1058396)
# The method just returns true in case of initialized.
Host.Read
Host.EnsureHostnameResolvable
Host.Write
Progress.set(orig)
Expand Down

0 comments on commit 923eb70

Please sign in to comment.