diff --git a/deployment/puppet/l23network/templates/centos_ifdown-local.erb b/deployment/puppet/l23network/files/centos_ifdown-local similarity index 56% rename from deployment/puppet/l23network/templates/centos_ifdown-local.erb rename to deployment/puppet/l23network/files/centos_ifdown-local index e0b3b41ea1..70b742dd5e 100644 --- a/deployment/puppet/l23network/templates/centos_ifdown-local.erb +++ b/deployment/puppet/l23network/files/centos_ifdown-local @@ -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 diff --git a/deployment/puppet/l23network/templates/centos_ifup-local.erb b/deployment/puppet/l23network/files/centos_ifup-local similarity index 55% rename from deployment/puppet/l23network/templates/centos_ifup-local.erb rename to deployment/puppet/l23network/files/centos_ifup-local index 9b4011598b..9e69ad5d4b 100644 --- a/deployment/puppet/l23network/templates/centos_ifup-local.erb +++ b/deployment/puppet/l23network/files/centos_ifup-local @@ -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 diff --git a/deployment/puppet/l23network/files/centos_ifup-pre-local b/deployment/puppet/l23network/files/centos_ifup-pre-local index 09a472dcf0..e376597daf 100644 --- a/deployment/puppet/l23network/files/centos_ifup-pre-local +++ b/deployment/puppet/l23network/files/centos_ifup-pre-local @@ -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 diff --git a/deployment/puppet/l23network/templates/interfaces.erb b/deployment/puppet/l23network/files/interfaces similarity index 100% rename from deployment/puppet/l23network/templates/interfaces.erb rename to deployment/puppet/l23network/files/interfaces diff --git a/deployment/puppet/l23network/lib/puppet/provider/l23_stored_config_centos.rb b/deployment/puppet/l23network/lib/puppet/provider/l23_stored_config_centos.rb index 6b86255b1d..6676352e2e 100644 --- a/deployment/puppet/l23network/lib/puppet/provider/l23_stored_config_centos.rb +++ b/deployment/puppet/l23network/lib/puppet/provider/l23_stored_config_centos.rb @@ -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) diff --git a/deployment/puppet/l23network/manifests/init.pp b/deployment/puppet/l23network/manifests/init.pp index de6f8f4216..5e9d1f296c 100644 --- a/deployment/puppet/l23network/manifests/init.pp +++ b/deployment/puppet/l23network/manifests/init.pp @@ -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}" |> diff --git a/deployment/puppet/l23network/manifests/l2/centos_upndown_scripts.pp b/deployment/puppet/l23network/manifests/l2/centos_upndown_scripts.pp index 6b6e03b356..191ce6032f 100644 --- a/deployment/puppet/l23network/manifests/l2/centos_upndown_scripts.pp +++ b/deployment/puppet/l23network/manifests/l2/centos_upndown_scripts.pp @@ -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, diff --git a/deployment/puppet/l23network/manifests/l2/patch.pp b/deployment/puppet/l23network/manifests/l2/patch.pp index f77c073948..891e23f973 100644 --- a/deployment/puppet/l23network/manifests/l2/patch.pp +++ b/deployment/puppet/l23network/manifests/l2/patch.pp @@ -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, diff --git a/deployment/puppet/l23network/spec/classes/ovs2lnx__ovs_patch__spec.rb b/deployment/puppet/l23network/spec/classes/ovs2lnx__ovs_patch__spec.rb index 31d9518edd..b035ae7683 100644 --- a/deployment/puppet/l23network/spec/classes/ovs2lnx__ovs_patch__spec.rb +++ b/deployment/puppet/l23network/spec/classes/ovs2lnx__ovs_patch__spec.rb @@ -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 diff --git a/deployment/puppet/l23network/spec/defines/l2_patch__spec.rb b/deployment/puppet/l23network/spec/defines/l2_patch__spec.rb index b98582669b..7e9ff7408c 100644 --- a/deployment/puppet/l23network/spec/defines/l2_patch__spec.rb +++ b/deployment/puppet/l23network/spec/defines/l2_patch__spec.rb @@ -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' => { diff --git a/deployment/puppet/l23network/spec/fixtures/provider/l23_stored_config/lnx_centos7__lnx2lnx_patch__spec/pre-up-ifcfg-p_33470efd-0 b/deployment/puppet/l23network/spec/fixtures/provider/l23_stored_config/lnx_centos7__lnx2lnx_patch__spec/pre-up-ifcfg-p_33470efd-0 old mode 100644 new mode 100755 diff --git a/deployment/puppet/l23network/spec/fixtures/provider/l23_stored_config/lnx_centos7__lnx2lnx_patch__spec/pre-up-ifcfg-p_33470efd-1 b/deployment/puppet/l23network/spec/fixtures/provider/l23_stored_config/lnx_centos7__lnx2lnx_patch__spec/pre-up-ifcfg-p_33470efd-1 old mode 100644 new mode 100755