aws-ami 0.0.7 → 0.0.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/bin/aws-ami +20 -2
- data/lib/aws_ami/ami.rb +4 -2
- metadata +2 -2
data/bin/aws-ami
CHANGED
@@ -17,6 +17,10 @@ OptionParser.new do |opts|
|
|
17
17
|
options[:region] = v
|
18
18
|
end
|
19
19
|
|
20
|
+
opts.on("--regions x,y,z", Array, "Specify a list of regions for creating AMIs, this option will overwrite --region option") do |list|
|
21
|
+
options[:regions] = list
|
22
|
+
end
|
23
|
+
|
20
24
|
opts.on("-f", "--install_script_file INSTALL_SCRIPT_FILE", "The install script file, installs all packages and setup AMI") do |f|
|
21
25
|
options[:install_script] = f
|
22
26
|
end
|
@@ -29,6 +33,10 @@ OptionParser.new do |opts|
|
|
29
33
|
options[:base_ami] = f
|
30
34
|
end
|
31
35
|
|
36
|
+
opts.on("-o", "--output BASE_AMI_YML_FILE_PATH", "Output created AMIs into a yaml file that aws-ami accepts to build new AMI") do |f|
|
37
|
+
options[:output_base_ami] = f
|
38
|
+
end
|
39
|
+
|
32
40
|
opts.on("-y", "--assume_yes", "Assume yes when asking for delete stack if the stack created failed, default is false") do
|
33
41
|
options[:assume_yes] = true
|
34
42
|
end
|
@@ -62,5 +70,15 @@ if options[:dry]
|
|
62
70
|
exit
|
63
71
|
end
|
64
72
|
|
65
|
-
|
66
|
-
|
73
|
+
options[:regions] ||= [options[:region]]
|
74
|
+
image_ids = options[:regions].map do |region|
|
75
|
+
ami = AWS::AMI.new(options.merge(:region => region))
|
76
|
+
image_id = ami.build
|
77
|
+
"#{region}: #{image_id}"
|
78
|
+
end
|
79
|
+
|
80
|
+
if options[:output_base_ami]
|
81
|
+
File.open(options[:output_base_ami], 'w') do |f|
|
82
|
+
f.write(image_ids.join("\n"))
|
83
|
+
end
|
84
|
+
end
|
data/lib/aws_ami/ami.rb
CHANGED
@@ -35,7 +35,7 @@ module AWS
|
|
35
35
|
'InstallScript' => @install_script,
|
36
36
|
"BaseAMI" => @base_ami
|
37
37
|
})
|
38
|
-
logger.info "creating stack"
|
38
|
+
logger.info "creating stack for region #{@region}"
|
39
39
|
wait_until_created(stack)
|
40
40
|
begin
|
41
41
|
instance_id = stack.resources['EC2Instance'].physical_resource_id
|
@@ -79,7 +79,9 @@ module AWS
|
|
79
79
|
logger.info "add permissions for #{@publish_to_account}"
|
80
80
|
image.permissions.add(@publish_to_account.gsub(/-/, ''))
|
81
81
|
end
|
82
|
-
|
82
|
+
image.id.tap do |image_id|
|
83
|
+
logger.info "Image #{@name}[#{image_id}] created"
|
84
|
+
end
|
83
85
|
end
|
84
86
|
|
85
87
|
private
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aws-ami
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-02-
|
12
|
+
date: 2013-02-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: aws-sdk
|