lakitu 1.0.5 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/lakitu/providers/aws.rb +5 -1
- data/lib/lakitu/version.rb +1 -1
- data/spec/providers/aws_spec.rb +10 -0
- data/spec/spec_helper.rb +5 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4d8621da712c864c70414408e869f51f942128a4
|
4
|
+
data.tar.gz: fddf1a52f5d214945aad0985d5700bea892b6748
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d785f739756be2531ae7a348aa131562c68bb9a13522255571834c4a4fc7fbaa0a3f20709bf5b6da7a8fcc89da32c3d6b261a47a70ce119fe6ab4c5ce167047
|
7
|
+
data.tar.gz: 1dc1e5fc1dadd3a6ed8bafc4d4aa472869d174c3b6de0c1c569adc40031d2cad97b6a276fdaa88dd15e63ba9ef3d39c12db1ee8c1f3a0aca770e7737815936cd
|
data/lib/lakitu/providers/aws.rb
CHANGED
@@ -3,8 +3,12 @@ require 'iniparse'
|
|
3
3
|
require 'lakitu/provider'
|
4
4
|
|
5
5
|
class Lakitu::Provider::Aws < Lakitu::Provider
|
6
|
+
CREDENTIALS_PATH = '~/.aws/credentials'
|
6
7
|
def profiles
|
7
|
-
IniParse.parse(File.read(File.expand_path(
|
8
|
+
IniParse.parse(File.read(File.expand_path(CREDENTIALS_PATH))).to_hash.keys.reject() do |x| x == '__anonymous__' end
|
9
|
+
rescue Errno::ENOENT
|
10
|
+
Lakitu.logger.info "No AWS credentials file found at #{CREDENTIALS_PATH}, skipping"
|
11
|
+
[]
|
8
12
|
end
|
9
13
|
|
10
14
|
def instances profile, region
|
data/lib/lakitu/version.rb
CHANGED
data/spec/providers/aws_spec.rb
CHANGED
@@ -10,6 +10,16 @@ RSpec.describe Lakitu::Provider::Aws do
|
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
|
+
context "without a valid credentials config" do
|
14
|
+
before :each do
|
15
|
+
mock_no_config
|
16
|
+
end
|
17
|
+
|
18
|
+
it "fails to get a list of profiles" do
|
19
|
+
expect(subject.profiles).to eq []
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
13
23
|
context "with a given list of instances" do
|
14
24
|
before do
|
15
25
|
stub_aws
|
data/spec/spec_helper.rb
CHANGED
@@ -67,6 +67,11 @@ def mock_config
|
|
67
67
|
allow(File).to receive(:read).with(File.expand_path('~/.aws/credentials')).and_return(AWS_CREDENTIALS_CONTENT).at_least(:once)
|
68
68
|
end
|
69
69
|
|
70
|
+
def mock_no_config
|
71
|
+
allow(File).to receive(:read).and_call_original
|
72
|
+
allow(File).to receive(:read).with(File.expand_path('~/.aws/credentials')).and_raise(Errno::ENOENT).at_least(:once)
|
73
|
+
end
|
74
|
+
|
70
75
|
LOCAL_SSHCONFIG=<<EOF
|
71
76
|
User myusername
|
72
77
|
EOF
|