awspec 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9899a6c41db7288dc6098840b36cffe8cd9c6836
4
- data.tar.gz: 0ff3377d77778182c0b0e4288617c61461ac749c
3
+ metadata.gz: 0aceb416d92d43a4e663f5ce3013c8ac09da82e7
4
+ data.tar.gz: 8f922eaad68c274aab3619c66db708be73e3e751
5
5
  SHA512:
6
- metadata.gz: ef5ff136b8790b96f4a9675343bc89316eda0b2f6eb9e2cbac188c1a7432b976b2d46ff0a64f8f6ca1db2ffde508f9e2094cd509e73ae645ee743d9b91c32917
7
- data.tar.gz: 3921163912753ffc4dc078b8a4ded4194f1332925d39b21fad7a6d29b7258610fa25881db423a0984a3d9ffb27cba6686021bfdfe27bbbd0bf2953216e189ce5
6
+ metadata.gz: 018073b48b54e5d9e5211938b6073121e62069feb03bd0fd6e0c3823f0cf643c9793c7bd1538705834badb2e302d4a9bce6f7922f10828f14080a98b0bb59b5e
7
+ data.tar.gz: 481becdd71747950e2d09f136f1ad15fa3c05f1d4dac229c87ef15ee6baca3e291f4a57370aec3d02fb42b2a0ad045f7d8d777dcee5e7cefe29d178bdb5b86a3
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # awspec [![Gem](https://img.shields.io/gem/v/awspec.svg)](https://rubygems.org/gems/awspec) [![Travis](https://img.shields.io/travis/k1LoW/awspec.svg)](https://travis-ci.org/k1LoW/awspec)
1
+ # awspec [![Gem](https://img.shields.io/gem/v/awspec.svg)](https://rubygems.org/gems/awspec) [![Travis](https://img.shields.io/travis/k1LoW/awspec.svg)](https://travis-ci.org/k1LoW/awspec) [![Scrutinizer](https://img.shields.io/scrutinizer/g/k1LoW/awspec.svg)](https://scrutinizer-ci.com/g/k1LoW/awspec/) [![Gemnasium](https://img.shields.io/gemnasium/k1LoW/awspec.svg)](https://gemnasium.com/k1LoW/awspec)
2
2
 
3
3
  RSpec tests for your AWS resources.
4
4
 
@@ -45,17 +45,6 @@ module Awspec::Helper
45
45
  return res[:subnets][0] if res[:subnets].count == 1
46
46
  end
47
47
 
48
- def find_route_table(route_table_id)
49
- res = @ec2_client.describe_route_tables({
50
- filters: [{ name: 'route-table-id', values: [route_table_id] }]
51
- })
52
- return res[:route_tables][0] if res[:route_tables].count == 1
53
- res = @ec2_client.describe_route_tables({
54
- filters: [{ name: 'tag:Name', values: [route_table_id] }]
55
- })
56
- return res[:route_tables][0] if res[:route_tables].count == 1
57
- end
58
-
59
48
  def find_internet_gateway(gateway_id)
60
49
  res = @ec2_client.describe_internet_gateways({
61
50
  filters: [{ name: 'internet-gateway-id', values: [gateway_id] }]
@@ -82,6 +71,17 @@ module Awspec::Helper
82
71
  return res[:security_groups][0] if res[:security_groups].count == 1
83
72
  end
84
73
 
74
+ def find_ebs(volume_id)
75
+ res = @ec2_client.describe_volumes({
76
+ filters: [{ name: 'volume-id', values: [volume_id] }]
77
+ })
78
+ return res[:volumes][0] if res[:volumes].count == 1
79
+ res = @ec2_client.describe_volumes({
80
+ filters: [{ name: 'tag:Name', values: [volume_id] }]
81
+ })
82
+ return res[:volumes][0] if res[:volumes].count == 1
83
+ end
84
+
85
85
  def select_ec2_by_vpc_id(vpc_id)
86
86
  res = @ec2_client.describe_instances({
87
87
  filters: [{ name: 'vpc-id', values: [vpc_id] }]
@@ -12,13 +12,13 @@ module Awspec::Helper
12
12
  return res[:vpcs][0] if res[:vpcs].count == 1
13
13
  end
14
14
 
15
- def find_route_table(id)
15
+ def find_route_table(route_table_id)
16
16
  res = @ec2_client.describe_route_tables({
17
- filters: [{ name: 'route-table-id', values: [id] }]
17
+ filters: [{ name: 'route-table-id', values: [route_table_id] }]
18
18
  })
19
19
  return res[:route_tables][0] if res[:route_tables].count == 1
20
20
  res = @ec2_client.describe_route_tables({
21
- filters: [{ name: 'tag:Name', values: [id] }]
21
+ filters: [{ name: 'tag:Name', values: [route_table_id] }]
22
22
  })
23
23
  return res[:route_tables][0] if res[:route_tables].count == 1
24
24
  end
@@ -46,8 +46,22 @@ module Awspec::Type
46
46
  end
47
47
  return true if ret
48
48
  sg2 = find_security_group(sg_id)
49
- sg2[:tags].find do |tag|
50
- tag[:key] == 'Name' && tag[:value] == sg_id
49
+ return false unless sg2.tag_name == sg_id
50
+ sgs.find do |sg|
51
+ sg[:group_id] == sg2[:group_id]
52
+ end
53
+ end
54
+
55
+ def has_ebs?(volume_id)
56
+ blocks = @instance[:block_device_mappings]
57
+ ret = blocks.find do |block|
58
+ next false unless block[:ebs]
59
+ block[:ebs][:volume_id] == volume_id
60
+ end
61
+ return true if ret
62
+ blocks2 = find_ebs(volume_id)
63
+ blocks2[:attachments].find do |attachment|
64
+ attachment.instance_id == @id
51
65
  end
52
66
  end
53
67
  end
@@ -1,3 +1,3 @@
1
1
  module Awspec
2
- VERSION = '0.4.0'
2
+ VERSION = '0.4.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: awspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - k1LoW
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-11 00:00:00.000000000 Z
11
+ date: 2015-08-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec