lib/ami_spec.rb in ami_spec-0.3.0 vs lib/ami_spec.rb in ami_spec-1.0.0
- old
+ new
@@ -38,10 +38,12 @@
# Set the maximum number of ssh retries while waiting for the instance to boot.
# tags:::
# Additional tags to add to launched instances in the form of comma separated key=value pairs
# debug::
# Don't terminate the instances on exit
+ # buildkite::
+ # Output section separators for buildkite
# == Returns:
# Boolean - The result of all the server specs.
def self.run(options)
instances = []
options[:amis].each_pair do |role, ami|
@@ -98,11 +100,14 @@
opt :aws_public_ip, "Launch instances with a public IP"
opt :ssh_retries, "The number of times we should try sshing to the ec2 instance before giving up. Defaults to 30",
type: :int, default: 30
opt :tags, "Additional tags to add to launched instances in the form of comma separated key=value pairs. i.e. Name=AmiSpec", type: :string, default: ""
opt :debug, "Don't terminate instances on exit"
+ opt :buildkite, "Output section separators for buildkite"
opt :wait_for_rc, "Wait for oldschool SystemV scripts to run before conducting tests. Currently only supports Ubuntu with upstart"
+ opt :user_data_file, "File path for aws ec2 user data", type: :string
+ opt :iam_instance_profile_arn, "IAM instance profile to use", type: :string
end
if options[:role] && options[:ami]
options[:amis] = { options[:role] => options[:ami] }
options.delete(:role)
@@ -112,9 +117,17 @@
file_array = file_lines.collect { |line| line.split(',') }.flatten
options[:amis] = Hash[*file_array]
options.delete(:role_ami_file)
else
fail "You must specify either role and ami or role_ami_file"
+ end
+
+ unless File.exist? options[:key_file]
+ fail "Key file #{options[:key_file]} not found"
+ end
+
+ unless options[:user_data_file] and File.exist? options[:user_data_file]
+ fail "User Data file #{options[:user_data_file]} not found"
end
options[:tags] = parse_tags(options[:tags])
exit run(options)