forked from test-kitchen/test-kitchen
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request test-kitchen#146 from test-kitchen/tball/logging
Providing logger to instance_generator, fixes test-kitchen#142
- Loading branch information
Showing
7 changed files
with
76 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,3 +13,6 @@ Metrics/CyclomaticComplexity: | |
|
||
Metrics/PerceivedComplexity: | ||
Max: 30 | ||
|
||
Metrics/AbcSize: | ||
Max: 60 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,13 +30,12 @@ class Aws | |
# @author Tyler Ball <[email protected]> | ||
class InstanceGenerator | ||
|
||
include Logging | ||
attr_reader :config, :ec2, :logger | ||
|
||
attr_reader :config, :ec2 | ||
|
||
def initialize(config, ec2) | ||
def initialize(config, ec2, logger) | ||
@config = config | ||
@ec2 = ec2 | ||
@logger = logger | ||
end | ||
|
||
# Transform the provided config into the hash to send to AWS. Some fields | ||
|
@@ -125,6 +124,7 @@ def block_device_mappings # rubocop:disable all | |
# If the provided bdms match the root device in the AMI, emit log that | ||
# states this | ||
def debug_if_root_device(bdms) | ||
return if bdms.nil? || bdms.empty? | ||
image_id = config[:image_id] | ||
image = ec2.resource.image(image_id) | ||
begin | ||
|
@@ -136,7 +136,7 @@ def debug_if_root_device(bdms) | |
end | ||
bdms.find { |bdm| | ||
if bdm[:device_name] == root_device_name | ||
info("Overriding root device [#{root_device_name}] from image [#{image_id}]") | ||
logger.info("Overriding root device [#{root_device_name}] from image [#{image_id}]") | ||
end | ||
} | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters