auser-poolparty 1.2.4 → 1.2.7
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/VERSION.yml +1 -1
- data/bin/cloud +8 -1
- data/bin/cloud-contract +1 -1
- data/bin/cloud-provision +0 -1
- data/bin/server-cloud-elections +9 -9
- data/bin/server-list-active +10 -17
- data/bin/server-manage-election +4 -5
- data/examples/basic.rb +5 -4
- data/examples/fairchild.rb +1 -1
- data/lib/poolparty.rb +1 -1
- data/lib/poolparty/core/hash.rb +10 -2
- data/lib/poolparty/helpers/optioner.rb +5 -5
- data/lib/poolparty/lite.rb +5 -2
- data/lib/poolparty/modules/cloud_resourcer.rb +12 -5
- data/lib/poolparty/modules/pretty_printer.rb +1 -1
- data/lib/poolparty/monitors/monitor_rack.rb +2 -2
- data/lib/poolparty/monitors/monitors/{time_monitor.rb → clock_monitor.rb} +2 -2
- data/lib/poolparty/monitors/monitors/neighborhood_monitor.rb +8 -5
- data/lib/poolparty/monitors/monitors/stats_monitor.rb +45 -29
- data/lib/poolparty/net/remoter/connections.rb +0 -1
- data/lib/poolparty/net/remoter/interactive.rb +6 -6
- data/lib/poolparty/net/remoter_base.rb +10 -2
- data/lib/poolparty/net/remoter_bases/ec2/ec2.rb +14 -6
- data/lib/poolparty/net/remoter_bases/metavirt/metavirt.rb +1 -1
- data/lib/poolparty/plugins/apache2/apache.rb +16 -8
- data/lib/poolparty/poolparty/cloud.rb +22 -5
- data/lib/poolparty/poolparty/default.rb +21 -15
- data/lib/poolparty/poolparty/key.rb +1 -1
- data/lib/poolparty/poolparty/neighborhoods.rb +15 -4
- data/lib/poolparty/poolparty/pool.rb +1 -1
- data/lib/poolparty/poolparty/resource.rb +1 -0
- data/lib/poolparty/provision/boot_strapper.rb +10 -4
- data/lib/poolparty/provision/dr_configure.rb +9 -9
- data/lib/poolparty/schema.rb +5 -6
- data/lib/poolparty/templates/monitor.ru +1 -0
- data/spec/poolparty/core/ordered_hash_spec.rb +7 -7
- data/spec/poolparty/net/remote_instance_spec.rb +1 -1
- data/spec/poolparty/poolparty/cloud_spec.rb +18 -0
- data/spec/poolparty/poolparty/example_spec.rb +29 -9
- data/spec/poolparty/poolparty/key_spec.rb +1 -1
- data/spec/poolparty/poolparty/neighborhoods_spec.rb +1 -1
- data/tasks/poolparty.rake +2 -0
- data/vendor/gems/dslify/VERSION.yml +4 -0
- data/vendor/gems/dslify/dslify.gemspec +29 -0
- data/vendor/gems/dslify/lib/dslify.rb +1 -1
- data/vendor/gems/dslify/test/dslify_test.rb +82 -13
- data/vendor/gems/git-style-binaries/VERSION.yml +1 -1
- data/vendor/gems/git-style-binaries/doc/poolparty-binaries.screenplay +389 -20
- data/vendor/gems/git-style-binaries/git-style-binaries.gemspec +2 -2
- data/vendor/gems/git-style-binaries/lib/git-style-binary/helpers/name_resolver.rb +2 -2
- data/vendor/gems/git-style-binaries/lib/git-style-binary/parser.rb +2 -2
- metadata +5 -3
@@ -2,18 +2,18 @@ module PoolParty
|
|
2
2
|
module Remote
|
3
3
|
|
4
4
|
# Select a list of instances based on their status
|
5
|
-
def nodes(hsh={})
|
6
|
-
list_of_instances.select_with_hash(hsh)
|
5
|
+
def nodes(hsh={}, with_neighborhood_default=true)
|
6
|
+
list_of_instances(with_neighborhood_default).select_with_hash(hsh)
|
7
7
|
end
|
8
8
|
|
9
9
|
# Select the list of instances, either based on the neighborhoods
|
10
10
|
# loaded from /etc/poolparty/neighborhood.json
|
11
11
|
# or by the remote_base on keypair
|
12
|
-
def list_of_instances
|
12
|
+
def list_of_instances(with_neighborhood_default=true)
|
13
13
|
return @list_of_instances if @list_of_instances
|
14
14
|
@containing_cloud = self
|
15
|
-
n = Neighborhoods.load_default
|
16
|
-
@list_of_instances = (n.instances.empty? ? _list_of_instances : n.instances)
|
15
|
+
n = with_neighborhood_default ? Neighborhoods.load_default : nil
|
16
|
+
@list_of_instances = ((n.nil? || n.instances.empty?) ? _list_of_instances : n.instances)
|
17
17
|
end
|
18
18
|
|
19
19
|
private
|
@@ -24,7 +24,7 @@ module PoolParty
|
|
24
24
|
|
25
25
|
# List the instances for the current key pair, regardless of their states
|
26
26
|
# If no keypair is passed, select them all
|
27
|
-
def _list_of_instances(select={})
|
27
|
+
def _list_of_instances(select={})
|
28
28
|
@describe_instances ||= remote_base.describe_instances(dsl_options).select_with_hash(select)
|
29
29
|
end
|
30
30
|
|
@@ -16,7 +16,6 @@
|
|
16
16
|
register_remote_base :remote_base_name
|
17
17
|
|
18
18
|
=end
|
19
|
-
require "#{::File.dirname(__FILE__)}/../modules/pinger.rb" #FIXME should not need this here
|
20
19
|
module PoolParty
|
21
20
|
|
22
21
|
module Remote
|
@@ -29,7 +28,8 @@ module PoolParty
|
|
29
28
|
|
30
29
|
dsl_methods :cloud, # The cloud this remoter_base is a part of
|
31
30
|
:keypair,
|
32
|
-
:image_id
|
31
|
+
:image_id,
|
32
|
+
:keypair_name
|
33
33
|
|
34
34
|
def initialize(opts={}, &block)
|
35
35
|
opts.each {|k,v| opts[k] = v.call if v.respond_to?(:call) }
|
@@ -187,6 +187,14 @@ module PoolParty
|
|
187
187
|
def before_shutdown
|
188
188
|
end
|
189
189
|
|
190
|
+
def to_s
|
191
|
+
self.class.name
|
192
|
+
end
|
193
|
+
|
194
|
+
def to_hash
|
195
|
+
dsl_options
|
196
|
+
end
|
197
|
+
|
190
198
|
end
|
191
199
|
|
192
200
|
end
|
@@ -47,8 +47,13 @@ module PoolParty
|
|
47
47
|
:availability_zone => "us-east-1a",
|
48
48
|
:access_key => ENV['AWS_ACCESS_KEY'],
|
49
49
|
:secret_access_key => ENV['AWS_SECRET_ACCESS_KEY'],
|
50
|
-
:security_group => ["default"]
|
50
|
+
:security_group => ["default"],
|
51
|
+
:keypair_name =>nil
|
51
52
|
})
|
53
|
+
|
54
|
+
def ami
|
55
|
+
image_id
|
56
|
+
end
|
52
57
|
|
53
58
|
# Requires a hash of options
|
54
59
|
def self.launch_new_instance!(o)
|
@@ -58,8 +63,9 @@ module PoolParty
|
|
58
63
|
# TODO: Fix the key_name issue
|
59
64
|
# Start a new instance with the given options
|
60
65
|
def launch_new_instance!(o={})
|
66
|
+
set_vars_from_options o
|
61
67
|
raise "You must pass a keypair to launch an instance, or else you will not be able to login. options = #{o.inspect}" if !keypair
|
62
|
-
o.merge!( dsl_options
|
68
|
+
o.merge!( dsl_options.merge(:key_name=>keypair_name) )
|
63
69
|
instance = ec2(o).run_instances(o)
|
64
70
|
begin
|
65
71
|
h = EC2ResponseObject.get_hash_from_response(instance.instancesSet.item.first)
|
@@ -83,7 +89,7 @@ module PoolParty
|
|
83
89
|
def describe_instances(o={})
|
84
90
|
id = 0
|
85
91
|
set_vars_from_options(dsl_options.merge(o))
|
86
|
-
get_instances_description(dsl_options).each_with_index do |h,i|
|
92
|
+
get_instances_description(dsl_options).each_with_index do |h,i|
|
87
93
|
if h[:status] == "running"
|
88
94
|
inst_name = id == 0 ? "master" : "node#{id}"
|
89
95
|
id += 1
|
@@ -106,8 +112,8 @@ module PoolParty
|
|
106
112
|
|
107
113
|
# return or create a new base EC2 connection object that will actually connect to ec2
|
108
114
|
def ec2(o={})
|
109
|
-
@ec2 ||= EC2::Base.new( :access_key_id => get_access_key,
|
110
|
-
:secret_access_key => get_secret_access_key
|
115
|
+
@ec2 ||= EC2::Base.new( :access_key_id => o[:access_key] || get_access_key,
|
116
|
+
:secret_access_key => o[:secret_access_key] || get_secret_access_key
|
111
117
|
)
|
112
118
|
end
|
113
119
|
def self.ec2(o)
|
@@ -119,8 +125,10 @@ module PoolParty
|
|
119
125
|
# Get the ec2 description for the response in a hash format
|
120
126
|
def get_instances_description(o={})
|
121
127
|
#TODO: only use keypair.full_filepath
|
128
|
+
set_vars_from_options dsl_options.merge(o)
|
122
129
|
key_hash = {:keypair => self.keypair_name}
|
123
|
-
EC2ResponseObject.get_descriptions(ec2(dsl_options).describe_instances)
|
130
|
+
out = EC2ResponseObject.get_descriptions(ec2(dsl_options).describe_instances)
|
131
|
+
out = keypair_name ? out.select_with_hash(key_hash) : out
|
124
132
|
end
|
125
133
|
def get_descriptions(o={})
|
126
134
|
self.class.get_descriptions(o)
|
@@ -26,6 +26,10 @@ default host.
|
|
26
26
|
def before_load(o={}, &block)
|
27
27
|
install
|
28
28
|
end
|
29
|
+
|
30
|
+
def www_user(www_user_name='www-data')
|
31
|
+
www_user_name
|
32
|
+
end
|
29
33
|
|
30
34
|
def install
|
31
35
|
installed_as_worker
|
@@ -224,20 +228,21 @@ default host.
|
|
224
228
|
def virtual_host_entry(file)
|
225
229
|
@virtual_host_entry = true
|
226
230
|
if ::File.file?(file)
|
227
|
-
has_file(
|
231
|
+
has_file(dsl_options.merge({:name => "/etc/apache2/sites-available/#{name}",
|
228
232
|
:template => file,
|
229
233
|
:requires => get_package("apache2")}))
|
230
234
|
else
|
231
|
-
has_file(
|
235
|
+
has_file(dsl_options.merge({:content => file,
|
232
236
|
:name => "/etc/apache2/sites-available/#{name}",
|
233
237
|
:requires => get_package("apache2")}))
|
234
238
|
end
|
235
239
|
end
|
240
|
+
|
236
241
|
|
237
242
|
def loaded(opts={}, parent=self)
|
238
|
-
has_directory(:name => "/var/www")
|
239
|
-
has_directory(:name => "/var/www/#{name}")
|
240
|
-
has_directory(:name => "/var/www/#{name}/logs", :owner =>
|
243
|
+
has_directory(:name => "/var/www", :owner => www_user, :mode=>'0744')
|
244
|
+
has_directory(:name => "/var/www/#{name}", :owner => www_user, :mode=>'0744')
|
245
|
+
has_directory(:name => "/var/www/#{name}/logs", :owner => www_user, :mode=>'0744')
|
241
246
|
|
242
247
|
has_variable(:name => "sitename", :value => "#{name}")
|
243
248
|
|
@@ -264,8 +269,11 @@ eof
|
|
264
269
|
virtual_resource(:passengersite) do # {{{
|
265
270
|
|
266
271
|
default_options(
|
267
|
-
:dir
|
268
|
-
:appended_path
|
272
|
+
:dir => "/var/www",
|
273
|
+
:appended_path => nil,
|
274
|
+
:owner => 'www-data',
|
275
|
+
:mode =>'0744',
|
276
|
+
:enviornment => 'production'
|
269
277
|
)
|
270
278
|
|
271
279
|
def loaded(opts={}, prnt=nil)
|
@@ -278,7 +286,7 @@ eof
|
|
278
286
|
<VirtualHost *:#{port}>
|
279
287
|
ServerName #{name}
|
280
288
|
DocumentRoot #{site_directory}/public
|
281
|
-
RailsEnv
|
289
|
+
RailsEnv #{enviornment}
|
282
290
|
ErrorLog #{site_directory}/log/error_log
|
283
291
|
CustomLog #{site_directory}/log/access_log common
|
284
292
|
</VirtualHost>
|
@@ -16,7 +16,7 @@ module PoolParty
|
|
16
16
|
# TODO: Deprecate
|
17
17
|
def with_cloud(cl, opts={}, &block)
|
18
18
|
raise CloudNotFoundException.new("Cloud not found") unless cl
|
19
|
-
cl.
|
19
|
+
cl.dsl_options.merge!(opts) if opts
|
20
20
|
cl.run_in_context &block if block
|
21
21
|
end
|
22
22
|
|
@@ -130,9 +130,9 @@ module PoolParty
|
|
130
130
|
|
131
131
|
# setup defaults for the cloud
|
132
132
|
def setup_defaults
|
133
|
-
set_vars_from_options(:keypair_name => key.basename,
|
134
|
-
|
135
|
-
dsl_options[:rules] = {:expand => dsl_options[:expand_when],
|
133
|
+
set_vars_from_options(:keypair_name => key.basename, :keypair_path => key.full_filepath) rescue nil
|
134
|
+
|
135
|
+
dsl_options[:rules] = {:expand => "#{dsl_options[:expand_when]}",
|
136
136
|
:contract => dsl_options[:contract_when]}
|
137
137
|
|
138
138
|
set_dependency_resolver 'chef'
|
@@ -257,7 +257,24 @@ module PoolParty
|
|
257
257
|
end
|
258
258
|
|
259
259
|
def to_json
|
260
|
-
to_properties_hash.to_json
|
260
|
+
to_properties_hash.reject{|k,v| k == :remote_base }.to_json
|
261
|
+
end
|
262
|
+
|
263
|
+
# TODO: test
|
264
|
+
# ruby -rrubygems -e 'require "poolparty";puts Cloud.load_from_json(open("/etc/poolparty/clouds.json").read).minimum_instances'
|
265
|
+
def self.load_from_json(str)
|
266
|
+
parsed = JSON.parse(str).each {|k,v| dsl_options[k.to_sym] = v}
|
267
|
+
opts= parsed.options
|
268
|
+
opts["keypair"] = opts["keypair_path"] = opts["keypair_name"]
|
269
|
+
# cld.remoter_base = PoolParty::Remote.module_eval( schema.options.remoter_base.camelcase )
|
270
|
+
# opts.remoter_base_class = PoolParty::Remote.module_eval( opts.remoter_base.camelcase )
|
271
|
+
# opts.remoter_base_class.new opts.remote_base
|
272
|
+
opts["dependency_resolver"] = options.dependency_resolver.send(:new, opts)
|
273
|
+
cld = Cloud.new opts.cloud_name.to_sym
|
274
|
+
cld.dsl_options.merge opts
|
275
|
+
cld.using opts.remoter_base.to_sym
|
276
|
+
cld.dsl_options.symbolize_keys!
|
277
|
+
cld
|
261
278
|
end
|
262
279
|
|
263
280
|
def tmp_path
|
@@ -17,6 +17,7 @@ module PoolParty
|
|
17
17
|
:minimum_instances => 2,
|
18
18
|
:maximum_instances => 5,
|
19
19
|
:user => "root", # This should change here
|
20
|
+
:keypair_name => nil,
|
20
21
|
:base_keypair_path => "#{ENV["HOME"]}/.ec2",
|
21
22
|
:base_ssh_path => "#{ENV["HOME"]}/.ssh",
|
22
23
|
:tmp_path => "/tmp/poolparty",
|
@@ -55,18 +56,18 @@ module PoolParty
|
|
55
56
|
dsl_options.include?(m) ? dsl_options[m] : super
|
56
57
|
end
|
57
58
|
# # Get the access_key
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
59
|
+
def access_key
|
60
|
+
@access_key ||= load_access_keys_from_environment_var || load_keys_from_file[:access_key]
|
61
|
+
end
|
62
|
+
def load_access_keys_from_environment_var
|
63
|
+
[ ENV["AWS_ACCESS_KEY"], ENV["AWS_ACCESS_KEY_ID"]].reject {|a| a.nil? }.first
|
64
|
+
end
|
65
|
+
def secret_access_key
|
66
|
+
@secret_access_key ||= load_secret_access_keys_from_environment_var || load_keys_from_file[:secret_access_key]
|
67
|
+
end
|
68
|
+
def load_secret_access_keys_from_environment_var
|
69
|
+
[ ENV["AWS_SECRET_ACCESS_KEY"] ].reject {|a| a.nil? }.first
|
70
|
+
end
|
70
71
|
def read_keyfile
|
71
72
|
open(get_working_key_file_locations).read
|
72
73
|
end
|
@@ -75,11 +76,14 @@ module PoolParty
|
|
75
76
|
end
|
76
77
|
# Store the keys in a yaml format to give the master access
|
77
78
|
# So that the master has access to the files
|
78
|
-
def store_keys_in_file
|
79
|
+
def store_keys_in_file(f=nil)
|
79
80
|
unless access_key.nil? || secret_access_key.nil?
|
80
|
-
write_to_file(
|
81
|
+
write_to_file( (f ? f : key_file_locations.first), keys_in_yaml)
|
81
82
|
end
|
82
83
|
end
|
84
|
+
def keys_in_yaml
|
85
|
+
YAML::dump({:access_key => access_key, :secret_access_key => secret_access_key})
|
86
|
+
end
|
83
87
|
def store_keys_in_file_for(obj=nil)
|
84
88
|
if obj
|
85
89
|
@access_key = obj.access_key
|
@@ -101,7 +105,9 @@ module PoolParty
|
|
101
105
|
[
|
102
106
|
".ppkeys",
|
103
107
|
"#{Default.base_config_directory}/.ppkeys",
|
104
|
-
"#{Default.storage_directory}/ppkeys",
|
108
|
+
"#{Default.storage_directory}/ppkeys",
|
109
|
+
"#{ENV["HOME"]}/.ssh/ppkeys",
|
110
|
+
"#{ENV["HOME"]}/.ssh/.ppkeys",
|
105
111
|
"~/.ppkeys",
|
106
112
|
"ppkeys"
|
107
113
|
]
|
@@ -20,7 +20,7 @@ module PoolParty
|
|
20
20
|
when Array
|
21
21
|
{:instances => data.map {|entry| disect(entry) }}
|
22
22
|
when String
|
23
|
-
|
23
|
+
JSON.parse(data)#.map "#{inst["instance_id"]}\t#{inst["ip"]}"}}
|
24
24
|
when Hash
|
25
25
|
data
|
26
26
|
end
|
@@ -30,7 +30,7 @@ module PoolParty
|
|
30
30
|
|
31
31
|
# Get the known instances from the neighborhood.json file on the server
|
32
32
|
def instances
|
33
|
-
@instances ||= @schema.to_hash[:instances] rescue @schema.instances.collect {|line| disect(line) }
|
33
|
+
@instances ||= @schema.to_hash[:instances] #rescue @schema.instances.collect {|line| disect(line) }
|
34
34
|
end
|
35
35
|
|
36
36
|
# Returns empty if the neighborhood has no instances
|
@@ -92,9 +92,20 @@ module PoolParty
|
|
92
92
|
new( open("/etc/poolparty/neighborhood.json").read )
|
93
93
|
elsif ping_port("127.0.0.1", Default.butterfly_port, 1)# butterfly responding?
|
94
94
|
require "open-uri"
|
95
|
-
|
95
|
+
begin
|
96
|
+
timeout(2) do
|
97
|
+
new( open("http://127.0.0.1:8642/neighborhood").read )
|
98
|
+
end
|
99
|
+
rescue TimeoutError => e
|
100
|
+
require "#{::File.dirname(__FILE__)}/../../poolparty"
|
101
|
+
cld = ::PoolParty::Cloud::Cloud.load_from_json(open("/etc/poolparty/clouds.json").read)
|
102
|
+
nodes = cld.nodes({:status => "running"}, false)
|
103
|
+
data = nodes.map {|hsh| hsh.reject {|k,v| v.nil? }}.map {|a| a.merge(:launching_time => a[:launching_time].to_s) }
|
104
|
+
# ::File.open("/etc/poolparty/neighborhood.json", "w") {|f| f << "{\"instances\":#{data.to_json}}" }
|
105
|
+
new(data)
|
106
|
+
end
|
96
107
|
else
|
97
|
-
new("[]")
|
108
|
+
new("{\"instances\":[]}")
|
98
109
|
end
|
99
110
|
end
|
100
111
|
|
@@ -28,6 +28,7 @@ module PoolParty
|
|
28
28
|
grempe-amazon-ec2
|
29
29
|
ohai
|
30
30
|
chef
|
31
|
+
ruby-openid
|
31
32
|
adamwiggins-rest-client
|
32
33
|
rack
|
33
34
|
thin
|
@@ -83,6 +84,8 @@ module PoolParty
|
|
83
84
|
def pack_the_dependencies
|
84
85
|
# Add the keypair to the instance... shudder
|
85
86
|
::Suitcase::Zipper.add(keypair, "keys")
|
87
|
+
::Suitcase::Zipper.add_content_as(Default.keys_in_yaml, "ppkeys", "keys")
|
88
|
+
|
86
89
|
edge_pp_gem = Dir["#{Default.vendor_path}/../pkg/*poolparty*gem"].pop
|
87
90
|
# Use the locally built poolparty gem if it is availabl
|
88
91
|
if edge_pp_gem
|
@@ -108,9 +111,10 @@ module PoolParty
|
|
108
111
|
::Suitcase::Zipper.add("#{::File.join(File.dirname(__FILE__), '..', 'templates', 'gemrc_template' )}", "etc/poolparty")
|
109
112
|
|
110
113
|
instances = @cloud.nodes(:status => "running") + [@cloud.started_instance]
|
111
|
-
::Suitcase::Zipper.add_content_as(
|
112
|
-
|
113
|
-
|
114
|
+
# ::Suitcase::Zipper.add_content_as(
|
115
|
+
# instances.flatten.compact.to_json,
|
116
|
+
# "neighborhood.json", "/etc/poolparty"
|
117
|
+
# )
|
114
118
|
|
115
119
|
::Suitcase::Zipper.build_dir!("#{cloud.tmp_path}/dependencies")
|
116
120
|
|
@@ -140,6 +144,7 @@ module PoolParty
|
|
140
144
|
"ln -sfv /usr/bin/gem1.8 /usr/bin/gem", #TODO: check if this is really needed
|
141
145
|
"cd ../ && rm -rf rubygems-1.3.1*",
|
142
146
|
"gem source --add http://gems.github.com",
|
147
|
+
"gem sources -a http://gems.opscode.com",
|
143
148
|
"cd /var/poolparty/dependencies/gems/",
|
144
149
|
"gem install --no-rdoc --no-ri *.gem",
|
145
150
|
"cd /var/poolparty/dependencies",
|
@@ -150,8 +155,9 @@ module PoolParty
|
|
150
155
|
"chmod 600 /root/.ssh/#{keypair_name}",
|
151
156
|
# "god -c /etc/poolparty/monitor.god",
|
152
157
|
"mkdir -p /var/log/poolparty/",
|
158
|
+
"echo '-- Starting monitor_rack --'",
|
153
159
|
"thin -R /etc/poolparty/monitor.ru -p 8642 --pid /var/run/stats_monitor.pid --daemon -l /var/log/poolparty/monitor.log start 2>/dev/null",
|
154
|
-
"tail /var/log/poolparty/monitor.log",
|
160
|
+
"tail -n 20 /var/log/poolparty/monitor.log",
|
155
161
|
'echo "bootstrap" >> /var/poolparty/POOLPARTY.PROGRESS']
|
156
162
|
commands << self.class.class_commands unless self.class.class_commands.empty?
|
157
163
|
end
|
@@ -22,13 +22,13 @@ module PoolParty
|
|
22
22
|
# In case the method is being called on ourself, let's check the
|
23
23
|
# defaults hash to see if it's available there
|
24
24
|
def method_missing(m,*a,&block)
|
25
|
-
if self.class.defaults.has_key?(m)
|
26
|
-
|
27
|
-
elsif @cloud
|
25
|
+
# if self.class.defaults.has_key?(m)
|
26
|
+
# self.class.defaults[m]
|
27
|
+
# elsif @cloud
|
28
28
|
@cloud.send m, *a, &block
|
29
|
-
else
|
30
|
-
super
|
31
|
-
end
|
29
|
+
# else
|
30
|
+
# super
|
31
|
+
# end
|
32
32
|
end
|
33
33
|
|
34
34
|
attr_reader :cloud, :keypair, :run_count, :cloud_name
|
@@ -36,7 +36,7 @@ module PoolParty
|
|
36
36
|
def initialize(host, opts={}, &block)
|
37
37
|
self.class.defaults.merge(opts).to_instance_variables(self)
|
38
38
|
@target_host = host
|
39
|
-
@configurator = "::PoolParty::Provision::#{dependency_resolver.
|
39
|
+
@configurator = "::PoolParty::Provision::#{dependency_resolver.camelcase}".constantize
|
40
40
|
@cloud = opts[:cloud]
|
41
41
|
@cloud_name = @cloud.name
|
42
42
|
@keypair = @cloud.keypair
|
@@ -54,7 +54,7 @@ module PoolParty
|
|
54
54
|
::FileUtils.mkdir_p "#{cloud.tmp_path}/dr_configure" unless ::File.directory?("#{cloud.tmp_path}/dr_configure")
|
55
55
|
::File.cp $pool_specfile, "#{cloud.tmp_path}/dr_configure/clouds.rb"
|
56
56
|
::File.open "#{cloud.tmp_path}/dr_configure/clouds.json", "w" do |f|
|
57
|
-
f << cloud.
|
57
|
+
f << cloud.to_json
|
58
58
|
end
|
59
59
|
|
60
60
|
setup_configurator
|
@@ -99,7 +99,7 @@ module PoolParty
|
|
99
99
|
'chmod 644 /var/poolparty/dr_configure/clouds.rb',
|
100
100
|
'cp /var/poolparty/dr_configure/clouds.json /etc/poolparty',
|
101
101
|
'cp /var/poolparty/dr_configure/clouds.rb /etc/poolparty',
|
102
|
-
|
102
|
+
'server-manage-election', #ensures that the monitor gets some data
|
103
103
|
'echo "configure" >> /var/poolparty/POOLPARTY.PROGRESS'
|
104
104
|
]
|
105
105
|
commands << self.class.class_commands unless self.class.class_commands.empty?
|