Skip to content

Commit

Permalink
Refactored Host#Export
Browse files Browse the repository at this point in the history
  • Loading branch information
mchf committed Dec 2, 2015
1 parent ceea56f commit dd1dbf6
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/modules/Host.rb
Expand Up @@ -207,14 +207,13 @@ def Import(settings)
# Dump the Hosts settings to a map, for autoinstallation use.
# @return autoinstallation settings
def Export
if Ops.greater_than(Builtins.size(Host.hosts), 0)
# Filter out IPs with empty hostname (so that valid autoyast
# profile is created)(#335120)
Host.hosts = Builtins.filter(Host.hosts) { |_ip, names| names != [] }
return { "hosts" => Builtins.eval(Host.hosts) }
else
return {}
end
return {} if hosts.empty?

# Filter out IPs with empty hostname (so that valid autoyast
# profile is created)(#335120)
hosts.keep_if { |_, names| !names.empty? }

{ "hosts" => hosts }
end

# Return "system" predefined hosts (should be present all the time)
Expand Down

0 comments on commit dd1dbf6

Please sign in to comment.