hiera-aws 0.0.3 → 0.0.4
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 +7 -7
- data/README.md +11 -3
- data/lib/hiera/backend/aws/version.rb +1 -1
- data/lib/hiera/backend/aws_backend.rb +15 -0
- data/spec/aws_backend_spec.rb +24 -2
- metadata +52 -70
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
5
|
-
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c5eb2b414df749ddb9fb5764e9424a8f86256fe0
|
4
|
+
data.tar.gz: dcc498e4413d0bcbba1b1e661078b6da37ed9ac5
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5d51b42416cb49e8e27d27e05aca4f86725e7548fe2a783fa3026970f2b69bb7ad0d53edd16ca473cde77ba8e6d4f59455b229c0850612a0180317e06179ba50
|
7
|
+
data.tar.gz: c38d28c309ddef1e90d2267f706b2b14e1d6a490a7a6e5c547ccd180448be131e7172fea1b8980dfd220917f2df4749f237eeba4816dea7b4dbfe3be2af396d3
|
data/README.md
CHANGED
@@ -33,9 +33,17 @@ service currently supported by this backend.
|
|
33
33
|
- aws/elasticache
|
34
34
|
```
|
35
35
|
|
36
|
-
|
37
|
-
|
38
|
-
|
36
|
+
To grant sufficient privileges for Hiera to work, you either have to assign the
|
37
|
+
EC2 instances an IAM role that allows the action `elasticache:Describe*`
|
38
|
+
(preferred) or provide credentials for a user with the same privileges via the
|
39
|
+
backend configuration in `hiera.yml`:
|
40
|
+
|
41
|
+
```yaml
|
42
|
+
:aws:
|
43
|
+
:access_key_id: your_aws_access_key_id_here
|
44
|
+
:secret_access_key: your_aws_secret_access_key_here
|
45
|
+
```
|
46
|
+
|
39
47
|
|
40
48
|
## Hiera Keys
|
41
49
|
|
@@ -11,9 +11,24 @@ class Hiera
|
|
11
11
|
require "aws-sdk"
|
12
12
|
end
|
13
13
|
|
14
|
+
setup_aws_credentials
|
15
|
+
|
14
16
|
Hiera.debug("AWS backend initialized")
|
15
17
|
end
|
16
18
|
|
19
|
+
def setup_aws_credentials
|
20
|
+
if Config[:aws] && Config[:aws][:access_key_id] && Config[:aws][:secret_access_key]
|
21
|
+
Hiera.debug("Using AWS credentials from backend configuration")
|
22
|
+
|
23
|
+
AWS.config({
|
24
|
+
:access_key_id => Config[:aws][:access_key_id],
|
25
|
+
:secret_access_key => Config[:aws][:secret_access_key]
|
26
|
+
})
|
27
|
+
else
|
28
|
+
Hiera.debug("Using AWS credentials from environment or IAM role")
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
17
32
|
def lookup(key, scope, order_override, resolution_type)
|
18
33
|
Backend.datasources(scope, order_override) do |elem|
|
19
34
|
elements = elem.split "/"
|
data/spec/aws_backend_spec.rb
CHANGED
@@ -3,17 +3,39 @@ require "hiera/backend/aws_backend"
|
|
3
3
|
class Hiera
|
4
4
|
module Backend
|
5
5
|
describe Aws_backend do
|
6
|
-
let(:backend) { Aws_backend.new }
|
7
|
-
|
8
6
|
before do
|
9
7
|
Hiera.stub(:debug)
|
10
8
|
end
|
11
9
|
|
10
|
+
describe "#initialize" do
|
11
|
+
it "uses AWS credentials from environment or IAM role by default" do
|
12
|
+
Config.stub(:[]).with(:aws)
|
13
|
+
expect(AWS).to_not receive(:config)
|
14
|
+
Aws_backend.new
|
15
|
+
end
|
16
|
+
|
17
|
+
it "uses AWS credentials from backend configuration if provided" do
|
18
|
+
credentials = {
|
19
|
+
:access_key_id => "some_access_key_id",
|
20
|
+
:secret_access_key => "some_secret_access_key"
|
21
|
+
}
|
22
|
+
|
23
|
+
Config.stub(:[]).with(:aws).and_return(credentials)
|
24
|
+
expect(AWS).to receive(:config).with(credentials)
|
25
|
+
Aws_backend.new
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
12
29
|
describe "#lookup" do
|
30
|
+
let(:backend) { Aws_backend.new }
|
13
31
|
let(:key) { "some_key" }
|
14
32
|
let(:scope) { { "foo" => "bar" } }
|
15
33
|
let(:params) { [key, scope, "", :priority] }
|
16
34
|
|
35
|
+
before do
|
36
|
+
Config.stub(:[]).with(:aws)
|
37
|
+
end
|
38
|
+
|
17
39
|
it "returns nil if hierarchy is empty" do
|
18
40
|
Backend.stub(:datasources)
|
19
41
|
expect(backend.lookup(*params)).to be_nil
|
metadata
CHANGED
@@ -1,80 +1,63 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: hiera-aws
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
|
-
authors:
|
6
|
+
authors:
|
7
7
|
- Mathias Lafeldt
|
8
8
|
- Deniz Adrian
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
|
13
|
+
date: 2014-01-30 00:00:00 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
15
16
|
name: aws-sdk
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
17
|
-
requirements:
|
18
|
-
- - '>='
|
19
|
-
- !ruby/object:Gem::Version
|
20
|
-
version: '0'
|
21
|
-
type: :runtime
|
22
17
|
prerelease: false
|
23
|
-
|
24
|
-
requirements:
|
25
|
-
-
|
26
|
-
-
|
27
|
-
|
28
|
-
|
18
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
19
|
+
requirements:
|
20
|
+
- &id002
|
21
|
+
- ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: "0"
|
24
|
+
type: :runtime
|
25
|
+
version_requirements: *id001
|
26
|
+
- !ruby/object:Gem::Dependency
|
29
27
|
name: bundler
|
30
|
-
requirement: !ruby/object:Gem::Requirement
|
31
|
-
requirements:
|
32
|
-
- - '>='
|
33
|
-
- !ruby/object:Gem::Version
|
34
|
-
version: '0'
|
35
|
-
type: :development
|
36
28
|
prerelease: false
|
37
|
-
|
38
|
-
requirements:
|
39
|
-
-
|
40
|
-
- !ruby/object:Gem::Version
|
41
|
-
version: '0'
|
42
|
-
- !ruby/object:Gem::Dependency
|
43
|
-
name: rake
|
44
|
-
requirement: !ruby/object:Gem::Requirement
|
45
|
-
requirements:
|
46
|
-
- - '>='
|
47
|
-
- !ruby/object:Gem::Version
|
48
|
-
version: '0'
|
29
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- *id002
|
49
32
|
type: :development
|
33
|
+
version_requirements: *id003
|
34
|
+
- !ruby/object:Gem::Dependency
|
35
|
+
name: rake
|
50
36
|
prerelease: false
|
51
|
-
|
52
|
-
requirements:
|
53
|
-
-
|
54
|
-
- !ruby/object:Gem::Version
|
55
|
-
version: '0'
|
56
|
-
- !ruby/object:Gem::Dependency
|
57
|
-
name: rspec
|
58
|
-
requirement: !ruby/object:Gem::Requirement
|
59
|
-
requirements:
|
60
|
-
- - '>='
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
version: '0'
|
37
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- *id002
|
63
40
|
type: :development
|
41
|
+
version_requirements: *id004
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: rspec
|
64
44
|
prerelease: false
|
65
|
-
|
66
|
-
requirements:
|
67
|
-
-
|
68
|
-
|
69
|
-
|
45
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- *id002
|
48
|
+
type: :development
|
49
|
+
version_requirements: *id005
|
70
50
|
description: Hiera AWS Backend
|
71
|
-
email:
|
51
|
+
email:
|
72
52
|
- mathias.lafeldt@jimdo.com
|
73
53
|
- deniz.adrian@jimdo.com
|
74
54
|
executables: []
|
55
|
+
|
75
56
|
extensions: []
|
57
|
+
|
76
58
|
extra_rdoc_files: []
|
77
|
-
|
59
|
+
|
60
|
+
files:
|
78
61
|
- .gitignore
|
79
62
|
- .travis.yml
|
80
63
|
- Gemfile
|
@@ -90,30 +73,29 @@ files:
|
|
90
73
|
- spec/aws_base_spec.rb
|
91
74
|
- spec/aws_elasticache_spec.rb
|
92
75
|
homepage: https://github.com/Jimdo/hiera-aws
|
93
|
-
licenses:
|
76
|
+
licenses:
|
94
77
|
- Apache 2.0
|
95
78
|
metadata: {}
|
79
|
+
|
96
80
|
post_install_message:
|
97
81
|
rdoc_options: []
|
98
|
-
|
82
|
+
|
83
|
+
require_paths:
|
99
84
|
- lib
|
100
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
101
|
-
requirements:
|
102
|
-
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
requirements:
|
107
|
-
- - '>='
|
108
|
-
- !ruby/object:Gem::Version
|
109
|
-
version: '0'
|
85
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- *id002
|
88
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
89
|
+
requirements:
|
90
|
+
- *id002
|
110
91
|
requirements: []
|
92
|
+
|
111
93
|
rubyforge_project:
|
112
|
-
rubygems_version: 2.1
|
94
|
+
rubygems_version: 2.2.1
|
113
95
|
signing_key:
|
114
96
|
specification_version: 4
|
115
97
|
summary: Hiera AWS Backend
|
116
|
-
test_files:
|
98
|
+
test_files:
|
117
99
|
- spec/aws_backend_spec.rb
|
118
100
|
- spec/aws_base_spec.rb
|
119
101
|
- spec/aws_elasticache_spec.rb
|