Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

travis fixes: introduce augeasversion fact #119

Merged
merged 4 commits into from
Aug 12, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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(' ') -%>