summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.travis.yml45
-rw-r--r--Modulefile4
-rw-r--r--README.markdown4
-rw-r--r--manifests/init.pp12
-rw-r--r--spec/classes/ntp_spec.rb6
-rw-r--r--spec/fixtures/modules/my_ntp/templates/ntp.conf.erb4
6 files changed, 49 insertions, 26 deletions
diff --git a/.travis.yml b/.travis.yml
index 8f713e0..c8d205f 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,26 +1,25 @@
+---
+branches:
+ only:
+ - master
+notifications:
+ email: false
language: ruby
-bundler_args: --without development
-script: "bundle exec rake spec SPEC_OPTS='--format documentation'"
+script: 'rake spec'
+after_success:
+- git clone -q git://github.com/puppetlabs/ghpublisher.git .forge-releng
+- .forge-releng/publish
rvm:
- - 1.8.7
- - 1.9.3
- - ruby-head
+- 1.8.7
+- 1.9.3
env:
- - PUPPET_GEM_VERSION="~> 2.6.0"
- - PUPPET_GEM_VERSION="~> 2.7.0"
- - PUPPET_GEM_VERSION="~> 3.0.0"
- - PUPPET_GEM_VERSION="~> 3.1.0"
-matrix:
- allow_failures:
- - rvm: ruby-head
- exclude:
- - rvm: 1.9.3
- env: PUPPET_GEM_VERSION="~> 2.7.0"
- - rvm: ruby-head
- env: PUPPET_GEM_VERSION="~> 2.7.0"
- - rvm: 1.9.3
- env: PUPPET_GEM_VERSION="~> 2.6.0"
- - rvm: ruby-head
- env: PUPPET_GEM_VERSION="~> 2.6.0"
-notifications:
- email: false
+ matrix:
+ - PUPPET_VERSION=2.6.18
+ - PUPPET_VERSION=2.7.21
+ - PUPPET_VERSION=3.1.1
+ global:
+ - PUBLISHER_LOGIN=puppetlabs
+ - secure: |-
+ ZiIkYd9+CdPzpwSjFPnVkCx1FIlipxpbdyD33q94h2Tj5zXjNb1GXizVy0NR
+ kVxGhU5Ld8y9z8DTqKRgCI1Yymg3H//OU++PKLOQj/X5juWVR4URBNPeBOzu
+ IJBDl1MADKA4i1+jAZPpz4mTvTtKS4pWKErgCSmhSfsY1hs7n6c=
diff --git a/Modulefile b/Modulefile
index d9e2f1a..3b18895 100644
--- a/Modulefile
+++ b/Modulefile
@@ -1,10 +1,10 @@
name 'puppetlabs-ntp'
-version '0.2.0'
+version '0.3.0'
source 'git://github.com/puppetlabs/puppetlabs-ntp'
author 'Puppet Labs'
license 'Apache Version 2.0'
summary 'NTP Module'
-description 'NTP Module for Debian, Ubuntu, CentOS, RHEL, OEL, Fedora & FreeBSD'
+description 'NTP Module for Debian, Ubuntu, CentOS, RHEL, OEL, Fedora, FreeBSD & Arch'
project_page 'http://github.com/puppetlabs/puppetlabs-ntp'
## Add dependencies, if any:
diff --git a/README.markdown b/README.markdown
index 6cfa7c8..3a84185 100644
--- a/README.markdown
+++ b/README.markdown
@@ -71,6 +71,10 @@ This parameter is used to determine whether the ntp package will be updated auto
This parameter allows you to choose whether to automatically start ntp daemon on boot.
+####`template`
+
+This parameter allows you to explicitly override the template used.
+
Limitations
------------
diff --git a/manifests/init.pp b/manifests/init.pp
index 9b9c465..af1f8d5 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -28,6 +28,9 @@
# $enable = true
# Automatically start ntp deamon on boot.
#
+# $template = '${module_name}/${config_tpl}'
+# Override with your own explicit template.
+#
# Actions:
#
# Installs, configures, and manages the ntp service.
@@ -46,6 +49,7 @@ class ntp($servers='UNSET',
$ensure='running',
$enable=true,
$restrict=true,
+ $config_template=undef,
$autoupdate=false
) {
@@ -147,6 +151,12 @@ class ntp($servers='UNSET',
}
}
+ if ($config_template == undef) {
+ $template_real = "${module_name}/${config_tpl}"
+ } else {
+ $template_real = $config_template
+ }
+
package { 'ntp':
ensure => $package_ensure,
name => $pkg_name,
@@ -157,7 +167,7 @@ class ntp($servers='UNSET',
owner => 0,
group => 0,
mode => '0644',
- content => template("${module_name}/${config_tpl}"),
+ content => template($template_real),
require => Package[$pkg_name],
}
diff --git a/spec/classes/ntp_spec.rb b/spec/classes/ntp_spec.rb
index e74f7c1..9ce690b 100644
--- a/spec/classes/ntp_spec.rb
+++ b/spec/classes/ntp_spec.rb
@@ -128,6 +128,12 @@ describe 'ntp' do
params[:autoupdate] = true
subject.should contain_package('ntp').with_ensure('latest')
end
+ it 'should allow template to be overridden' do
+ params[:config_template] = 'my_ntp/ntp.conf.erb'
+ content = param_value(subject, 'file', '/etc/ntp.conf', 'content')
+ expected_lines = ['server foobar']
+ (content.split("\n") & expected_lines).should == expected_lines
+ end
end
end
end
diff --git a/spec/fixtures/modules/my_ntp/templates/ntp.conf.erb b/spec/fixtures/modules/my_ntp/templates/ntp.conf.erb
new file mode 100644
index 0000000..40cf67c
--- /dev/null
+++ b/spec/fixtures/modules/my_ntp/templates/ntp.conf.erb
@@ -0,0 +1,4 @@
+#my uber ntp config
+#
+
+server foobar