mirror of
https://github.com/inspec/inspec
synced 2025-02-17 06:28:40 +00:00
Two deprecations in aws_ec2_instance (#2637)
* Drop deprecation warning for old name of aws_ec2 Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
This commit is contained in:
parent
e77b99235f
commit
33787124a7
3 changed files with 11 additions and 16 deletions
|
@ -55,7 +55,7 @@ The following examples show how to use this InSpec audit resource.
|
||||||
|
|
||||||
## Properties
|
## Properties
|
||||||
|
|
||||||
* `architecture`, `client_token`, `image_id`,`instance_type`, `key_name`, `launch_time`,`private_ip_address`, `private_dns_name`, `public_dns_name`, `public_ip_address`, `root_device_type`, `root_device_name`, `subnet_id`, `tags`,`virtualization_type`, `vpc_id`
|
* `architecture`, `client_token`, `image_id`,`instance_type`, `key_name`, `launch_time`,`private_ip_address`, `private_dns_name`, `public_dns_name`, `public_ip_address`, `root_device_type`, `root_device_name`, `security_group_ids`, `subnet_id`, `tags`,`virtualization_type`, `vpc_id`
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
|
|
|
@ -107,6 +107,8 @@ EOX
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Don't document this - it's a bit hard to use. Our current doctrine
|
||||||
|
# is to use dumb things, like arrays of strings - use security_group_ids instead.
|
||||||
def security_groups
|
def security_groups
|
||||||
catch_aws_errors do
|
catch_aws_errors do
|
||||||
@security_groups ||= instance.security_groups.map { |sg|
|
@security_groups ||= instance.security_groups.map { |sg|
|
||||||
|
@ -115,6 +117,12 @@ EOX
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def security_group_ids
|
||||||
|
catch_aws_errors do
|
||||||
|
@security_group_ids ||= instance.security_groups.map(&:group_id)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def tags
|
def tags
|
||||||
catch_aws_errors do
|
catch_aws_errors do
|
||||||
@tags ||= instance.tags.map { |tag| { key: tag.key, value: tag.value } }
|
@tags ||= instance.tags.map { |tag| { key: tag.key, value: tag.value } }
|
||||||
|
@ -147,18 +155,3 @@ EOX
|
||||||
catch_aws_errors { @instance ||= @ec2_resource.instance(id) }
|
catch_aws_errors { @instance ||= @ec2_resource.instance(id) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Deprecated
|
|
||||||
class AwsEc2 < AwsEc2Instance
|
|
||||||
name 'aws_ec2'
|
|
||||||
|
|
||||||
def initialize(opts, conn = nil)
|
|
||||||
deprecated
|
|
||||||
super(opts, conn)
|
|
||||||
end
|
|
||||||
|
|
||||||
def deprecated
|
|
||||||
warn '[DEPRECATION] `aws_ec2(parameter)` is deprecated. ' \
|
|
||||||
'Please use `aws_ec2_instance(parameter)` instead.'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
|
@ -15,7 +15,9 @@ class AwsIamPasswordPolicyTest < Minitest::Test
|
||||||
assert_equal true, AwsIamPasswordPolicy.new(@mock_conn).exists?
|
assert_equal true, AwsIamPasswordPolicy.new(@mock_conn).exists?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
def test_policy_does_not_exists_when_no_policy
|
def test_policy_does_not_exists_when_no_policy
|
||||||
|
skip "Disabled until fix for issue 2633"
|
||||||
@mock_resource.expect :account_password_policy, nil do
|
@mock_resource.expect :account_password_policy, nil do
|
||||||
raise Aws::IAM::Errors::NoSuchEntity.new nil, nil
|
raise Aws::IAM::Errors::NoSuchEntity.new nil, nil
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue