diff --git a/lib/puppet/provider/network_route/network_route.rb b/lib/puppet/provider/network_route/network_route.rb index 656569fe..2848b9cf 100644 --- a/lib/puppet/provider/network_route/network_route.rb +++ b/lib/puppet/provider/network_route/network_route.rb @@ -15,35 +15,26 @@ def routes_list end def get(_context) - instances = Array.new + routes_list.map do |route| + default = if route['prefix'] == 'default' + true + else + false + end - routes_list.map { |route| - instances << self.class.routes_list_to_hash(route) - # require 'pry'; binding.pry - } - - instances - end - - def self.routes_list_to_hash(route) - default = if route['prefix'] == 'default' - true - else - false - end - - { - ensure: 'present', - prefix: route['prefix'], - default_route: default, - gateway: route['via'], - interface: route['dev'], - metric: route['metric'], - table: route['table'], - source: route['src'], - scope: route['scope'], - protocol: route['proto'], - mtu: route['mtu'] - }.compact! + { + ensure: 'present', + prefix: route['prefix'], + default_route: default, + gateway: route['via'], + interface: route['dev'], + metric: route['metric'], + table: route['table'], + source: route['src'], + scope: route['scope'], + protocol: route['proto'], + mtu: route['mtu'] + }.compact! + end end end