auser-poolparty 0.2.81 → 0.2.84
Sign up to get free protection for your applications and to get access to all the features.
- data/Capfile +1 -0
- data/Manifest.txt +13 -6
- data/PostInstall.txt +1 -1
- data/bin/cloud-configure +2 -1
- data/bin/cloud-handle-load +3 -3
- data/bin/cloud-maintain +2 -2
- data/bin/cloud-provision +4 -4
- data/bin/cloud-setup-dev +25 -0
- data/bin/cloud-start +1 -0
- data/bin/server-start-client +1 -1
- data/bin/server-start-master +1 -1
- data/bin/server-start-node +1 -1
- data/bin/server-write-new-nodes +26 -0
- data/lib/poolparty/capistrano.rb +18 -0
- data/lib/poolparty/exceptions/ProvisionerException.rb +5 -0
- data/lib/poolparty/helpers/optioner.rb +2 -1
- data/lib/poolparty/modules/cloud_resourcer.rb +17 -0
- data/lib/poolparty/modules/file_writer.rb +2 -2
- data/lib/poolparty/net/messenger.rb +1 -1
- data/lib/poolparty/net/remote_bases/ec2.rb +3 -2
- data/lib/poolparty/net/remoter.rb +12 -8
- data/lib/poolparty/plugins/git.rb +5 -1
- data/lib/poolparty/poolparty/cloud.rb +3 -1
- data/lib/poolparty/provisioners/capistrano/capistrano.rb +129 -0
- data/lib/poolparty/provisioners/capistrano/capistrano_configurer.rb +58 -0
- data/lib/poolparty/provisioners/capistrano/recipies/base.rb +100 -0
- data/lib/poolparty/provisioners/capistrano/recipies/master.rb +120 -0
- data/lib/poolparty/provisioners/capistrano/recipies/slave.rb +12 -0
- data/lib/poolparty/provisioners/provisioner_base.rb +98 -274
- data/lib/poolparty/templates/gem +12 -10
- data/lib/poolparty/version.rb +1 -1
- data/lib/poolparty.rb +5 -3
- data/poolparty.gemspec +18 -9
- data/spec/poolparty/helpers/optioner_spec.rb +1 -1
- data/spec/poolparty/net/remote_spec.rb +13 -14
- data/spec/poolparty/net/remoter_spec.rb +11 -11
- data/spec/poolparty/plugins/git_spec.rb +1 -1
- data/spec/poolparty/poolparty_spec.rb +1 -1
- data/spec/poolparty/provisioners/capistrano/capistrano_spec.rb +27 -0
- data/spec/poolparty/provisioners/provisioner_base_spec.rb +120 -0
- data/spec/poolparty/spec_helper.rb +15 -1
- data/website/index.html +1 -1
- metadata +18 -9
- data/lib/poolparty/provisioners/provisioners/become_master.rb +0 -166
- data/lib/poolparty/provisioners/provisioners/master.rb +0 -196
- data/lib/poolparty/provisioners/provisioners/slave.rb +0 -65
- data/spec/poolparty/helpers/provisioner_base_spec.rb +0 -137
- data/spec/poolparty/helpers/provisioners/master_spec.rb +0 -53
- data/spec/poolparty/helpers/provisioners/slave_spec.rb +0 -27
@@ -3,246 +3,104 @@
|
|
3
3
|
This class only comes in to play when calling the setup commands on
|
4
4
|
the development machine
|
5
5
|
=end
|
6
|
+
require 'capistrano/cli'
|
7
|
+
|
6
8
|
module PoolParty
|
7
9
|
module Provisioner
|
8
10
|
|
9
|
-
|
10
|
-
|
11
|
-
def self.provision_master(cloud, testing=false)
|
12
|
-
Provisioner::Master.new(cloud).process_install!(testing)
|
13
|
-
end
|
14
|
-
|
15
|
-
def self.configure_master(cloud, testing=false)
|
16
|
-
Provisioner::Master.new(cloud).process_configure!(testing)
|
17
|
-
end
|
18
|
-
|
19
|
-
def self.reconfigure_master(cloud, testing=false)
|
20
|
-
Provisioner::Master.new(cloud).process_reconfigure!(testing)
|
21
|
-
end
|
22
|
-
|
23
|
-
def self.provision_slaves(cloud, testing=false)
|
24
|
-
cloud.nonmaster_nonterminated_instances.each do |sl|
|
25
|
-
provision_slave(sl, cloud, testing)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
def self.configure_slaves(cloud, testing=false)
|
30
|
-
cloud.nonmaster_nonterminated_instances.each do |sl|
|
31
|
-
configure_slave(sl, cloud, testing)
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
def self.provision_slave(instance, cloud, testing=false)
|
36
|
-
Provisioner::Slave.new(instance, cloud).process_install!(testing)
|
37
|
-
end
|
38
|
-
|
39
|
-
def self.configure_slave(instance, cloud, testing=false)
|
40
|
-
Provisioner::Slave.new(instance, cloud).process_configure!(testing)
|
41
|
-
end
|
42
|
-
|
43
|
-
def self.become_master(cloud, testing=false)
|
44
|
-
Provisioner::BecomeMaster.new(cloud).process_install!(testing)
|
45
|
-
end
|
46
|
-
|
47
|
-
def self.process_clean_reconfigure_for!(instance, cloud, testing=false)
|
48
|
-
Provisioner::Master.new(cloud).process_clean_reconfigure_for!(instance, testing)
|
49
|
-
end
|
50
|
-
|
51
|
-
def self.clear_master_ssl_certs(cloud, testing=false)
|
52
|
-
Provisioner::Master.new(cloud).clear_master_ssl_certs
|
11
|
+
def provisioner_for(inst)
|
12
|
+
PoolParty::Provisioner::Capistrano.new(inst, self, :ubuntu)
|
53
13
|
end
|
54
14
|
|
55
15
|
class ProvisionerBase
|
16
|
+
attr_accessor :config, :loaded_tasks, :instance, :cloud, :os
|
56
17
|
|
57
18
|
include Configurable
|
58
19
|
include CloudResourcer
|
59
20
|
include FileWriter
|
60
21
|
|
61
|
-
def initialize(instance,cld=self, os=:ubuntu)
|
22
|
+
def initialize(instance=nil, cld=self, os=:ubuntu, &block)
|
62
23
|
@instance = instance
|
63
24
|
@cloud = cld
|
64
25
|
|
65
26
|
options(cloud.options) if cloud && cloud.respond_to?(:options)
|
66
|
-
set_vars_from_options(instance.options) unless instance.nil? || !instance.options || !instance.options.empty?
|
67
|
-
options(instance.options) if instance.respond_to?(:options)
|
27
|
+
# set_vars_from_options(instance.options) unless instance.nil? || !instance.options || !instance.options.empty?
|
28
|
+
# options(instance.options) if instance.respond_to?(:options)
|
29
|
+
|
30
|
+
@os = os.to_s.downcase.to_sym
|
31
|
+
self.instance_eval &block if block
|
68
32
|
|
69
|
-
@os = os.to_s.downcase.to_sym
|
70
33
|
loaded
|
71
34
|
end
|
35
|
+
|
36
|
+
def provision_master?
|
37
|
+
!@instance.nil? && @instance.master?
|
38
|
+
end
|
39
|
+
|
72
40
|
# Callback after initialized
|
73
|
-
def loaded
|
41
|
+
def loaded
|
42
|
+
end
|
43
|
+
|
44
|
+
def loaded_tasks
|
45
|
+
@loaded_tasks ||= []
|
74
46
|
end
|
75
47
|
|
76
48
|
### Installation tasks
|
77
49
|
|
78
50
|
# This is the actual runner for the installation
|
79
|
-
def install
|
80
|
-
valid? ? install_string : error
|
81
|
-
end
|
82
|
-
# Write the installation tasks to a file in the storage directory
|
83
|
-
def write_install_file
|
84
|
-
error unless valid?
|
85
|
-
::FileUtils.mkdir_p Base.storage_directory unless ::File.exists?(Base.storage_directory)
|
86
|
-
provisioner_file = ::File.join(Base.storage_directory, "install_#{name}.sh")
|
87
|
-
::File.open(provisioner_file, "w+") {|f| f << install }
|
88
|
-
end
|
89
|
-
def name
|
90
|
-
@instance.name
|
91
|
-
end
|
92
|
-
# TODO: Clean up this method
|
93
|
-
def process_install!(testing=false)
|
51
|
+
def install(testing=false)
|
94
52
|
error unless valid?
|
95
|
-
write_install_file
|
96
53
|
setup_runner
|
97
|
-
|
98
|
-
unless testing
|
99
|
-
vputs "Logging on to #{@instance.ip} (#{@instance.name})"
|
100
|
-
@cloud.rsync_storage_files_to(@instance)
|
101
|
-
vputs "Preparing configuration on the master"
|
102
|
-
|
54
|
+
unless testing
|
103
55
|
before_install(@instance)
|
104
|
-
|
105
|
-
#
|
106
|
-
|
107
|
-
|
108
|
-
# /bin/rm install_#{name}.sh
|
109
|
-
cmd = "cd #{Base.remote_storage_path} && /bin/chmod +x install_#{name}.sh && /bin/sh install_#{name}.sh"
|
110
|
-
verbose ? @cloud.run_command_on(cmd, @instance) : hide_output {@cloud.run_command_on(cmd, @instance)}
|
111
|
-
|
112
|
-
process_clean_reconfigure_for!(@instance, testing)
|
113
|
-
|
56
|
+
|
57
|
+
vputs "Provisioning #{@instance.name}"
|
58
|
+
process_install!(testing)
|
59
|
+
|
114
60
|
after_install(@instance)
|
115
61
|
end
|
116
62
|
end
|
117
|
-
#
|
118
|
-
|
119
|
-
def before_install(instance)
|
120
|
-
end
|
121
|
-
def after_install(instance)
|
63
|
+
# The provisioner bases overwrite this method
|
64
|
+
def process_install!(testing=false)
|
122
65
|
end
|
123
66
|
|
124
|
-
|
125
|
-
|
126
|
-
def configure
|
127
|
-
valid? ? configure_string : error
|
128
|
-
end
|
129
|
-
def write_configure_file
|
130
|
-
error unless valid?
|
131
|
-
provisioner_file = ::File.join(Base.storage_directory, "configure_#{name}.sh")
|
132
|
-
::File.open(provisioner_file, "w+") {|f| f << configure }
|
133
|
-
end
|
134
|
-
def process_configure!(testing=false)
|
67
|
+
# Configuration
|
68
|
+
def configure(testing=false)
|
135
69
|
error unless valid?
|
136
|
-
write_configure_file
|
137
70
|
setup_runner
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
@
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
end
|
146
|
-
end
|
147
|
-
def process_clean_reconfigure_for!(instance, testing=false)
|
148
|
-
if instance.is_a?(String)
|
149
|
-
name = instance
|
150
|
-
instance = MyOpenStruct.new(:name => name)
|
151
|
-
end
|
152
|
-
vputs "Cleaning certs from master: #{instance.name}"
|
153
|
-
# puppetca --clean #{instance.name}.compute-1.internal; puppetca --clean #{instance.name}.ec2.internal
|
154
|
-
# find /etc/puppet/ssl -type f -exec rm {} \;
|
155
|
-
unless testing
|
156
|
-
# @cloud.run_command_on("rm -rf /etc/puppet/ssl", instance) unless instance.master?
|
157
|
-
str = returning String.new do |s|
|
158
|
-
s << "puppetca --clean #{instance.name}.compute-1.internal 2>&1 > /dev/null;"
|
159
|
-
s << "puppetca --clean #{instance.name}.ec2.internal 2>&1 > /dev/null"
|
160
|
-
end
|
161
|
-
# @cloud.run_command_on(str, @cloud.master)
|
162
|
-
end
|
163
|
-
end
|
164
|
-
def clear_master_ssl_certs
|
165
|
-
str = returning String.new do |s|
|
166
|
-
s << "puppetca --clean master.compute-1.internal 2>&1 > /dev/null;"
|
167
|
-
s << "puppetca --clean master.ec2.internal 2>&1 > /dev/null"
|
71
|
+
unless testing
|
72
|
+
before_configure(@instance)
|
73
|
+
|
74
|
+
vputs "Provisioning #{@instance.name}"
|
75
|
+
process_configure!(testing)
|
76
|
+
|
77
|
+
after_configure(@instance)
|
168
78
|
end
|
169
|
-
@cloud.run_command_on("if [ -f '/usr/bin/puppetcleaner' ]; then /usr/bin/env puppetcleaner `hostname`; else #{str}; fi", @cloud.master)
|
170
|
-
end
|
171
|
-
def process_reconfigure!(testing=false)
|
172
|
-
@cloud.run_command_on(PoolParty::Remote::RemoteInstance.puppet_runner_command, @instance) unless testing
|
173
79
|
end
|
80
|
+
|
174
81
|
# Tasks that need to be performed everytime we do any
|
175
82
|
# remote ssh'ing into any instance
|
176
83
|
def setup_runner(force=false)
|
177
84
|
@cloud.prepare_for_configuration
|
178
85
|
@cloud.build_and_store_new_config_file(force)
|
179
86
|
end
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
def
|
184
|
-
"Error in installation"
|
185
|
-
end
|
186
|
-
# Gather all the tasks into one string
|
187
|
-
def install_string
|
188
|
-
[default_install_tasks, last_install_tasks].flatten.each do |task|
|
189
|
-
case task.class
|
190
|
-
when String
|
191
|
-
task
|
192
|
-
when Method
|
193
|
-
self.send(task.to_sym)
|
194
|
-
end
|
195
|
-
end.nice_runnable
|
196
|
-
end
|
197
|
-
def last_install_tasks
|
198
|
-
[]
|
199
|
-
end
|
200
|
-
def configure_string
|
201
|
-
[default_configure_tasks, last_configure_tasks].flatten.each do |task|
|
202
|
-
case task.class
|
203
|
-
when String
|
204
|
-
task
|
205
|
-
when Method
|
206
|
-
self.send(task.to_sym)
|
207
|
-
end
|
208
|
-
end.nice_runnable
|
209
|
-
end
|
210
|
-
def last_configure_tasks
|
211
|
-
[]
|
87
|
+
|
88
|
+
# Callbacks
|
89
|
+
# Before installation callback
|
90
|
+
def before_install(instance)
|
212
91
|
end
|
213
|
-
|
214
|
-
# These are run on all the provisioners, master or slave
|
215
|
-
def default_install_tasks
|
216
|
-
[
|
217
|
-
"#!/usr/bin/env sh",
|
218
|
-
first_install_tasks,
|
219
|
-
upgrade_system,
|
220
|
-
install_rubygems,
|
221
|
-
make_logger_directory,
|
222
|
-
install_puppet,
|
223
|
-
fix_rubygems,
|
224
|
-
setup_system_for_poolparty,
|
225
|
-
custom_install_tasks
|
226
|
-
] << install_tasks
|
92
|
+
def after_install(instance)
|
227
93
|
end
|
228
|
-
|
229
|
-
# This is run on the provisioner, regardless
|
230
|
-
def default_configure_tasks
|
231
|
-
[
|
232
|
-
custom_configure_tasks
|
233
|
-
] << configure_tasks
|
94
|
+
def before_configure(instance)
|
234
95
|
end
|
235
|
-
|
236
|
-
def install_tasks(a=[])
|
237
|
-
@install_task ||= a
|
96
|
+
def after_configure(instance)
|
238
97
|
end
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
@cloud.first_install_tasks_for(@instances) || []
|
98
|
+
|
99
|
+
def valid?
|
100
|
+
true
|
243
101
|
end
|
244
|
-
def
|
245
|
-
|
102
|
+
def error
|
103
|
+
raise ProvisionerException.new("Error in installation")
|
246
104
|
end
|
247
105
|
# Custom installation tasks
|
248
106
|
# Allow the remoter bases to attach their own tasks on the
|
@@ -274,107 +132,73 @@ module PoolParty
|
|
274
132
|
:gentoo => "emerge"
|
275
133
|
}
|
276
134
|
end
|
135
|
+
def os_installer
|
136
|
+
"#{self.class.installers[@os]}"
|
137
|
+
end
|
277
138
|
# Convenience method to grab the installer
|
278
139
|
def installer_for(names=[])
|
279
140
|
packages = names.is_a?(Array) ? names.join(" ") : names
|
280
141
|
"#{self.class.installers[@os]} #{packages}"
|
281
142
|
end
|
143
|
+
|
144
|
+
#TODO#
|
145
|
+
# Abstract the gems out
|
146
|
+
def base_gems
|
147
|
+
{
|
148
|
+
:logging => "http://rubyforge.org/frs/download.php/44731/logging-0.9.4.gem",
|
149
|
+
:ZenTest => "http://rubyforge.org/frs/download.php/45581/ZenTest-3.11.0.gem",
|
150
|
+
:ParseTree => "http://rubyforge.org/frs/download.php/45600/ParseTree-3.0.1.gem",
|
151
|
+
:ruby2ruby => "http://rubyforge.org/frs/download.php/45587/ruby2ruby-1.2.0.gem",
|
152
|
+
:activesupport => "http://rubyforge.org/frs/download.php/45627/activesupport-2.1.2.gem",
|
153
|
+
:"xml-simple" => "http://rubyforge.org/frs/download.php/18366/xml-simple-1.0.11.gem",
|
154
|
+
:RubyInline => "http://rubyforge.org/frs/download.php/45683/RubyInline-3.8.1.gem",
|
155
|
+
:flexmock => "http://rubyforge.org/frs/download.php/42580/flexmock-0.8.3.gem",
|
156
|
+
:hoe => "http://rubyforge.org/frs/download.php/45685/hoe-1.8.2.gem",
|
157
|
+
:lockfile => "http://rubyforge.org/frs/download.php/18698/lockfile-1.4.3.gem",
|
158
|
+
:rubyforge => "http://rubyforge.org/frs/download.php/45546/rubyforge-1.0.1.gem",
|
159
|
+
:rake => "http://rubyforge.org/frs/download.php/43954/rake-0.8.3.gem",
|
160
|
+
:sexp_processor => "http://rubyforge.org/frs/download.php/45589/sexp_processor-3.0.0.gem",
|
161
|
+
:capistrano => "http://rubyforge.org/frs/download.php/48031/capistrano-2.5.3.gem",
|
162
|
+
:poolparty => "http://github.com/auser/poolparty/tree/master%2Fpkg%2Fpoolparty.gem?raw=true",
|
163
|
+
"ec2" => "http://rubyforge.org/frs/download.php/43666/amazon-ec2-0.3.1.gem"
|
164
|
+
}
|
165
|
+
end
|
282
166
|
|
283
|
-
|
284
|
-
|
285
|
-
|
167
|
+
def download_base_gems_string
|
168
|
+
returning(Array.new) do |arr|
|
169
|
+
base_gems.each do |name, url|
|
170
|
+
arr << "wget #{url} -O #{Base.remote_storage_path}/#{name}.gem 2>&1"
|
171
|
+
end
|
172
|
+
end.join(" && ")
|
286
173
|
end
|
287
|
-
|
288
|
-
def
|
289
|
-
new
|
174
|
+
|
175
|
+
def install_base_gems_string
|
176
|
+
returning(Array.new) do |arr|
|
177
|
+
base_gems.each do |name, url|
|
178
|
+
arr << "/usr/bin/gem install --ignore-dependencies --no-ri --no-rdoc #{Base.remote_storage_path}/#{name}.gem"
|
179
|
+
end
|
180
|
+
end.join(" && ")
|
290
181
|
end
|
291
182
|
|
292
183
|
# Template directory from the provisioner base
|
293
184
|
def template_directory
|
294
185
|
File.join(File.dirname(__FILE__), "..", "templates")
|
295
186
|
end
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
EOE
|
301
|
-
end
|
302
|
-
|
303
|
-
def fix_rubygems
|
304
|
-
<<-EOE
|
305
|
-
echo '#{open(::File.join(template_directory, "gem")).read}' > /usr/bin/gem
|
306
|
-
echo 'Updating rubygems'
|
307
|
-
PAT=`/usr/bin/gem env gemdir`
|
308
|
-
/usr/bin/gem update --system #{unix_hide_string}
|
309
|
-
/usr/bin/gem update --system #{unix_hide_string}
|
310
|
-
EOE
|
311
|
-
end
|
312
|
-
|
313
|
-
def create_local_node
|
314
|
-
str = <<-EOS
|
315
|
-
node default {
|
316
|
-
include poolparty
|
317
|
-
}
|
318
|
-
EOS
|
319
|
-
@cloud.list_of_running_instances.each do |ri|
|
320
|
-
str << <<-EOS
|
321
|
-
node "#{ri.name}" {}
|
322
|
-
EOS
|
323
|
-
end
|
324
|
-
"echo '#{str}' > /etc/puppet/manifests/nodes/nodes.pp"
|
187
|
+
|
188
|
+
# Install from the class-level
|
189
|
+
def self.install(instance, cl=self, testing=false)
|
190
|
+
new(instance, cl).install(testing)
|
325
191
|
end
|
326
|
-
|
327
|
-
def upgrade_system
|
328
|
-
case @os
|
329
|
-
when :ubuntu
|
330
|
-
"
|
331
|
-
if grep -q 'http://mirrors.kernel.org/ubuntu hardy main universe' /etc/apt/sources.list
|
332
|
-
then
|
333
|
-
echo 'Updated already'
|
334
|
-
else
|
335
|
-
touch /etc/apt/sources.list
|
336
|
-
echo 'deb http://mirrors.kernel.org/ubuntu hardy main universe' >> /etc/apt/sources.list
|
337
|
-
aptitude update -y #{unix_hide_string} <<heredoc
|
338
|
-
Y
|
339
192
|
|
340
|
-
|
341
|
-
|
342
|
-
"
|
343
|
-
else
|
344
|
-
"# No system upgrade needed"
|
345
|
-
end
|
346
|
-
end
|
347
|
-
|
348
|
-
def install_puppet
|
349
|
-
"#{installer_for( puppet_packages )}"
|
350
|
-
end
|
351
|
-
|
352
|
-
def make_logger_directory
|
353
|
-
"mkdir -p /var/log/poolparty"
|
193
|
+
def self.configure(instance, cl=self, testing=false)
|
194
|
+
new(instance, cl).configure(testing)
|
354
195
|
end
|
355
196
|
|
356
|
-
def create_poolparty_manifest
|
357
|
-
<<-EOS
|
358
|
-
cp #{Base.remote_storage_path}/poolparty.pp /etc/puppet/manifests/classes
|
359
|
-
EOS
|
360
|
-
end
|
361
|
-
def setup_system_for_poolparty
|
362
|
-
<<-EOS
|
363
|
-
mkdir -p #{Base.base_config_directory}/ssl/private_keys
|
364
|
-
mkdir -p #{Base.base_config_directory}/ssl/certs
|
365
|
-
mkdir -p #{Base.base_config_directory}/ssl/public_keys
|
366
|
-
|
367
|
-
cp #{Base.remote_storage_path}/#{Base.template_directory}/puppetrerun /usr/bin/puppetrerun
|
368
|
-
chmod +x /usr/bin/puppetrerun
|
369
|
-
|
370
|
-
mv #{Base.remote_storage_path}/cookie ~/.erlang.cookie
|
371
|
-
chmod 400 ~/.erlang.cookie
|
372
|
-
EOS
|
373
|
-
end
|
374
197
|
end
|
375
198
|
end
|
376
199
|
end
|
200
|
+
|
377
201
|
## Load the provisioners
|
378
|
-
Dir[File.dirname(__FILE__) + "
|
202
|
+
Dir[File.dirname(__FILE__) + "/*/*.rb"].each do |file|
|
379
203
|
require file
|
380
204
|
end
|
data/lib/poolparty/templates/gem
CHANGED
@@ -1,20 +1,18 @@
|
|
1
|
-
|
1
|
+
#!/usr/bin/env ruby
|
2
2
|
#--
|
3
3
|
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
|
4
4
|
# All rights reserved.
|
5
5
|
# See LICENSE.txt for permissions.
|
6
|
-
# /usr/bin/gem is broken, so... have to use this until it is fixed
|
7
6
|
#++
|
8
7
|
|
8
|
+
require 'rubygems'
|
9
|
+
require 'rubygems/gem_runner'
|
10
|
+
require 'rubygems/exceptions'
|
9
11
|
|
10
|
-
|
11
|
-
require "rubygems/gem_runner"
|
12
|
-
Gem.manage_gems
|
12
|
+
required_version = Gem::Requirement.new "> 1.8.3"
|
13
13
|
|
14
|
-
required_version
|
15
|
-
|
16
|
-
puts "Expected Ruby Version #{required_version}, was #{RUBY_VERSION}"
|
17
|
-
exit(1)
|
14
|
+
unless required_version.satisfied_by? Gem.ruby_version then
|
15
|
+
abort "Expected Ruby Version #{required_version}, was #{Gem.ruby_version}"
|
18
16
|
end
|
19
17
|
|
20
18
|
# We need to preserve the original ARGV to use for passing gem options
|
@@ -22,4 +20,8 @@ end
|
|
22
20
|
# it...its for the source building process.
|
23
21
|
args = !ARGV.include?("--") ? ARGV.clone : ARGV[0...ARGV.index("--")]
|
24
22
|
|
25
|
-
|
23
|
+
begin
|
24
|
+
Gem::GemRunner.new.run args
|
25
|
+
rescue Gem::SystemExitException => e
|
26
|
+
exit e.exit_code
|
27
|
+
end
|
data/lib/poolparty/version.rb
CHANGED
data/lib/poolparty.rb
CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
|
|
2
2
|
|
3
3
|
# Load required gems
|
4
4
|
@required_software = Array.new
|
5
|
-
%w(activesupport ftools logging resolv ruby2ruby digest/sha2 open3).each do |lib|
|
5
|
+
%w(activesupport ftools logging resolv ruby2ruby digest/sha2 open3 capistrano).each do |lib|
|
6
6
|
begin
|
7
7
|
require lib
|
8
8
|
rescue Exception => e
|
@@ -36,7 +36,9 @@ end
|
|
36
36
|
ActiveSupport::Dependencies.load_paths << File.dirname(__FILE__)
|
37
37
|
|
38
38
|
## Load PoolParty
|
39
|
-
|
39
|
+
%w(version).each do |f|
|
40
|
+
require "#{File.dirname(__FILE__)}/poolparty/#{f}"
|
41
|
+
end
|
40
42
|
|
41
43
|
%w(core modules exceptions dependency_resolutions aska monitors provisioners extra net).each do |dir|
|
42
44
|
Dir[File.dirname(__FILE__) + "/poolparty/#{dir}/**.rb"].each do |file|
|
@@ -50,7 +52,7 @@ Logging.init :debug, :info, :warn, :error, :fatal
|
|
50
52
|
module PoolParty
|
51
53
|
include FileWriter
|
52
54
|
|
53
|
-
def
|
55
|
+
def log
|
54
56
|
@logger ||= make_new_logger
|
55
57
|
end
|
56
58
|
|
data/poolparty.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: poolparty
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.84
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ari Lerner
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-12-
|
12
|
+
date: 2008-12-13 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -70,6 +70,7 @@ executables:
|
|
70
70
|
- cloud-refresh
|
71
71
|
- cloud-rsync
|
72
72
|
- cloud-run
|
73
|
+
- cloud-setup-dev
|
73
74
|
- cloud-spec
|
74
75
|
- cloud-ssh
|
75
76
|
- cloud-start
|
@@ -99,6 +100,7 @@ executables:
|
|
99
100
|
- server-stop-master
|
100
101
|
- server-stop-node
|
101
102
|
- server-update-hosts
|
103
|
+
- server-write-new-nodes
|
102
104
|
extensions: []
|
103
105
|
|
104
106
|
extra_rdoc_files:
|
@@ -111,6 +113,7 @@ extra_rdoc_files:
|
|
111
113
|
- lib/poolparty/config/postlaunchmessage.txt
|
112
114
|
- website/index.txt
|
113
115
|
files:
|
116
|
+
- Capfile
|
114
117
|
- History.txt
|
115
118
|
- License.txt
|
116
119
|
- Manifest.txt
|
@@ -131,6 +134,7 @@ files:
|
|
131
134
|
- bin/cloud-refresh
|
132
135
|
- bin/cloud-rsync
|
133
136
|
- bin/cloud-run
|
137
|
+
- bin/cloud-setup-dev
|
134
138
|
- bin/cloud-spec
|
135
139
|
- bin/cloud-ssh
|
136
140
|
- bin/cloud-start
|
@@ -160,6 +164,7 @@ files:
|
|
160
164
|
- bin/server-stop-master
|
161
165
|
- bin/server-stop-node
|
162
166
|
- bin/server-update-hosts
|
167
|
+
- bin/server-write-new-nodes
|
163
168
|
- config/hoe.rb
|
164
169
|
- config/requirements.rb
|
165
170
|
- examples/basic.rb
|
@@ -286,6 +291,7 @@ files:
|
|
286
291
|
- lib/poolparty/base_packages/poolparty.rb
|
287
292
|
- lib/poolparty/base_packages/ruby.rb
|
288
293
|
- lib/poolparty/base_packages/runit.rb
|
294
|
+
- lib/poolparty/capistrano.rb
|
289
295
|
- lib/poolparty/config/postlaunchmessage.txt
|
290
296
|
- lib/poolparty/core/array.rb
|
291
297
|
- lib/poolparty/core/class.rb
|
@@ -306,6 +312,7 @@ files:
|
|
306
312
|
- lib/poolparty/exceptions/CloudNotFoundException.rb
|
307
313
|
- lib/poolparty/exceptions/LoadRulesException.rb
|
308
314
|
- lib/poolparty/exceptions/MasterException.rb
|
315
|
+
- lib/poolparty/exceptions/ProvisionerException.rb
|
309
316
|
- lib/poolparty/exceptions/RemoteException.rb
|
310
317
|
- lib/poolparty/exceptions/ResourceException.rb
|
311
318
|
- lib/poolparty/exceptions/RuntimeException.rb
|
@@ -374,10 +381,12 @@ files:
|
|
374
381
|
- lib/poolparty/poolparty/resources/symlink.rb
|
375
382
|
- lib/poolparty/poolparty/resources/variable.rb
|
376
383
|
- lib/poolparty/poolparty/script.rb
|
384
|
+
- lib/poolparty/provisioners/capistrano/capistrano.rb
|
385
|
+
- lib/poolparty/provisioners/capistrano/capistrano_configurer.rb
|
386
|
+
- lib/poolparty/provisioners/capistrano/recipies/base.rb
|
387
|
+
- lib/poolparty/provisioners/capistrano/recipies/master.rb
|
388
|
+
- lib/poolparty/provisioners/capistrano/recipies/slave.rb
|
377
389
|
- lib/poolparty/provisioners/provisioner_base.rb
|
378
|
-
- lib/poolparty/provisioners/provisioners/become_master.rb
|
379
|
-
- lib/poolparty/provisioners/provisioners/master.rb
|
380
|
-
- lib/poolparty/provisioners/provisioners/slave.rb
|
381
390
|
- lib/poolparty/spec/core/string.rb
|
382
391
|
- lib/poolparty/spec/matchers/a_spec_extensions_base.rb
|
383
392
|
- lib/poolparty/spec/matchers/have_cron.rb
|
@@ -445,9 +454,6 @@ files:
|
|
445
454
|
- spec/poolparty/helpers/binary_spec.rb
|
446
455
|
- spec/poolparty/helpers/display_spec.rb
|
447
456
|
- spec/poolparty/helpers/optioner_spec.rb
|
448
|
-
- spec/poolparty/helpers/provisioner_base_spec.rb
|
449
|
-
- spec/poolparty/helpers/provisioners/master_spec.rb
|
450
|
-
- spec/poolparty/helpers/provisioners/slave_spec.rb
|
451
457
|
- spec/poolparty/modules/cloud_resourcer_spec.rb
|
452
458
|
- spec/poolparty/modules/configurable_spec.rb
|
453
459
|
- spec/poolparty/modules/definable_resource.rb
|
@@ -456,6 +462,7 @@ files:
|
|
456
462
|
- spec/poolparty/monitors/base_monitor_spec.rb
|
457
463
|
- spec/poolparty/monitors/monitors/cpu_monitor_spec.rb
|
458
464
|
- spec/poolparty/monitors/monitors/memory_monitor_spec.rb
|
465
|
+
- spec/poolparty/net/log/pool.log
|
459
466
|
- spec/poolparty/net/messenger_spec.rb
|
460
467
|
- spec/poolparty/net/remote_bases/ec2_spec.rb
|
461
468
|
- spec/poolparty/net/remote_instance_spec.rb
|
@@ -497,6 +504,8 @@ files:
|
|
497
504
|
- spec/poolparty/poolparty/test_plugins/virtual_host_template.erb
|
498
505
|
- spec/poolparty/poolparty/test_plugins/webserver.rb
|
499
506
|
- spec/poolparty/poolparty_spec.rb
|
507
|
+
- spec/poolparty/provisioners/capistrano/capistrano_spec.rb
|
508
|
+
- spec/poolparty/provisioners/provisioner_base_spec.rb
|
500
509
|
- spec/poolparty/spec/core/string_spec.rb
|
501
510
|
- spec/poolparty/spec_helper.rb
|
502
511
|
- tasks/cloud.rake
|
@@ -521,7 +530,7 @@ files:
|
|
521
530
|
has_rdoc: true
|
522
531
|
homepage: http://poolparty.rubyforge.org
|
523
532
|
post_install_message: |-
|
524
|
-
Get ready to jump in the pool, you just installed PoolParty! (Updated at
|
533
|
+
Get ready to jump in the pool, you just installed PoolParty! (Updated at 19:18 12/13/08)
|
525
534
|
|
526
535
|
To get started, run the generator:
|
527
536
|
|
@@ -33,7 +33,7 @@ describe "Option Parser" do
|
|
33
33
|
@op = PoolParty::Optioner.new(%w( -v -i 1 five six -x), {:abstract => true, :parse_options => false})
|
34
34
|
end
|
35
35
|
it "should have an array of default boolean args" do
|
36
|
-
@op.boolean_args.sort.should == ['-V', '-h', '-t', '-v']
|
36
|
+
@op.boolean_args.sort.should == ['--debug', '-V', '-h', '-t', '-v']
|
37
37
|
end
|
38
38
|
it "should split ARGV into flagged and unflagged arg arrays" do
|
39
39
|
@op.unflagged_args.sort.sort.should == ["five", "six"]
|