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

Side by Side Diff: modules/adblockplus/manifests/mercurial.pp

Issue 29526640: #3044 - Introduce class adblockplus::mercurial (Closed)
Patch Set: For comment 5 Created Aug. 24, 2017, 6:37 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « hiera/roles/web/adblockplus.yaml ('k') | modules/adblockplus/manifests/mercurial/extension.pp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # == Class: adblockplus::mercurial
2 #
3 # Manage Mercurial (https://www.mercurial-scm.org/) resources.
4 #
5 # === Parameters:
6 #
7 # [*config*]
8 # Overwrite the default hgrc file options for the Mercurial config.
9 #
10 # [*package*]
11 # Overwrite the default package options.
12 #
13 # === Examples:
14 #
15 # class {'adblockplus::mercurial':
16 # package => {
17 # ensure => 'latest',
18 # },
19 # }
20 #
21 class adblockplus::mercurial (
22 $config = {},
23 $package = {},
24 ) {
25
26 # https://forge.puppet.com/puppetlabs/stdlib
27 include stdlib
28
29 # https://forge.puppet.com/puppetlabs/stdlib#ensure_resource
30 ensure_resource('package', 'mercurial', $package)
31
32 # https://forge.puppet.com/puppetlabs/stdlib#getparam
33 $package_ensure = getparam(Package['mercurial'], 'ensure')
34
35 # https://docs.puppet.com/puppet/latest/lang_conditional.html#selectors
36 $ensure = $package_ensure ? {
37 /^(absent|latest|present|purged|true)$/ => $package_ensure,
38 default => 'present',
39 }
40
41 # https://docs.puppet.com/puppet/latest/types/file.html#file-attribute-content
42 # https://docs.puppet.com/puppet/latest/types/file.html#file-attribute-source
43 $default_content = $config['source'] ? {
44 undef => template('adblockplus/mercurial/hgrc.erb'),
45 default => undef,
46 }
47
48 # https://forge.puppet.com/puppetlabs/stdlib#merge
49 ensure_resource('file', 'hgrc', merge({
50 ensure => ensure_file_state(Package['mercurial']),
51 group => 'root',
52 mode => '0644',
53 owner => 'root',
54 path => '/etc/mercurial/hgrc',
55 content => $default_content,
56 }, $config))
57
58 # https://docs.puppet.com/puppet/latest/lang_relationships.html
59 Package['mercurial'] -> File['hgrc']
60
61 # https://docs.puppet.com/puppet/latest/function.html#createresources
62 $extensions = hiera_hash('adblockplus::mercurial::extensions', {})
63 create_resources('adblockplus::mercurial::extension', $extensions)
64 }
OLDNEW
« no previous file with comments | « hiera/roles/web/adblockplus.yaml ('k') | modules/adblockplus/manifests/mercurial/extension.pp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld