1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
|
# File 'manifests/params.pp', line 1
class nodejs::params {
$legacy_debian_symlinks = false
$nodejs_debug_package_ensure = 'absent'
$nodejs_dev_package_ensure = 'absent'
$nodejs_package_ensure = 'present'
$repo_enable_src = false
$repo_ensure = 'present'
$repo_pin = false
$repo_priority = 'absent'
$repo_proxy = 'absent'
$repo_proxy_password = 'absent'
$repo_proxy_username = 'absent'
$repo_url_suffix = 'node_0.10'
$use_flags = ['npm', 'snapshot']
# The full path to cmd.exe is required on Windows. The system32 fact is only
# available from Facter 2.3
$cmd_exe_path = $::osfamily ? {
'Windows' => 'C:\Windows\system32\cmd.exe',
default => undef,
}
case $::osfamily {
'Debian': {
if $::operatingsystemrelease =~ /^6\.(\d+)/ {
fail("The ${module_name} module is not supported on Debian Squeeze.")
}
if $::operatingsystemrelease =~ /^7\.(\d+)/ {
$manage_package_repo = true
$nodejs_debug_package_name = 'nodejs-dbg'
$nodejs_dev_package_name = undef
$nodejs_package_name = 'nodejs'
$npm_package_ensure = 'absent'
$npm_package_name = undef
$npm_path = '/usr/bin/npm'
$repo_class = '::nodejs::repo::nodesource'
}
elsif $::operatingsystemrelease =~ /^10.04$/ {
$manage_package_repo = true
$nodejs_debug_package_name = 'nodejs-dbg'
$nodejs_dev_package_name = undef
$nodejs_package_name = 'nodejs'
$npm_package_ensure = 'absent'
$npm_package_name = undef
$npm_path = '/usr/bin/npm'
$repo_class = '::nodejs::repo::nodesource'
}
elsif $::operatingsystemrelease =~ /^12.04$/ {
$manage_package_repo = true
$nodejs_debug_package_name = 'nodejs-dbg'
$nodejs_dev_package_name = 'nodejs-dev'
$nodejs_package_name = 'nodejs'
$npm_package_ensure = 'absent'
$npm_package_name = 'npm'
$npm_path = '/usr/bin/npm'
$repo_class = '::nodejs::repo::nodesource'
}
elsif $::operatingsystemrelease =~ /^14.04$/ {
$manage_package_repo = true
$nodejs_debug_package_name = 'nodejs-dbg'
$nodejs_dev_package_name = 'nodejs-dev'
$nodejs_package_name = 'nodejs'
$npm_package_ensure = 'absent'
$npm_package_name = 'npm'
$npm_path = '/usr/bin/npm'
$repo_class = '::nodejs::repo::nodesource'
}
else {
warning("The ${module_name} module might not work on ${::operatingsystem} ${::operatingsystemrelease}. Sensible defaults will be attempted.")
$manage_package_repo = true
$nodejs_debug_package_name = 'nodejs-dbg'
$nodejs_dev_package_name = 'nodejs-dev'
$nodejs_package_name = 'nodejs'
$npm_package_ensure = 'absent'
$npm_package_name = 'npm'
$npm_path = '/usr/bin/npm'
$repo_class = '::nodejs::repo::nodesource'
}
}
'RedHat': {
if $::operatingsystemrelease =~ /^[5-7]\.(\d+)/ {
$manage_package_repo = true
$nodejs_debug_package_name = 'nodejs-debuginfo'
$nodejs_dev_package_name = 'nodejs-devel'
$nodejs_package_name = 'nodejs'
$npm_package_ensure = 'absent'
$npm_package_name = 'npm'
$npm_path = '/usr/bin/npm'
$repo_class = '::nodejs::repo::nodesource'
}
elsif ($::operatingsystem == 'Fedora') and (versioncmp($::operatingsystemrelease, '18') > 0) {
$manage_package_repo = true
$nodejs_debug_package_name = 'nodejs-debuginfo'
$nodejs_dev_package_name = 'nodejs-devel'
$nodejs_package_name = 'nodejs'
$npm_package_ensure = 'absent'
$npm_package_name = 'npm'
$npm_path = '/usr/bin/npm'
$repo_class = '::nodejs::repo::nodesource'
}
elsif ($::operatingsystem == 'Amazon') {
$manage_package_repo = true
$nodejs_debug_package_name = 'nodejs-debuginfo'
$nodejs_dev_package_name = 'nodejs-devel'
$nodejs_package_name = 'nodejs'
$npm_package_ensure = 'absent'
$npm_package_name = 'npm'
$npm_path = '/usr/bin/npm'
$repo_class = '::nodejs::repo::nodesource'
}
else {
fail("The ${module_name} module is not supported on ${::operatingsystem} ${::operatingsystemrelease}.")
}
}
'Suse': {
$manage_package_repo = false
$nodejs_debug_package_name = 'nodejs-debuginfo'
$nodejs_dev_package_name = 'nodejs-devel'
$nodejs_package_name = 'nodejs'
$npm_package_ensure = 'present'
$npm_package_name = 'npm'
$npm_path = '/usr/bin/npm'
$repo_class = undef
}
'Archlinux': {
$manage_package_repo = false
$nodejs_debug_package_name = undef
$nodejs_dev_package_name = undef
$nodejs_package_name = 'nodejs'
$npm_package_ensure = 'present'
$npm_package_name = 'npm'
$npm_path = '/usr/bin/npm'
$repo_class = undef
}
'FreeBSD': {
$manage_package_repo = false
$nodejs_debug_package_name = undef
$nodejs_dev_package_name = 'www/node-devel'
$nodejs_package_name = 'www/node'
$npm_package_ensure = 'present'
$npm_package_name = 'www/npm'
$npm_path = '/usr/bin/npm'
$repo_class = undef
}
'OpenBSD': {
$manage_package_repo = false
$nodejs_debug_package_name = undef
$nodejs_dev_package_name = undef
$nodejs_package_name = 'node'
$npm_package_ensure = 'absent'
$npm_package_name = undef
$npm_path = '/usr/local/bin/npm'
$repo_class = undef
}
'Darwin': {
$manage_package_repo = false
$nodejs_debug_package_name = undef
$nodejs_dev_package_name = 'nodejs-devel'
$nodejs_package_name = 'nodejs'
$npm_package_ensure = 'present'
$npm_package_name = 'npm'
$npm_path = '/opt/local/bin/npm'
$repo_class = undef
Package { provider => 'macports' }
}
'Windows': {
$manage_package_repo = false
$nodejs_debug_package_name = undef
$nodejs_dev_package_name = undef
$nodejs_package_name = 'nodejs'
$npm_package_ensure = 'absent'
$npm_package_name = 'npm'
$npm_path = '"C:\Program Files\nodejs\npm.cmd"'
$repo_class = undef
Package { provider => 'chocolatey' }
}
# Gentoo was added as its own $::osfamily in Facter 1.7.0
'Gentoo': {
$manage_package_repo = false
$nodejs_debug_package_name = undef
$nodejs_dev_package_name = undef
$nodejs_package_name = 'net-libs/nodejs'
$npm_package_ensure = 'absent'
$npm_package_name = undef
$npm_path = '/usr/bin/npm'
$repo_class = undef
}
'Linux': {
# Before Facter 1.7.0 Gentoo did not have its own $::osfamily
case $::operatingsystem {
'Gentoo': {
$manage_package_repo = false
$nodejs_debug_package_name = undef
$nodejs_dev_package_name = undef
$nodejs_package_name = 'net-libs/nodejs'
$npm_package_ensure = 'absent'
$npm_package_name = undef
$npm_path = '/usr/bin/npm'
$repo_class = undef
}
'Amazon': {
# this is here only for historical reasons:
# old facter and Amazon Linux versions will run into this code path
$manage_package_repo = true
$nodejs_debug_package_name = 'nodejs-debuginfo'
$nodejs_dev_package_name = 'nodejs-devel'
$nodejs_package_name = 'nodejs'
$npm_package_ensure = 'absent'
$npm_package_name = 'npm'
$npm_path = '/usr/bin/npm'
$repo_class = '::nodejs::repo::nodesource'
}
default: {
fail("The ${module_name} module is not supported on an ${::operatingsystem} distribution.")
}
}
}
default: {
fail("The ${module_name} module is not supported on a ${::osfamily} based system.")
}
}
}
|