Skip to content

Commit

Permalink
Merge pull request #119 from igalic/bondtest
Browse files Browse the repository at this point in the history
travis fixes: introduce augeasversion fact
  • Loading branch information
igalic committed Aug 12, 2015
2 parents 70e14b7 + 7ab3038 commit 5646b9a
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 17 deletions.
12 changes: 6 additions & 6 deletions manifests/bond.pp
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,13 @@
$options = undef,
$slave_options = undef,

$mode = "active-backup",
$miimon = "100",
$downdelay = "200",
$updelay = "200",
$mode = 'active-backup',
$miimon = '100',
$downdelay = '200',
$updelay = '200',
$primary = $slaves[0],
$primary_reselect = "always",
$xmit_hash_policy = "layer2",
$primary_reselect = 'always',
$xmit_hash_policy = 'layer2',
) {

require network::bond::setup
Expand Down
6 changes: 4 additions & 2 deletions manifests/bond/redhat.pp
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@


$opts_slave = merge(
{ 'MASTER' => $name,
'SLAVE' =>'yes' },
{
'MASTER' => $name,
'SLAVE' => 'yes'
},
$slave_options
)

Expand Down
11 changes: 6 additions & 5 deletions manifests/bond/setup.pp
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
# make it work on debian..
class network::bond::setup {

case $::osfamily {
RedHat: {
# Redhat installs the ifenslave command with the iputils package which
# is available by default
}
Debian: {
'Debian': {
package { 'ifenslave-2.6':
ensure => present,
}
}
'RedHat', default: {
# Redhat installs the ifenslave command with the iputils package which
# is available by default
}
}
}
21 changes: 18 additions & 3 deletions spec/defines/bond_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@

describe 'on platform' do
describe 'RedHat' do
let(:facts) {{:osfamily => 'RedHat'}}
let(:facts) do
{
:osfamily => 'RedHat',
:augeasversion => '1.4.0',
}
end

it "should create 'network::bond::redhat'" do
should contain_network__bond__redhat('bond0')
Expand All @@ -38,7 +43,12 @@
end

describe 'Debian' do
let(:facts) {{:osfamily => 'Debian'}}
let(:facts) do
{
:osfamily => 'Debian',
:augeasversion => '1.4.0',
}
end

it "should create 'network::bond::debian'" do
should contain_network__bond__debian('bond0')
Expand All @@ -59,7 +69,12 @@
end

describe 'configuring the kernel bonding device' do
let(:facts) {{:osfamily => 'Debian'}}
let(:facts) do
{
:osfamily => 'Debian',
:augeasversion => '1.4.0',
}
end

it { should contain_class('network::bond::setup') }

Expand Down
1 change: 1 addition & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

config.module_path = File.join(fixture_path, 'modules')
config.manifest_dir = File.join(fixture_path, 'manifests')
config.environmentpath = File.expand_path(File.join(Dir.pwd, 'spec'))
end

# ---
Expand Down
5 changes: 4 additions & 1 deletion templates/bond/opts-redhat.erb
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
<%= %w[mode miimon downdelay updelay lacp_rate primary primary_reselect xmit_hash_policy].reject { |thing| scope.lookupvar(thing) == :undef }.map {|thing| "#{thing}=#{scope.lookupvar(thing)}"}.join(' ') -%>
<%= %w[mode miimon downdelay updelay lacp_rate primary primary_reselect xmit_hash_policy].reject {
|option| scope.lookupvar(option).nil? || scope.lookupvar(option) == :undef || scope.lookupvar(option) == :absent || scope.lookupvar(option).empty? }.map {
|key| "#{key}=#{scope.lookupvar(key)}"
}.join(' ') -%>

0 comments on commit 5646b9a

Please sign in to comment.