sambot 0.1.223 → 0.1.225

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: 5096933a1f30de324555298311a65541e2e5f96c
4
- data.tar.gz: 407fa64cc091116c102c696cb31167e9b3a4eebb
3
+ metadata.gz: 181b34f8dc667713236f6eb5b977d4867b03dcb5
4
+ data.tar.gz: 73117bd92de7f49725971cb1a1a71671f48852dd
5
5
  SHA512:
6
- metadata.gz: 6abbedc56de4aa5da548d924fb6418166ca16345dd596616c5f28543f4425c932ddc7dbe07f3de7f006828a29590637d5595a60f648a61904b8bf42ffe3764b3
7
- data.tar.gz: 37662ebcdadee13a0d56c4c8e8434bb3567f11f45b0b887b9c39c56a292d37c0c2cd6f99262dd6fe44dea5545c91e163bb3e5fdece8f5869e5d10aecb3bf4e89
6
+ metadata.gz: eb5c17af4f26acf78f6409965e524ae0959cedc09b5c96d5c8f23e8770cea813f0f91446895fb8286a7be195fc29b13c05b77046a9733fd3bdfea3f0290cfb4a
7
+ data.tar.gz: 07f4af7a8f0bf13babb5293c4220543c0689490fe876871e414b9568c10ccac24d89a458af0e82e7ff7a1f5bc2f13009849c21911de175599c288dc26f921ede
@@ -0,0 +1,3 @@
1
+ c
2
+ existing_secret.data
3
+ existing_secret
@@ -0,0 +1,31 @@
1
+ name: as-ldap-server
2
+ version: 0.0.7
3
+ platforms:
4
+ - centos
5
+ identifier:
6
+ description: Installs the 389-ds directory server
7
+ dependencies:
8
+ - as-vault-token-v2
9
+ suites:
10
+ - name: default
11
+ run_list:
12
+ - recipe[as-ldap-server::default]
13
+ verifier:
14
+ inspec_tests:
15
+ - name: as-ldap-server-profile
16
+ path: controls
17
+ local_testing:
18
+ secrets:
19
+ - description: LDAP root password hash
20
+ path: dev/nightswatch/ldap/root_dn_pwd
21
+ keys:
22
+ - ssha: '{SSHA}QkYU9g2DCC8CuavASnoEQ+9i8LuePRs='
23
+ - description: GCS backup credentials
24
+ path: dev/nightswatch/gcs/backupcreds
25
+ keys:
26
+ - access_key: GOOG5AA6QCCSQ2TNKOUA
27
+ - secret_key: oKVkpPerVeMDxfj/OOYkuHXgj/tIbfejCRlPkdFF
28
+ - description: GCS backup encryption key
29
+ path: dev/nightswatch/gcs/backup_encryption_key
30
+ keys:
31
+ - value: Fj9zCPAJw9t125O
@@ -1,6 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative 'spec_helper'
4
+ require 'awesome_print'
5
+ require 'byebug'
4
6
 
5
7
  VaultHelper = Sambot::Testing::VaultHelper
6
8
  Fixtures = Sambot::Testing::Fixtures
@@ -31,6 +33,18 @@ RSpec.describe Sambot::Testing::VaultHelper do
31
33
 
32
34
  end
33
35
 
36
+ context '.load_secrets()' do
37
+
38
+ it 'can save multiple keys' do
39
+ config = Sambot::Config.read
40
+ VaultHelper.load_secrets(config)
41
+ secret = VaultHelper.read_path('dev/nightswatch/gcs/backupcreds')
42
+ expect(secret.data[:access_key]).to_not be nil
43
+ expect(secret.data[:secret_key]).to_not be nil
44
+ end
45
+
46
+ end
47
+
34
48
  context '.generate_wrapped_token()' do
35
49
 
36
50
  it 'generates the correct token' do
@@ -64,6 +64,16 @@ module Sambot
64
64
  end
65
65
  end
66
66
 
67
+ def read_path(path)
68
+ configure
69
+ Vault.logical.read(path)
70
+ end
71
+
72
+ def read_field(path, key)
73
+ configure
74
+ Vault.logical.read(path, key)
75
+ end
76
+
67
77
  private
68
78
 
69
79
  def store_secrets(secrets, src)
@@ -88,8 +98,13 @@ module Sambot
88
98
  end
89
99
 
90
100
  def write_to_vault(path, key, value)
91
- configure
92
- Vault.logical.write(path, key.to_sym => value)
101
+ existing_secret = Vault.logical.read(path)
102
+ new_value = {key.to_sym => value}
103
+ if existing_secret
104
+ UI.info("Adding the key '#{key}' to the existing path '#{path}'")
105
+ new_value = new_value.merge(existing_secret.data)
106
+ end
107
+ Vault.logical.write(path, new_value)
93
108
  end
94
109
 
95
110
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Sambot
4
- VERSION = '0.1.223'
4
+ VERSION = '0.1.225'
5
5
  end
data/sambot.gemspec CHANGED
@@ -30,6 +30,7 @@ Gem::Specification.new do |spec|
30
30
  spec.add_dependency 'teamcity-ruby-client'
31
31
  spec.add_dependency 'open4'
32
32
  spec.add_dependency 'diplomat'
33
+ spec.add_dependency 'byebug'
33
34
  spec.add_dependency 'semantic'
34
35
  spec.add_dependency 'chef', '~> 12.18'
35
36
  spec.add_dependency 'thor', '~> 0.19'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sambot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.223
4
+ version: 0.1.225
5
5
  platform: ruby
6
6
  authors:
7
7
  - Olivier Kouame
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-08 00:00:00.000000000 Z
11
+ date: 2017-08-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor-hollaback
@@ -164,6 +164,20 @@ dependencies:
164
164
  - - ">="
165
165
  - !ruby/object:Gem::Version
166
166
  version: '0'
167
+ - !ruby/object:Gem::Dependency
168
+ name: byebug
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - ">="
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ type: :runtime
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ">="
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
167
181
  - !ruby/object:Gem::Dependency
168
182
  name: semantic
169
183
  requirement: !ruby/object:Gem::Requirement
@@ -391,6 +405,8 @@ files:
391
405
  - README.md
392
406
  - bin/sambot
393
407
  - bin/setup
408
+ - integration_tests/.byebug_history
409
+ - integration_tests/.config.yml
394
410
  - integration_tests/docker-compose.yml
395
411
  - integration_tests/spec_helper.rb
396
412
  - integration_tests/vault_helper_spec.rb