Skip to content

Commit 6ffcc2f

Browse files
committed
replace vault ref separator
- replace ":" to "=" as vault separator (vault|engine=secret|path=fake_path|attr=attr_name). - Add functional job
1 parent 1058119 commit 6ffcc2f

File tree

9 files changed

+20
-13
lines changed

9 files changed

+20
-13
lines changed

.zuul.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,16 @@
3131
jobs:
3232
- otc-tox-pep8
3333
- otc-tox-py38
34+
- otc-tox-functional
3435
- apimon-build-image
3536
check-post:
3637
jobs:
3738
- apimon-upload-image
3839
gate:
3940
jobs:
4041
- otc-tox-pep8
42+
- otc-tox-py38
43+
- otc-tox-functional
4144
- apimon-upload-image
4245
release:
4346
jobs:

apimon/lib/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def expand_vars(value, vault_client=None):
5656
return value
5757
try:
5858
pairs = value.split('|')
59-
dt = {k: v for k, v in [x.split(':') for x in pairs[1:]]}
59+
dt = {k: v for k, v in [x.split('=') for x in pairs[1:]]}
6060
if dt['engine'] == 'secret':
6161
data = vault_client.secrets.kv.v2.read_secret(
6262
path=dt['path']

apimon/tests/functional/lib/test_config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ def test_get_cloud_with_vault(self):
4949
name='vault_cloud',
5050
data=dict(
5151
auth=dict(
52-
username="vault|engine:secret|path:usr1|attr:username",
53-
password="vault|engine:secret|path:usr1|attr:password"
52+
username="vault|engine=secret|path=usr1|attr=username",
53+
password="vault|engine=secret|path=usr1|attr=password"
5454
)
5555
)
5656
)

apimon/tests/functional/lib/test_utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def test_expand_vars_vault(self):
3333
self.assertEqual(
3434
'bar',
3535
utils.expand_vars(
36-
'vault|engine:secret|path:usr1|attr:password',
36+
'vault|engine=secret|path=usr1|attr=password',
3737
vault_client)
3838
)
3939

@@ -55,9 +55,9 @@ def test_expand_dict(self):
5555
)
5656
)
5757
struct = {
58-
'foo': 'vault|engine:secret|path:fake|attr:foo',
58+
'foo': 'vault|engine=secret|path=fake|attr=foo',
5959
'inline': {
60-
'foo2': 'vault|engine:secret|path:fake2|attr:foo'
60+
'foo2': 'vault|engine=secret|path=fake2|attr=foo'
6161
}
6262
}
6363

apimon/tests/unit/executor/test_server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ def __get_cloud_config(self, job):
315315
json.dumps({
316316
'_version': 0,
317317
'clouds': {
318-
'a': 'vault|engine:secret|path:fake|attr:foo'
318+
'a': 'vault|engine=secret|path=fake|attr=foo'
319319
}
320320
})
321321
)

apimon/tests/unit/lib/test_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,6 @@ def test_expand_vars_vault(self):
4747
self.assertEqual(
4848
'bar',
4949
utils.expand_vars(
50-
'vault|engine:secret|path:fake_path|attr:attr_name',
50+
'vault|engine=secret|path=fake_path|attr=attr_name',
5151
fake_client)
5252
)

etc/apimon.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ clouds:
4141
auth_url: https://my_url
4242
project_name: test_proj
4343
user_domain_name: TEST_DOMAIN
44-
username: "vault|engine:secrets|path:path|attr:attr"
44+
username: "vault|engine=secrets|path=path|attr=attr"
4545
password: password
4646
additional_metric_tags:
4747
environment: production

etc/secure.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
---
22
vault:
33
addr: http://localhost:8200
4-
# role_id: some_role
5-
#secret_id: "top_secret!123"
64
token: "root"
75
additional_vars:
86
foo: bar

tox.ini

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[tox]
2-
minversion = 3.6
2+
minversion = 3.8
33
skipsdist = True
4-
envlist = pep8,py37
4+
envlist = pep8,py39
55
ignore_basepython_conflict = True
66

77
[testenv]
@@ -18,6 +18,12 @@ deps =
1818
commands = stestr run {posargs}
1919
stestr slowest
2020

21+
[testenv:functional]
22+
setenv =
23+
{[testenv]setenv}
24+
commands = stestr --test-path ./apimon/tests/functional/ run --serial {posargs}
25+
stestr slowest
26+
2127
[testenv:pep8]
2228
install_command = pip install {opts} {packages}
2329
commands =

0 commit comments

Comments
 (0)