zzdeploy 0.1.10 → 0.1.11

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.
@@ -16,6 +16,8 @@ module Commands
16
16
  @required_options ||= Set.new [
17
17
  :role,
18
18
  :group,
19
+ :config_access_key,
20
+ :config_secret_key,
19
21
  ]
20
22
  end
21
23
 
@@ -50,6 +52,14 @@ module Commands
50
52
  opts.on('-p', "--print path", "The directory into which we output the data as a file per host.") do |v|
51
53
  options[:result_path] = v
52
54
  end
55
+
56
+ opts.on("--config_akey AmazonAccessKey", "Required - Amazon access key to store on server.") do |v|
57
+ options[:config_access_key] = v
58
+ end
59
+
60
+ opts.on("--config_skey AmazonSecretKey", "Required - Amazon secret key to store on server.") do |v|
61
+ options[:config_secret_key] = v
62
+ end
53
63
  end
54
64
 
55
65
 
@@ -156,6 +166,12 @@ module Commands
156
166
  # do the initial upload step for the chef recipes by fetching the proper tag on the remote machine
157
167
  ec2.create_tags(inst_id, {:state => 'ready' })
158
168
 
169
+ remote_cmd = "#{ssh_cmd} #{make_amazon_config_command(options[:config_access_key], options[:config_secret_key])}"
170
+ result = ZZSharedLib::CL.do_cmd_result remote_cmd
171
+ if result != 0
172
+ raise "The instance was created but we were unable to upload amazon keys."
173
+ end
174
+
159
175
  git_cmd = ChefUpload.get_upload_command(recipes_deploy_tag)
160
176
  remote_cmd = "#{ssh_cmd} \"#{git_cmd}\""
161
177
  result = ZZSharedLib::CL.do_cmd_result remote_cmd
@@ -183,5 +199,22 @@ module Commands
183
199
  end
184
200
 
185
201
  end
202
+
203
+ # build the command to create the amazon.json file containing the keys passed
204
+ def make_amazon_config_command(akey, skey)
205
+ file = "/var/chef/test.json"
206
+ cmd =
207
+ "'sudo rm -f #{file}
208
+ (
209
+ cat <<'EOP'
210
+ {
211
+ \"aws_access_key_id\": \"#{akey}\",
212
+ \"aws_secret_access_key\": \"#{skey}\"
213
+ }
214
+ EOP
215
+ ) > #{file}
216
+ sudo chown root:root #{file}
217
+ sudo chmod 0644 #{file}'"
218
+ end
186
219
  end
187
220
  end
data/lib/info.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  class Info
2
2
  def self.version
3
- "0.1.10"
3
+ "0.1.11"
4
4
  end
5
5
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 10
9
- version: 0.1.10
8
+ - 11
9
+ version: 0.1.11
10
10
  platform: ruby
11
11
  authors:
12
12
  - Greg Seitz
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-12-09 00:00:00 -08:00
17
+ date: 2012-01-05 00:00:00 -08:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency