From 7bdb71f5fce7aef0ac3a62fbe1adc5a6ecd58928 Mon Sep 17 00:00:00 2001 From: Sergey Vasilenko Date: Wed, 22 Apr 2015 00:52:41 +0300 Subject: [PATCH] Add additional order between end of init l23network and start of resource processing Fuel-CI: disable Closes-bug: #1446875 Change-Id: Ib3862318db65b296e5b21edb8a6242eac0b0b6e7 --- .../puppet/l23network/manifests/init.pp | 4 +-- .../puppet/l23network/manifests/l2/bond.pp | 2 +- .../puppet/l23network/manifests/l2/bridge.pp | 2 +- .../puppet/l23network/manifests/l2/patch.pp | 2 +- .../puppet/l23network/manifests/l2/port.pp | 2 +- .../l23network/manifests/l3/ifconfig.pp | 1 - .../puppet/l23network/manifests/l3/route.pp | 1 + .../l23network/spec/classes/bond__spec.rb | 2 +- .../spec/classes/l23network_init__spec.rb | 6 +++- .../spec/defines/ifconfig__dhcp__spec.rb | 4 +++ .../l23network/spec/defines/ifconfig__spec.rb | 4 +++ .../l23network/spec/defines/l2_bond__spec.rb | 6 +++- .../spec/defines/l2_bridge__spec.rb | 9 +++-- .../l23network/spec/defines/l2_patch__spec.rb | 9 +++-- .../l23network/spec/defines/l2_port__spec.rb | 33 ++++++++----------- 15 files changed, 52 insertions(+), 35 deletions(-) diff --git a/deployment/puppet/l23network/manifests/init.pp b/deployment/puppet/l23network/manifests/init.pp index 6a206e0bb5..c55e8da241 100644 --- a/deployment/puppet/l23network/manifests/init.pp +++ b/deployment/puppet/l23network/manifests/init.pp @@ -49,8 +49,8 @@ class l23network ( mode => '0755', } -> Anchor['l23network::init'] } - Class['l23network::l2'] -> File<| title == "${::l23network::params::interfaces_dir}" |> - Class['l23network::l2'] -> File<| title == "${::l23network::params::interfaces_file}" |> + Anchor['l23network::l2::init'] -> File<| title == "${::l23network::params::interfaces_dir}" |> + Anchor['l23network::l2::init'] -> File<| title == "${::l23network::params::interfaces_file}" |> # Centos interface up-n-down scripts if $::osfamily =~ /(?i)redhat/ { diff --git a/deployment/puppet/l23network/manifests/l2/bond.pp b/deployment/puppet/l23network/manifests/l2/bond.pp index 6bac65bcc2..b2ffbe98ea 100644 --- a/deployment/puppet/l23network/manifests/l2/bond.pp +++ b/deployment/puppet/l23network/manifests/l2/bond.pp @@ -174,7 +174,7 @@ define l23network::l2::bond ( # this need for creating L2_port resource by ifup, if it allowed by OS L23_stored_config[$bond] -> L2_bond[$bond] - K_mod<||> -> L2_bond<||> + Anchor['l23network::init'] -> K_mod<||> -> L2_bond<||> } diff --git a/deployment/puppet/l23network/manifests/l2/bridge.pp b/deployment/puppet/l23network/manifests/l2/bridge.pp index a007f98052..e3a88c5bec 100644 --- a/deployment/puppet/l23network/manifests/l2/bridge.pp +++ b/deployment/puppet/l23network/manifests/l2/bridge.pp @@ -59,7 +59,7 @@ define l23network::l2::bridge ( # this need for creating L2_bridge resource by ifup, if it allowed by OS L23_stored_config[$name] -> L2_bridge[$name] - K_mod<||> -> L2_bridge<||> + Anchor['l23network::init'] -> K_mod<||> -> L2_bridge<||> } } diff --git a/deployment/puppet/l23network/manifests/l2/patch.pp b/deployment/puppet/l23network/manifests/l2/patch.pp index cc21dc77f7..716d4f606c 100644 --- a/deployment/puppet/l23network/manifests/l2/patch.pp +++ b/deployment/puppet/l23network/manifests/l2/patch.pp @@ -63,7 +63,7 @@ define l23network::l2::patch ( provider => $provider } - K_mod<||> -> L2_patch<||> + Anchor['l23network::init'] -> K_mod<||> -> L2_patch<||> } } # vim: set ts=2 sw=2 et : \ No newline at end of file diff --git a/deployment/puppet/l23network/manifests/l2/port.pp b/deployment/puppet/l23network/manifests/l2/port.pp index 085510a907..4d63c8322e 100644 --- a/deployment/puppet/l23network/manifests/l2/port.pp +++ b/deployment/puppet/l23network/manifests/l2/port.pp @@ -139,7 +139,7 @@ define l23network::l2::port ( # this need for creating L2_port resource by ifup, if it allowed by OS L23_stored_config[$port_name] -> L2_port[$port_name] - K_mod<||> -> L2_port<||> + Anchor['l23network::init'] -> K_mod<||> -> L2_port<||> } } # vim: set ts=2 sw=2 et : \ No newline at end of file diff --git a/deployment/puppet/l23network/manifests/l3/ifconfig.pp b/deployment/puppet/l23network/manifests/l3/ifconfig.pp index 43acf4361a..81647ac8a8 100644 --- a/deployment/puppet/l23network/manifests/l3/ifconfig.pp +++ b/deployment/puppet/l23network/manifests/l3/ifconfig.pp @@ -230,5 +230,4 @@ define l23network::l3::ifconfig ( L23_stored_config <| title == $interface |> -> L3_ifconfig <| title == $interface |> } - } diff --git a/deployment/puppet/l23network/manifests/l3/route.pp b/deployment/puppet/l23network/manifests/l3/route.pp index 34ee12564a..aeb8dd75b2 100644 --- a/deployment/puppet/l23network/manifests/l3/route.pp +++ b/deployment/puppet/l23network/manifests/l3/route.pp @@ -30,5 +30,6 @@ define l23network::l3::route ( } L3_ifconfig<||> -> L3_route<||> } + Anchor['l23network::init'] -> L3_route<||> } diff --git a/deployment/puppet/l23network/spec/classes/bond__spec.rb b/deployment/puppet/l23network/spec/classes/bond__spec.rb index a165a2a3bf..66906b2b46 100644 --- a/deployment/puppet/l23network/spec/classes/bond__spec.rb +++ b/deployment/puppet/l23network/spec/classes/bond__spec.rb @@ -46,7 +46,7 @@ end } end it do - should compile + should compile.with_all_deps end it do diff --git a/deployment/puppet/l23network/spec/classes/l23network_init__spec.rb b/deployment/puppet/l23network/spec/classes/l23network_init__spec.rb index 4068865eaf..3440ea2107 100644 --- a/deployment/puppet/l23network/spec/classes/l23network_init__spec.rb +++ b/deployment/puppet/l23network/spec/classes/l23network_init__spec.rb @@ -21,6 +21,10 @@ describe 'l23network', :type => :class do should contain_package('ethtool').with_ensure('present') should contain_package('ifenslave').with_ensure('present') should contain_package('vlan').with_ensure('present') + should contain_anchor('l23network::l2::init').that_comes_before('Anchor[l23network::init]') + should contain_anchor('l23network::l2::init').that_requires('Package[vlan]') + should contain_anchor('l23network::l2::init').that_requires('Package[ifenslave]') + should contain_anchor('l23network::l2::init').that_requires('Package[ethtool]') end end @@ -57,7 +61,7 @@ describe 'l23network', :type => :class do 'ensure' => 'running', 'name' => 'openvswitch-switch', 'enable' => true - }) + }).that_comes_before('Anchor[l23network::l2::init]') end end diff --git a/deployment/puppet/l23network/spec/defines/ifconfig__dhcp__spec.rb b/deployment/puppet/l23network/spec/defines/ifconfig__dhcp__spec.rb index e8516567e5..b3f5d76c83 100644 --- a/deployment/puppet/l23network/spec/defines/ifconfig__dhcp__spec.rb +++ b/deployment/puppet/l23network/spec/defines/ifconfig__dhcp__spec.rb @@ -14,6 +14,10 @@ describe 'l23network::l3::ifconfig', :type => :define do :ipaddr => 'dhcp' } } + let(:pre_condition) { [ + "class {'l23network': }" + ] } + it do should compile end diff --git a/deployment/puppet/l23network/spec/defines/ifconfig__spec.rb b/deployment/puppet/l23network/spec/defines/ifconfig__spec.rb index 276a081704..0bbd01b79b 100644 --- a/deployment/puppet/l23network/spec/defines/ifconfig__spec.rb +++ b/deployment/puppet/l23network/spec/defines/ifconfig__spec.rb @@ -14,6 +14,10 @@ describe 'l23network::l3::ifconfig', :type => :define do :ipaddr => 'none' } } + let(:pre_condition) { [ + "class {'l23network': }" + ] } + it do should compile end diff --git a/deployment/puppet/l23network/spec/defines/l2_bond__spec.rb b/deployment/puppet/l23network/spec/defines/l2_bond__spec.rb index 4058464001..d74b138ac5 100644 --- a/deployment/puppet/l23network/spec/defines/l2_bond__spec.rb +++ b/deployment/puppet/l23network/spec/defines/l2_bond__spec.rb @@ -9,6 +9,10 @@ describe 'l23network::l2::bond', :type => :define do :l23_os => 'ubuntu', :l3_fqdn_hostname => 'stupid_hostname', } } + let(:pre_condition) { [ + "class {'l23network': }" + ] } + context 'Just create a lnx-bond with two slave interfaces' do let(:params) do @@ -21,7 +25,7 @@ describe 'l23network::l2::bond', :type => :define do end it do - should compile + should compile.with_all_deps end it do diff --git a/deployment/puppet/l23network/spec/defines/l2_bridge__spec.rb b/deployment/puppet/l23network/spec/defines/l2_bridge__spec.rb index d46d8cf3cd..c0f9cf3259 100644 --- a/deployment/puppet/l23network/spec/defines/l2_bridge__spec.rb +++ b/deployment/puppet/l23network/spec/defines/l2_bridge__spec.rb @@ -9,6 +9,10 @@ describe 'l23network::l2::bridge', :type => :define do :l23_os => 'ubuntu', :l3_fqdn_hostname => 'stupid_hostname', } } + let(:pre_condition) { [ + "class {'l23network': }" + ] } + context 'Just a bridge, created by name' do let(:params) do @@ -32,9 +36,8 @@ describe 'l23network::l2::bridge', :type => :define do end it do - should contain_l2_bridge('br-mgmt').only_with({ + should contain_l2_bridge('br-mgmt').with({ 'ensure' => 'present', - 'use_ovs' => nil, 'external_ids' => {'bridge-id'=>'br-mgmt'}, }).that_requires('L23_stored_config[br-mgmt]') end @@ -77,7 +80,7 @@ describe 'l23network::l2::bridge', :type => :define do end it do - should compile + should compile.with_all_deps end it do diff --git a/deployment/puppet/l23network/spec/defines/l2_patch__spec.rb b/deployment/puppet/l23network/spec/defines/l2_patch__spec.rb index e01e0fc75d..0830de3bc2 100644 --- a/deployment/puppet/l23network/spec/defines/l2_patch__spec.rb +++ b/deployment/puppet/l23network/spec/defines/l2_patch__spec.rb @@ -9,6 +9,10 @@ describe 'l23network::l2::patch', :type => :define do :l23_os => 'ubuntu', :l3_fqdn_hostname => 'stupid_hostname', } } + let(:pre_condition) { [ + "class {'l23network': }" + ] } + context 'Just a patch between two bridges' do let(:params) do @@ -18,7 +22,7 @@ describe 'l23network::l2::patch', :type => :define do end it do - should compile + should compile.with_all_deps end it do @@ -34,9 +38,8 @@ describe 'l23network::l2::patch', :type => :define do end it do - should contain_l2_patch('patch__br1--br2').only_with({ + should contain_l2_patch('patch__br1--br2').with({ 'ensure' => 'present', - 'use_ovs' => nil, 'bridges' => ['br1', 'br2'], }).that_requires('L23_stored_config[p_br1-0]') end diff --git a/deployment/puppet/l23network/spec/defines/l2_port__spec.rb b/deployment/puppet/l23network/spec/defines/l2_port__spec.rb index d4c2bd746f..5eee067312 100644 --- a/deployment/puppet/l23network/spec/defines/l2_port__spec.rb +++ b/deployment/puppet/l23network/spec/defines/l2_port__spec.rb @@ -9,6 +9,10 @@ describe 'l23network::l2::port', :type => :define do :l23_os => 'ubuntu', :l3_fqdn_hostname => 'stupid_hostname', } } + let(:pre_condition) { [ + "class {'l23network': }" + ] } + context 'Port without anythyng' do let(:params) do @@ -18,7 +22,7 @@ describe 'l23network::l2::port', :type => :define do end it do - should compile + should compile.with_all_deps end it do @@ -31,9 +35,8 @@ describe 'l23network::l2::port', :type => :define do end it do - should contain_l2_port('eth4').only_with({ + should contain_l2_port('eth4').with({ 'ensure' => 'present', - 'use_ovs' => nil, }).that_requires('L23_stored_config[eth4]') end end @@ -62,9 +65,8 @@ describe 'l23network::l2::port', :type => :define do end it do - should contain_l2_port('eth4.102').only_with({ + should contain_l2_port('eth4.102').with({ 'ensure' => 'present', - 'use_ovs' => nil, 'vlan_id' => '102', 'vlan_dev' => 'eth4', 'vlan_mode' => 'eth' @@ -98,9 +100,8 @@ describe 'l23network::l2::port', :type => :define do end it do - should contain_l2_port('vlan102').only_with({ + should contain_l2_port('vlan102').with({ 'ensure' => 'present', - 'use_ovs' => nil, 'vlan_id' => '102', 'vlan_dev' => 'eth4', 'vlan_mode' => 'vlan' @@ -137,17 +138,15 @@ describe 'l23network::l2::port', :type => :define do it do should compile - should contain_l23_stored_config('eth2').only_with({ - 'use_ovs' => nil, + should contain_l23_stored_config('eth2').with({ 'method' => nil, 'ipaddr' => nil, 'gateway' => nil, 'mtu' => 9000, }) - should contain_l2_port('eth2').only_with({ + should contain_l2_port('eth2').with({ 'ensure' => 'present', 'mtu' => 9000, - 'use_ovs' => nil, }).that_requires('L23_stored_config[eth2]') end end @@ -162,16 +161,14 @@ describe 'l23network::l2::port', :type => :define do it do should compile - should contain_l23_stored_config('eth2').only_with({ - 'use_ovs' => nil, + should contain_l23_stored_config('eth2').with({ 'method' => nil, 'ipaddr' => nil, 'gateway' => nil, 'bridge' => 'br-floating', }) - should contain_l2_port('eth2').only_with({ + should contain_l2_port('eth2').with({ 'ensure' => 'present', - 'use_ovs' => nil, 'bridge' => 'br-floating', }).that_requires('L23_stored_config[eth2]') end @@ -193,8 +190,7 @@ describe 'l23network::l2::port', :type => :define do it do should compile - should contain_l23_stored_config('eth2').only_with({ - 'use_ovs' => nil, + should contain_l23_stored_config('eth2').with({ 'method' => nil, 'ipaddr' => nil, 'gateway' => nil, @@ -206,9 +202,8 @@ describe 'l23network::l2::port', :type => :define do }, }, }) - should contain_l2_port('eth2').only_with({ + should contain_l2_port('eth2').with({ 'ensure' => 'present', - 'use_ovs' => nil, 'vendor_specific' => { 'aaa' => '1111', 'bbb' => {