Fixing puppet-lint errors.

This commit is contained in:
Timo Mkinen 2012-03-27 14:41:39 +03:00
parent 2f83cb7d4a
commit 34c36045fa
59 changed files with 995 additions and 990 deletions

View file

@ -5,20 +5,20 @@
#
class network::helper::restart {
case $operatingsystem {
centos,fedora: {
exec { "restart-network":
command => "/sbin/service network restart",
path => "/bin:/usr/bin:/sbin:/usr/sbin",
refreshonly => true,
}
}
openbsd: {
exec { "restart-network":
command => "/sbin/route delete default ; /bin/sh /etc/netstart",
path => "/bin:/usr/bin:/sbin:/usr/sbin",
refreshonly => true,
}
}
centos,fedora: {
exec { "restart-network":
command => "/sbin/service network restart",
path => "/bin:/usr/bin:/sbin:/usr/sbin",
refreshonly => true,
}
}
openbsd: {
exec { "restart-network":
command => "/sbin/route delete default ; /bin/sh /etc/netstart",
path => "/bin:/usr/bin:/sbin:/usr/sbin",
refreshonly => true,
}
}
debian,ubuntu: {
exec { "restart-network":
cwd => "/etc/network",
@ -101,12 +101,12 @@ class network::hostname {
# $name:
# Network device name.
# $ipaddr:
# IP address for interface. Use dhcp for DHCP configuration and none
# if interface just needs to be brought up. Defaults to none.
# IP address for interface. Use dhcp for DHCP configuration and none
# if interface just needs to be brought up. Defaults to none.
# $eaddr:
# Ethernet address. Overrides udev configuration.
# $netmask:
# Netmask for interface. Required only when $ipaddr is used.
# Netmask for interface. Required only when $ipaddr is used.
# $ip6addr:
# IPv6 address for interface. Use auto for autoconfigured address.
# Defaults to none.
@ -115,7 +115,7 @@ class network::hostname {
# $bridge:
# Array of interfaces to add to bridge.
# $options:
# Custom options for interface (used only on OpenBSD).
# Custom options for interface (used only on OpenBSD).
# $postcmd:
# Custom commands to be executed after interface is up (used only on
# OpenBSD).
@ -135,14 +135,14 @@ define network::interface($ipaddr = "none", $eaddr = "none", $netmask = "none",
# try to determine boot protocol from ip address
case $ipaddr {
dhcp: { $proto = "dhcp" }
none: { $proto = "none" }
default: {
$proto = "static"
case $netmask {
none: { fail("Netmask must be defined with ip address") }
}
}
dhcp: { $proto = "dhcp" }
none: { $proto = "none" }
default: {
$proto = "static"
case $netmask {
none: { fail("Netmask must be defined with ip address") }
}
}
}
case $eaddr {
none: {
@ -155,39 +155,39 @@ define network::interface($ipaddr = "none", $eaddr = "none", $netmask = "none",
}
case $operatingsystem {
openbsd: {
file { "/etc/hostname.${name}":
ensure => present,
content => template("network/hostname.if.erb"),
mode => 0600,
owner => root,
group => wheel,
notify => Exec["restart-network"],
}
}
centos,fedora: {
openbsd: {
file { "/etc/hostname.${name}":
ensure => present,
content => template("network/hostname.if.erb"),
mode => 0600,
owner => root,
group => wheel,
notify => Exec["restart-network"],
}
}
centos,fedora: {
if $bridge {
network::interface { $bridge:
options => [ "BRIDGE=${name}", "LINKDELAY=10" ],
before => Exec["restart-interface-${name}"],
}
}
file { "/etc/sysconfig/network-scripts/ifcfg-${name}":
ensure => present,
content => template("network/ifcfg-if.erb"),
mode => 0644,
owner => root,
group => root,
notify => Exec["restart-interface-${name}"],
}
exec { "restart-interface-${name}":
command => "ifdown ${name} ; ifup ${name}",
path => "/bin:/usr/bin:/sbin:/usr/sbin",
user => root,
refreshonly => true,
require => File["/etc/sysconfig/network-scripts/ifcfg-${name}"],
}
}
file { "/etc/sysconfig/network-scripts/ifcfg-${name}":
ensure => present,
content => template("network/ifcfg-if.erb"),
mode => 0644,
owner => root,
group => root,
notify => Exec["restart-interface-${name}"],
}
exec { "restart-interface-${name}":
command => "ifdown ${name} ; ifup ${name}",
path => "/bin:/usr/bin:/sbin:/usr/sbin",
user => root,
refreshonly => true,
require => File["/etc/sysconfig/network-scripts/ifcfg-${name}"],
}
}
debian,ubuntu: {
include network::helper::debian
file { "/etc/network/interfaces.d/${name}-addr.conf":
@ -209,9 +209,9 @@ define network::interface($ipaddr = "none", $eaddr = "none", $netmask = "none",
}
}
}
default: {
fail("Network module not supported in ${operatingsystem}")
}
default: {
fail("Network module not supported in ${operatingsystem}")
}
}
}
@ -233,17 +233,17 @@ define network::interface($ipaddr = "none", $eaddr = "none", $netmask = "none",
define network::route($gateway = "", $device, $ipv6gateway = "") {
case $name {
"default": {
case $operatingsystem {
centos,fedora: {
include network::helper::restart
"default": {
case $operatingsystem {
centos,fedora: {
include network::helper::restart
if "${gateway}" != "" {
augeas { "set-default-route":
context => "/files/etc/sysconfig/network",
changes => [ "set GATEWAY ${gateway}",
"set GATEWAYDEV ${device}", ],
notify => Exec["restart-network"],
}
augeas { "set-default-route":
context => "/files/etc/sysconfig/network",
changes => [ "set GATEWAY ${gateway}",
"set GATEWAYDEV ${device}", ],
notify => Exec["restart-network"],
}
}
if "${ipv6gateway}" != "" {
augeas { "set-default-ipv6-route":
@ -252,18 +252,18 @@ define network::route($gateway = "", $device, $ipv6gateway = "") {
notify => Exec["restart-network"],
}
}
}
openbsd: {
include network::helper::restart
file { "/etc/mygate":
ensure => present,
content => template("network/mygate.erb"),
mode => 644,
owner => root,
group => wheel,
notify => Exec["restart-network"],
}
}
}
openbsd: {
include network::helper::restart
file { "/etc/mygate":
ensure => present,
content => template("network/mygate.erb"),
mode => 0644,
owner => root,
group => wheel,
notify => Exec["restart-network"],
}
}
debian,ubuntu: {
include network::helper::restart
include network::helper::debian
@ -277,12 +277,12 @@ define network::route($gateway = "", $device, $ipv6gateway = "") {
require => File["/etc/network/interfaces.d/${device}-addr.conf"],
}
}
default: {
fail("Network module not supported in ${operatingsystem}")
}
}
}
default: {
default: {
fail("Network module not supported in ${operatingsystem}")
}
}
}
default: {
if ipv6gateway != "" {
fail("Custom IPv6 routes not supported yet.")
}
@ -333,29 +333,29 @@ define network::route($gateway = "", $device, $ipv6gateway = "") {
#
define network::carp($password, $ipaddr, $netmask, $options = []) {
case $operatingsystem {
openbsd: {
network::interface { "carp${name}":
ipaddr => "${ipaddr}",
netmask => "${netmask}",
options => [ "vhid ${name}", "pass ${password}", $options ],
openbsd: {
network::interface { "carp${name}":
ipaddr => $ipaddr,
netmask => $netmask,
options => [ "vhid ${name}", "pass ${password}", $options ],
postcmd => [ "/usr/sbin/ndp -i carp${name} -- -accept_rtadv" ],
}
}
centos,fedora: {
include network::ucarp
file { "/etc/ucarp/vip-${name}.conf":
ensure => present,
content => template("network/vip.conf.erb"),
mode => 0600,
owner => root,
group => root,
require => Package["ucarp"],
notify => Service["ucarp"],
}
}
default: {
fail("Network module not supported in ${operatingsystem}")
}
}
}
centos,fedora: {
include network::ucarp
file { "/etc/ucarp/vip-${name}.conf":
ensure => present,
content => template("network/vip.conf.erb"),
mode => 0600,
owner => root,
group => root,
require => Package["ucarp"],
notify => Service["ucarp"],
}
}
default: {
fail("Network module not supported in ${operatingsystem}")
}
}
}
@ -366,13 +366,13 @@ define network::carp($password, $ipaddr, $netmask, $options = []) {
#
class network::ucarp {
package { "ucarp":
ensure => installed,
ensure => installed,
}
service { "ucarp":
ensure => running,
enable => true,
hasstatus => true,
require => Package["ucarp"],
ensure => running,
enable => true,
hasstatus => true,
require => Package["ucarp"],
}
}
@ -397,19 +397,19 @@ define network::pppoe($username, $password, $device, $authtype = "pap") {
include network::helper::restart
case $operatingsystem {
openbsd: {
file { "/etc/hostname.${name}":
ensure => present,
content => template("network/hostname.pppoe.erb"),
mode => 0600,
owner => root,
group => wheel,
notify => Exec["restart-network"],
}
}
default: {
fail("Network module not supported in ${operatingsystem}")
}
openbsd: {
file { "/etc/hostname.${name}":
ensure => present,
content => template("network/hostname.pppoe.erb"),
mode => 0600,
owner => root,
group => wheel,
notify => Exec["restart-network"],
}
}
default: {
fail("Network module not supported in ${operatingsystem}")
}
}
}
@ -438,27 +438,27 @@ define network::pppoe($username, $password, $device, $authtype = "pap") {
#
define network::trunk($devices, $mode = 0, $ipaddr = "none", $netmask = "none") {
case $operatingsystem {
centos,fedora: {
file { "/etc/modprobe.d/${name}.conf":
ensure => present,
content => "alias ${name} bonding\noptions ${name} miimon=100 mode=${mode}\n",
mode => 0644,
owner => root,
group => root,
}
network::interface { $devices:
options => [ "MASTER=${name}", "SLAVE=yes", ],
require => File["/etc/modprobe.d/${name}.conf"],
before => Network::Interface["${name}"],
}
network::interface { $name:
ipaddr => "${ipaddr}",
netmask => "${netmask}",
}
}
default: {
fail("Network module not supported in ${operatingsystem}")
}
centos,fedora: {
file { "/etc/modprobe.d/${name}.conf":
ensure => present,
content => "alias ${name} bonding\noptions ${name} miimon=100 mode=${mode}\n",
mode => 0644,
owner => root,
group => root,
}
network::interface { $devices:
options => [ "MASTER=${name}", "SLAVE=yes", ],
require => File["/etc/modprobe.d/${name}.conf"],
before => Network::Interface[$name],
}
network::interface { $name:
ipaddr => $ipaddr,
netmask => $netmask,
}
}
default: {
fail("Network module not supported in ${operatingsystem}")
}
}
}
@ -469,12 +469,12 @@ define network::trunk($devices, $mode = 0, $ipaddr = "none", $netmask = "none")
#
class network::helper::vlan {
case $operatingsystem {
centos,fedora: {
augeas { "enable-vlan-support":
context => "/files/etc/sysconfig/network",
changes => "set VLAN yes",
}
}
centos,fedora: {
augeas { "enable-vlan-support":
context => "/files/etc/sysconfig/network",
changes => "set VLAN yes",
}
}
}
}
@ -505,25 +505,25 @@ class network::helper::vlan {
define network::vlan($device, $ipaddr = "none", $netmask = "none",
$options = []) {
case $operatingsystem {
openbsd: {
network::interface { "vlan${name}":
options => [ "vlandev ${device}" ],
ipaddr => $ipaddr,
netmask => $netmask,
}
}
centos,fedora: {
include network::helper::vlan
network::interface { "${device}.${name}":
ipaddr => $ipaddr,
netmask => $netmask,
openbsd: {
network::interface { "vlan${name}":
options => [ "vlandev ${device}" ],
ipaddr => $ipaddr,
netmask => $netmask,
}
}
centos,fedora: {
include network::helper::vlan
network::interface { "${device}.${name}":
ipaddr => $ipaddr,
netmask => $netmask,
options => $options,
require => Augeas["enable-vlan-support"],
}
}
default: {
fail("Network module not supported in ${operatingsystem}")
}
require => Augeas["enable-vlan-support"],
}
}
default: {
fail("Network module not supported in ${operatingsystem}")
}
}
}