Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: modules/adblockplus/manifests/puppet/agent.pp

Issue 29367556: Issue 3065 - Refactor adblockplus::puppet module to include Puppet patches (Closed)
Patch Set: (remove accidental changes) Created Dec. 15, 2016, 10 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « modules/adblockplus/manifests/puppet.pp ('k') | modules/adblockplus/manifests/puppet/master.pp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: modules/adblockplus/manifests/puppet/agent.pp
===================================================================
new file mode 100644
--- /dev/null
+++ b/modules/adblockplus/manifests/puppet/agent.pp
@@ -0,0 +1,51 @@
+# == Class: adblockplus::puppet::agent
+#
+# Manage Puppet (https://github.com/puppetlabs/puppet) agent configuration.
+#
+# === Parameters:
+#
+# [*package*]
+# Custom parameters for the implicit Package['puppet'] resource.
+#
+# [*service*]
+# Custom parameters for the Service['puppet'] resource implicitly defined
+# if Package['puppet'] is ensured to be neither "absent" nor "purged".
+#
+# === Examples:
+#
+# class {'adblockplus::puppet::agent':
+# package => {
+# 'ensure' => 'present',
+# 'name' => 'puppet',
+# },
+# service => {
+# 'ensure' => 'stopped',
+# 'name' => 'puppet',
+# },
+# }
+#
+class adblockplus::puppet::agent (
+ $package = hiera('adblockplus::puppet::agent::package', {}),
+ $service = hiera('adblockplus::puppet::agent::service', {}),
+) {
+
+ include adblockplus::puppet
+ include stdlib
+
+ # https://forge.puppet.com/puppetlabs/stdlib#ensure_resource
+ ensure_resource('package', 'puppet', merge({
+ 'ensure' => $adblockplus::puppet::ensure,
+ }, $package))
+
+ # https://forge.puppet.com/puppetlabs/stdlib#getparam
+ if getparam(Package['puppet'], 'ensure') !~ /^(absent|purged)$/ {
+
+ ensure_resource('service', 'puppet', merge({
+ 'ensure' => 'stopped',
+ 'hasrestart' => true,
+ 'hasstatus' => true,
+ }, $service))
+
+ Service['puppet'] <- Package['puppet']
+ }
+}
« no previous file with comments | « modules/adblockplus/manifests/puppet.pp ('k') | modules/adblockplus/manifests/puppet/master.pp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld