File tree Expand file tree Collapse file tree 1 file changed +16
-6
lines changed Expand file tree Collapse file tree 1 file changed +16
-6
lines changed Original file line number Diff line number Diff line change
1
+ local_nodejs_up_to_date = ::File . exists? ( "/usr/local/bin/node" ) && system ( "/usr/local/bin/node -v | grep -q '#{ node [ :opsworks_nodejs ] [ :version ] } '" )
2
+
1
3
case node [ :platform ]
2
4
when 'debian' , 'ubuntu'
3
5
remote_file "/tmp/#{ node [ :opsworks_nodejs ] [ :deb ] } " do
4
6
source node [ :opsworks_nodejs ] [ :deb_url ]
5
7
action :create_if_missing
6
8
not_if do
7
- ::File . exists? ( "/usr/local/bin/node" ) &&
8
- system ( "/usr/local/bin/node -v | grep -q '#{ node [ :opsworks_nodejs ] [ :version ] } '" )
9
+ local_nodejs_up_to_date
10
+ end
11
+ end
12
+
13
+ execute "Remove old node.js versions due to update" do
14
+ command "dpkg --purge nodejs"
15
+ only_if do
16
+ ::File . exists? ( "/tmp/#{ node [ :opsworks_nodejs ] [ :deb ] } " )
9
17
end
10
18
end
11
19
12
- apt_package "Install node.js #{ node [ :opsworks_nodejs ] [ :version ] } " do
13
- source "/tmp/#{ node [ :opsworks_nodejs ] [ :deb ] } "
20
+ execute "Install node.js #{ node [ :opsworks_nodejs ] [ :version ] } " do
21
+ cwd "/tmp"
22
+ command "dpkg -i /tmp/#{ node [ :opsworks_nodejs ] [ :deb ] } "
14
23
only_if do
15
24
::File . exists? ( "/tmp/#{ node [ :opsworks_nodejs ] [ :deb ] } " )
16
25
end
21
30
source node [ :opsworks_nodejs ] [ :rpm_url ]
22
31
action :create_if_missing
23
32
not_if do
24
- ::File . exists? ( "/usr/local/bin/node" ) &&
25
- system ( "/usr/local/bin/node -v | grep -q '#{ node [ :opsworks_nodejs ] [ :version ] } '" )
33
+ local_nodejs_up_to_date
26
34
end
27
35
end
28
36
29
37
rpm_package "Install node.js #{ node [ :opsworks_nodejs ] [ :version ] } " do
30
38
source "/tmp/#{ node [ :opsworks_nodejs ] [ :rpm ] } "
39
+ action :upgrade
40
+ options "--oldpackage"
31
41
only_if do
32
42
::File . exists? ( "/tmp/#{ node [ :opsworks_nodejs ] [ :rpm ] } " )
33
43
end
You can’t perform that action at this time.
0 commit comments