Skip to content

Commit

Permalink
updated type and provider for network_route
Browse files Browse the repository at this point in the history
  • Loading branch information
David Hollinger committed May 29, 2018
1 parent c599d1a commit 32cc8e0
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 20 deletions.
16 changes: 9 additions & 7 deletions lib/puppet/provider/network_route/network_route.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def routes_list
routes
end

def get(context)
def get(_context)
instances = Array.new

routes_list.each { |route|
Expand All @@ -32,18 +32,20 @@ def self.routes_list_to_hash(route)
else
false
end

{
ensure: 'present',
prefix: route['prefix'],
name: route['prefix'],
default_route: default,
device: route['dev'],
protocol: route['proto'],
via: route['via'],
gateway: route['via'],
interface: route['dev'],
metric: route['metric'],
scope: route['scope'],
table: route['table'],
source: route['src'],
scope: route['scope'],
protocol: route['proto'],
mtu: route['mtu']
}.compact!
}.compact!
end
end
46 changes: 33 additions & 13 deletions lib/puppet/type/network_route.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,50 @@
desc: 'Whether the network route should be present or absent on the target system.',
default: 'present',
},
name: {
prefix: {
type: 'String',
desc: 'The name of the network route you want to manage.',
desc: 'The destination prefix/network of the route.',
behaviour: :namevar,
},
network: {
type: 'String',
desc: 'The target network address.',
},
netmask: {
type: 'String',
desc: 'The subnet mask to apply to the route.',
default_route: {
type: 'Optional[Boolean]',
desc: 'Whether the route is default or not.',
},
gateway: {
type: 'IP',
type: 'Optional[String]',
desc: 'The gateway to use for the route.',
},
interface: {
type: 'String',
type: 'Optional[String]',
desc: 'The interface to use for the route.',
},
options: {
metric: {
type: 'String',
desc: 'preference value of the route. NUMBER is an arbitrary 32bit number.',
default: '100',
},
table: {
type: 'String',
desc: 'Provider specific options to be passed to the provider.',
desc: 'table to add this route.',
default: 'local',
},
source: {
type: 'Optional[String]',
desc: 'the source address to prefer using when sending to the destinations covered by route prefix.',
},
scope: {
type: 'Enum[global, nowhere, host, link, site]',
desc: 'scope of the destinations covered by the route prefix.',
default: 'global',
},
protocol: {
type: 'String',
desc: 'routing protocol identifier of this route.',
default: 'boot',
},
mtu: {
type: 'Optional[String]',
desc: 'the MTU along the path to destination.',
},
},
)

0 comments on commit 32cc8e0

Please sign in to comment.