ami_spec 1.4.0 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -1
- data/lib/ami_spec.rb +10 -2
- data/lib/ami_spec/aws_default_vpc.rb +10 -0
- data/lib/ami_spec/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5c700a6f5448ab25c9b1247276aa03da13a25e8b6ee11c99627c0001b980bb7d
|
4
|
+
data.tar.gz: 162c0f91f251d700daecf145b80dc713d5f7770d6f718fd96276461c61497ab3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f202c83cce3214a851739e6eaa2564b8a8c85f3b865732196d11381a789a4e5ee15b44b381b1d0dddd41109614c0b1a1ba2aff58e9bfaacdb0f97a28be164c73
|
7
|
+
data.tar.gz: db260f6ed177d0f6574d4e53a4d445c340806c5c81c95d1f5ba3173673fe698c7be11a0a4a68c0075698d31f7ea4d0807262574284b45f44f1200861807a9f6b
|
data/README.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# AmiSpec
|
2
2
|
|
3
|
+
[![License MIT](https://img.shields.io/badge/license-MIT-brightgreen.svg)](https://github.com/envato/ami-spec/blob/master/LICENSE.txt)
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/ami_spec.svg)](https://badge.fury.io/rb/ami_spec)
|
5
|
+
[![Build Status](https://travis-ci.org/envato/ami-spec.svg?branch=master)](https://travis-ci.org/envato/ami-spec)
|
6
|
+
|
3
7
|
Acceptance testing your AMIs.
|
4
8
|
|
5
9
|
AmiSpec is a RubyGem used to launch an Amazon Machine Image (AMI) and run ServerSpecs against it. It wraps around the AWS API and ServerSpec to spin up, test and tear down instances.
|
@@ -35,7 +39,8 @@ Options:
|
|
35
39
|
-o, --role-ami-file=<s> A file containing comma separated roles and amis. i.e.
|
36
40
|
web_server,ami-id.
|
37
41
|
-s, --specs=<s> The directory to find ServerSpecs
|
38
|
-
-u, --subnet-id=<s> The subnet to start the instance in
|
42
|
+
-u, --subnet-id=<s> The subnet to start the instance in. If not provided a subnet
|
43
|
+
will be chosen from the default VPC
|
39
44
|
-k, --key-name=<s> The SSH key name to assign to instances. If not provided a
|
40
45
|
temporary key pair will be generated in AWS
|
41
46
|
-e, --key-file=<s> The SSH private key file associated to the key_name
|
data/lib/ami_spec.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'ami_spec/aws_instance'
|
2
2
|
require 'ami_spec/aws_instance_options'
|
3
|
+
require 'ami_spec/aws_default_vpc'
|
3
4
|
require 'ami_spec/aws_key_pair'
|
4
5
|
require 'ami_spec/aws_security_group'
|
5
6
|
require 'ami_spec/server_spec'
|
@@ -54,6 +55,13 @@ module AmiSpec
|
|
54
55
|
|
55
56
|
ec2 = Aws::EC2::Resource.new(options[:aws_region] ? {region: options[:aws_region]} : {})
|
56
57
|
|
58
|
+
if options[:subnet_id].nil?
|
59
|
+
default_vpc_subnet = AwsDefaultVpc.find_subnet(ec2: ec2)
|
60
|
+
raise 'No default VPC subnet found. Please specify a subnet id.' if default_vpc_subnet.nil?
|
61
|
+
options[:subnet_id] = default_vpc_subnet.id
|
62
|
+
logger.info("Using subnet #{options[:subnet_id]} from the default VPC")
|
63
|
+
end
|
64
|
+
|
57
65
|
unless options[:key_name]
|
58
66
|
key_pair = AwsKeyPair.create(ec2: ec2, logger: logger)
|
59
67
|
options[:key_name] = key_pair.key_name
|
@@ -94,7 +102,7 @@ module AmiSpec
|
|
94
102
|
end
|
95
103
|
|
96
104
|
def self.stop_instances(instances, debug)
|
97
|
-
instances.each do |instance|
|
105
|
+
instances && instances.each do |instance|
|
98
106
|
begin
|
99
107
|
if debug
|
100
108
|
puts "EC2 instance ##{instance.instance_id} has not been stopped due to debug mode."
|
@@ -116,7 +124,7 @@ module AmiSpec
|
|
116
124
|
opt :role_ami_file, "A file containing comma separated roles and amis. i.e.\nweb_server,ami-id.",
|
117
125
|
type: :string
|
118
126
|
opt :specs, "The directory to find ServerSpecs", type: :string, required: true
|
119
|
-
opt :subnet_id, "The subnet to start the instance in", type: :string
|
127
|
+
opt :subnet_id, "The subnet to start the instance in. If not provided a subnet will be chosen from the default VPC", type: :string
|
120
128
|
opt :key_name, "The SSH key name to assign to instances. If not provided a temporary key pair will be generated in AWS",
|
121
129
|
type: :string
|
122
130
|
opt :key_file, "The SSH private key file associated to the key_name", type: :string
|
data/lib/ami_spec/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ami_spec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Patrick Robinson
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2019-
|
12
|
+
date: 2019-08-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: aws-sdk-ec2
|
@@ -120,6 +120,7 @@ files:
|
|
120
120
|
- README.md
|
121
121
|
- bin/ami_spec
|
122
122
|
- lib/ami_spec.rb
|
123
|
+
- lib/ami_spec/aws_default_vpc.rb
|
123
124
|
- lib/ami_spec/aws_instance.rb
|
124
125
|
- lib/ami_spec/aws_instance_options.rb
|
125
126
|
- lib/ami_spec/aws_key_pair.rb
|