add some minor fixes to the L23 module.

Closes-Bug: #1310655
Change-Id: Ic8fd53e3040577e0ea466767690ce72a39fb45fa
This commit is contained in:
Sergey Vasilenko 2014-04-21 16:14:57 +04:00 committed by Gerrit Code Review
parent 28d82c7960
commit 8b68888bd5
13 changed files with 29 additions and 16 deletions

View File

@ -203,6 +203,12 @@ Puppet::Parser::Functions::newfunction(:generate_network_config, :type => :rvalu
ifconfig_order.insert(-1, t[:name].to_sym())
end
elsif action == :bond
if ! t[:interfaces].is_a? Array
raise(Puppet::ParseError, "generate_network_config(): 'add-bond' resource should has non-empty 'interfaces' list.")
end
if ! t[:properties].is_a? Hash
raise(Puppet::ParseError, "generate_network_config(): 'add-bond' resource should has non-empty 'properties' field.")
end
if t[:provider] == 'lnx'
if ! ifconfig_order.index(t[:name].to_sym())
ifconfig_order.insert(-1, t[:name].to_sym())

View File

@ -28,13 +28,15 @@ EOS
# Add deprecated properties
depre.each { |k,v|
if rv[k].nil?
if rv[k].nil? and ![nil, 'undef', :undef].index(v)
warn("You using deprecated parameter '#{k}':#{v}")
rv[k] = v
end
}
defa.each { |k,v|
if rv[k].nil?
if rv[k].nil? and ![nil, 'undef', :undef].index(v)
info("Setup default parameter '#{k}':#{v}")
rv[k] = v
end
}

View File

@ -32,6 +32,7 @@ define l23network::l2::bond (
$properties = [],
$tag = 0,
$trunks = [],
$provider = 'ovs',
$ensure = present,
$skip_existing = false
) {

View File

@ -17,8 +17,9 @@
#
define l23network::l2::bridge (
$external_ids = '',
$provider = 'ovs',
$ensure = present,
$skip_existing = false,
$skip_existing = false
) {
if ! $::l23network::l2::use_ovs {
fail('You must enable Open vSwitch by setting the l23network::l2::use_ovs to true.')

View File

@ -27,7 +27,9 @@ define l23network::l2::patch (
$peers = [undef,undef],
$tags = [0, 0],
$trunks = [],
$provider = 'ovs',
$ensure = present,
$skip_existing = false
) {
if ! $::l23network::l2::use_ovs {
fail('You must enable Open vSwitch by setting the l23network::l2::use_ovs to true.')

View File

@ -34,11 +34,12 @@ define l23network::l2::port (
$type = '',
$port_properties = [],
$interface_properties = [],
$ensure = present,
$skip_existing = false,
$tag = 0,
$trunks = [],
$vlan_splinters= false
$vlan_splinters= false,
$provider = 'ovs',
$ensure = present,
$skip_existing = false
) {
if ! $::l23network::l2::use_ovs {
fail('You must enable Open vSwitch by setting the l23network::l2::use_ovs to true.')

View File

@ -1,5 +1,5 @@
<%- if @ethtool_lines -%>
<%- @ethtool_lines.each do |key,line| -%>
post-up ethtool <%= key %> <%= interface %> <%= line %> || true
post-up ethtool <%= key %> <%= @interface %> <%= line %> || true
<%- end -%>
<%- end -%>

View File

@ -1,5 +1,5 @@
auto <%= interface %>
iface <%= interface %> inet manual
auto <%= @interface %>
iface <%= @interface %> inet manual
bond-master <%= @bond_master %>
<% if @macaddr -%>
hwaddress ether <%= @macaddr.downcase %>

View File

@ -1,5 +1,5 @@
auto <%= interface %>
iface <%= interface %> inet dhcp
auto <%= @interface %>
iface <%= @interface %> inet dhcp
<% if @macaddr -%>
hwaddress ether <%= @macaddr.downcase %>
<% end -%>

View File

@ -1,4 +1,4 @@
DEVICE=<%= interface %>
DEVICE=<%= @interface %>
BOOTPROTO=none
ONBOOT=yes
USERCTL=no

View File

@ -1,4 +1,4 @@
DEVICE=<%= interface %>
DEVICE=<%= @interface %>
BOOTPROTO=dhcp
ONBOOT=yes
USERCTL=no

View File

@ -1,7 +1,7 @@
#!/bin/sh
<%- if @ipaddr_aliases -%>
<%- @ipaddr_aliases.each do |addr| -%>
ip addr del <%= addr %> dev <%= interface %>
ip addr del <%= addr %> dev <%= @interface %>
<%- end -%>
<%- end -%>
true

View File

@ -1,12 +1,12 @@
#!/bin/sh
<%- if @ipaddr_aliases -%>
<%- @ipaddr_aliases.each do |addr| -%>
ip addr add <%= addr %> dev <%= interface %>
ip addr add <%= addr %> dev <%= @interface %>
<%- end -%>
<%- end -%>
<%- if @ethtool_lines -%>
<%- @ethtool_lines.each do |key,line| -%>
ethtool <%= key %> <%= interface %> <%= line %>
ethtool <%= key %> <%= @interface %> <%= line %>
<%- end -%>
<%- end -%>
true