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

Side by Side Diff: modules/nodejs/manifests/init.pp

Issue 29483578: #2007 - Introduce nodejs module (Closed)
Patch Set: Created July 9, 2017, 1:30 a.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 | « no previous file | modules/nodejs/manifests/package.pp » ('j') | modules/nodejs/manifests/package.pp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # == Class: nodejs
2 #
3 # Install nodejs package from source
4 #
5 # == Parameters:
6 #
7 # [*package*]
8 # Overwrite the default package options, to fine-tune the target version (i.e.
9 # ensure => 'latest') or remove nodejs (ensure => 'absent' or 'purged')
10 #
11 # [*key*]
12 # Overwrite the default apt::key used (given Class['apt'] is defined).
13 #
14 # [*source*]
15 # Overwrite the default apt::source used (given Class['apt'] is defined).
16 #
17 # [*packages*]
18 # Adds adittional packages with npm.
19 #
20 # === Examples:
21 #
22 # class {'nodejs':
23 # package => {
24 # ensure => 'latest',
25 # },
26 # }
27 #
28 #
29 class nodejs (
30 $key = {
31 key => '68576280',
32 key_content => template("nodejs/nodesource.gpg.key.erb"),
33 },
34 $package = {},
35 $source = {
36 location => 'https://deb.nodesource.com/node_4.x',
37 release => downcase($lsbdistcodename),
38 repos => 'main',
39 },
40 $packages = {},
41 ) {
42
43 include stdlib
44
45 ensure_resource('package', $title, merge({
46 name => $title,
47 require => Apt::Source[$title],
mathias 2017/07/09 07:26:50 Use arrow-notation to establish relationships, esp
48 ensure => $ensure,
49 }, $package))
50
51 # Used as default $ensure parameter for most resources below
52 $ensure = getparam(Package[$title], 'ensure') ? {
53 /^(absent|purged)$/ => 'absent',
54 default => 'present',
55 }
56
57 if ensure_state($ensure) {
58
59 # The only package provider recognized implicitly
60 ensure_resource('apt::key', $title, merge({
mathias 2017/07/09 07:26:50 How is the user supposed to remove this one if the
61 ensure => $ensure,
62 name => 'nodesource',
63 }, $key))
64
65 ensure_resource('apt::source', $title, merge({
mathias 2017/07/09 07:26:50 How is the user supposed to remove this one if the
66 ensure => $ensure,
67 include_src => false,
68 name => 'nodesource',
69 }, $source))
70
71 Apt::Source[$title] <- Apt::Key[$title]
72 Apt::Source[$title] -> Package[$title]
73
74 create_resources('nodejs::package', $packages)
75
76 }
77
78 }
OLDNEW
« no previous file with comments | « no previous file | modules/nodejs/manifests/package.pp » ('j') | modules/nodejs/manifests/package.pp » ('J')

Powered by Google App Engine
This is Rietveld