Updates based on PR feedback

Signed-off-by: Chris Redekop <chris.redekop@d2l.com>
This commit is contained in:
Chris Redekop 2017-04-13 18:55:28 +00:00 committed by Christoph Hartmann
parent 3cdb639a0c
commit 915e2fd7c6
3 changed files with 14 additions and 5 deletions

View file

@ -16,7 +16,7 @@ Encoding:
HashSyntax: HashSyntax:
Enabled: true Enabled: true
LineLength: LineLength:
Enabled: false Enabled: true
EmptyLinesAroundBlockBody: EmptyLinesAroundBlockBody:
Enabled: false Enabled: false
MethodLength: MethodLength:

View file

@ -31,12 +31,19 @@ class AwsIamAccessKey < Inspec.resource(1)
private private
def access_key_last_used def access_key_last_used
@access_key_last_used ||= @iam_client.get_access_key_last_used({ access_key_id: access_key_metadata.access_key_id }).access_key_last_used @access_key_last_used ||=
@iam_client.get_access_key_last_used(
{
access_key_id: access_key_metadata.access_key_id,
},
).access_key_last_used
end end
def access_key_metadata def access_key_metadata
if !(defined? @access_key_metadata) || !@access_key_metadata unless (defined? @access_key_metadata) && @access_key_metadata
@iam_client.list_access_keys({ user_name: @opts[:username] }).access_key_metadata.each do |access_key_metadata| @iam_client.list_access_keys({ user_name: @opts[:username] })
.access_key_metadata.each do |access_key_metadata|
if access_key_metadata.access_key_id.eql? @opts[:id] if access_key_metadata.access_key_id.eql? @opts[:id]
@access_key_metadata = access_key_metadata @access_key_metadata = access_key_metadata
break break

View file

@ -74,7 +74,9 @@ class Ec2 < Inspec.resource(1)
end end
def security_groups def security_groups
@security_groups ||= instance.security_groups.map { |sg| { id: sg.group_id, name: sg.group_name } } @security_groups ||= instance.security_groups.map { |sg|
{ id: sg.group_id, name: sg.group_name }
}
end end
def tags def tags