auser-poolparty 1.3.7 → 1.3.8
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/lib/cloud_providers/ec2/ec2.rb +15 -6
- data/lib/cloud_providers/ec2/ec2_instance.rb +1 -1
- metadata +3 -2
data/VERSION.yml
CHANGED
@@ -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/
|
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[:
|
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/
|
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/
|
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/
|
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.
|
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.
|
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
|