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

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

Issue 29483578: #2007 - Introduce nodejs module (Closed)
Patch Set: For comment 4 Created July 11, 2017, 6:14 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
OLDNEW
(Empty)
1 # == Type: nodejs::package
2 #
3 # Manage nodejs packages.
4 #
5 # === Parameters:
6 #
7 # [*ensure*]
8 # Translated directly into the state of installed/uninstalled
9 # package.
10 #
11 # [*options*]
12 # A list of zero or more options to install the package.
13 #
14 define nodejs::package (
15 $ensure = 'present',
16 $options = [],
17 ) {
18
19 $check_command = [
20 "npm", "list",
21 "--global",
22 "--parseable",
23 $name,
24 ]
25
26 if ensure_state($ensure) {
27 $command = [
28 "npm",
29 "install", "--global",
30 $options,
31 $title,
32 ]
33
34 $onlyif = shellquote("test", "!", "`${check_command}`")
mathias 2017/07/11 18:24:42 That doesn't make any sense: The backticks are esc
35 }
36 else {
37 $command = [
38 "npm",
39 "uninstall", "--global",
40 $options,
41 $title,
42 ]
43
44 $onlyif = shellquote("test", "`${check_command}`")
45 }
46
47 exec {"state_$title":
48 path => ["/usr/bin"],
49 command => shellquote($command),
50 require => Package['nodejs'],
51 onlyif => $onlyif,
52 }
53 }
54
OLDNEW

Powered by Google App Engine
This is Rietveld