Showing with 108 additions and 13 deletions.
  1. +2 −2 .fixtures.yml
  2. +0 −1 .gitignore
  3. +2 −4 .travis.yml
  4. +1 −1 Gemfile
  5. +1 −1 Modulefile
  6. +0 −1 Rakefile
  7. +3 −2 manifests/init.pp
  8. +69 −0 metadata.json
  9. +30 −0 spec/classes/init_spec.rb
  10. +0 −1 spec/spec_helper.rb
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}"
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ doc/
.DS_Store

# Puppet
metadata.json
coverage/
spec/fixtures/modules/*
spec/fixtures
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
2 changes: 1 addition & 1 deletion Modulefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name 'ghoneycutt-hosts'
version '2.0.1'
version '2.1.0'
source 'git://github.com/ghoneycutt/puppet-module-hosts.git'
author 'ghoneycutt'
license 'Apache License, Version 2.0'
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)
}
}
69 changes: 69 additions & 0 deletions metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{
"requirements": [
{
"name": "pe",
"version_requirement": "3.2.x"
},
{
"name": "puppet",
"version_requirement": "3.x"
}
],
"operatingsystem_support": [
{
"operatingsystem": "Debian"
},
{
"operatingsystem": "RedHat"
},
{
"operatingsystem": "CentOS"
},
{
"operatingsystem": "OracleLinux"
},
{
"operatingsystem": "Scientific"
},
{
"operatingsystem": "Solaris"
},
{
"operatingsystem": "SLES"
},
{
"operatingsystem": "SLED"
},
{
"operatingsystem": "Ubuntu"
}
],
"name": "ghoneycutt-hosts",
"version": "2.1.0",
"source": "git://github.com/ghoneycutt/puppet-module-hosts.git",
"author": "ghoneycutt",
"license": "Apache License, Version 2.0",
"summary": "Manages host entries",
"description": "Can ensure entries for localhost, localhost6, and $::fqdn,\nincluding aliases and optionally purge unmanaged entries.",
"project_page": "https://github.com/ghoneycutt/puppet-module-hosts",
"dependencies": [
{
"name": "puppetlabs/stdlib",
"version_requirement": ">= 3.2.0"
}
],
"types": [

],
"checksums": {
"Gemfile": "f184c7cca73bc8169572ab8c48e223bc",
"LICENSE": "567e6cc3941d464d60c74d1f4abd5f46",
"Modulefile": "23e22dfce928f3b4d78974af79d64c4a",
"README.md": "409911c21322853063ba3e9e75aed2bb",
"Rakefile": "1cb426d5b98cd8d27b9147563a78ab7c",
"manifests/init.pp": "d86f62e2f3f7ba129fb411862046221d",
"spec/classes/init_spec.rb": "ef5fc5741cef2e5289fa8397e1d13e89",
"spec/spec_helper.rb": "0db89c9a486df193c0e40095422e19dc",
"tests/init.pp": "669ed02ca7363697bf7491d75e9ceac3"
}
}
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'