diff --git a/CHANGELOG.md b/CHANGELOG.md index d63256d..7aad88f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,84 +1,93 @@ +##2015-03-16 - Release 1.3.1 + +###Summary +Fixed issue #2 + +###Fixes +- bridge and bond resources were not able to access package names declared in +params.pp + ##2015-03-15 - Release 1.3.0 ###Summary New feature helper allows declaring static routes on interfaces. ###Features - feature helper of static routes added ##2015-03-12 - Release 1.2.1 ###Summary - Bugfix, to resolve dependency problems to newer versions of concat and stdlib modules. ###Features - feature helper for static routes added ###Fixes - Minor improvements in documentation - Metadata fixed. ##2015-02-26 - Release 1.2.0 ###Summary Introduction of feature helpers. Configurable bridge parameters extended. ###Features - feature helper tx_queue added for setting tx queue length of an interface - added attributes maxage and maxwait to bridge ##2015-02-05 - Release 1.1.1 ###Summary Documentation bugfixes. ###Features ###Bugfixes - requirements corrected - README links fixed ##2015-02-04 - Release 1.1.0 ###Summary Operating system support tested. Up and down hooks now available for many resources. ###Features - support for Debian 6 and Ubuntu 12.04 added to metadata.json - added support for up/down hooks to resources bond, bridge, dhcp, loopback and static ##2015-01-20 - Release 1.0.1 ###Summary Bugfix. ###Changes - Validation of bonding attributes fixed. ##2015-01-20 - Release 1.0.0 ###Summary Added support for bonding and removed the need of including the module. ###Changes - including the module is not necessary anymore ###Features - support for bonding devices ##2014-12-27 - Release 0.3.1 ###Summary Minor refactoring, documentation and metadata improvements. ####Fixes - Metadata fixes to improve quality measures. - Some lint warnings with bridge.pp fixed. - Documentation fixed. ##2014-12-27 - Release 0.3.0 ###Summary New feature for configuring bridge interfaces. diff --git a/manifests/iface/bond.pp b/manifests/iface/bond.pp index 44e8132..301a961 100644 --- a/manifests/iface/bond.pp +++ b/manifests/iface/bond.pp @@ -1,251 +1,253 @@ # == Define: iface::bond # # Resource to define a bonding interface configuration stanza within # interfaces(5). # # == Parameters # # [*ifname*] => *(namevar)* - string # Name of the interface to be configured. # # [*method*] - string # Configuration method to be used. # # [*auto*] - bool # Sets the interface on automatic setup on startup. This is affected by # ifup -a and ifdown -a commands. # # [*allows*] - array # Adds an allow- entry to the interface stanza. # # [*family*] - string # Address family. Currently, only inet family is supported. Support for # inet6 is comming soon. # # [*order*] - int # Order of the entry to be created in /etc/network/interfaces. Innate # odering is preset with default value of 10 for loopback and 20 for dhcp # and static stanzas. The order attribute of the resource is added to the # default value. # # [*hwaddress*] - string # The MAC address of the interface. This value is validated as standard # IEEE MAC address of 6 bytes, written hexadecimal, delimited with # colons (:) or dashes (-). # # [*hostname*] - string # The hostname to be submitted with dhcp requests. # # [*leasetime*] - int # The requested leasetime of dhcp leases. # # [*vendor*] - string # The vendor id to be submitted with dhcp requests. # # [*client*] - string # The client id to be submitted with dhcp requests. # # [*metric*] - int # Routing metric for routes added resolved on this interface. # # [*address*] - string # IP address formatted as dotted-quad for IPv4. # # [*netmask*] - string # Netmask as dotted-quad or CIDR prefix length. # # [*broadcast*] - string # Broadcast address as dotted-quad or + or -. # # [*gateway*] - string # Default route to be brought up with this interface. # # [*pointopoint*] - stirng # Address of the ppp endpoint as dotted-quad. # # [*mtu*] - int # Size of the maximum transportable unit over this interface. # # [*scope*] - string # Scope of address validity. Values allowed are global, link or host. # # [*pre_ups*] - array # Array of commands to be run prior to bringing this interface up. # # [*ups*] - array # Array of commands to be run after bringing this interface up. # # [*downs*] - array # Array of commands to be run prior to bringing this interface down. # # [*post_downs*] - array # Array of commands to be run after bringing this interface down. # # [*aux_ops_*] - hash # Hash of key-value pairs with auxiliary options for this interface. # To be used by other debnet types only. # # [*aux_ops*] - hash # Hash of key-value pairs with auxiliary options for this interface. # To be used by other debnet types only. # # === Authors # # Tibor Repasi # # === Copyright # # Copyright 2015 Tibor Repasi # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # define debnet::iface::bond( $method, $ifname = $title, $auto = true, $allows = [], $family = 'inet', $order = 0, # bond options $ports = [], $mode = 'active-backup', $miimon = 100, $use_carrier = true, $updelay = undef, $downdelay = undef, # options for multiple methods $metric = undef, $hwaddress = undef, # options for method dhcp $hostname = undef, $leasetime = undef, $vendor = undef, $client = undef, # options for method static $address = undef, $netmask = undef, $broadcast = undef, $gateway = undef, $pointopoint = undef, $mtu = undef, $scope = undef, # up and down commands $pre_ups = [], $ups = [], $downs = [], $post_downs = [], # auxiliary options $aux_ops_master = {}, $aux_ops_slaves = {}, # feature-helpers $tx_queue = undef, $routes = {}, ) { + include debnet + if !defined(Package[$debnet::params::ifenslave_pkg]) { package { $debnet::params::ifenslave_pkg: ensure => 'installed', } } validate_array($ports) if size($ports) == 0 { fail('Bonding needs at least one port to be declared!') } validate_re($mode, '^balance\-rr$|^active\-backup$|^balance\-xor$|^broadcast$|^802\.3ad$|^balance\-tlb$|^balance\-alb$') validate_re($miimon, '^\d+$') $bondopts0 = { 'bond-slaves' => 'none', 'bond-primary' => $ports[1], 'bond-mode' => $mode, 'bond-miimon' => $miimon, } validate_bool($use_carrier) if $updelay { validate_re($updelay, '^\d+$') $bondopts1 = {'bond-updelay' => $updelay} } else { $bondopts1 = {} } if $downdelay { validate_re($downdelay, '^\d+$') $bondopts2 = {'bond-downdelay' => $downdelay} } else { $bondopts2 = {} } debnet::iface { $ports: method => 'manual', auto => $auto, allows => $allows, family => $family, order => 50 + $order, mtu => $mtu, pre_ups => $pre_ups, ups => $ups, downs => $downs, post_downs => $post_downs, aux_ops => merge( $aux_ops_slaves, { 'bond-master' => $ifname, 'bond-mode' => $mode, 'bond-primary' => $ports[1], } ), tx_queue => $tx_queue, routes => $routes, } debnet::iface { $ifname: method => $method, auto => $auto, allows => $allows, family => $family, order => 60 + $order, metric => $metric, hwaddress => $hwaddress, hostname => $hostname, leasetime => $leasetime, vendor => $vendor, client => $client, address => $address, netmask => $netmask, broadcast => $broadcast, gateway => $gateway, pointopoint => $pointopoint, mtu => $mtu, scope => $scope, pre_ups => $pre_ups, ups => $ups, downs => $downs, post_downs => $post_downs, aux_ops => merge( $aux_ops_master, $bondopts0, $bondopts1, $bondopts2 ), tx_queue => $tx_queue, routes => $routes, } } \ No newline at end of file diff --git a/manifests/iface/bridge.pp b/manifests/iface/bridge.pp index 9653c2e..8b939c9 100644 --- a/manifests/iface/bridge.pp +++ b/manifests/iface/bridge.pp @@ -1,266 +1,268 @@ # == Define: iface::bridge # # Resource to define a bridge interface configuration stanza within # interfaces(5). # # == Parameters # # [*ifname*] => *(namevar)* - string # Name of the interface to be configured. # # [*method*] - string # Configuration method to be used. # # [*auto*] - bool # Sets the interface on automatic setup on startup. This is affected by # ifup -a and ifdown -a commands. # # [*allows*] - array # Adds an allow- entry to the interface stanza. # # [*family*] - string # Address family. Currently, only inet family is supported. Support for # inet6 is comming soon. # # [*order*] - int # Order of the entry to be created in /etc/network/interfaces. Innate # odering is preset with default value of 10 for loopback and 20 for dhcp # and static stanzas. The order attribute of the resource is added to the # default value. # # [*hwaddress*] - string # The MAC address of the interface. This value is validated as standard # IEEE MAC address of 6 bytes, written hexadecimal, delimited with # colons (:) or dashes (-). # # [*hostname*] - string # The hostname to be submitted with dhcp requests. # # [*leasetime*] - int # The requested leasetime of dhcp leases. # # [*vendor*] - string # The vendor id to be submitted with dhcp requests. # # [*client*] - string # The client id to be submitted with dhcp requests. # # [*metric*] - int # Routing metric for routes added resolved on this interface. # # [*address*] - string # IP address formatted as dotted-quad for IPv4. # # [*netmask*] - string # Netmask as dotted-quad or CIDR prefix length. # # [*broadcast*] - string # Broadcast address as dotted-quad or + or -. # # [*gateway*] - string # Default route to be brought up with this interface. # # [*pointopoint*] - stirng # Address of the ppp endpoint as dotted-quad. # # [*mtu*] - int # Size of the maximum transportable unit over this interface. # # [*scope*] - string # Scope of address validity. Values allowed are global, link or host. # # [*ports*] - array # Array of ports to be added to the bridge. # # [*stp*] - bool # Sets if bridge should implement spanning tree protocol. # # [*prio*] - int # Priority of the bridge for root selection within spanning tree. # # [*fwdelay*] - int # Sets the forward delay of the bridge in seconds. # # [*hello*] - int # Sets the bridge hello time in seconds. # # [*maxage*] - int # Maximum seconds of age of STP message. # # [*maxwait*] - int # Maximum seconds to wait for bridge interfaces to come up. # # [*pre_ups*] - array # Array of commands to be run prior to bringing this interface up. # # [*ups*] - array # Array of commands to be run after bringing this interface up. # # [*downs*] - array # Array of commands to be run prior to bringing this interface down. # # [*post_downs*] - array # Array of commands to be run after bringing this interface down. # # [*aux_ops*] - hash # Hash of key-value pairs with auxiliary options for this interface. # To be used by other debnet types only. # # === Authors # # Tibor Repasi # # === Copyright # # Copyright 2015 Tibor Repasi # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # define debnet::iface::bridge( $method, $ifname = $title, $auto = true, $allows = [], $family = 'inet', $order = 0, # bridge options $ports = [], $stp = false, $prio = undef, $fwdelay = undef, $hello = undef, $maxage = undef, $maxwait = undef, # options for multiple methods $metric = undef, $hwaddress = undef, # options for method dhcp $hostname = undef, $leasetime = undef, $vendor = undef, $client = undef, # options for method static $address = undef, $netmask = undef, $broadcast = undef, $gateway = undef, $pointopoint = undef, $mtu = undef, $scope = undef, # up and down commands $pre_ups = [], $ups = [], $downs = [], $post_downs = [], # auxiliary options $aux_ops = {}, # feature-helpers $tx_queue = undef, $routes = {}, ) { + include debnet + if !defined(Package[$debnet::params::bridge_utils_pkg]) { package { $debnet::params::bridge_utils_pkg: ensure => 'installed', } } if size($ports) > 0 { $brports = join($ports, ' ') debnet::iface { $ports: method => 'manual', tx_queue => $tx_queue, } } else { $brports = 'none' } $bropts0 = {'bridge_ports' => $brports} if $hwaddress { $bropts1 = {'bridge_hw' => $hwaddress} } else { $bropts1 = {} } $bropts2 = {'bridge_stp' => $stp ? { true => 'on', default => 'off'} } if $stp { if $prio { validate_re($prio, '^\d+$') $bropts3 = { 'bridge_bridgeprio' => $prio} } else { $bropts3 = {} } if $fwdelay { validate_re($fwdelay, '^\d+$') $bropts4 = { 'bridge_fd' => $fwdelay } } else { $bropts4 = {} } if $hello { validate_re($hello, '^\d+$') $bropts5 = { 'bridge_hello' => $hello } } else { $bropts5 = {} } if $maxage { validate_re($maxage, '^\d+$') $bropts6 = { 'bridge_maxage' => $maxage } } else { $bropts6 = {} } if $maxwait { validate_re($maxwait, '^\d+$') $bropts7 = { 'bridge_maxwait' => $maxwait } } else { $bropts7 = {} } } debnet::iface { $ifname: method => $method, auto => $auto, allows => $allows, family => $family, order => $order, metric => $metric, hostname => $hostname, leasetime => $leasetime, vendor => $vendor, client => $client, address => $address, netmask => $netmask, broadcast => $broadcast, gateway => $gateway, pointopoint => $pointopoint, mtu => $mtu, scope => $scope, pre_ups => $pre_ups, ups => $ups, downs => $downs, post_downs => $post_downs, aux_ops => merge( $aux_ops, $bropts0, $bropts1, $bropts2, $bropts3, $bropts4, $bropts5, $bropts6, $bropts7), routes => $routes, } } \ No newline at end of file diff --git a/manifests/iface/dhcp.pp b/manifests/iface/dhcp.pp index 8e70a97..15d4d56 100644 --- a/manifests/iface/dhcp.pp +++ b/manifests/iface/dhcp.pp @@ -1,134 +1,136 @@ # == Define: iface::dhcp # # Resource to define an interface configuration stanza within interfaces(5). # # == Parameters # # [*ifname*] => *(namevar)* - string # Name of the interface to be configured. # # [*method*] - string # Configuration method to be used. # # [*auto*] - bool # Sets the interface on automatic setup on startup. This is affected by # ifup -a and ifdown -a commands. # # [*allows*] - array # Adds an allow- entry to the interface stanza. # # [*family*] - string # Address family. Currently, only inet family is supported. Support for # inet6 is comming soon. # # [*order*] - int # Order of the entry to be created in /etc/network/interfaces. Innate # odering is preset with default value of 10 for loopback and 20 for dhcp # and static stanzas. The order attribute of the resource is added to the # default value. # # [*hwaddress*] - string # The MAC address of the interface. This value is validated as standard # IEEE MAC address of 6 bytes, written hexadecimal, delimited with # colons (:) or dashes (-). # # [*hostname*] - string # The hostname to be submitted with dhcp requests. # # [*leasetime*] - int # The requested leasetime of dhcp leases. # # [*vendor*] - string # The vendor id to be submitted with dhcp requests. # # [*client*] - string # The client id to be submitted with dhcp requests. # # [*metric*] - int # Routing metric for routes added resolved on this interface. # # [*pre_ups*] - array # Array of commands to be run prior to bringing this interface up. # # [*ups*] - array # Array of commands to be run after bringing this interface up. # # [*downs*] - array # Array of commands to be run prior to bringing this interface down. # # [*post_downs*] - array # Array of commands to be run after bringing this interface down. # # [*aux_ops*] - hash # Hash of key-value pairs with auxiliary options for this interface. # To be used by other debnet types only. # # === Authors # # Tibor Repasi # # === Copyright # # Copyright 2014 Tibor Repasi # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # define debnet::iface::dhcp ( $ifname = $title, $auto = true, $allows = [], $family = 'inet', $order = 0, $metric = undef, $hwaddress = undef, $hostname = undef, $leasetime = undef, $vendor = undef, $client = undef, # up and down commands $pre_ups = [], $ups = [], $downs = [], $post_downs = [], # auxiliary options $aux_ops = {}, # feature-helpers $tx_queue = undef, $routes = {}, ) { + include debnet + validate_string($ifname) validate_bool($auto) validate_array($allows) validate_re($family, '^inet$' ) debnet::iface { $ifname : method => 'dhcp', hostname => $hwaddress, metric => $metric, leasetime => $leasetime, vendor => $vendor, client => $client, hwaddress => $hwaddress, pre_ups => $pre_ups, ups => $ups, downs => $downs, post_downs => $post_downs, aux_ops => $aux_ops, tx_queue => $tx_queue, routes => $routes, } } diff --git a/manifests/iface/loopback.pp b/manifests/iface/loopback.pp index 74ff0a2..0714b4f 100644 --- a/manifests/iface/loopback.pp +++ b/manifests/iface/loopback.pp @@ -1,84 +1,86 @@ # == Define: iface::loopback # # Resource to define an loopback interface stanza within interfaces(5). # # == Parameters # # [*ifname*] => *(namevar)* - string # Must conventionally always be 'lo'. # # [*auto*] - bool # Sets the interface on automatic setup on startup. This is affected by # ifup -a and ifdown -a commands. # # [*allows*] - array # Adds an allow- entry to the interface stanza. # # [*pre_ups*] - array # Array of commands to be run prior to bringing this interface up. # # [*ups*] - array # Array of commands to be run after bringing this interface up. # # [*downs*] - array # Array of commands to be run prior to bringing this interface down. # # [*post_downs*] - array # Array of commands to be run after bringing this interface down. # # [*aux_ops*] - hash # Hash of key-value pairs with auxiliary options for this interface. # To be used by other debnet types only. # # === Authors # # Tibor Repasi # # === Copyright # # Copyright 2015 Tibor Repasi # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # define debnet::iface::loopback ( $ifname = $title, $auto = true, $allows = [], $family = 'inet', $order = 0, # up and down commands $pre_ups = [], $ups = [], $downs = [], $post_downs = [], # auxiliary options $aux_ops = {}, ) { + include debnet + validate_re($ifname, '^lo$') validate_bool($auto) validate_array($allows) validate_re($family, '^inet$' ) debnet::iface { $ifname: method => 'loopback', auto => $auto, allows => $allows, family => $family, pre_ups => $pre_ups, ups => $ups, downs => $downs, post_downs => $post_downs, aux_ops => $aux_ops, } } diff --git a/manifests/iface/static.pp b/manifests/iface/static.pp index d0ab255..253ca02 100644 --- a/manifests/iface/static.pp +++ b/manifests/iface/static.pp @@ -1,152 +1,154 @@ # == Define: iface::static # # Resource to define simple interface with static configuration stanza within # interfaces(5). # # == Parameters # # [*ifname*] => *(namevar)* - string # Name of the interface to be configured. # # [*auto*] - bool # Sets the interface on automatic setup on startup. This is affected by # ifup -a and ifdown -a commands. # # [*allows*] - array # Adds an allow- entry to the interface stanza. # # [*family*] - string # Address family. Currently, only inet family is supported. Support for # inet6 is comming soon. # # [*order*] - int # Order of the entry to be created in /etc/network/interfaces. Innate # odering is preset with default value of 10 for loopback and 20 for dhcp # and static stanzas. The order attribute of the resource is added to the # default value. # # [*address*] - string # IP address formatted as dotted-quad for IPv4. # # [*netmask*] - string # Netmask as dotted-quad or CIDR prefix length. # # [*broadcast*] - string # Broadcast address as dotted-quad or + or -. # # [*gateway*] - string # Default route to be brought up with this interface. # # [*metric*] - int # Routing metric for routes added resolved on this interface. # # [*pointopoint*] - stirng # Address of the ppp endpoint as dotted-quad. # # [*mtu*] - int # Size of the maximum transportable unit over this interface. # # [*scope*] - string # Scope of address validity. Values allowed are global, link or host. # # [*hwaddress*] - string # The MAC address of the interface. This value is validated as standard # IEEE MAC address of 6 bytes, written hexadecimal, delimited with # colons (:) or dashes (-). # # [*pre_ups*] - array # Array of commands to be run prior to bringing this interface up. # # [*ups*] - array # Array of commands to be run after bringing this interface up. # # [*downs*] - array # Array of commands to be run prior to bringing this interface down. # # [*post_downs*] - array # Array of commands to be run after bringing this interface down. # # [*aux_ops*] - hash # Hash of key-value pairs with auxiliary options for this interface. # To be used by other debnet types only. # # === Authors # # Tibor Repasi # # === Copyright # # Copyright 2015 Tibor Repasi # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # define debnet::iface::static ( $address, $netmask, $ifname = $title, $auto = true, $allows = [], $family = 'inet', $order = 0, $broadcast = undef, $metric = undef, $gateway = undef, $pointopoint = undef, $hwaddress = undef, $mtu = undef, $scope = undef, # up and down commands $pre_ups = [], $ups = [], $downs = [], $post_downs = [], # auxiliary options $aux_ops = {}, # feature-helpers $tx_queue = undef, $routes = {}, ) { + include debnet + validate_string($ifname) validate_bool($auto) validate_array($allows) validate_re($family, '^inet$' ) - + debnet::iface { $ifname: method => 'static', auto => $auto, allows => $allows, family => $family, order => $order, address => $address, netmask => $netmask, broadcast => $broadcast, metric => $metric, gateway => $gateway, pointopoint => $pointopoint, hwaddress => $hwaddress, mtu => $mtu, scope => $scope, pre_ups => $pre_ups, ups => $ups, downs => $downs, post_downs => $post_downs, aux_ops => $aux_ops, tx_queue => $tx_queue, routes => $routes, } } diff --git a/metadata.json b/metadata.json index ea131a7..a966519 100644 --- a/metadata.json +++ b/metadata.json @@ -1,23 +1,23 @@ { "name": "trepasi-debnet", - "version": "1.3.0", + "version": "1.3.1", "author": "T. Repasi", "summary": "Puppet module to manage /etc/network/interface file on Debian based Linux systems.", "tags": ["network","interfaces","ifup","ifdown","bridge","bonding"], "license": "Apache-2.0", "project_page": "https://github.com/rtib/tib-debnet.git", "source": "https://github.com/rtib/tib-debnet.git", "issues_url":"https://github.com/rtib/tib-debnet/issues", "operatingsystem_support": [ {"operatingsystem": "Debian", "operatingsystemrelease": ["6","7"] }, {"operatingsystem": "Ubuntu", "operatingsystemrelease": ["12.04","14.04"] } ], "dependencies": [ {"name":"puppetlabs/concat","version_requirement":">= 1.1.1 < 2.0.0"}, {"name":"puppetlabs/stdlib","version_requirement":">= 4.3.2 < 5.0.0"} ], "requirements": [ {"name": "pe", "version_requirement": "3.x" }, {"name": "puppet", "version_requirement": ">=2.7.20 <4.0.0" } ] }