oc-cdtapi 3.21.2__py3-none-any.whl → 3.21.6__py3-none-any.whl
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.
- oc_cdtapi/PgQAPI.py +1 -1
- oc_cdtapi/VaultAPI.py +19 -5
- {oc_cdtapi-3.21.2.dist-info → oc_cdtapi-3.21.6.dist-info}/METADATA +1 -1
- {oc_cdtapi-3.21.2.dist-info → oc_cdtapi-3.21.6.dist-info}/RECORD +8 -8
- {oc_cdtapi-3.21.2.data → oc_cdtapi-3.21.6.data}/scripts/nexus.py +0 -0
- {oc_cdtapi-3.21.2.dist-info → oc_cdtapi-3.21.6.dist-info}/WHEEL +0 -0
- {oc_cdtapi-3.21.2.dist-info → oc_cdtapi-3.21.6.dist-info}/licenses/LICENSE +0 -0
- {oc_cdtapi-3.21.2.dist-info → oc_cdtapi-3.21.6.dist-info}/top_level.txt +0 -0
oc_cdtapi/PgQAPI.py
CHANGED
@@ -190,7 +190,7 @@ class PgQAPI (object):
|
|
190
190
|
if not queue_id:
|
191
191
|
logging.error('queue [%s] does not exist' % queue_code)
|
192
192
|
return None
|
193
|
-
ds = self.exec_select('select min(id), count(id) from queue_message where queue_type__oid = %s and status = %s', (queue_id, 'N') )
|
193
|
+
ds = self.exec_select('select min(id), count(id) from queue_message where creation_date < current_timestamp - interval \'1 minute\' and queue_type__oid = %s and status = %s', (queue_id, 'N') )
|
194
194
|
if ds[0][1] == 0:
|
195
195
|
logging.debug('currently no new messages in queue [%s]' % queue_code)
|
196
196
|
return None
|
oc_cdtapi/VaultAPI.py
CHANGED
@@ -9,14 +9,13 @@ class VaultAPI:
|
|
9
9
|
vault_enable=False,
|
10
10
|
vault_url=None,
|
11
11
|
vault_token=None,
|
12
|
-
vault_path=None,
|
13
12
|
vault_mount_point=None,
|
14
13
|
verify_ssl=True):
|
15
14
|
self.vault_enable = vault_enable or os.getenv("VAULT_ENABLE")
|
16
15
|
self.vault_url = vault_url or os.getenv("VAULT_URL")
|
17
16
|
self.vault_token = vault_token or os.getenv("VAULT_TOKEN")
|
18
|
-
self.vault_path = vault_path or os.getenv("VAULT_PATH")
|
19
17
|
self.mount_point = vault_mount_point or os.getenv("VAULT_MOUNT_POINT")
|
18
|
+
self.use_staging_secrets = os.getenv("USE_STAGING_ENVIRONMENT", "false").lower() == "true" #Check whether we have env USE_STAGING_ENVIRONMENT true or not
|
20
19
|
self.verify_ssl = verify_ssl
|
21
20
|
self._client = None
|
22
21
|
|
@@ -46,16 +45,31 @@ class VaultAPI:
|
|
46
45
|
|
47
46
|
return self._client
|
48
47
|
|
48
|
+
def parse_secret_name(self, name):
|
49
|
+
if 'USER' in name:
|
50
|
+
split_name = name.split('_USER')[0]
|
51
|
+
return split_name, 'USER'
|
52
|
+
|
53
|
+
if 'PASSWORD' in name:
|
54
|
+
split_name = name.split('_PASSWORD')[0]
|
55
|
+
return split_name, 'PASSWORD'
|
56
|
+
|
57
|
+
return 'OTHER', name
|
58
|
+
|
49
59
|
def get_secret_from_path(self, name):
|
50
60
|
client = self.client
|
51
61
|
if client is None:
|
52
62
|
return None
|
53
63
|
|
64
|
+
secret_path, credentials = self.parse_secret_name(name)
|
65
|
+
if self.use_staging_secrets:
|
66
|
+
secret_path = secret_path + "_TEST"
|
67
|
+
|
54
68
|
try:
|
55
|
-
response = client.secrets.kv.read_secret_version(path=
|
56
|
-
return response['data']['data'].get(
|
69
|
+
response = client.secrets.kv.read_secret_version(path=secret_path, mount_point=self.mount_point)
|
70
|
+
return response['data']['data'].get(credentials)
|
57
71
|
except VaultError as e:
|
58
|
-
logging.warning(f"Failed getting data from vault: {e}")
|
72
|
+
logging.warning(f"Failed getting data from vault for path {secret_path} and credentials {credentials}: {e}")
|
59
73
|
return None
|
60
74
|
|
61
75
|
def load_secret(self, name, default=None):
|
@@ -7,14 +7,14 @@ oc_cdtapi/ForemanAPI.py,sha256=9r1MSOsubiSxM1sdzF2MHD7IcSwX9Y4UDJknHqQK07g,44255
|
|
7
7
|
oc_cdtapi/JenkinsAPI.py,sha256=lZ8pe3a4eb_6h53JE7QLuzOSlu7Sqatc9PQwWhio9Vg,15748
|
8
8
|
oc_cdtapi/NexusAPI.py,sha256=uU12GtHvKlWorFaPAnFcQ5AGEc94MZ5SdmfM2Pw3F7A,26122
|
9
9
|
oc_cdtapi/PgAPI.py,sha256=URSz7qu-Ir7AOj0jI3ucTXn2PM-nC96nmPZI746OLjA,14356
|
10
|
-
oc_cdtapi/PgQAPI.py,sha256=
|
10
|
+
oc_cdtapi/PgQAPI.py,sha256=q7FjC4HGotLXg-vZ2h6VcmlWAkBMdV_B37sicDaL7PU,8720
|
11
11
|
oc_cdtapi/RundeckAPI.py,sha256=O3LmcFaHSz8UqeUyIHTTEMJncDD191Utd-iZaeJay2s,24243
|
12
12
|
oc_cdtapi/TestServer.py,sha256=HV97UWg2IK4gOYAp9yaMdwFUWsw9v66MxyZdI3qQctA,2715
|
13
|
-
oc_cdtapi/VaultAPI.py,sha256=
|
13
|
+
oc_cdtapi/VaultAPI.py,sha256=OgKS5GFDAzs_6YlAv412OzFy2Cd4H1z-KjBGKfb__tY,2838
|
14
14
|
oc_cdtapi/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
15
|
-
oc_cdtapi-3.21.
|
16
|
-
oc_cdtapi-3.21.
|
17
|
-
oc_cdtapi-3.21.
|
18
|
-
oc_cdtapi-3.21.
|
19
|
-
oc_cdtapi-3.21.
|
20
|
-
oc_cdtapi-3.21.
|
15
|
+
oc_cdtapi-3.21.6.data/scripts/nexus.py,sha256=4teqZ_KtCSrwHDJVgA7lkreteod4Xt5XJFZNbwb7E6E,6858
|
16
|
+
oc_cdtapi-3.21.6.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
17
|
+
oc_cdtapi-3.21.6.dist-info/METADATA,sha256=fttjVI1dKLAQ6ssYhpEaLkEdK7b9uiMlfD-U8I-JiMA,504
|
18
|
+
oc_cdtapi-3.21.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
19
|
+
oc_cdtapi-3.21.6.dist-info/top_level.txt,sha256=d4-5-D-0CSeSXYuLCP7-nIFCpjkfmJr-Y_muzds8iVU,10
|
20
|
+
oc_cdtapi-3.21.6.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|