Skip to content

Commit 83cdb79

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 83cdb79

File tree

6 files changed

+18
-9
lines changed

6 files changed

+18
-9
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/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
)

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)