ebs_tagger 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/ebs_tagger +19 -10
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7f5fa69c1531dd2604f41aef136adc7e974b5265
|
4
|
+
data.tar.gz: 73e42d8779cb12df972cc3f4f0ff8feb14de02c4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bcf940fc64c99783f3ed750af0fcc2c8d0d6b21926e167431c1556c767f48a95e708115c1bfbd99cf2d630cc437d5eed9974f741025975dba6655e9fff38a0bd
|
7
|
+
data.tar.gz: ca37f5ebba2cdf93a3190ade02652e09c6037d9156d2f942337a6232b27423903b9ca8f76e23132f6b47acbf0d6770d27913239e15303f3986256e62f7a0b06d
|
data/bin/ebs_tagger
CHANGED
@@ -29,14 +29,18 @@ OptionParser.new do |parser|
|
|
29
29
|
end
|
30
30
|
end.parse!
|
31
31
|
|
32
|
-
if !
|
33
|
-
raise Exception.new 'You must provide
|
34
|
-
elsif !creds['secret_key']
|
35
|
-
raise Exception.new 'You must provide an AWS access key (--key)'
|
36
|
-
elsif !options[:regions]
|
37
|
-
raise Exception.new 'You must provide an at least one AWS Region (--regions)'
|
32
|
+
if !options[:regions]
|
33
|
+
raise Exception.new 'You must provide at least one AWS region (--region)'
|
38
34
|
end
|
39
35
|
|
36
|
+
# if !creds['access_id']
|
37
|
+
# raise Exception.new 'You must provide an AWS access ID (--id)'
|
38
|
+
# elsif !creds['secret_key']
|
39
|
+
# raise Exception.new 'You must provide an AWS access key (--key)'
|
40
|
+
# elsif !options[:regions]
|
41
|
+
# raise Exception.new 'You must provide an at least one AWS Region (--regions)'
|
42
|
+
# end
|
43
|
+
|
40
44
|
@too_many_tags_errors = 0
|
41
45
|
|
42
46
|
def tag_volume volume, instance_tags, instance_id, volume_tags, ignored_tags
|
@@ -81,8 +85,10 @@ def get_tags thing
|
|
81
85
|
tags
|
82
86
|
end
|
83
87
|
|
84
|
-
def create_resource
|
85
|
-
|
88
|
+
def create_resource region, credentials=nil
|
89
|
+
if credentials
|
90
|
+
Aws.config[:credentials] = credentials
|
91
|
+
end
|
86
92
|
Aws.config[:region] = region
|
87
93
|
begin
|
88
94
|
ec2_resource = Aws::EC2::Resource.new
|
@@ -100,10 +106,13 @@ end
|
|
100
106
|
|
101
107
|
begin
|
102
108
|
# Establish AWS EC2 credentials
|
103
|
-
aws_credentials =
|
109
|
+
aws_credentials = nil
|
110
|
+
if creds['access_id'] && creds['secret_key']
|
111
|
+
aws_credentials = Aws::Credentials.new(creds['access_id'], creds['secret_key'])
|
112
|
+
end
|
104
113
|
|
105
114
|
options[:regions].each do |region|
|
106
|
-
ec2_resource = create_resource
|
115
|
+
ec2_resource = create_resource region, aws_credentials
|
107
116
|
puts "Syncing tags on #{region} instances..."
|
108
117
|
|
109
118
|
instance_tracker = 0
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ebs_tagger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hunter Wong
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-10-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk
|