dumbwaiter 0.3.5 → 0.3.6
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ecdc3bda7d10fbfb6e265a6bb7014bc6ff93f186
|
4
|
+
data.tar.gz: c2c3f6d0985a8e80088bcbbea20f3fc0f4ecaead
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ea521ffdae488a9f1d2b8c8a3d1266ec7979f0ee143f8bccdd915dce9255d4fd5035b13af97d703d2c1c5c0a4cf5e30ebeaf58df9a1ac39217e0ce24ac724c8b
|
7
|
+
data.tar.gz: ad34b6685b65fcc70826277fc63ecc723addcaa1f90ee1ff7a4fefa49bcf47e784fefe483a4e4590b4d037c04f6475c616f0b7331e2b08595566e7b1aaf2bec3
|
@@ -1,9 +1,12 @@
|
|
1
1
|
class Dumbwaiter::UserProfile
|
2
2
|
attr_reader :opsworks_user_profile, :opsworks
|
3
3
|
|
4
|
-
def self.
|
5
|
-
|
4
|
+
def self.cache
|
5
|
+
@cache ||= {}
|
6
|
+
end
|
6
7
|
|
8
|
+
def self.find(iam_user_arn, opsworks = Aws::OpsWorks.new(region: "us-east-1"))
|
9
|
+
cache[iam_user_arn] ||= opsworks.describe_user_profiles(iam_user_arns: [iam_user_arn]).user_profiles.first
|
7
10
|
end
|
8
11
|
|
9
12
|
def initialize(opsworks_user_profile, opsworks = Aws::OpsWorks.new(region: "us-east-1"))
|
data/lib/dumbwaiter/version.rb
CHANGED
@@ -25,7 +25,7 @@ describe Dumbwaiter::Deployment do
|
|
25
25
|
its(:status) { should == "badical" }
|
26
26
|
its(:git_ref) { should == "eh-buddy" }
|
27
27
|
its(:user_name) { should == "goose" }
|
28
|
-
its(:to_log) { should == "#{DateTime.parse("last Tuesday")} - deplode - badical - eh-buddy" }
|
28
|
+
its(:to_log) { should == "#{DateTime.parse("last Tuesday")} - goose - deplode - badical - eh-buddy" }
|
29
29
|
|
30
30
|
context "when custom_json is nil" do
|
31
31
|
let(:fake_deployment) do
|
@@ -16,5 +16,11 @@ describe Dumbwaiter::UserProfile do
|
|
16
16
|
fake_opsworks.should_receive(:describe_user_profiles).with(iam_user_arns: ["schwarz"])
|
17
17
|
Dumbwaiter::UserProfile.find("schwarz", fake_opsworks).should == fake_user_profile
|
18
18
|
end
|
19
|
+
|
20
|
+
it "caches duplicate requests for the same arn" do
|
21
|
+
fake_opsworks.should_receive(:describe_user_profiles).once
|
22
|
+
Dumbwaiter::UserProfile.find("schwarz", fake_opsworks)
|
23
|
+
Dumbwaiter::UserProfile.find("schwarz", fake_opsworks)
|
24
|
+
end
|
19
25
|
end
|
20
26
|
end
|
data/spec/spec_helper.rb
CHANGED