Clean up for network::interface definition.

This commit is contained in:
Timo Mkinen 2010-05-10 23:58:29 +03:00
parent 3975b50621
commit 2592ca9fad
2 changed files with 6 additions and 8 deletions

View file

@ -31,7 +31,7 @@ class network::helper::restart {
# Network device name. # Network device name.
# $ipaddr: # $ipaddr:
# IP address for interface. Use dhcp for DHCP configuration and none # IP address for interface. Use dhcp for DHCP configuration and none
# if interface just needs to be brought up. # if interface just needs to be brought up. Defaults to none.
# $netmask: # $netmask:
# Netmask for interface. Required only when $ipaddr is used. # Netmask for interface. Required only when $ipaddr is used.
# $options: # $options:
@ -64,10 +64,7 @@ define network::interface($options = [], $ipaddr = "none", $netmask = "none") {
openbsd: { openbsd: {
file { "/etc/hostname.${name}": file { "/etc/hostname.${name}":
ensure => present, ensure => present,
content => $proto ? { content => template("network/hostname.if.erb"),
none => "up\n",
default => template("network/hostname.if.erb"),
},
mode => 0600, mode => 0600,
owner => root, owner => root,
group => wheel, group => wheel,

View file

@ -1,6 +1,7 @@
<% if proto == 'dhcp' -%> <% if proto == 'dhcp' -%>
dhcp NONE NONE NONE<% options.each do |val| -%> <%= val -%><% end -%> dhcp NONE NONE NONE<% options.each do |val| %> <%= val %><% end %>
<% elsif proto == 'none' -%>
up
<% else -%> <% else -%>
inet <%= ipaddr -%> <%= netmask -%> NONE<% options.each do |val| -%> <%= val -%><% end -%> inet <%= ipaddr %> <%= netmask %> NONE<% options.each do |val| %> <%= val %><% end %>
<% end -%> <% end -%>