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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4251a967b1cec67a91d2174a88aef103fcc36133
4
- data.tar.gz: 3e963fbc25fcadb2f6838a65c3929f7d73dcbedd
3
+ metadata.gz: a9232959264332f47eaf4c91beebfcf9e296ac6d
4
+ data.tar.gz: e579865097fd4694310b16420422b38e1a251411
5
5
  SHA512:
6
- metadata.gz: c29d2d8ec07fef7f365373339b8041343af3366049a742647b9333b7833ff1770b0529c01f43285da89c061fd10d1f35ef79ee43662f3ea21f12340c3a2f25a2
7
- data.tar.gz: 40120ea2e514988b2c155d909e25be4f778b335142ce6efe7fb4ec46f82d81bcea798556c01d1d8038abe1a8c1184f0ade997a0bc3e478b1b0213a9960122492
6
+ metadata.gz: 335ce803f2660413aa7cea0200247a116eb5d2aa8c92c25335833b45de976349e3c47dbe781e8148be6a532c2c31184a873136a9ca7ad4422bf6f66b67f4a21a
7
+ data.tar.gz: 12dc1e926902ab443cf495dda0ab6ee5b0eb4750bee1db7ae493a8cb8e8d52961e87fb9a6e410c85bc22122e8fe1cf7e4a4034d141888fffb0cbc65daf9e3845
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AwsSu
4
- VERSION = '0.1.2'
4
+ VERSION = '0.1.3'
5
5
  end
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.2
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-02 00:00:00.000000000 Z
11
+ date: 2018-12-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: awsecrets