ami_spec 1.8.0 → 1.8.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a2a7a5034e02deb64f10fae91426c5771688bbae9c8e56764c6af2faa13ebe7c
4
- data.tar.gz: b006c1eeeae2d04e63d077717fabf1aa0ebe29a8361f88c6958d92401866ff7f
3
+ metadata.gz: c83caf5c011d84b3e70d6a855cf6fff7a87d01e06910bab01aeea55530ebde1d
4
+ data.tar.gz: 6b40b0cff04fe050717d2c500a2c3a635c974f83c4a3335b65f1985b6db76f84
5
5
  SHA512:
6
- metadata.gz: c9e66fea702fe7f9edf9aa8679ec2c386e1c46079c9371b5cbae2964b25b9d84eb60ed65a54b34e54d123ab27e7bc2756dd4c9ee2fefffdd751187802d74976a
7
- data.tar.gz: 1aaf85899a5269204bc817680c83c386e1b8132727712c49145cfa52627b72ea7301c8be6d08b28ae143daab2aa67aa0a61ec07854fb6b4a896c230b5843ccde
6
+ metadata.gz: 31de74ea052fafb212ce9ae126950c8882de96492cc2e40cd4c3f11821c1af17922de74825e6e3aaca9214b64e235c32a417845edff757880baca75e4f08341a
7
+ data.tar.gz: 01f976c2c436f1ddc1dd997524e788eb90ddad9d8f4ebe5fd2954c1078cfbb907f3323761850801709d865b35b4aaa557345dcf438c6f64f59baa47d7dca0e63
@@ -25,22 +25,28 @@ module AmiSpec
25
25
  @tags = ec2ify_tags(options.fetch(:tags))
26
26
  @user_data_file = options.fetch(:user_data_file, nil)
27
27
  @iam_instance_profile_arn = options.fetch(:iam_instance_profile_arn, nil)
28
+ @logger = options.fetch(:logger)
28
29
  end
29
30
 
30
31
  def_delegators :@instance, :instance_id, :tags, :private_ip_address, :public_ip_address
31
32
 
32
33
  def start
34
+ @logger.info "Creating AWS EC2 instance for #{@ami}"
33
35
  client = Aws::EC2::Client.new(client_options)
34
36
  placeholder_instance = client.run_instances(instances_options).instances.first
35
37
 
36
38
  @instance = Aws::EC2::Instance.new(placeholder_instance.instance_id, client_options)
39
+ @logger.info "Waiting for AWS EC2 instance to start: #{@instance.id}"
37
40
  @instance.wait_until_running
38
41
  tag_instance
42
+ @logger.info "AWS EC2 instance started: #{@instance.id}"
39
43
  end
40
44
 
41
45
  def terminate
46
+ @logger.info "Terminating AWS EC2 instance: #{@instance.id}"
42
47
  @instance.terminate
43
48
  @instance.wait_until_terminated
49
+ @logger.info "AWS EC2 instance terminated: #{@instance.id}"
44
50
  end
45
51
 
46
52
  private
@@ -16,5 +16,6 @@ module AmiSpec
16
16
  property :tags
17
17
  property :user_data_file
18
18
  property :iam_instance_profile_arn
19
+ property :logger
19
20
  end
20
21
  end
@@ -16,8 +16,6 @@ module AmiSpec
16
16
  @user = options.fetch(:ssh_user)
17
17
  @key_file = options.fetch(:key_file)
18
18
  @buildkite = options.fetch(:buildkite)
19
- @user_data_file = options.fetch(:user_data_file)
20
- @iam_instance_profile_arn = options.fetch(:user_data_file)
21
19
  end
22
20
 
23
21
  def run
@@ -11,7 +11,5 @@ module AmiSpec
11
11
  property :specs
12
12
  property :ssh_user
13
13
  property :buildkite
14
- property :user_data_file
15
- property :iam_instance_profile_arn
16
14
  end
17
15
  end
@@ -1,3 +1,3 @@
1
1
  module AmiSpec
2
- VERSION = '1.8.0'
2
+ VERSION = '1.8.2'
3
3
  end
data/lib/ami_spec.rb CHANGED
@@ -83,17 +83,25 @@ module AmiSpec
83
83
 
84
84
  instances = []
85
85
  options[:amis].each_pair do |role, ami|
86
- aws_instance_options = AwsInstanceOptions.new(options.merge(role: role, ami: ami))
86
+ aws_instance_options = AwsInstanceOptions.new(options.merge(role: role, ami: ami, logger: logger))
87
87
  instances << AwsInstance.start(aws_instance_options)
88
88
  end
89
89
 
90
90
  results = []
91
91
  instances.each do |instance|
92
92
  ip_address = options[:aws_public_ip] ? instance.public_ip_address : instance.private_ip_address
93
+ logger.info("Waiting for SSH…")
93
94
  WaitForSSH.wait(ip_address, options[:ssh_user], options[:key_file], options[:ssh_retries])
94
- WaitForRC.wait(ip_address, options[:ssh_user], options[:key_file]) if options[:wait_for_rc]
95
- WaitForCloudInit.wait(ip_address, options[:ssh_user], options[:key_file]) if options[:wait_for_cloud_init]
95
+ if options[:wait_for_rc]
96
+ logger.info("Waiting for RC…")
97
+ WaitForRC.wait(ip_address, options[:ssh_user], options[:key_file])
98
+ end
99
+ if options[:wait_for_cloud_init]
100
+ logger.info("Waiting for cloud init…")
101
+ WaitForCloudInit.wait(ip_address, options[:ssh_user], options[:key_file])
102
+ end
96
103
 
104
+ logger.info("Running serverspec…")
97
105
  server_spec_options = ServerSpecOptions.new(options.merge(instance: instance))
98
106
  results << ServerSpec.new(server_spec_options).run
99
107
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ami_spec
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.0
4
+ version: 1.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patrick Robinson
8
8
  - Martin Jagusch
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-11-25 00:00:00.000000000 Z
12
+ date: 2023-03-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: aws-sdk-ec2
@@ -25,20 +25,6 @@ dependencies:
25
25
  - - "~>"
26
26
  - !ruby/object:Gem::Version
27
27
  version: '1'
28
- - !ruby/object:Gem::Dependency
29
- name: rake
30
- requirement: !ruby/object:Gem::Requirement
31
- requirements:
32
- - - ">="
33
- - !ruby/object:Gem::Version
34
- version: '0'
35
- type: :development
36
- prerelease: false
37
- version_requirements: !ruby/object:Gem::Requirement
38
- requirements:
39
- - - ">="
40
- - !ruby/object:Gem::Version
41
- version: '0'
42
28
  - !ruby/object:Gem::Dependency
43
29
  name: serverspec
44
30
  requirement: !ruby/object:Gem::Requirement
@@ -99,14 +85,14 @@ dependencies:
99
85
  name: net-ssh
100
86
  requirement: !ruby/object:Gem::Requirement
101
87
  requirements:
102
- - - "~>"
88
+ - - ">="
103
89
  - !ruby/object:Gem::Version
104
90
  version: '5'
105
91
  type: :runtime
106
92
  prerelease: false
107
93
  version_requirements: !ruby/object:Gem::Requirement
108
94
  requirements:
109
- - - "~>"
95
+ - - ">="
110
96
  - !ruby/object:Gem::Version
111
97
  version: '5'
112
98
  description: Acceptance testing your AMIs
@@ -134,7 +120,7 @@ files:
134
120
  homepage: https://github.com/envato/ami-spec
135
121
  licenses: []
136
122
  metadata: {}
137
- post_install_message:
123
+ post_install_message:
138
124
  rdoc_options: []
139
125
  require_paths:
140
126
  - lib
@@ -149,8 +135,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
149
135
  - !ruby/object:Gem::Version
150
136
  version: '0'
151
137
  requirements: []
152
- rubygems_version: 3.0.4
153
- signing_key:
138
+ rubygems_version: 3.4.5
139
+ signing_key:
154
140
  specification_version: 4
155
141
  summary: Acceptance testing your AMIs
156
142
  test_files: []