Skip to content

Commit

Permalink
Happy rubocop
Browse files Browse the repository at this point in the history
  • Loading branch information
mchf committed Feb 18, 2020
1 parent dda85ee commit c593430
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/lib/y2network/sysconfig/hostname_writer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,15 @@ def update_sysconfig_dhcp(hostname, old_hostname)
#
# @param hostname [Y2Network::Hostname] Hostname configuration
def update_hostname(hostname)
hostname = hostname.static
# 1) when user asked for ereasing hostname from /etc/hostname, we keep runtime as it is
# 2) we will write whatever user wants even FQDN - no changes under the hood
Yast::Execute.on_target!("/usr/bin/hostname", hostname.static) if !hostname.static.empty?
Yast::SCR.Write(Yast::Path.new(".target.string"), HOSTNAME_PATH, hostname.static.empty? ? hostname.static : "#{hostname.static}\n")
Yast::Execute.on_target!("/usr/bin/hostname", hostname) if !hostname.empty?
Yast::SCR.Write(
Yast::Path.new(".target.string"),
HOSTNAME_PATH,
hostname.empty? ? "" : hostname + "\n"
)
end
end
end
Expand Down

0 comments on commit c593430

Please sign in to comment.