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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/bin/ebs_tagger +19 -10
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cab10438fcef9e9ae1a91fd9f5fa1601a90c376b
4
- data.tar.gz: 8a47b0b339c770e81a9ab31d2849ad7bbce4da5b
3
+ metadata.gz: 7f5fa69c1531dd2604f41aef136adc7e974b5265
4
+ data.tar.gz: 73e42d8779cb12df972cc3f4f0ff8feb14de02c4
5
5
  SHA512:
6
- metadata.gz: 63f09fb9cbd632a130f43ca00c22ab0ed166eb4581b9b92054ac5b8ca45ab2efbeb0b3f21947420279f845cafd3ed02133319f19a3900cb5c4db65324ace5c0a
7
- data.tar.gz: 27d910c479b4abcbcb5561e197c04112140a24a82dc08892e12c13f20c665c45fcaa496ec6001a1b8a22ff17cb621743d75dacc83b6cafe5c812953f069e1322
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 !creds['access_id']
33
- raise Exception.new 'You must provide an AWS access ID (--id)'
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 credentials, region
85
- Aws.config[:credentials] = credentials
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 = Aws::Credentials.new(creds['access_id'], creds['secret_key'])
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 aws_credentials, region
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.2
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-07-06 00:00:00.000000000 Z
11
+ date: 2017-10-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk