auser-poolparty 1.3.8 → 1.3.10

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 CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :minor: 3
3
- :patch: 8
3
+ :patch: 10
4
4
  :major: 1
data/bin/cloud-thrift CHANGED
@@ -22,9 +22,11 @@ Usage: #{$0} #{all_options_string}
22
22
  EOS
23
23
 
24
24
  short_desc "Start the cloud thrift interface"
25
- opt :port, "Start a port", :type => :integer, :default => 11223
25
+ opt :port, "Start on port", :type => :integer, :default => 11223
26
26
  opt :dir, "Pid directory", :type => :string, :default => "/tmp"
27
27
  opt :daemon, "Daemonize", :type => :bool, :default => true
28
+ # Query params
29
+ opt :host, "Query on host", :type => :string, :default => "localhost"
28
30
 
29
31
  run do |command|
30
32
 
@@ -33,12 +35,12 @@ EOS
33
35
  cmd = ARGV.shift
34
36
  cmd = ARGV.shift if cmd == "thrift"
35
37
 
36
- if %w(run start restart stop).include?(cmd)
38
+ if %w(run start restart stop query).include?(cmd)
37
39
  args = [cmd]
38
40
  args << ["--", command.argv] unless command.argv.empty?
39
41
  args.flatten!
40
42
  else
41
- puts "You must pass one of the following: #{%w(run start restart stop).join(", ")}"
43
+ puts "You must pass one of the following: #{%w(run start restart stop query).join(", ")}"
42
44
  args = ["--help"]
43
45
  end
44
46
 
@@ -55,22 +57,30 @@ EOS
55
57
  :monitor => true
56
58
  }.merge(command.opts)
57
59
 
58
- block = Proc.new do
59
- handler = CommandInterfaceHandler.new
60
- processor = CloudThrift::CommandInterface::Processor.new(handler)
61
- transport = Thrift::ServerSocket.new( options[:port] )
62
- transportFactory = Thrift::BufferedTransportFactory.new()
63
- server = Thrift::SimpleServer.new(processor, transport, transportFactory)
60
+ if cmd == "query"
61
+ require "command_query_handler"
64
62
 
65
- puts "Starting the cloud server..."
66
- server.serve()
67
- puts "done."
68
- end
69
-
70
- if command[:daemon]
71
- Daemons.run_proc("cloud-thrift", options, &block)
72
- else
73
- block.call
63
+ @loaded_clouds.map do |cld|
64
+ CommandQueryHandler.run_query(cld, ARGV.shift, ARGV, options)
65
+ end
66
+ else
67
+ block = Proc.new do
68
+ handler = CommandInterfaceHandler.new
69
+ processor = CloudThrift::CommandInterface::Processor.new(handler)
70
+ transport = Thrift::ServerSocket.new( options[:port] )
71
+ transportFactory = Thrift::BufferedTransportFactory.new()
72
+ server = Thrift::SimpleServer.new(processor, transport, transportFactory)
73
+
74
+ puts "Starting the cloud server..."
75
+ server.serve()
76
+ puts "done."
77
+ end
78
+
79
+ if command[:daemon]
80
+ Daemons.run_proc("cloud-thrift", options, &block)
81
+ else
82
+ block.call
83
+ end
74
84
  end
75
85
 
76
86
  end
data/config/jeweler.rb CHANGED
@@ -26,7 +26,9 @@ end
26
26
 
27
27
  s.files = (%w(Rakefile README.rdoc License.txt VERSION.yml) + Dir["{config,examples,lib,test,tasks,script,generators,bin,vendor}/**/*"])
28
28
 
29
- s.files.exclude 'vendor/erlang/*'
29
+ s.files += ["vendor/erlang/hermes/ebin/*.tar.gz"]
30
+
31
+ s.files.exclude 'vendor/erlang/hermes'
30
32
  s.files.exclude 'examples/thrift/**/*.beam'
31
33
  # s.files.exclude "**/*/erl_crash.dump"
32
34
 
@@ -15,6 +15,7 @@ require "poolparty_types"
15
15
  port = ARGV.pop || 11223
16
16
 
17
17
  transport = Thrift::BufferedTransport.new(Thrift::Socket.new('localhost', port))
18
+ # transport = Thrift::BufferedTransport.new(Thrift::Socket.new('192.168.2.31', port))
18
19
  # transport = Thrift::BufferedTransport.new(Thrift::Socket.new('vm', port))
19
20
  protocol = Thrift::BinaryProtocol.new(transport)
20
21
 
@@ -63,7 +63,7 @@ module CloudProviders
63
63
  return @aws_yml if @aws_yml && caching==true
64
64
  return {} unless File.exists?(filename)
65
65
  ddputs("Reading keys from file: #{filename}")
66
- @aws_yml = YAML::load( open(filename).read )
66
+ @aws_yml = YAML::load( open(filename).read ) || {}
67
67
  end
68
68
 
69
69
  default_options({
@@ -94,7 +94,7 @@ module CloudProviders
94
94
 
95
95
 
96
96
  def ec2(o={})
97
- @ec2 ||= Rightscale::Ec2.new(access_key, secret_access_key, o.merge(:logger => PoolParty::PoolPartyLog, :default_host => ec2_url))
97
+ @ec2 ||= Rightscale::Ec2.new(access_key, secret_access_key, o.merge(:logger => PoolParty::PoolPartyLog, :endpoint_url => ec2_url))
98
98
  end
99
99
 
100
100
  # Start a new instance with the given options
@@ -11,22 +11,27 @@ module PoolParty
11
11
  )
12
12
 
13
13
  def after_loaded
14
+ run_dependencies
15
+ build_rsync_directory
14
16
  add_unpack
15
17
  run_if_needed
16
18
  end
17
19
 
18
20
  def after_compile
19
- run_dependencies
20
- build_rsync_directory
21
21
  end
22
22
 
23
23
  def run_dependencies
24
- case cloud.platform
24
+ install_packages = case cloud.platform
25
25
  when false
26
26
  else
27
- has_package "erlang-nox"
28
- has_package "erlang-dev"
29
- has_package "rrdtool"
27
+ ["erlang-nox", "erlang-dev"]
28
+ end
29
+ has_package "rrdtool"
30
+ has_exec "install_erlang" do
31
+ command "echo ''"
32
+ install_packages.each do |pkg|
33
+ has_package pkg
34
+ end
30
35
  end
31
36
  end
32
37
 
@@ -43,18 +48,21 @@ module PoolParty
43
48
  etc_poolparty = cloud.tmp_path + "/etc/poolparty"
44
49
  FileUtils.mkdir_p(etc_poolparty)
45
50
  node_names = cloud.nodes.collect{|n| n.internal_ip || n.dns_name}.compact.collect{|n| "hermes@#{n}"}
46
- contents = node_names.collect{|n| %Q{"#{n}".}}.join("\n")
51
+ contents = node_names.collect{|n| %Q{'#{n}'.}}.join("\n")
47
52
  File.open(etc_poolparty + "/seeds.conf", "w") {|f| f.puts contents}
48
53
  end
49
54
 
50
55
  def add_unpack
51
- has_exec "cd /tmp/hermes && escript target_system install hermes-#{hermes_release_version} #{remote_hermes_deployed_dir}",
52
- :creates => "#{remote_hermes_deployed_dir}/releases/#{hermes_release_version}"
56
+ has_exec "install_hermes",
57
+ :command => "cd /tmp/hermes && escript target_system install hermes-#{hermes_release_version} #{remote_hermes_deployed_dir}",
58
+ :creates => "#{remote_hermes_deployed_dir}/releases/#{hermes_release_version}",
59
+ :requires => get_exec("install_erlang")
53
60
  end
54
61
 
55
62
  def run_if_needed
56
63
  has_exec "env GEN_CLUSTER_SEED_CONFIG=/etc/poolparty/seeds.conf #{remote_hermes_deployed_dir}/bin/erl -boot #{remote_hermes_deployed_dir}/releases/#{hermes_release_version}/start -noshell -detached",
57
- :not_if => "ps aux | grep -v grep | grep hermes | grep beam"
64
+ :not_if => "ps aux | grep -v grep | grep hermes | grep beam",
65
+ :requires => get_exec("install_hermes")
58
66
  end
59
67
 
60
68
  private
@@ -151,17 +151,16 @@ module PoolParty
151
151
  # + calls the resource define_resource_methods to define the resource methods
152
152
  # + sets up the log
153
153
  def self.before_file_load(filepath)
154
- $:.unshift(::File.dirname(filepath))
155
- Dir["#{ ::File.dirname(filepath)}/{plugins,lib}/**/*"].each do |plugin_path|
154
+ $:.unshift(File.dirname(filepath))
155
+ $:.unshift("#{File.dirname(filepath)}/lib")
156
+ $:.unshift("#{File.dirname(filepath)}/plugins")
157
+
158
+ Dir["#{File.dirname(filepath)}/lib/*"].each {|lib_path| require lib_path }
159
+ Dir["#{File.dirname(filepath)}/plugins/*"].each do |plugin_path|
156
160
  if File.directory?(plugin_path)
157
161
  $:.unshift(plugin_path)
158
-
159
- ["#{plugin_path}/#{File.basename(plugin_path)}", "#{plugin_path}/lib/#{File.basename(plugin_path)}"].each do |potential|
160
- require potential if File.exists?(potential)
161
- end
162
-
163
- elsif File.file?(plugin_path) && plugin_path.match(/.rb$/)
164
- require plugin_path
162
+ else
163
+ require plugin_path if File.file?(plugin_path) && plugin_path.match(/.rb$/)
165
164
  end
166
165
  end
167
166
  end
@@ -0,0 +1,19 @@
1
+ class CommandQueryHandler
2
+ def self.run_query(on_cloud, command, args, opts={})
3
+ port = opts[:port] || 11223
4
+ host = opts[:host] || "localhost"
5
+
6
+ transport = Thrift::BufferedTransport.new(Thrift::Socket.new(host, port))
7
+ protocol = Thrift::BinaryProtocol.new(transport)
8
+
9
+ client = CloudThrift::CommandInterface::Client.new(protocol)
10
+ transport.open()
11
+
12
+ cld = CloudThrift::CloudQuery.new
13
+ cld.name = on_cloud.name
14
+
15
+ ddputs("Running command: #{command} on #{cld.name} at #{host}:#{port}")
16
+ resp = client.run_command(cld, command, args)
17
+ resp.response
18
+ end
19
+ end
@@ -0,0 +1,11 @@
1
+ require "#{File.dirname(__FILE__)}/../../test_helper"
2
+ $:.unshift("#{File.dirname(__FILE__)}/../../../lib/proto")
3
+ require "command_query_handler"
4
+
5
+ class CommandQueryHandlerTest < Test::Unit::TestCase
6
+
7
+ def test_has_run_query_command
8
+ assert CommandQueryHandler.respond_to?(:run_query)
9
+ end
10
+
11
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: auser-poolparty
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.8
4
+ version: 1.3.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ari Lerner
@@ -11,7 +11,7 @@ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
13
 
14
- date: 2009-09-02 00:00:00 -07:00
14
+ date: 2009-09-03 00:00:00 -07:00
15
15
  default_executable:
16
16
  dependencies: []
17
17
 
@@ -208,6 +208,7 @@ files:
208
208
  - lib/poolparty/resources/user.rb
209
209
  - lib/poolparty/resources/variable.rb
210
210
  - lib/proto/command_interface_handler.rb
211
+ - lib/proto/command_query_handler.rb
211
212
  - lib/proto/gen-erl/commandInterface_thrift.erl
212
213
  - lib/proto/gen-erl/commandInterface_thrift.hrl
213
214
  - lib/proto/gen-erl/poolparty_constants.hrl
@@ -335,6 +336,7 @@ files:
335
336
  - test/lib/poolparty/resources/service_test.rb
336
337
  - test/lib/poolparty/resources/user_test.rb
337
338
  - test/lib/poolparty/resources/variable_test.rb
339
+ - test/lib/proto/command_query_handler_test.rb
338
340
  - test/lib/provision/base_test.rb
339
341
  - test/lib/provision/bootstrapper_test.rb
340
342
  - test/test_helper.rb
@@ -1112,7 +1114,6 @@ files:
1112
1114
  - vendor/gems/trollop/www/index.html
1113
1115
  has_rdoc: false
1114
1116
  homepage: http://poolpartyrb.com
1115
- licenses:
1116
1117
  post_install_message:
1117
1118
  rdoc_options:
1118
1119
  - --quiet
@@ -1138,7 +1139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1138
1139
  requirements: []
1139
1140
 
1140
1141
  rubyforge_project:
1141
- rubygems_version: 1.3.5
1142
+ rubygems_version: 1.2.0
1142
1143
  signing_key:
1143
1144
  specification_version: 3
1144
1145
  summary: Self-healing, auto-scaling system administration, provisioning and maintaining tool that makes cloud computing easy and fun