Skip to content

Commit

Permalink
Merge pull request #19 from ghoneycutt/fix_dupe_fqdn
Browse files Browse the repository at this point in the history
Fix dupe fqdn
  • Loading branch information
ghoneycutt committed May 21, 2014
2 parents 09d3952 + 30e7cd8 commit 45fb572
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 11 deletions.
4 changes: 2 additions & 2 deletions .fixtures.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
fixtures:
repositories:
'stdlib':
stdlib:
repo: 'git://github.com/puppetlabs/puppetlabs-stdlib.git'
ref: '3.2.0'
symlinks:
'hosts': "#{source_dir}"
hosts: "#{source_dir}"
6 changes: 2 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@
env:
- PUPPET_VERSION=3.3.2
- PUPPET_VERSION=3.4.2
- PUPPET_VERSION=3.5.1
- PUPPET_VERSION=3.6.0
notifications:
email: false
rvm:
- 1.8.7
- 1.9.3
- 2.0.0
matrix:
fast_finish: true
allow_failures:
- rvm: 2.0.0
language: ruby
before_script: "gem install --no-ri --no-rdoc bundler"
script: 'bundle exec rake validate && bundle exec rake lint && SPEC_OPTS="--format documentation" bundle exec rake spec'
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
source "https://rubygems.org"
source 'https://rubygems.org'

puppetversion = ENV.key?('PUPPET_VERSION') ? "= #{ENV['PUPPET_VERSION']}" : ['>= 3.3']
gem 'puppet', puppetversion
Expand Down
1 change: 0 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
require 'rubygems'
require 'puppetlabs_spec_helper/rake_tasks'
require 'puppet-lint/tasks/puppet-lint'
PuppetLint.configuration.send('disable_80chars')
Expand Down
5 changes: 3 additions & 2 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@
}

if $host_entries != undef {
validate_hash($host_entries)
create_resources(host,$host_entries)
$host_entries_real = delete($host_entries,$::fqdn)
validate_hash($host_entries_real)
create_resources(host,$host_entries_real)
}
}
30 changes: 30 additions & 0 deletions spec/classes/init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,36 @@
}
end

context 'with host_entries containing post for fqdn' do
let(:facts) { { :fqdn => 'myhost.example.com',
:ip => '10.0.0.5',} }
let(:params) {
{ :host_entries => {
'myhost.example.com' => {
'ip' => '10.0.0.5',
'host_aliases' => 'myhost',
},
'anotherhost.example.com' => {
'ip' => '10.0.0.6',
'host_aliases' => 'anotherhost',
},
} } }

it {
should_not contain_host('myhost.example.com').with({
'ip' => '10.0.0.5',
'host_aliases' => ['myhost',],
})
}

it {
should contain_host('anotherhost.example.com').with({
'ip' => '10.0.0.6',
'host_aliases' => ['anotherhost',],
})
}
end

context 'with host specified as not of type hash' do
let(:params) { { :keys => [ 'not', 'a', 'hash' ] } }

Expand Down
1 change: 0 additions & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
require 'rubygems'
require 'puppetlabs_spec_helper/module_spec_helper'

0 comments on commit 45fb572

Please sign in to comment.