ironfan 4.0.8 → 4.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.md +3 -0
- data/VERSION +1 -1
- data/config/ubuntu10.04-ironfan.erb +3 -3
- data/config/ubuntu11.10-ironfan.erb +3 -3
- data/ironfan.gemspec +1 -1
- data/lib/chef/knife/bootstrap/centos6.2-ironfan.erb +3 -3
- data/lib/chef/knife/bootstrap/ubuntu10.04-ironfan.erb +3 -3
- data/lib/chef/knife/bootstrap/ubuntu11.10-ironfan.erb +3 -3
- data/lib/chef/knife/cluster_bootstrap.rb +2 -3
- data/lib/chef/knife/cluster_launch.rb +44 -45
- data/lib/chef/knife/ironfan_knife_common.rb +18 -13
- data/lib/ironfan/broker/computer.rb +12 -0
- data/lib/ironfan/provider/ec2/machine.rb +4 -0
- metadata +2 -2
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
# v4.0.9:
|
2
|
+
* Making bootstrap work again (fixes #159)
|
3
|
+
|
1
4
|
# v4.0.8:
|
2
5
|
* Removed .delegates_to, .parallelize in favor of manual delegation (via .each) and .parallel, to remove assumption that calls must be in the context of the individual object (preparation for fixing bootstrapping)
|
3
6
|
* Adding cluster and facet roles to server run list (fixes #160)
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
4.0.
|
1
|
+
4.0.9
|
@@ -5,7 +5,7 @@ bash <<'EOF' || echo "Chef bootstrap failed!"
|
|
5
5
|
#
|
6
6
|
# * installs ruby 1.9.2 (not 1.8.7) from source
|
7
7
|
# * upgrades rubygems rather than installing from source
|
8
|
-
# * pushes the
|
8
|
+
# * pushes the computer identity into the first-boot.json
|
9
9
|
# * installs the chef-client service and kicks off the first run of chef
|
10
10
|
|
11
11
|
set -e
|
@@ -127,13 +127,13 @@ echo -e "`date` \n\n**** \n**** Creating chef client script:\n****\n"
|
|
127
127
|
(
|
128
128
|
cat <<'EOP'
|
129
129
|
<%= config_content %>
|
130
|
-
<%= @config[:
|
130
|
+
<%= @config[:computer].chef_client_script_content %>
|
131
131
|
EOP
|
132
132
|
) > /etc/chef/client.rb
|
133
133
|
|
134
134
|
(
|
135
135
|
cat <<'EOP'
|
136
|
-
<%= { "run_list" => @run_list, "cluster_name" => @config[:
|
136
|
+
<%= { "run_list" => @run_list, "cluster_name" => @config[:server].cluster_name, "facet_name" => @config[:server].facet_name, "facet_index" => @config[:server].index }.to_json %>
|
137
137
|
EOP
|
138
138
|
) > /etc/chef/first-boot.json
|
139
139
|
|
@@ -5,7 +5,7 @@ bash <<'EOF' || echo "Chef bootstrap failed!"
|
|
5
5
|
#
|
6
6
|
# * installs ruby 1.9.2 (not 1.8.7) using the system ruby
|
7
7
|
# * upgrades rubygems rather than installing from source
|
8
|
-
# * pushes the
|
8
|
+
# * pushes the computer identity into the first-boot.json
|
9
9
|
# * installs the chef-client service and kicks off the first run of chef
|
10
10
|
|
11
11
|
set -e
|
@@ -115,13 +115,13 @@ echo -e "`date` \n\n**** \n**** Creating chef client script:\n****\n"
|
|
115
115
|
(
|
116
116
|
cat <<'EOP'
|
117
117
|
<%= config_content %>
|
118
|
-
<%= @config[:
|
118
|
+
<%= @config[:computer].chef_client_script_content %>
|
119
119
|
EOP
|
120
120
|
) > /etc/chef/client.rb
|
121
121
|
|
122
122
|
(
|
123
123
|
cat <<'EOP'
|
124
|
-
<%= { "run_list" => @run_list, "cluster_name" => @config[:
|
124
|
+
<%= { "run_list" => @run_list, "cluster_name" => @config[:server].cluster_name, "facet_name" => @config[:server].facet_name, "facet_index" => @config[:server].index }.to_json %>
|
125
125
|
EOP
|
126
126
|
) > /etc/chef/first-boot.json
|
127
127
|
|
data/ironfan.gemspec
CHANGED
@@ -5,7 +5,7 @@ bash <<'EOF' || echo "Chef bootstrap failed!"
|
|
5
5
|
#
|
6
6
|
# * installs ruby 1.9.2 (not 1.8.7) from source
|
7
7
|
# * upgrades rubygems rather than installing from source
|
8
|
-
# * pushes the
|
8
|
+
# * pushes the computer identity into the first-boot.json
|
9
9
|
# * installs the chef-client service and kicks off the first run of chef
|
10
10
|
|
11
11
|
set -e
|
@@ -109,13 +109,13 @@ echo -e "`date` \n\n**** \n**** Creating chef client script:\n****\n"
|
|
109
109
|
(
|
110
110
|
cat <<'EOP'
|
111
111
|
<%= config_content %>
|
112
|
-
<%= @config[:
|
112
|
+
<%= @config[:computer].chef_client_script_content %>
|
113
113
|
EOP
|
114
114
|
) > /etc/chef/client.rb
|
115
115
|
|
116
116
|
(
|
117
117
|
cat <<'EOP'
|
118
|
-
<%= { "run_list" => @run_list, "cluster_name" => @config[:
|
118
|
+
<%= { "run_list" => @run_list, "cluster_name" => @config[:server].cluster_name, "facet_name" => @config[:server].facet_name, "facet_index" => @config[:server].index }.to_json %>
|
119
119
|
EOP
|
120
120
|
) > /etc/chef/first-boot.json
|
121
121
|
|
@@ -5,7 +5,7 @@ bash <<'EOF' || echo "Chef bootstrap failed!"
|
|
5
5
|
#
|
6
6
|
# * installs ruby 1.9.2 (not 1.8.7) from source
|
7
7
|
# * upgrades rubygems rather than installing from source
|
8
|
-
# * pushes the
|
8
|
+
# * pushes the computer identity into the first-boot.json
|
9
9
|
# * installs the chef-client service and kicks off the first run of chef
|
10
10
|
|
11
11
|
set -e
|
@@ -127,13 +127,13 @@ echo -e "`date` \n\n**** \n**** Creating chef client script:\n****\n"
|
|
127
127
|
(
|
128
128
|
cat <<'EOP'
|
129
129
|
<%= config_content %>
|
130
|
-
<%= @config[:
|
130
|
+
<%= @config[:computer].chef_client_script_content %>
|
131
131
|
EOP
|
132
132
|
) > /etc/chef/client.rb
|
133
133
|
|
134
134
|
(
|
135
135
|
cat <<'EOP'
|
136
|
-
<%= { "run_list" => @run_list, "cluster_name" => @config[:
|
136
|
+
<%= { "run_list" => @run_list, "cluster_name" => @config[:server].cluster_name, "facet_name" => @config[:server].facet_name, "facet_index" => @config[:server].index }.to_json %>
|
137
137
|
EOP
|
138
138
|
) > /etc/chef/first-boot.json
|
139
139
|
|
@@ -5,7 +5,7 @@ bash <<'EOF' || echo "Chef bootstrap failed!"
|
|
5
5
|
#
|
6
6
|
# * installs ruby 1.9.2 (not 1.8.7) using the system ruby
|
7
7
|
# * upgrades rubygems rather than installing from source
|
8
|
-
# * pushes the
|
8
|
+
# * pushes the computer identity into the first-boot.json
|
9
9
|
# * installs the chef-client service and kicks off the first run of chef
|
10
10
|
|
11
11
|
set -e
|
@@ -115,13 +115,13 @@ echo -e "`date` \n\n**** \n**** Creating chef client script:\n****\n"
|
|
115
115
|
(
|
116
116
|
cat <<'EOP'
|
117
117
|
<%= config_content %>
|
118
|
-
<%= @config[:
|
118
|
+
<%= @config[:computer].chef_client_script_content %>
|
119
119
|
EOP
|
120
120
|
) > /etc/chef/client.rb
|
121
121
|
|
122
122
|
(
|
123
123
|
cat <<'EOP'
|
124
|
-
<%= { "run_list" => @run_list, "cluster_name" => @config[:
|
124
|
+
<%= { "run_list" => @run_list, "cluster_name" => @config[:server].cluster_name, "facet_name" => @config[:server].facet_name, "facet_index" => @config[:server].index }.to_json %>
|
125
125
|
EOP
|
126
126
|
) > /etc/chef/first-boot.json
|
127
127
|
|
@@ -60,9 +60,8 @@ class Chef
|
|
60
60
|
|
61
61
|
def perform_execution(target)
|
62
62
|
# Execute across all servers in parallel
|
63
|
-
|
64
|
-
|
65
|
-
threads.map{ |t| t.join.value }
|
63
|
+
Ironfan.parallel(target.values) {|computer| run_bootstrap(computer)}
|
64
|
+
# threads = target.servers.map{ |server| Thread.new(server) { |svr| run_bootstrap(svr, svr.public_hostname) } }
|
66
65
|
end
|
67
66
|
|
68
67
|
def confirm_execution(target)
|
@@ -51,7 +51,7 @@ class Chef
|
|
51
51
|
|
52
52
|
option :bootstrap,
|
53
53
|
:long => "--[no-]bootstrap",
|
54
|
-
:description => "Also bootstrap the launched
|
54
|
+
:description => "Also bootstrap the launched machine (default is NOT to bootstrap)",
|
55
55
|
:boolean => true,
|
56
56
|
:default => false
|
57
57
|
|
@@ -81,61 +81,60 @@ class Chef
|
|
81
81
|
display(target)
|
82
82
|
target.launch
|
83
83
|
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
# perform_after_launch_tasks(svr)
|
89
|
-
# end
|
90
|
-
#
|
84
|
+
# As each server finishes, configure it
|
85
|
+
Ironfan.parallel(target.values) do |computer|
|
86
|
+
perform_after_launch_tasks(computer)
|
87
|
+
end
|
91
88
|
# progressbar_for_threads(watcher_threads)
|
92
89
|
|
93
90
|
display(target)
|
94
91
|
end
|
95
92
|
|
96
|
-
|
97
|
-
#
|
93
|
+
def perform_after_launch_tasks(computer)
|
94
|
+
# Wait for machine creation on amazon side
|
98
95
|
# server.fog_server.wait_for{ ready? }
|
99
|
-
|
100
|
-
|
101
|
-
#
|
96
|
+
computer.machine.wait_for{ ready? }
|
97
|
+
|
98
|
+
# Try SSH
|
99
|
+
unless config[:dry_run]
|
102
100
|
# nil until tcp_test_ssh(server.fog_server.dns_name){ sleep @initial_sleep_delay ||= 10 }
|
103
|
-
|
104
|
-
|
101
|
+
nil until tcp_test_ssh(computer.machine.dns_name){ sleep @initial_sleep_delay ||= 10 }
|
102
|
+
end
|
103
|
+
|
105
104
|
# # Make sure our list of volumes is accurate
|
106
105
|
# Ironfan.fetch_fog_volumes
|
107
106
|
# server.discover_volumes!
|
108
|
-
|
109
|
-
#
|
107
|
+
|
108
|
+
# Attach volumes, etc
|
110
109
|
# server.sync_to_cloud
|
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
|
-
|
110
|
+
computer.save
|
111
|
+
|
112
|
+
# Run Bootstrap
|
113
|
+
Chef::Log.warn "UNTESTED --bootstrap"
|
114
|
+
run_bootstrap(computer) if config[:bootstrap]
|
115
|
+
end
|
116
|
+
|
117
|
+
def tcp_test_ssh(hostname)
|
118
|
+
tcp_socket = TCPSocket.new(hostname, 22)
|
119
|
+
readable = IO.select([tcp_socket], nil, nil, 5)
|
120
|
+
if readable
|
121
|
+
Chef::Log.debug("sshd accepting connections on #{hostname}, banner is #{tcp_socket.gets}")
|
122
|
+
yield
|
123
|
+
true
|
124
|
+
else
|
125
|
+
false
|
126
|
+
end
|
127
|
+
rescue Errno::ETIMEDOUT
|
128
|
+
false
|
129
|
+
rescue Errno::ECONNREFUSED
|
130
|
+
sleep 2
|
131
|
+
false
|
132
|
+
rescue Errno::EHOSTUNREACH
|
133
|
+
sleep 2
|
134
|
+
false
|
135
|
+
ensure
|
136
|
+
tcp_socket && tcp_socket.close
|
137
|
+
end
|
139
138
|
|
140
139
|
def warn_or_die_on_bogus_servers(target)
|
141
140
|
ui.info("")
|
@@ -51,8 +51,8 @@ module Ironfan
|
|
51
51
|
end
|
52
52
|
|
53
53
|
# method to nodes should be filtered on
|
54
|
-
def relevant?(
|
55
|
-
|
54
|
+
def relevant?(computer)
|
55
|
+
computer.running?
|
56
56
|
end
|
57
57
|
|
58
58
|
# override in subclass to confirm risky actions
|
@@ -114,28 +114,33 @@ module Ironfan
|
|
114
114
|
ui.info ''
|
115
115
|
end
|
116
116
|
|
117
|
-
def bootstrapper(
|
117
|
+
def bootstrapper(computer)
|
118
|
+
server = computer.server
|
119
|
+
cloud = server.selected_cloud
|
120
|
+
hostname = computer.machine.dns_name
|
121
|
+
|
118
122
|
bootstrap = Chef::Knife::Bootstrap.new
|
119
123
|
bootstrap.config.merge!(config)
|
120
124
|
|
121
125
|
bootstrap.name_args = [ hostname ]
|
122
|
-
bootstrap.config[:
|
123
|
-
bootstrap.config[:
|
124
|
-
bootstrap.config[:
|
126
|
+
bootstrap.config[:computer] = computer
|
127
|
+
bootstrap.config[:server] = server
|
128
|
+
bootstrap.config[:run_list] = server.run_list
|
129
|
+
bootstrap.config[:ssh_user] = config[:ssh_user] || cloud.ssh_user
|
125
130
|
bootstrap.config[:attribute] = config[:attribute]
|
126
|
-
bootstrap.config[:identity_file] = config[:identity_file] ||
|
127
|
-
bootstrap.config[:distro] = config[:distro] ||
|
131
|
+
bootstrap.config[:identity_file] = config[:identity_file] || computer.ssh_identity_file
|
132
|
+
bootstrap.config[:distro] = config[:distro] || cloud.bootstrap_distro
|
128
133
|
bootstrap.config[:use_sudo] = true unless config[:use_sudo] == false
|
129
134
|
bootstrap.config[:chef_node_name] = server.fullname
|
130
|
-
bootstrap.config[:client_key] =
|
135
|
+
bootstrap.config[:client_key] = ( computer.client.private_key rescue nil )
|
131
136
|
|
132
137
|
bootstrap
|
133
138
|
end
|
134
139
|
|
135
|
-
def run_bootstrap(
|
136
|
-
bs = bootstrapper(
|
140
|
+
def run_bootstrap(computer)
|
141
|
+
bs = bootstrapper(computer)
|
137
142
|
if config[:skip].to_s == 'true'
|
138
|
-
ui.info "Skipping: bootstrap #{
|
143
|
+
ui.info "Skipping: bootstrap #{computer.name} with #{JSON.pretty_generate(bs.config)}"
|
139
144
|
return
|
140
145
|
end
|
141
146
|
begin
|
@@ -144,7 +149,7 @@ module Ironfan
|
|
144
149
|
ui.warn e
|
145
150
|
ui.warn e.backtrace
|
146
151
|
ui.warn ""
|
147
|
-
ui.warn
|
152
|
+
ui.warn computer.inspect
|
148
153
|
ui.warn ""
|
149
154
|
end
|
150
155
|
end
|
@@ -110,6 +110,18 @@ module Ironfan
|
|
110
110
|
end
|
111
111
|
end
|
112
112
|
|
113
|
+
def chef_client_script_content
|
114
|
+
cloud = server.selected_cloud
|
115
|
+
return @chef_client_script_content if @chef_client_script_content
|
116
|
+
return unless cloud.chef_client_script
|
117
|
+
script_filename = File.expand_path("../../../config/#{cloud.chef_client_script}", File.dirname(File.realdirpath(__FILE__)))
|
118
|
+
@chef_client_script_content = Ironfan.safely{ File.read(script_filename) }
|
119
|
+
end
|
120
|
+
|
121
|
+
def ssh_identity_file
|
122
|
+
resources[:key_pair].key_filename
|
123
|
+
end
|
124
|
+
|
113
125
|
# def ensure_resource(type)
|
114
126
|
# if type.multiple?
|
115
127
|
# existing = resources[type.resource_id]
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: ironfan
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 4.0.
|
5
|
+
version: 4.0.9
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Infochimps
|
@@ -232,7 +232,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
232
232
|
requirements:
|
233
233
|
- - ">="
|
234
234
|
- !ruby/object:Gem::Version
|
235
|
-
hash:
|
235
|
+
hash: 2386087126154656208
|
236
236
|
segments:
|
237
237
|
- 0
|
238
238
|
version: "0"
|