cluster_chef-knife 3.0.12 → 3.0.14
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +24 -0
- data/Gemfile +3 -2
- data/README.md +5 -1
- data/Rakefile +11 -4
- data/VERSION +1 -1
- data/cluster_chef-knife.gemspec +8 -6
- data/config/ubuntu10.04-cluster_chef.erb +157 -0
- data/config/ubuntu11.10-cluster_chef.erb +145 -0
- data/ironfan.gemspec +123 -0
- data/lib/chef/knife/bootstrap/ubuntu10.04-cluster_chef.erb +40 -22
- data/lib/chef/knife/bootstrap/ubuntu11.10-cluster_chef.erb +26 -14
- data/lib/chef/knife/cluster_kick.rb +8 -0
- data/lib/chef/knife/cluster_kill.rb +2 -2
- data/lib/chef/knife/cluster_proxy.rb +16 -10
- data/lib/chef/knife/cluster_show.rb +5 -0
- data/lib/chef/knife/cluster_ssh.rb +49 -2
- data/lib/chef/knife/cluster_start.rb +8 -0
- data/lib/chef/knife/cluster_stop.rb +7 -1
- data/lib/chef/knife/cluster_sync.rb +2 -2
- data/lib/chef/knife/knife_common.rb +3 -6
- metadata +83 -82
- data/clusters/website_demo.rb +0 -65
- data/lib/chef/knife/bootstrap/ubuntu10.04-basic.erb +0 -78
data/ironfan.gemspec
ADDED
@@ -0,0 +1,123 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = "ironfan"
|
8
|
+
s.version = "3.0.14"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Infochimps"]
|
12
|
+
s.date = "2012-02-15"
|
13
|
+
s.description = "ironfan allows you to orchestrate not just systems but clusters of machines. It includes a powerful layer on top of knife and a collection of cloud cookbooks."
|
14
|
+
s.email = "coders@infochimps.com"
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE",
|
17
|
+
"README.md"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".gitignore",
|
21
|
+
".rspec",
|
22
|
+
"CHANGELOG.md",
|
23
|
+
"Gemfile",
|
24
|
+
"LICENSE",
|
25
|
+
"README.md",
|
26
|
+
"Rakefile",
|
27
|
+
"TODO.md",
|
28
|
+
"VERSION",
|
29
|
+
"chefignore",
|
30
|
+
"cluster_chef-knife.gemspec",
|
31
|
+
"cluster_chef.gemspec",
|
32
|
+
"config/client.rb",
|
33
|
+
"config/proxy.pac",
|
34
|
+
"config/ubuntu10.04-cluster_chef.erb",
|
35
|
+
"config/ubuntu11.10-cluster_chef.erb",
|
36
|
+
"lib/chef/knife/bootstrap/ubuntu10.04-cluster_chef.erb",
|
37
|
+
"lib/chef/knife/bootstrap/ubuntu11.10-cluster_chef.erb",
|
38
|
+
"lib/chef/knife/cluster_bootstrap.rb",
|
39
|
+
"lib/chef/knife/cluster_kick.rb",
|
40
|
+
"lib/chef/knife/cluster_kill.rb",
|
41
|
+
"lib/chef/knife/cluster_launch.rb",
|
42
|
+
"lib/chef/knife/cluster_list.rb",
|
43
|
+
"lib/chef/knife/cluster_proxy.rb",
|
44
|
+
"lib/chef/knife/cluster_show.rb",
|
45
|
+
"lib/chef/knife/cluster_ssh.rb",
|
46
|
+
"lib/chef/knife/cluster_start.rb",
|
47
|
+
"lib/chef/knife/cluster_stop.rb",
|
48
|
+
"lib/chef/knife/cluster_sync.rb",
|
49
|
+
"lib/chef/knife/generic_command.rb",
|
50
|
+
"lib/chef/knife/knife_common.rb",
|
51
|
+
"lib/cluster_chef.rb",
|
52
|
+
"lib/cluster_chef/chef_layer.rb",
|
53
|
+
"lib/cluster_chef/cloud.rb",
|
54
|
+
"lib/cluster_chef/cluster.rb",
|
55
|
+
"lib/cluster_chef/compute.rb",
|
56
|
+
"lib/cluster_chef/deprecated.rb",
|
57
|
+
"lib/cluster_chef/discovery.rb",
|
58
|
+
"lib/cluster_chef/dsl_object.rb",
|
59
|
+
"lib/cluster_chef/facet.rb",
|
60
|
+
"lib/cluster_chef/fog_layer.rb",
|
61
|
+
"lib/cluster_chef/private_key.rb",
|
62
|
+
"lib/cluster_chef/role_implications.rb",
|
63
|
+
"lib/cluster_chef/security_group.rb",
|
64
|
+
"lib/cluster_chef/server.rb",
|
65
|
+
"lib/cluster_chef/server_slice.rb",
|
66
|
+
"lib/cluster_chef/volume.rb",
|
67
|
+
"notes/aws_console_screenshot.jpg",
|
68
|
+
"rspec.watchr",
|
69
|
+
"spec/cluster_chef/cluster_spec.rb",
|
70
|
+
"spec/cluster_chef/facet_spec.rb",
|
71
|
+
"spec/cluster_chef/server_slice_spec.rb",
|
72
|
+
"spec/cluster_chef/server_spec.rb",
|
73
|
+
"spec/cluster_chef_spec.rb",
|
74
|
+
"spec/spec_helper.rb",
|
75
|
+
"spec/spec_helper/dummy_chef.rb",
|
76
|
+
"spec/test_config.rb",
|
77
|
+
"tasks/chef_config.rake",
|
78
|
+
"tasks/jeweler_use_alt_branch.rake"
|
79
|
+
]
|
80
|
+
s.homepage = "http://infochimps.com/labs"
|
81
|
+
s.licenses = ["apachev2"]
|
82
|
+
s.require_paths = ["lib"]
|
83
|
+
s.rubygems_version = "1.8.15"
|
84
|
+
s.summary = "ironfan allows you to orchestrate not just systems but clusters of machines. It includes a powerful layer on top of knife and a collection of cloud cookbooks."
|
85
|
+
s.test_files = ["spec/cluster_chef/cluster_spec.rb", "spec/cluster_chef/facet_spec.rb", "spec/cluster_chef/server_slice_spec.rb", "spec/cluster_chef/server_spec.rb", "spec/cluster_chef_spec.rb", "spec/spec_helper/dummy_chef.rb", "spec/spec_helper.rb", "spec/test_config.rb"]
|
86
|
+
|
87
|
+
if s.respond_to? :specification_version then
|
88
|
+
s.specification_version = 3
|
89
|
+
|
90
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
91
|
+
s.add_runtime_dependency(%q<chef>, ["~> 0.10.4"])
|
92
|
+
s.add_runtime_dependency(%q<fog>, ["~> 1.1.1"])
|
93
|
+
s.add_runtime_dependency(%q<formatador>, ["~> 0.2.1"])
|
94
|
+
s.add_runtime_dependency(%q<gorillib>, ["~> 0.1.7"])
|
95
|
+
s.add_development_dependency(%q<bundler>, ["~> 1"])
|
96
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.6"])
|
97
|
+
s.add_development_dependency(%q<rspec>, ["~> 2.5"])
|
98
|
+
s.add_development_dependency(%q<yard>, ["~> 0.6"])
|
99
|
+
s.add_development_dependency(%q<configliere>, ["~> 0.4.8"])
|
100
|
+
else
|
101
|
+
s.add_dependency(%q<chef>, ["~> 0.10.4"])
|
102
|
+
s.add_dependency(%q<fog>, ["~> 1.1.1"])
|
103
|
+
s.add_dependency(%q<formatador>, ["~> 0.2.1"])
|
104
|
+
s.add_dependency(%q<gorillib>, ["~> 0.1.7"])
|
105
|
+
s.add_dependency(%q<bundler>, ["~> 1"])
|
106
|
+
s.add_dependency(%q<jeweler>, ["~> 1.6"])
|
107
|
+
s.add_dependency(%q<rspec>, ["~> 2.5"])
|
108
|
+
s.add_dependency(%q<yard>, ["~> 0.6"])
|
109
|
+
s.add_dependency(%q<configliere>, ["~> 0.4.8"])
|
110
|
+
end
|
111
|
+
else
|
112
|
+
s.add_dependency(%q<chef>, ["~> 0.10.4"])
|
113
|
+
s.add_dependency(%q<fog>, ["~> 1.1.1"])
|
114
|
+
s.add_dependency(%q<formatador>, ["~> 0.2.1"])
|
115
|
+
s.add_dependency(%q<gorillib>, ["~> 0.1.7"])
|
116
|
+
s.add_dependency(%q<bundler>, ["~> 1"])
|
117
|
+
s.add_dependency(%q<jeweler>, ["~> 1.6"])
|
118
|
+
s.add_dependency(%q<rspec>, ["~> 2.5"])
|
119
|
+
s.add_dependency(%q<yard>, ["~> 0.6"])
|
120
|
+
s.add_dependency(%q<configliere>, ["~> 0.4.8"])
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
@@ -1,30 +1,40 @@
|
|
1
|
-
bash
|
1
|
+
bash <<EOF || echo "Chef bootstrap failed!"
|
2
2
|
|
3
|
-
# This is the ubuntu
|
4
|
-
#
|
3
|
+
# This is the ubuntu natty bootstrap script from infochimps' cluster_chef. It is
|
4
|
+
# based on opscode's bootstrap script, with the following important differences:
|
5
|
+
#
|
6
|
+
# * installs ruby 1.9.2 (not 1.8.7) from source
|
5
7
|
# * upgrades rubygems rather than installing from source
|
6
8
|
# * pushes the node identity into the first-boot.json
|
7
9
|
# * installs the chef-client service and kicks off the first run of chef
|
8
10
|
|
9
|
-
|
11
|
+
set -e
|
10
12
|
|
11
|
-
|
12
|
-
cd /tmp/knife-bootstrap
|
13
|
+
<%= (@config[:verbosity].to_i > 1 ? 'set -v' : '') %>
|
13
14
|
|
14
15
|
RUBY_VERSION=1.9.2-p290
|
16
|
+
CHEF_VERSION=<%= bootstrap_version_string.gsub(/.*[\s=]/,"") %>
|
17
|
+
|
18
|
+
mkdir -p /tmp/knife-bootstrap
|
19
|
+
chmod 700 /tmp/knife-bootstrap
|
20
|
+
cd /tmp/knife-bootstrap
|
15
21
|
|
16
22
|
<%= "export http_proxy=\"#{knife_config[:bootstrap_proxy]}\"" if knife_config[:bootstrap_proxy] -%>
|
17
23
|
eval `cat /etc/lsb-release `
|
18
24
|
export DEBIAN_FRONTEND=noninteractive
|
19
25
|
|
20
|
-
|
26
|
+
date > /etc/box_build_time
|
27
|
+
|
21
28
|
echo -e "`date` \n\n**** \n**** apt update:\n****\n"
|
22
|
-
apt-get
|
29
|
+
apt-get -y update
|
23
30
|
apt-get -y upgrade
|
24
31
|
|
25
32
|
echo -e "`date` \n\n**** \n**** Installing base packages:\n****\n"
|
26
|
-
apt-get
|
33
|
+
apt-get -y install build-essential make wget curl runit zlib1g-dev libssl-dev openssl libcurl4-openssl-dev libxml2-dev libxslt-dev libyaml-dev libreadline6 libreadline6-dev
|
34
|
+
apt-get -y install runit-services
|
35
|
+
apt-get clean
|
27
36
|
|
37
|
+
if [ ! -f /usr/bin/chef-client ]; then
|
28
38
|
echo -e "`date` \n\n**** \n**** Installing ruby version ${RUBY_VERSION}:\n****\n"
|
29
39
|
|
30
40
|
wget ftp://ftp.ruby-lang.org//pub/ruby/1.9/ruby-${RUBY_VERSION}.tar.gz
|
@@ -46,21 +56,28 @@ update-alternatives \
|
|
46
56
|
|
47
57
|
if ruby -e "exit(%x{gem --version} < \"1.6.2\" ? 0 : -1 )" ; then
|
48
58
|
echo -e "`date` \n\n**** \n**** Updating rubygems:\n****\n"
|
49
|
-
|
50
|
-
|
59
|
+
# screw you Debian
|
60
|
+
REALLY_GEM_UPDATE_SYSTEM=1 gem update --system
|
61
|
+
# screw you rubygems
|
62
|
+
for foo in /usr/lib/ruby/site_ruby/*/rubygems/deprecate.rb ; do
|
63
|
+
# Don't have to be any such deprecations, in which case $foo won't exist
|
64
|
+
[ -f "$foo" ] && sudo sed -i.bak 's!@skip ||= false!true!' "$foo"
|
65
|
+
done
|
51
66
|
fi
|
52
67
|
|
53
68
|
echo -e "`date` \n\n**** \n**** Installing chef:\n****\n"
|
54
69
|
gem install ohai --no-rdoc --no-ri
|
55
70
|
gem install chef --no-rdoc --no-ri <%= bootstrap_version_string %>
|
56
|
-
|
71
|
+
# gems needed for the client.rb or so generically useful you want them at hand
|
72
|
+
gem install --no-rdoc --no-ri extlib bundler json right_aws pry
|
57
73
|
|
58
74
|
else # no chef-client
|
59
75
|
echo -e "`date` \n\n**** \n**** Chef is present -- skipping apt/ruby/chef installation\n****\n"
|
60
|
-
fi
|
76
|
+
fi # end ruby+chef install
|
61
77
|
|
62
78
|
# fix a bug in chef that prevents debugging template errors
|
63
|
-
|
79
|
+
# will not work with --prerelease but that's OK hopefully opscode patches this crap soon
|
80
|
+
bad_template_file="/usr/lib/ruby/gems/${RUBY_VERSION}/gems/chef-${CHEF_VERSION}/lib/chef/mixin/template.rb"
|
64
81
|
if echo "0505c482b8b0b333ac71bbc8a1795d19 $bad_template_file" | md5sum -c - 2>/dev/null ; then
|
65
82
|
curl https://github.com/mrflip/chef/commit/655a1967253a8759afb54f30b818bbcb7c309198.patch | sudo patch $bad_template_file
|
66
83
|
fi
|
@@ -87,7 +104,7 @@ awk NF /tmp/knife-bootstrap/validation.pem > /etc/chef/validation.pem
|
|
87
104
|
echo -e "`date` \n\n**** \n**** Nuking our temp files:\n****\n"
|
88
105
|
|
89
106
|
cd /tmp
|
90
|
-
|
107
|
+
rm -rf /tmp/knife-bootstrap
|
91
108
|
|
92
109
|
echo -e "`date` \n\n**** \n**** Creating chef client script:\n****\n"
|
93
110
|
|
@@ -105,21 +122,21 @@ EOP
|
|
105
122
|
) > /etc/chef/first-boot.json
|
106
123
|
|
107
124
|
echo -e "`date` \n\n**** \n**** Adding chef client runit scripts:\n****\n"
|
108
|
-
service chef-client stop >/dev/null 2>&1 ; sleep 1 ; killall chef-client 2>/dev/null
|
125
|
+
( service chef-client stop >/dev/null 2>&1 ; sleep 1 ; killall chef-client 2>/dev/null ) || true
|
109
126
|
mkdir -p /var/log/chef /var/chef /etc/service /etc/sv/chef-client/{log/main,supervise}
|
110
|
-
cat > /etc/sv/chef-client/log/run <<
|
127
|
+
cat > /etc/sv/chef-client/log/run <<EOP
|
111
128
|
#!/bin/bash
|
112
129
|
exec svlogd -tt ./main
|
113
|
-
|
114
|
-
cat > /etc/sv/chef-client/run <<
|
130
|
+
EOP
|
131
|
+
cat > /etc/sv/chef-client/run <<EOP
|
115
132
|
#!/bin/bash
|
116
133
|
exec 2>&1
|
117
134
|
exec /usr/bin/env chef-client -i 43200 -s 20 -L /var/log/chef/client.log
|
118
|
-
|
135
|
+
EOP
|
119
136
|
chmod +x /etc/sv/chef-client/log/run /etc/sv/chef-client/run
|
120
137
|
ln -nfs /usr/bin/sv /etc/init.d/chef-client
|
121
138
|
|
122
|
-
service chef-client stop
|
139
|
+
service chef-client stop >/dev/null 2>&1 || true
|
123
140
|
|
124
141
|
<%- if (@config[:bootstrap_runs_chef_client].to_s == 'true') || (@chef_config.knife[:bootstrap_runs_chef_client].to_s == 'true') %>
|
125
142
|
echo -e "`date` \n\n**** \n**** First run of chef:\n****\n"
|
@@ -129,6 +146,7 @@ set +e
|
|
129
146
|
<%- end %>
|
130
147
|
|
131
148
|
echo -e "`date` \n\n**** \n**** Cleanup:\n****\n"
|
149
|
+
# make locate work good
|
132
150
|
updatedb
|
133
151
|
|
134
152
|
echo -e "`date` \n\n**** \n**** Enabling chef client service:\n****\n"
|
@@ -136,4 +154,4 @@ ln -nfs /etc/sv/chef-client /etc/service/chef-client
|
|
136
154
|
service chef-client start
|
137
155
|
|
138
156
|
echo -e "`date` \n\n**** \n**** Cluster Chef client bootstrap complete\n****\n"
|
139
|
-
|
157
|
+
EOF
|
@@ -1,8 +1,9 @@
|
|
1
1
|
bash <<EOF || echo "Chef bootstrap failed!"
|
2
2
|
|
3
|
-
# This is the ubuntu
|
4
|
-
#
|
5
|
-
#
|
3
|
+
# This is the ubuntu oneiric bootstrap script from infochimps' cluster_chef. It is
|
4
|
+
# based on the opscode bootstrap script, with the important differences being it:
|
5
|
+
#
|
6
|
+
# * installs ruby 1.9.2 (not 1.8.7) using the system ruby
|
6
7
|
# * upgrades rubygems rather than installing from source
|
7
8
|
# * pushes the node identity into the first-boot.json
|
8
9
|
# * installs the chef-client service and kicks off the first run of chef
|
@@ -11,6 +12,9 @@ set -e
|
|
11
12
|
|
12
13
|
<%= (@config[:verbosity].to_i > 1 ? 'set -v' : '') %>
|
13
14
|
|
15
|
+
RUBY_VERSION=1.9.1
|
16
|
+
CHEF_VERSION=<%= bootstrap_version_string.gsub(/.*[\s=]/,"") %>
|
17
|
+
|
14
18
|
mkdir -p /tmp/knife-bootstrap
|
15
19
|
chmod 700 /tmp/knife-bootstrap
|
16
20
|
cd /tmp/knife-bootstrap
|
@@ -19,26 +23,31 @@ cd /tmp/knife-bootstrap
|
|
19
23
|
eval `cat /etc/lsb-release `
|
20
24
|
export DEBIAN_FRONTEND=noninteractive
|
21
25
|
|
26
|
+
date > /etc/box_build_time
|
27
|
+
|
22
28
|
# source for sun java if you want to install it later
|
23
29
|
apt-get install -y python-software-properties
|
24
30
|
add-apt-repository -y ppa:ferramroberto/java
|
25
|
-
apt-get -y update
|
26
31
|
|
27
|
-
if [ ! -f /usr/bin/chef-client ]; then
|
28
32
|
echo -e "`date` \n\n**** \n**** apt update:\n****\n"
|
29
|
-
apt-get
|
33
|
+
apt-get -y update
|
30
34
|
apt-get -y upgrade
|
31
35
|
|
32
36
|
echo -e "`date` \n\n**** \n**** Installing base packages:\n****\n"
|
33
|
-
apt-get
|
37
|
+
apt-get -y install build-essential make wget curl runit zlib1g-dev libssl-dev openssl libcurl4-openssl-dev libxml2-dev libxslt-dev libyaml-dev libreadline6 libreadline6-dev
|
38
|
+
apt-get clean
|
39
|
+
|
40
|
+
if [ ! -f /usr/bin/chef-client ]; then
|
41
|
+
echo -e "`date` \n\n**** \n**** Installing ruby version ${RUBY_VERSION}:\n****\n"
|
42
|
+
|
43
|
+
apt-get install -y ruby1.9.1 ruby1.9.1-dev
|
34
44
|
|
35
45
|
if ruby -e "exit(%x{gem --version} < \"1.6.2\" ? 0 : -1 )" ; then
|
36
46
|
echo -e "`date` \n\n**** \n**** Updating rubygems:\n****\n"
|
37
47
|
# screw you Debian
|
38
48
|
REALLY_GEM_UPDATE_SYSTEM=1 gem update --system
|
39
49
|
# screw you rubygems
|
40
|
-
for foo in /usr/lib/ruby/site_ruby/*/rubygems/deprecate.rb
|
41
|
-
do
|
50
|
+
for foo in /usr/lib/ruby/site_ruby/*/rubygems/deprecate.rb ; do
|
42
51
|
# Don't have to be any such deprecations, in which case $foo won't exist
|
43
52
|
[ -f "$foo" ] && sudo sed -i.bak 's!@skip ||= false!true!' "$foo"
|
44
53
|
done
|
@@ -47,14 +56,16 @@ fi
|
|
47
56
|
echo -e "`date` \n\n**** \n**** Installing chef:\n****\n"
|
48
57
|
gem install ohai --no-rdoc --no-ri
|
49
58
|
gem install chef --no-rdoc --no-ri <%= bootstrap_version_string %>
|
50
|
-
|
59
|
+
# gems needed for the client.rb or so generically useful you want them at hand
|
60
|
+
gem install --no-rdoc --no-ri extlib bundler json right_aws pry
|
51
61
|
|
52
62
|
else # no chef-client
|
53
63
|
echo -e "`date` \n\n**** \n**** Chef is present -- skipping apt/ruby/chef installation\n****\n"
|
54
|
-
fi
|
64
|
+
fi # end ruby+chef install
|
55
65
|
|
56
66
|
# fix a bug in chef that prevents debugging template errors
|
57
|
-
|
67
|
+
# will not work with --prerelease but that's OK hopefully opscode patches this crap soon
|
68
|
+
bad_template_file="/usr/lib/ruby/gems/${RUBY_VERSION}/gems/chef-${CHEF_VERSION}/lib/chef/mixin/template.rb"
|
58
69
|
if echo "0505c482b8b0b333ac71bbc8a1795d19 $bad_template_file" | md5sum -c - 2>/dev/null ; then
|
59
70
|
curl https://github.com/mrflip/chef/commit/655a1967253a8759afb54f30b818bbcb7c309198.patch | sudo patch $bad_template_file
|
60
71
|
fi
|
@@ -81,7 +92,7 @@ awk NF /tmp/knife-bootstrap/validation.pem > /etc/chef/validation.pem
|
|
81
92
|
echo -e "`date` \n\n**** \n**** Nuking our temp files:\n****\n"
|
82
93
|
|
83
94
|
cd /tmp
|
84
|
-
|
95
|
+
rm -rf /tmp/knife-bootstrap
|
85
96
|
|
86
97
|
echo -e "`date` \n\n**** \n**** Creating chef client script:\n****\n"
|
87
98
|
|
@@ -99,7 +110,7 @@ EOP
|
|
99
110
|
) > /etc/chef/first-boot.json
|
100
111
|
|
101
112
|
echo -e "`date` \n\n**** \n**** Adding chef client runit scripts:\n****\n"
|
102
|
-
(service chef-client stop >/dev/null 2>&1 ; sleep 1 ; killall chef-client 2>/dev/null) || true
|
113
|
+
( service chef-client stop >/dev/null 2>&1 ; sleep 1 ; killall chef-client 2>/dev/null ) || true
|
103
114
|
mkdir -p /var/log/chef /var/chef /etc/service /etc/sv/chef-client/{log/main,supervise}
|
104
115
|
cat > /etc/sv/chef-client/log/run <<EOP
|
105
116
|
#!/bin/bash
|
@@ -123,6 +134,7 @@ set +e
|
|
123
134
|
<%- end %>
|
124
135
|
|
125
136
|
echo -e "`date` \n\n**** \n**** Cleanup:\n****\n"
|
137
|
+
# make locate work good
|
126
138
|
updatedb
|
127
139
|
|
128
140
|
echo -e "`date` \n\n**** \n**** Enabling chef client service:\n****\n"
|
@@ -48,6 +48,9 @@ class Chef
|
|
48
48
|
set -e
|
49
49
|
<%= ((config[:verbosity].to_i > 1) ? "set -v" : "") %>
|
50
50
|
|
51
|
+
if sudo service chef-client status ; then
|
52
|
+
|
53
|
+
# running
|
51
54
|
pid_file="<%= config[:pid_file] %>"
|
52
55
|
log_file=/var/log/chef/client.log
|
53
56
|
|
@@ -71,6 +74,11 @@ sudo true
|
|
71
74
|
pid="$(sudo cat $pid_file)"
|
72
75
|
sudo kill -USR1 "$pid"
|
73
76
|
sed -r "/(ERROR: Sleeping for [0-9]+ seconds before trying again|INFO: Report handlers complete)\$/{q}" $pipe
|
77
|
+
|
78
|
+
else
|
79
|
+
echo -e "****\n\nchef-client daemon not running, invoking chef-client directly\n\n****\n"
|
80
|
+
sudo chef-client
|
81
|
+
fi
|
74
82
|
EOF
|
75
83
|
end
|
76
84
|
|
@@ -30,12 +30,12 @@ class Chef
|
|
30
30
|
:default => false
|
31
31
|
option :cloud,
|
32
32
|
:long => '--[no-]cloud',
|
33
|
-
:description => "
|
33
|
+
:description => "Kill machines from cloud (default is yes, terminate machines; use --no-cloud to skip)",
|
34
34
|
:boolean => true,
|
35
35
|
:default => true
|
36
36
|
option :chef,
|
37
37
|
:long => "--[no-]chef",
|
38
|
-
:description => "Delete the chef node and client (default is
|
38
|
+
:description => "Delete the chef node and client (default is yes, delete chef objects; use --no-chef to skip)",
|
39
39
|
:boolean => true,
|
40
40
|
:default => true
|
41
41
|
|
@@ -99,22 +99,28 @@ class Chef
|
|
99
99
|
pac_filename = File.expand_path(File.join('/tmp', "cluster_chef_proxy-#{ENV['USER']}.pac"))
|
100
100
|
ui.info("point your browser at PAC (automatic proxy config file) file://#{pac_filename}")
|
101
101
|
File.open(pac_filename, 'w') do |f|
|
102
|
-
f.print
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
102
|
+
f.print proxy_pac_contents
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
EC2_PROXY_PATTERNS = [ "*ec2*.amazonaws.com", "*ec2.internal*", "*compute-*.amazonaws.com", "*compute-*.internal*", "*domu*.internal*", "10.*",]
|
107
|
+
|
108
|
+
def proxy_pac_contents
|
109
|
+
proxy_patterns = EC2_PROXY_PATTERNS
|
110
|
+
proxy_patterns += Array(Chef::Config[:cluster_proxy_patterns])
|
111
|
+
rules = proxy_patterns.compact.map{|str| "(shExpMatch(host, %-28s))" % %Q{"#{str}"} }
|
112
|
+
%Q{function FindProxyForURL(url, host) {
|
113
|
+
if (#{rules.join(" ||\n ")}
|
109
114
|
) {
|
110
115
|
return "SOCKS5 localhost:#{config[:socks_port]}";
|
111
116
|
}
|
112
117
|
return "DIRECT";
|
113
|
-
}
|
114
|
-
}
|
115
|
-
end
|
118
|
+
}\n}
|
116
119
|
end
|
117
120
|
|
121
|
+
|
122
|
+
|
123
|
+
|
118
124
|
end
|
119
125
|
end
|
120
126
|
end
|
@@ -27,6 +27,11 @@ class Chef
|
|
27
27
|
end
|
28
28
|
|
29
29
|
banner "knife cluster show CLUSTER_NAME [FACET_NAME [INDEXES]] (options)"
|
30
|
+
option :cloud,
|
31
|
+
:long => "--[no-]cloud",
|
32
|
+
:description => "Look up machines on AWS cloud (default is yes, look up machines; use --no-cloud to skip)",
|
33
|
+
:default => true,
|
34
|
+
:boolean => true
|
30
35
|
|
31
36
|
def run
|
32
37
|
load_cluster_chef
|