l23network corrections

* Use bash as shebang for scripts as well as CenOS/RHEL network scripts use
* Change *if* conditions according to bash
* Move files that are not templates to files folder
* Add chmod for pre-up config files
* Remove jacks for l23_stored_config ovs2lnx patch as it is not used

Change-Id: I78f31000e57fb9bfeecad2ba9a7f343967e68f9c
Partial-bug: #1522481
This commit is contained in:
Stanislav Makar 2015-12-10 12:27:26 +00:00
parent 6da29b4686
commit a17eb556d9
12 changed files with 11 additions and 22 deletions

View File

@ -1,5 +1,3 @@
#!/bin/sh
#!/bin/bash
SCRIPT="/etc/sysconfig/network-scripts/interface-down-script-$1"
if [[ -x $SCRIPT ]] ; then
. $SCRIPT
fi
[ -x $SCRIPT ] && . $SCRIPT

View File

@ -1,5 +1,3 @@
#!/bin/sh
#!/bin/bash
SCRIPT="/etc/sysconfig/network-scripts/interface-up-script-$1"
if [[ -x $SCRIPT ]] ; then
. $SCRIPT
fi
[ -x $SCRIPT ] && . $SCRIPT

View File

@ -1,5 +1,3 @@
#!/bin/sh
#!/bin/bash
SCRIPT="/etc/sysconfig/network-scripts/pre-up-$1"
if [[ -x $SCRIPT ]] ; then
. $SCRIPT
fi
[ -x $SCRIPT ] && . $SCRIPT

View File

@ -273,7 +273,7 @@ class Puppet::Provider::L23_stored_config_centos < Puppet::Provider::L23_stored_
#ip link add p_3911f6cc-0 type veth peer name p_3911f6cc-1\nip link set up dev p_3911f6cc-1
rv = []
p "parse jacks #{data}"
data.split("\n").each do | line |
data.each_line do | line |
jacks = line.scan(/ip\s+link\s+add\s+([\w\-]+)\s+type\s+veth\s+peer\s+name\s+([\w\-]+)/).flatten
rv = jacks if !jacks.empty?
end
@ -367,6 +367,7 @@ class Puppet::Provider::L23_stored_config_centos < Puppet::Provider::L23_stored_
rescue
raise Puppet::Error, "write_file(): file #{file} can not be written!"
end
File.chmod(0744, file)
end
def self.remove_line_from_file(file, remove)

View File

@ -63,7 +63,7 @@ class l23network (
if ! defined(File["${::l23network::params::interfaces_file}"]) {
file {"${::l23network::params::interfaces_file}":
ensure => present,
content => template('l23network/interfaces.erb'),
source => 'puppet:///modules/l23network/interfaces',
}
}
File<| title == "${::l23network::params::interfaces_file}" |> -> File<| title == "${::l23network::params::interfaces_dir}" |>

View File

@ -4,13 +4,13 @@ class l23network::l2::centos_upndown_scripts {
ensure => present,
owner => 'root',
mode => '0755',
content => template('l23network/centos_ifup-local.erb'),
source => 'puppet:///modules/l23network/centos_ifup-local',
} ->
file {'/sbin/ifdown-local':
ensure => present,
owner => 'root',
mode => '0755',
content => template('l23network/centos_ifdown-local.erb'),
source => 'puppet:///modules/l23network/centos_ifdown-local',
} ->
file {'/sbin/ifup-pre-local':
ensure => present,

View File

@ -132,7 +132,6 @@ define l23network::l2::patch (
ensure => $ensure,
if_type => 'vport',
bridge => $act_bridges,
jacks => $patch_jacks_names,
mtu => $mtu,
onboot => true,
vendor_specific => $vendor_specific,

View File

@ -108,7 +108,6 @@ end
'ensure' => 'present',
'if_type' => 'vport',
'bridge' => ["br-ovs", "br1"],
'jacks' => ['p_33470efd-0', 'p_33470efd-1'],
'provider' => 'ovs_ubuntu'
})
end

View File

@ -48,7 +48,6 @@ describe 'l23network::l2::patch', :type => :define do
'gateway' => nil,
'onboot' => true,
'bridge' => ['br1', 'br2'],
'jacks' => ['p_39a440c1-0', 'p_39a440c1-1']
})
end
@ -77,7 +76,6 @@ describe 'l23network::l2::patch', :type => :define do
'gateway' => nil,
'onboot' => true,
'bridge' => ['br1', 'br2'],
'jacks' => ['p_39a440c1-0', 'p_39a440c1-1']
})
end
@ -105,7 +103,6 @@ describe 'l23network::l2::patch', :type => :define do
it do
should contain_l23_stored_config('p_39a440c1-0').with({
'bridge' => ['br1', 'br2'],
'jacks' => ['p_39a440c1-0', 'p_39a440c1-1'],
'mtu' => 9000,
})
end
@ -140,7 +137,6 @@ describe 'l23network::l2::patch', :type => :define do
it do
should contain_l23_stored_config('p_39a440c1-0').with({
'bridge' => ['br1', 'br2'],
'jacks' => ['p_39a440c1-0', 'p_39a440c1-1'],
'vendor_specific' => {
'aaa' => '111',
'bbb' => {