forked from aws/opsworks-cookbooks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.rb
54 lines (41 loc) · 1.64 KB
/
install.rb
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
def up_to_date?
OpsWorks::Berkshelf.berkshelf_installed? && node['opsworks_berkshelf']['version'] == OpsWorks::Berkshelf.current_version
end
unless up_to_date?
include_recipe "opsworks_berkshelf::purge"
log "downloading" do
message "Trying to download and install pre-built package for berkshelf version #{node['opsworks_berkshelf']['version']}"
level :info
action :nothing
end
Chef::Log.info "Install berkself dependency: git"
ensure_scm_package_installed("git")
opsworks_commons_assets_installer "Try to install berkshelf prebuilt package" do
asset "opsworks-berkshelf"
version node['opsworks_berkshelf']['version']
release node['opsworks_berkshelf']['pkg_release']
ignore_failure true
notifies :write, "log[downloading]", :immediately
action :install
only_if do
node['opsworks_berkshelf']['prebuilt_versions'].include?(node['opsworks_berkshelf']['version'])
end
end
log "installing gem" do
message "No pre-built package found for berkshelf version #{node['opsworks_berkshelf']['version']}, trying to install from rubygems.org"
level :info
action :nothing
end
gem_package 'berkshelf' do
gem_binary Opsworks::InstanceAgent::Environment.gem_binary
version node['opsworks_berkshelf']['version']
options("--bindir #{Opsworks::InstanceAgent::Environment.embedded_bin_path} --no-document #{node['opsworks_berkshelf']['rubygems_options']}")
ignore_failure false
notifies :write, "log[installing gem]", :immediately
action :install
not_if do
OpsWorks::Berkshelf.berkshelf_installed?
end
end
end
opsworks_berkshelf_runner "Install berkshelf cookbooks"