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 6, ensure_resources prefered in order to avoid using the present parameter for a simple… Created July 11, 2017, 10:04 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 = [],
mathias 2017/07/11 22:28:03 Are you sure we still need that $options parameter
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 $unless = shellquote($check_command)
35 $onlyif = undef
36 }
37 else {
38 $command = [
39 "npm",
40 "uninstall", "--global",
41 $options,
42 $title,
43 ]
44
45 $unless = undef
46 $onlyif = shellquote($check_command)
47 }
48
49 exec {"state_$title":
mathias 2017/07/11 22:28:03 Not a good title, no association with the type def
50 path => ["/usr/bin"],
mathias 2017/07/11 22:28:03 Not sure but this path seems too short. I am sure
51 command => shellquote($command),
52 require => Package['nodejs'],
53 onlyif => $onlyif,
54 unless => $unless,
55 }
56 }
57
OLDNEW

Powered by Google App Engine
This is Rietveld