zanzibar 0.1.18 → 0.1.19

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YzNhZjM1YjJkMTBhNjVkYWVlY2ZkZWFlYWZkNmY5NzNlZGQ0MWMyNQ==
4
+ ZWVlZGZlZDQ4ZmI4NWY1OTk1ZTcxNDQzYTE1MzYyYzFhZTY2NDY2Mw==
5
5
  data.tar.gz: !binary |-
6
- NDQwZDE4MWUxNGZhOGY0YmZhNWEyNzMwNmUxNjIzN2VkMzE2YzFjOQ==
6
+ NWUzYzYyMjExODhiNzIxMjc0NDI5ODA1NDkwNDdlNmVkNTY5NDYzMQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NWY5YzcyMzg4MGE2ZDk3ODEwZGJjZTVlZDRhMWJkOWI0MWI1NDBlMTdkYTNk
10
- MzYyZWY4NGM5MzVhZWQ0NDBiOGM5ZGViMjU1ZGMxN2E0YzliNWJkOTEzMGNh
11
- YzZhZDdkNjJkNTQwYmMwNWRjMGVkYzc2N2UxZDZjMjVkZTEwMGU=
9
+ MTFmZWE4MGIwMWRkNWMwYTYyOTNiZmYwOGU1ZjAwNWExYzJiMTNmYmEwNGYz
10
+ NmU4MDkwZjQ4ZjNhZDk2MTBlMGU3ZjJlMzA1N2E2MTRlMzUwYTY1ZmI0NGFl
11
+ MzhhZTY0ZjU2M2IxODk3MjFjYmNhYzkwZWQzZjY3YTUwMzI0MmE=
12
12
  data.tar.gz: !binary |-
13
- OWE1NTI4MTEwNWI4ZGJhZjcyNDFkMDYyNjUyYmMyZDI5NGIzNzUxNjg0OGUy
14
- ZjBjZmQ5ODc0NGQ2MzA0YzlmMDY0NDBkYWNkYTY0MTE1MzQ5ZGUwOGE5Y2M4
15
- MzQxMjFjZTAyOGIyNmU0YmVmN2E4MTliY2NlMmQzNGViMTExZTk=
13
+ YWY0ODJmYTBiMzg4NjRiMzc1MTgzMmVkMDVlZTQ5MGU0MGM1YWZkNzk4YThm
14
+ YTU2YTgxYTYwY2U1MGQ1ZjIzN2E1Y2Y3NTZjZjZmOTM0YjkxZjMzNzE4OWFk
15
+ NzliNDJlNWQ4NDY2ZTdhNjFlOTEzMjJlMTA1MmE3N2NhNjllMDQ=
@@ -92,9 +92,10 @@ module Zanzibar
92
92
 
93
93
  downloaded_secrets = {}
94
94
  remote_secrets.each do |key, secret|
95
+ full_path = secret.has_key?('prefix') ? File.join(@settings['secret_dir'], secret['prefix']) : @settings['secret_dir']
95
96
  downloaded_secrets[key] = download_one_secret(secret['id'],
96
97
  secret['label'],
97
- @settings['secret_dir'],
98
+ full_path,
98
99
  args,
99
100
  secret['name'] || "#{secret['id']}_password")
100
101
 
@@ -1,4 +1,4 @@
1
1
  # The version of the gem
2
2
  module Zanzibar
3
- VERSION = '0.1.18'
3
+ VERSION = '0.1.19'
4
4
  end
data/spec/files/Zanzifile CHANGED
@@ -4,8 +4,11 @@ settings:
4
4
  domain: zanzitest.net
5
5
  secret_dir: secrets/
6
6
  ignore_ssl: true
7
- secrets:
8
7
  secrets:
9
8
  ssh_key:
10
9
  id: 2345
11
10
  label: Private Key
11
+ prefix_ssh_key:
12
+ id: 2345
13
+ label: Private Key
14
+ prefix: ssh/
@@ -24,9 +24,12 @@ describe Zanzibar::Cli do
24
24
  FakeFS::FileSystem.clone files
25
25
 
26
26
  stub_request(:any, 'https://www.zanzitest.net/webservices/sswebservice.asmx')
27
- .to_return(body: AUTH_XML, status: 200).then
28
- .to_return(body: SECRET_WITH_KEY_XML, status: 200).then
29
- .to_return(body: PRIVATE_KEY_XML, status: 200)
27
+ .to_return({body: AUTH_XML, status: 200}).then
28
+ .to_return({body: SECRET_WITH_KEY_XML, status: 200}).then
29
+ .to_return({body: PRIVATE_KEY_XML, status: 200}).then
30
+ .to_return({body: AUTH_XML, status: 200}).then
31
+ .to_return({body: SECRET_WITH_KEY_XML, status: 200}).then
32
+ .to_return({body: PRIVATE_KEY_XML, status: 200})
30
33
 
31
34
  Dir.chdir File.join(source_root, 'spec', 'files')
32
35
  end
@@ -50,6 +53,12 @@ describe Zanzibar::Cli do
50
53
  expect(FakeFS::FileTest.file? File.join('secrets', 'zanzi_key')).to be(true)
51
54
  end
52
55
 
56
+ it 'should download a file to a prefix' do
57
+ expect(FakeFS::FileTest.file? File.join('secrets/ssh', 'zanzi_key')).to be(false)
58
+ expect { subject.bundle }.to output(/Finished downloading secrets/).to_stdout
59
+ expect(FakeFS::FileTest.file? File.join('secrets/ssh', 'zanzi_key')).to be(true)
60
+ end
61
+
53
62
  it 'should create a .gitignore' do
54
63
  expect(FakeFS::FileTest.file? File.join('secrets', '.gitignore')).to be(false)
55
64
  expect { subject.bundle }.to output(/Finished downloading secrets/).to_stdout
@@ -64,7 +73,7 @@ describe Zanzibar::Cli do
64
73
 
65
74
  it 'should not redownload files it already has' do
66
75
  expect { subject.bundle }.to output(/Finished downloading secrets/).to_stdout
67
- expect(WebMock).to have_requested(:post, 'https://www.zanzitest.net/webservices/sswebservice.asmx').times(3)
76
+ expect(WebMock).to have_requested(:post, 'https://www.zanzitest.net/webservices/sswebservice.asmx').times(6)
68
77
 
69
78
  WebMock.reset!
70
79
 
@@ -74,16 +83,19 @@ describe Zanzibar::Cli do
74
83
 
75
84
  it 'should redownload on update action' do
76
85
  expect { subject.bundle }.to output(/Finished downloading secrets/).to_stdout
77
- expect(WebMock).to have_requested(:post, 'https://www.zanzitest.net/webservices/sswebservice.asmx').times(3)
86
+ expect(WebMock).to have_requested(:post, 'https://www.zanzitest.net/webservices/sswebservice.asmx').times(6)
78
87
 
79
88
  WebMock.reset!
80
89
  stub_request(:any, 'https://www.zanzitest.net/webservices/sswebservice.asmx')
90
+ .to_return({body: AUTH_XML, status: 200}).then
91
+ .to_return({body: SECRET_WITH_KEY_XML, status: 200}).then
92
+ .to_return({body: PRIVATE_KEY_XML, status: 200}).then
81
93
  .to_return(body: AUTH_XML, status: 200).then
82
94
  .to_return(body: SECRET_WITH_KEY_XML, status: 200).then
83
95
  .to_return(body: PRIVATE_KEY_XML, status: 200)
84
96
 
85
97
  expect { subject.update }.to output(/Finished downloading secrets/).to_stdout
86
- expect(WebMock).to have_requested(:post, 'https://www.zanzitest.net/webservices/sswebservice.asmx').times(3)
98
+ expect(WebMock).to have_requested(:post, 'https://www.zanzitest.net/webservices/sswebservice.asmx').times(6)
87
99
  end
88
100
 
89
101
  it 'should reject a malformed Zanzifile' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zanzibar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.18
4
+ version: 0.1.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Davis-Cooke
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-03 00:00:00.000000000 Z
11
+ date: 2015-06-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler