assumer 0.4.1a → 0.4.2

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: 0040c2a8af4e270a7ece881c71b5697aeab7ac8f
4
- data.tar.gz: 84b37cdfc3ab9d03ea47f24bb1aca1cc44a73c19
3
+ metadata.gz: c10e463a92188934c2bc9792ea46b7b2a8a75b28
4
+ data.tar.gz: f040681ac07f584c4a6a1ac43c7c26145e515069
5
5
  SHA512:
6
- metadata.gz: 0de21876310eec88959970b68c998e7e6559e6aa143931241297b49cd5c8e359c778475d33e179d055c8a19de4bf4cb596ff7f0d3409bd04a13c64fbc1a3ba31
7
- data.tar.gz: 6f138e89278f33f2a0f2c543df35715c2c00b1ddde1dd82b78483b484067861cc7a51d478553bdbdaf7687b97b33f1e2927b8a28fa750b7b3d272780bdee9f95
6
+ metadata.gz: ba1fe37f2224aff087c443ccad8390af0aabd42bc79fcfefaac64e0195cbb9bc59531863a9ad9cab7db8994b6bc9813ee325c5a9659e9ee1fe02ab347f87c60f
7
+ data.tar.gz: 985154971e954069cf472ace3b277b43abb742a67cd146f15af5a2e7fd71de201878ee8294e93a5c9c7cb9b746c65b8401307e46b7416cf784b73cbfa72ff4fb
data/exe/assumer CHANGED
@@ -62,25 +62,41 @@ def debug_credential_output(credentials:)
62
62
  end
63
63
 
64
64
  # First jump
65
- control_creds = Assumer::Assumer.new(
66
- region: parsed_options[:region],
67
- account: parsed_options[:control_account],
68
- role: control_plane_role,
69
- serial_number: mfa_serial_number,
70
- profile: parsed_options[:profile]
71
- )
65
+ begin
66
+ control_creds = Assumer::Assumer.new(
67
+ region: parsed_options[:region],
68
+ account: parsed_options[:control_account],
69
+ role: control_plane_role,
70
+ serial_number: mfa_serial_number,
71
+ profile: parsed_options[:profile]
72
+ )
73
+ rescue Assumer::AssumerError => e
74
+ puts e.message
75
+ puts "#{e.cause.class}: #{e.cause}" if DEBUG_FLAG
76
+ puts e.backtrace if DEBUG_FLAG
77
+ exit -1
78
+ end
79
+
72
80
  if DEBUG_FLAG
73
81
  warn 'First Jump Credentials:'
74
82
  warn debug_credential_output(credentials: control_creds.assume_role_credentials.credentials)
75
83
  end
76
84
 
77
85
  # Second jump
78
- target_creds = Assumer::Assumer.new(
79
- region: parsed_options[:region],
80
- account: parsed_options[:target_account],
81
- role: target_account_role,
82
- credentials: control_creds
83
- )
86
+ begin
87
+ target_creds = Assumer::Assumer.new(
88
+ region: parsed_options[:region],
89
+ account: parsed_options[:target_account],
90
+ role: target_account_role,
91
+ credentials: control_creds
92
+ )
93
+ rescue Assumer::AssumerError => e
94
+ puts e.message
95
+ puts "#{e.cause.class}: #{e.cause}" if DEBUG_FLAG
96
+ puts e.backtrace if DEBUG_FLAG
97
+ exit -1
98
+ end
99
+
84
100
  if DEBUG_FLAG
85
101
  warn 'Second Jump Credentials:'
86
102
  warn debug_credential_output(credentials: target_creds.assume_role_credentials.credentials)
@@ -1,3 +1,3 @@
1
1
  module Assumer
2
- VERSION = '0.4.1a'.freeze
2
+ VERSION = '0.4.2'.freeze
3
3
  end
data/lib/mfa.rb CHANGED
@@ -13,7 +13,9 @@ module Assumer
13
13
  @otp = $stdin.gets(7).chomp
14
14
  $stderr.puts 'MFA code should be 6 digits' if @otp !~ /\d{6}/
15
15
  end
16
- @otp
16
+ @otp # return the MFA code
17
+ rescue SystemExit, Interrupt
18
+ exit 0
17
19
  end
18
20
  end
19
21
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: assumer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1a
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Sherman
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-06-15 00:00:00.000000000 Z
11
+ date: 2016-10-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -96,7 +96,6 @@ extensions: []
96
96
  extra_rdoc_files: []
97
97
  files:
98
98
  - Gemfile
99
- - Gemfile.lock
100
99
  - Rakefile
101
100
  - assumer.gemspec
102
101
  - bin/console
@@ -120,9 +119,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
120
119
  version: '2.1'
121
120
  required_rubygems_version: !ruby/object:Gem::Requirement
122
121
  requirements:
123
- - - ">"
122
+ - - ">="
124
123
  - !ruby/object:Gem::Version
125
- version: 1.3.1
124
+ version: '0'
126
125
  requirements: []
127
126
  rubyforge_project:
128
127
  rubygems_version: 2.4.5.1
data/Gemfile.lock DELETED
@@ -1,34 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- assumer (0.2.2)
5
- aws-sdk-core (~> 2.1, >= 2.1.1)
6
- pry (~> 0)
7
- trollop (= 2.1.2)
8
-
9
- GEM
10
- remote: https://rubygems.org/
11
- specs:
12
- aws-sdk-core (2.1.26)
13
- jmespath (~> 1.0)
14
- coderay (1.1.0)
15
- jmespath (1.1.3)
16
- method_source (0.8.2)
17
- pry (0.10.2)
18
- coderay (~> 1.1.0)
19
- method_source (~> 0.8.1)
20
- slop (~> 3.4)
21
- rake (10.4.2)
22
- slop (3.6.0)
23
- trollop (2.1.2)
24
-
25
- PLATFORMS
26
- ruby
27
-
28
- DEPENDENCIES
29
- assumer!
30
- bundler (~> 1.10)
31
- rake (~> 10.0)
32
-
33
- BUNDLED WITH
34
- 1.10.6