ami_spec 1.8.0 → 1.8.1

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: 52b2bb6051e9962f16d4743d539763034bdf6e5ae33154852bbd335fe0a1b26b
4
+ data.tar.gz: 3b8876510c793c28911dab088fa35f003a0f15862c869bda17092db38e266929
5
5
  SHA512:
6
- metadata.gz: c9e66fea702fe7f9edf9aa8679ec2c386e1c46079c9371b5cbae2964b25b9d84eb60ed65a54b34e54d123ab27e7bc2756dd4c9ee2fefffdd751187802d74976a
7
- data.tar.gz: 1aaf85899a5269204bc817680c83c386e1b8132727712c49145cfa52627b72ea7301c8be6d08b28ae143daab2aa67aa0a61ec07854fb6b4a896c230b5843ccde
6
+ metadata.gz: '06228534001d96065a6bc5937533e4e00a250d821ce264259cc792d41165639d0142e04e4dfa0374cd934fc9b0786fa80c76deb577e96649519017a28a23a4c1'
7
+ data.tar.gz: 3aff902fd3205ce1704dbddb09eda7b5a02ce960cc253e944c04473e5101624d8459c31b3bb69400ac20565745647dfbb178f1c23b2f6fc2f259bc7fc50c02a8
@@ -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
@@ -1,3 +1,3 @@
1
1
  module AmiSpec
2
- VERSION = '1.8.0'
2
+ VERSION = '1.8.1'
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.1
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: 2022-12-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: aws-sdk-ec2
@@ -134,7 +134,7 @@ files:
134
134
  homepage: https://github.com/envato/ami-spec
135
135
  licenses: []
136
136
  metadata: {}
137
- post_install_message:
137
+ post_install_message:
138
138
  rdoc_options: []
139
139
  require_paths:
140
140
  - lib
@@ -149,8 +149,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
149
149
  - !ruby/object:Gem::Version
150
150
  version: '0'
151
151
  requirements: []
152
- rubygems_version: 3.0.4
153
- signing_key:
152
+ rubygems_version: 3.3.26
153
+ signing_key:
154
154
  specification_version: 4
155
155
  summary: Acceptance testing your AMIs
156
156
  test_files: []