Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
mchf committed Mar 27, 2019
1 parent 76537ad commit 195cca4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/lib/y2network/config_reader/routes_reader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,11 @@ def normalize_routes(routes)
routes.map do |route|
subnet, prefix = route["destination"].split("/")

next if prefix.nil?
next route if prefix.nil?

route["destination"] = subnet
route["netmask"] = "/#{prefix}"

route
end
end
Expand All @@ -88,7 +89,7 @@ def normalize_routes(routes)
# @param ip_str [String] IP address; {MISSING_VALUE} means that the IP is not defined
# @param netmask_str [String] Netmask; {MISSING_VALUE} means than no netmask was specified
# @return [IPAddr,nil] The IP address or `nil` if the IP is missing
def build_ip(ip_str, netmask_str = nil)
def build_ip(ip_str, netmask_str = MISSING_VALUE)
return nil if ip_str == MISSING_VALUE
ip = IPAddr.new(ip_str)
netmask_str == MISSING_VALUE ? ip : ip.mask(netmask_str)
Expand Down

0 comments on commit 195cca4

Please sign in to comment.