Showing with 822 additions and 0 deletions.
  1. +7 −0 .fixtures.yml
  2. +6 −0 .gemfile
  3. +6 −0 .gitignore
  4. +16 −0 .travis.yml
  5. +25 −0 CHANGELOG
  6. +13 −0 LICENSE
  7. +10 −0 Modulefile
  8. 0 README
  9. +92 −0 README.markdown
  10. +3 −0 Rakefile
  11. +44 −0 manifests/init.pp
  12. +561 −0 spec/classes/init_spec.rb
  13. +2 −0 spec/spec_helper.rb
  14. +17 −0 templates/resolv.conf.erb
  15. +3 −0 tests/domain.pp
  16. +1 −0 tests/init.pp
  17. +4 −0 tests/path.pp
  18. +4 −0 tests/search.pp
  19. +8 −0 tests/stuff.pp
7 changes: 7 additions & 0 deletions .fixtures.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
fixtures:
repositories:
"stdlib":
repo: "git://github.com/puppetlabs/puppetlabs-stdlib.git"
ref: "3.2.0"
symlinks:
"dnsclient": "#{source_dir}"
6 changes: 6 additions & 0 deletions .gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
source :rubygems

puppetversion = ENV.key?('PUPPET_VERSION') ? "= #{ENV['PUPPET_VERSION']}" : ['>= 2.7']
gem 'puppet', puppetversion
gem 'puppetlabs_spec_helper', '>= 0.1.0'
gem 'puppet-lint', '>= 0.3.2'
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
pkg/
*.swp
.DS_Store
metadata.json
coverage/
spec/fixtures/modules/*
16 changes: 16 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
language: ruby
before_script: "gem install --no-ri --no-rdoc bundler"
after_script:
script: "rake spec"
notifications:
email: false
rvm:
- 1.9.3
- 1.8.7
env:
- PUPPET_VERSION=2.7.13
- PUPPET_VERSION=3.2.1
gemfile: .gemfile
matrix:
allow_failures:
- rvm: 1.9.3
25 changes: 25 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
3.0.4 - 2013-06-08 Garrett Honeycutt <code@garretthoneycutt.com>
* Fix warnings by using @ in front of variables in template
* .fixtures.yml is tracking correct version of puppetlabs/stdlib
* Drop Puppet v2.6 from travis-ci
* anders-larsson updates README to document support for SLES 10
* anders-larsson updates README to document support for all EL, not just CentOS

3.0.1 - 2013-03-16 Garrett Honeycutt <code@garretthoneycutt.com>
* fixed spec bug relating to lack of .fixtures.yml
* cleaned up testing framework

3.0.0 - 2013-03-16 Garrett Honeycutt <code@garretthoneycutt.com>
* Switched to semantic versioning - http://semver.org
* Implemented new design pattern that manages data with Hiera
* Truly portable module! Code is completely data driven, so you can make changes
through Hiera and never have to edit the code itself.

2.0.0 - 2011-09-09 Garrett Honeycutt <garrett@puppetlabs.com>
* Implemented design pattern based on http://www.puppetlabs.com/blog/design-pattern-for-dealing-with-data/

1.0.1 - 2010-09-24 Garrett Honeycutt <code@garretthoneycutt.com>
* Added documentation

1.0.0 - 2010-06-24 Garrett Honeycutt <code@garretthoneycutt.com>
* Initial release
13 changes: 13 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Copyright (C) 2010-2013 Garrett Honeycutt <code@garretthoneycutt.com>

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
10 changes: 10 additions & 0 deletions Modulefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name 'ghoneycutt-dnsclient'
version '3.0.4'
source 'git://github.com/ghoneycutt/puppet-module-dnsclient.git'
author 'ghoneycutt'
license 'Apache License, Version 2.0'
summary 'Manage resolver'
description "Manage a DNS client's resolver"
project_page 'https://github.com/ghoneycutt/puppet-module-dnsclient/'

dependency 'puppetlabs/stdlib', '3.2.x'
Empty file removed README
Empty file.
92 changes: 92 additions & 0 deletions README.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# dnsclient module #

[![Build Status](
https://api.travis-ci.org/ghoneycutt/puppet-module-dnsclient.png?branch=master)](https://travis-ci.org/ghoneycutt/puppet-module-dnsclient)

This module manages /etc/resolv.conf and its various options.

It makes use of Hiera (http://github.com/puppetlabs/hiera) and demonstrates a
new design pattern in module development that allows for totally data driven
code with no modifications to the module itself as a guiding principle.

# Compatibility #

This module has been tested to work on the following systems.

* EL 5
* EL 6
* Debian 6
* SLES 10
* SLES 11
* Solaris 10
* Ubuntu 10.04 LTS (Lucid Lynx)
* Ubuntu 12.04 LTS (Precise Pangolin)

# Parameters #

See RESOLV.CONF(5) for more information regarding /etc/resolv.conf settings


nameservers
-----------
Array of name servers.

- *Default*: Google's public name servers

options
-------
Array of options.

- *Default*: 'rotate' and 'timeout:1'

search
------
Array of domains for search list. This is mutually exclusive with **domain**. If both are set, search will be used and domain will be ignored.

- *Default*: none

domain
------
Domain setting. See **search**.

- *Default*: none

sortlist
--------
Array of sortlist addresses.

- *Default*: none

resolver_config_file
--------------------
Path to resolv.conf.

- *Default*: '/etc/resolv.conf'

resolver_config_file_ensure
---------------------------
ensure attribute for file resource. Valid values are 'file', 'present' and 'absent'.

- *Default*: file

resolver_config_file_owner
--------------------------
resolv.conf's owner.

- *Default*: 'root'


resolver_config_file_group
--------------------------
resolv.conf's group.

- *Default*: 'root'


resolver_config_file_mode
-------------------------
resolv.conf's mode.

- *Default*: '0644'


3 changes: 3 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
require 'rubygems'
require 'puppetlabs_spec_helper/rake_tasks'
require 'puppet-lint/tasks/puppet-lint'
44 changes: 44 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# ## Class: dnsclient ##
#
# This module manages /etc/resolv.conf and is meant to be included in the
# common class that applies to all systems.
#
class dnsclient (
$nameservers = [ '8.8.8.8',
'8.8.4.4' ],
$options = [ 'rotate',
'timeout:1'],
$search = ['UNSET'],
$domain = 'UNSET',
$sortlist = ['UNSET'],
$resolver_config_file = '/etc/resolv.conf',
$resolver_config_file_ensure = 'file',
$resolver_config_file_owner = 'root',
$resolver_config_file_group = 'root',
$resolver_config_file_mode = '0644',
) {

# Validates domain
if is_domain_name($domain) != true {
fail("Domain name, ${domain}, is invalid.")
}

# Validates $resolver_config_file_ensure
case $resolver_config_file_ensure {
'file', 'present', 'absent': {
# noop, these values are valid
}
default: {
fail("Valid values for \$resolver_config_file_ensure are \'absent\', \'file\', or \'present\'. Specified value is ${resolver_config_file_ensure}")
}
}

file { 'dnsclient_resolver_config_file':
ensure => $resolver_config_file_ensure,
content => template('dnsclient/resolv.conf.erb'),
path => $resolver_config_file,
owner => $resolver_config_file_owner,
group => $resolver_config_file_group,
mode => $resolver_config_file_mode,
}
}
Loading