aws_runas 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
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/CHANGELOG.md +6 -0
- data/lib/aws_runas/config.rb +5 -2
- data/lib/aws_runas/version.rb +1 -1
- data/spec/aws_runas/config_spec.rb +24 -0
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b42c61f6910d824c789cda5dfd180ee21526a4eb
|
4
|
+
data.tar.gz: 633b4c171c180074c8236fadbb0b1fd228d28286
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 89c0b88c7dc6ac5700b96934db1741c5a6847bb879d05675d6ab7d520d56a1e7ab4e169d216d77912c083062b59043f5596de9f4a51a7c872043f46b07f977e2
|
7
|
+
data.tar.gz: 950a1ab391f0508b074a824937ded7948b99137022b0d3b8fa69dc93ef5b43f00965e4f7cd1a0406b6937e17c2cb183378ab14ad7b2a24f75f98d4cdbb388881
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
aws_runas CHANGELOG
|
2
2
|
====================
|
3
3
|
|
4
|
+
0.1.3 (Fri 27 Nov 2015 08:05:45 PST)
|
5
|
+
-------------------------------------
|
6
|
+
|
7
|
+
* Fixed #3 (better handling of invalid profile name).
|
8
|
+
* Added guard for invalid file as well.
|
9
|
+
|
4
10
|
0.1.2 (Wed 25 Nov 2015 09:09:09 PST)
|
5
11
|
-------------------------------------
|
6
12
|
|
data/lib/aws_runas/config.rb
CHANGED
@@ -29,6 +29,7 @@ module AwsRunAs
|
|
29
29
|
def initialize(path:, profile:)
|
30
30
|
@path = path
|
31
31
|
@path = self.class.find_config_file unless @path
|
32
|
+
fail(Errno::ENOENT, "#{@path}") unless File.exist?(@path.to_s)
|
32
33
|
@profile = profile
|
33
34
|
end
|
34
35
|
|
@@ -36,8 +37,10 @@ module AwsRunAs
|
|
36
37
|
def load_config_value(key:)
|
37
38
|
section = @profile
|
38
39
|
section = "profile #{@profile}" unless @profile == 'default'
|
39
|
-
aws_config = IniFile.load(@path)
|
40
|
-
|
40
|
+
aws_config = IniFile.load(@path)
|
41
|
+
unless aws_config.has_section?(section)
|
42
|
+
fail(NameError, "Profile #{@profile} not found in #{@path}")
|
43
|
+
end
|
41
44
|
aws_config[section][key]
|
42
45
|
end
|
43
46
|
|
data/lib/aws_runas/version.rb
CHANGED
@@ -81,4 +81,28 @@ describe AwsRunAs::Config do
|
|
81
81
|
end
|
82
82
|
end
|
83
83
|
end
|
84
|
+
|
85
|
+
context 'with profile set to an invalid profile' do
|
86
|
+
before(:context) do
|
87
|
+
@cfg = AwsRunAs::Config.new(path: MOCK_AWS_CONFIGPATH, profile: 'bad-profile')
|
88
|
+
end
|
89
|
+
|
90
|
+
describe '#load_config_value' do
|
91
|
+
it 'raises a NameError when a value load is attempted' do
|
92
|
+
expect { @cfg.load_config_value(key: 'region') }.to raise_error(NameError)
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
context 'with an invalid config file supplied' do
|
98
|
+
describe '#load_config_value' do
|
99
|
+
it 'raises a Errno::ENOENT error' do
|
100
|
+
expect do
|
101
|
+
AwsRunAs::Config.new(
|
102
|
+
path: '/bad/path/here', profile: 'default'
|
103
|
+
)
|
104
|
+
end.to raise_error(Errno::ENOENT)
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
84
108
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aws_runas
|
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
|
- Chris Marchesi
|
@@ -31,7 +31,7 @@ cert_chain:
|
|
31
31
|
reriQxVYXGlD8ZDuaKlDyVqUbF026ZHIlHKIgg90O037qFPxCBACTtxtYTP2hwug
|
32
32
|
Yis=
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date: 2015-11-
|
34
|
+
date: 2015-11-27 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: aws-sdk
|
metadata.gz.sig
CHANGED
Binary file
|