lakitu 1.0.5 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 114b8ce1725614f65a2267a592cb51ed0d01a975
4
- data.tar.gz: 1138e706299c115bfc5f39db44c55cdb51c9ab30
3
+ metadata.gz: 4d8621da712c864c70414408e869f51f942128a4
4
+ data.tar.gz: fddf1a52f5d214945aad0985d5700bea892b6748
5
5
  SHA512:
6
- metadata.gz: b4207886eec4438a2fe7fccd55536166f3e42df971984dca3a722027c802c5fba53c804f866f8a1dece431a6521c30c1aa0c0da2a0e14568cad9016a6e7467f1
7
- data.tar.gz: 7b7404e09ba08b7bdbb50bc289d39add64da6b25694c8996a81e7b59c6d23150465cf51862718cc3970b31104da39b8643be49f592532cca2ac079748153221e
6
+ metadata.gz: 2d785f739756be2531ae7a348aa131562c68bb9a13522255571834c4a4fc7fbaa0a3f20709bf5b6da7a8fcc89da32c3d6b261a47a70ce119fe6ab4c5ce167047
7
+ data.tar.gz: 1dc1e5fc1dadd3a6ed8bafc4d4aa472869d174c3b6de0c1c569adc40031d2cad97b6a276fdaa88dd15e63ba9ef3d39c12db1ee8c1f3a0aca770e7737815936cd
@@ -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('~/.aws/credentials'))).to_hash.keys.reject() do |x| x == '__anonymous__' end
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
@@ -1,3 +1,3 @@
1
1
  class LakituVersion
2
- VERSION = "1.0.5"
2
+ VERSION = "1.0.6"
3
3
  end
@@ -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
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lakitu
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bryan Conrad