From 228b917116270c0566eeb73fb0a9864111c5eb27 Mon Sep 17 00:00:00 2001 From: mischa Date: Mon, 20 Jun 2022 22:13:58 +0200 Subject: [PATCH] move service and instance credential id to config file, timestamp credential name --- example.cnf | 3 +++ push.py | 9 ++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/example.cnf b/example.cnf index 5c2ac9f..29c2ec4 100644 --- a/example.cnf +++ b/example.cnf @@ -2,3 +2,6 @@ ALKIRA_TENANT = mytenant.preprod.alkira3.net ALKIRA_USERNAME = ALKIRA_PASSWORD = +[services] +SERVICE_USERNAME = admin +SERVICE_PASSWORD = Blabla123 diff --git a/push.py b/push.py index b9afc19..a0abb6d 100755 --- a/push.py +++ b/push.py @@ -68,6 +68,8 @@ ALKIRA_TENANT = alkira.get('alkira', 'ALKIRA_TENANT') ALKIRA_USERNAME = alkira.get('alkira', 'ALKIRA_USERNAME') ALKIRA_PASSWORD = alkira.get('alkira', 'ALKIRA_PASSWORD') ALKIRA_BASE_URI = f'https://{ALKIRA_TENANT}/api' +SERVICE_USERNAME = alkira.get('services', 'SERVICE_USERNAME') +SERVICE_PASSWORD = alkira.get('services', 'SERVICE_PASSWORD') # Connector config if not os.path.isfile(CONNECTOR_CONFIG): @@ -148,12 +150,13 @@ def alkira_delete(session, uri): return response def alkira_service(session, connector_name): + fwcredential = f'fwcredential-{time.time()}' body = { "credentials": { - "userName": "admin", - "password": "Blabla123" + "userName": SERVICE_USERNAME, + "password": SERVICE_PASSWORD }, - "name": "fwcredentials00" + "name": fwcredential } logging.debug(f'Received Connector: {connector_name}') logging.info('=== Create Credentials')