Merged in oherrala/puppet (pull request #2)

This commit is contained in:
Timo Mäkinen 2012-02-06 22:19:38 +02:00
commit 8418c2c557
2 changed files with 13 additions and 11 deletions

View file

@ -230,22 +230,21 @@ define network::interface($ipaddr = "none", $eaddr = "none", $netmask = "none",
# $device:
# Interface to use for this route.
#
define network::route($gateway = "NONE", $device, $ipv6gateway = "") {
define network::route($gateway = "", $device, $ipv6gateway = "") {
case $name {
"default": {
if "${gateway}" == "NONE" {
fail("Cannot set empty gateway for default route.")
}
case $operatingsystem {
centos,fedora: {
include network::helper::restart
augeas { "set-default-route":
context => "/files/etc/sysconfig/network",
changes => [ "set GATEWAY ${gateway}",
"set GATEWAYDEV ${device}", ],
notify => Exec["restart-network"],
}
if "${gateway}" != "" {
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":
context => "/files/etc/sysconfig/network",
@ -284,6 +283,9 @@ define network::route($gateway = "NONE", $device, $ipv6gateway = "") {
}
}
default: {
if ipv6gateway != "" {
fail("Custom IPv6 routes not supported yet.")
}
case $operatingsystem {
"fedora","centos": {
include network::helper::restart

View file

@ -1,3 +1,3 @@
ADDRESS0=<%= name.split('/')[0] %>
NETMASK0=<%= name.split('/')[1] %>
<% if gateway != "NONE" %>GATEWAY0=<%= gateway %><% end %>
<% if gateway != "" %>GATEWAY0=<%= gateway %><% end %>