auser-poolparty 1.3.7 → 1.3.8

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :minor: 3
3
- :patch: 7
3
+ :patch: 8
4
4
  :major: 1
@@ -25,13 +25,13 @@ require "#{File.dirname(__FILE__)}/ec2_instance"
25
25
  module CloudProviders
26
26
  class Ec2 < CloudProvider
27
27
 
28
- # Set the aws keys from the environment, or load from /etc/poolparty/aws.yml if the environment variable is not set
28
+ # Set the aws keys from the environment, or load from /etc/poolparty/env.yml if the environment variable is not set
29
29
  def self.default_access_key
30
30
  ENV['EC2_ACCESS_KEY'] || load_keys_from_file[:access_key]
31
31
  end
32
32
 
33
33
  def self.default_secret_access_key
34
- ENV['EC2_SECRET_KEY'] || load_keys_from_file[:access_key]
34
+ ENV['EC2_SECRET_KEY'] || load_keys_from_file[:secret_access_key]
35
35
  end
36
36
 
37
37
  def self.default_private_key
@@ -59,9 +59,10 @@ module CloudProviders
59
59
  end
60
60
 
61
61
  # Load the yaml file containing keys. If the file does not exist, return an empty hash
62
- def self.load_keys_from_file(filename='/etc/poolparty/ec2/aws.yml', caching=true)
62
+ def self.load_keys_from_file(filename='/etc/poolparty/env.yml', caching=true)
63
63
  return @aws_yml if @aws_yml && caching==true
64
64
  return {} unless File.exists?(filename)
65
+ ddputs("Reading keys from file: #{filename}")
65
66
  @aws_yml = YAML::load( open(filename).read )
66
67
  end
67
68
 
@@ -93,7 +94,7 @@ module CloudProviders
93
94
 
94
95
 
95
96
  def ec2(o={})
96
- @ec2 ||= Rightscale::Ec2.new(access_key, secret_access_key, o.merge(:logger => PoolParty::PoolPartyLog))
97
+ @ec2 ||= Rightscale::Ec2.new(access_key, secret_access_key, o.merge(:logger => PoolParty::PoolPartyLog, :default_host => ec2_url))
97
98
  end
98
99
 
99
100
  # Start a new instance with the given options
@@ -153,6 +154,14 @@ module CloudProviders
153
154
  ].include?(ec2_url)
154
155
  end
155
156
 
157
+ # Callbacks
158
+ def before_compile(cld)
159
+ end
160
+
161
+ def after_compile(cld)
162
+ save_aws_env_to_yml(cld.tmp_path/"etc"/"poolparty"/"env.yml")
163
+ end
164
+
156
165
  # Read yaml file and use it to set environment variables and local variables.
157
166
  def set_aws_env_from_yml_file(filename='/etc/poolparty/env.yml')
158
167
  aws = self.class.load_keys_from_file(filename)
@@ -161,8 +170,8 @@ module CloudProviders
161
170
  end
162
171
 
163
172
  # Save aws keys and env variables to a yaml file
164
- def save_aws_env_to_yml(filename='/etc/poolparty/aws.yml')
165
- File.open(filename, 'w') {|f| f<<YAML::dump(aws_hash) }
173
+ def save_aws_env_to_yml(filename='/etc/poolparty/env.yml')
174
+ File.open(filename, 'w') {|f| f<<YAML::dump(aws_hash(dsl_options, "/etc/poolparty/ec2")) } rescue nil
166
175
  end
167
176
 
168
177
  # Return a hash of the aws keys and environment variables
@@ -64,7 +64,7 @@ module CloudProviders
64
64
  FileUtils.mkdir_p(cloud.tmp_path/ec2_dir) unless File.directory?(cloud.tmp_path/ec2_dir)
65
65
  run ["mkdir -p #{ec2_dir}"]
66
66
  # Save a yaml file of aws varibles and send to the instance
67
- File.open(cloud.tmp_path/ec2_dir/'aws.yml', 'w') do |f|
67
+ File.open(cloud.tmp_path/"etc"/"poolparty"/'env.yml', 'w') do |f|
68
68
  f<<YAML::dump(cloud_provider.aws_hash(ec2_dir)) #TODO: don't save sensitive info in /tmp
69
69
  end
70
70
  # We scp these files directly to the instance so to reduce the risk of accidentally leaving them in an insecure location
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.7
4
+ version: 1.3.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ari Lerner
@@ -1112,6 +1112,7 @@ files:
1112
1112
  - vendor/gems/trollop/www/index.html
1113
1113
  has_rdoc: false
1114
1114
  homepage: http://poolpartyrb.com
1115
+ licenses:
1115
1116
  post_install_message:
1116
1117
  rdoc_options:
1117
1118
  - --quiet
@@ -1137,7 +1138,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1137
1138
  requirements: []
1138
1139
 
1139
1140
  rubyforge_project:
1140
- rubygems_version: 1.2.0
1141
+ rubygems_version: 1.3.5
1141
1142
  signing_key:
1142
1143
  specification_version: 3
1143
1144
  summary: Self-healing, auto-scaling system administration, provisioning and maintaining tool that makes cloud computing easy and fun