aws_su 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/aws_su/version.rb +1 -1
- data/lib/aws_su.rb +7 -1
- 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: a9232959264332f47eaf4c91beebfcf9e296ac6d
|
4
|
+
data.tar.gz: e579865097fd4694310b16420422b38e1a251411
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 335ce803f2660413aa7cea0200247a116eb5d2aa8c92c25335833b45de976349e3c47dbe781e8148be6a532c2c31184a873136a9ca7ad4422bf6f66b67f4a21a
|
7
|
+
data.tar.gz: 12dc1e926902ab443cf495dda0ab6ee5b0eb4750bee1db7ae493a8cb8e8d52961e87fb9a6e410c85bc22122e8fe1cf7e4a4034d141888fffb0cbc65daf9e3845
|
data/lib/aws_su/version.rb
CHANGED
data/lib/aws_su.rb
CHANGED
@@ -128,6 +128,7 @@ module AwsSu
|
|
128
128
|
# Assume a role using an MFA Token
|
129
129
|
def assume_role_mfa(duration, mfa_code = nil)
|
130
130
|
mfa_code = prompt_for_mfa_code if mfa_code.nil?
|
131
|
+
delete_sudo_file
|
131
132
|
role_creds = sts_client.assume_role(
|
132
133
|
role_arn: AWSConfig[@profile]['role_arn'],
|
133
134
|
role_session_name: @session,
|
@@ -145,6 +146,11 @@ module AwsSu
|
|
145
146
|
(Time.now + duration.to_i).strftime('%Y-%m-%d %H:%M:%S')
|
146
147
|
end
|
147
148
|
|
149
|
+
# Delete the AWS sudo file
|
150
|
+
def delete_sudo_file
|
151
|
+
File.delete(AWS_SUDO_FILE) if File.exist?(AWS_SUDO_FILE)
|
152
|
+
end
|
153
|
+
|
148
154
|
# Get the values for AWS secrets etc and export them to the environment
|
149
155
|
def export_aws_sudo_file
|
150
156
|
return unless File.exists?(AWS_SUDO_FILE)
|
@@ -244,7 +250,7 @@ module AwsSu
|
|
244
250
|
false
|
245
251
|
end
|
246
252
|
|
247
|
-
# Update the Aws.config
|
253
|
+
# Update the Aws.config hash
|
248
254
|
def update_aws_config(role_creds)
|
249
255
|
Aws.config.update(
|
250
256
|
credentials: Aws::Credentials.new(
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aws_su
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bradley Atkins
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-12-
|
11
|
+
date: 2018-12-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: awsecrets
|