diff options
author | k.kedron <k.kedron@partner.samsung.com> | 2021-06-25 14:39:39 +0200 |
---|---|---|
committer | k.kedron <k.kedron@partner.samsung.com> | 2021-06-28 13:55:02 +0200 |
commit | 107d71b96a3a12432c63297907e71cc6ad479f1b (patch) | |
tree | ea1d754e3967c78bad9e798903f883257d32a40b | |
parent | 5ec59f8ea2751b78797424e0a224b9cd6f1cf1b7 (diff) |
Fix a1pesim scripts
- update dace-cli for new DCAE NB API
- change 644 to 755 for all scripts
Issue-ID: INT-1887
Signed-off-by: Krystian Kedron <k.kedron@partner.samsung.com>
Change-Id: Id1f71235904ae8e99145c2aa2ce843042ea7ee53
-rwxr-xr-x[-rw-r--r--] | operations/dcae/dcae-cli.py | 25 | ||||
-rwxr-xr-x[-rw-r--r--] | operations/dcae/dcae.sh | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | operations/dcae/rapps.sh | 9 |
3 files changed, 21 insertions, 13 deletions
diff --git a/operations/dcae/dcae-cli.py b/operations/dcae/dcae-cli.py index 520037e..49db4f1 100644..100755 --- a/operations/dcae/dcae-cli.py +++ b/operations/dcae/dcae-cli.py @@ -13,14 +13,15 @@ https://git.onap.org/ccsdk/dashboard/tree/ccsdk-app-os/src/main/resources/swagge """ import argparse import base64 - -import requests import json -import yaml -import time import os -import sys import re +import sys +import time +from datetime import datetime + +import requests +import yaml try: from urllib.parse import quote @@ -64,10 +65,9 @@ def print_rows_formatted(matrix): print("".join(word.ljust(col_width) for word in row)) print -def epoch_2_date(epoch): - if len(epoch) > 10: - epoch = epoch[:10] - return time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(float(epoch))) + +def str_2_date(_str): + return datetime.strptime(_str, '%Y-%m-%dT%H:%M:%S.%fZ').strftime('%Y-%m-%d %H:%M:%S') def create_filter(_filter): @@ -162,7 +162,7 @@ def list_deployments(): data = [list_headers] if "items" in r_json: for dep in r_json["items"]: - row = [dep['service_id'], epoch_2_date(dep['created']), epoch_2_date(dep['modified'])] + row = [dep['id'], str_2_date(dep['created_at']), str_2_date(dep['updated_at'])] data.append(row) print_rows_formatted(data) print("Total " + str(total_items) + " deployments.") @@ -281,15 +281,16 @@ def wait_deployment(deployment_id, operation, timeout=240): def get_workflow_id(deployment_id, operation): r = executions_status(deployment_id, args.tenant) print_get_payload(r) + print("Get status for operation: %s" % operation) return get_executions_items(r, "workflow_id", operation) failed = False - result = "" op_timeout = Timeout(timeout, "deployment " + deployment_id + " operation " + operation) while True: wf = get_workflow_id(deployment_id, operation) - if not wf: + if wf: status = wf[0]["status"] + print("Operation status is %s" % status) if status in ["terminated", "failed"]: result = "SUCCESS" if status == "terminated" else "FAILED" if status == "failed": diff --git a/operations/dcae/dcae.sh b/operations/dcae/dcae.sh index 31bb334..31bb334 100644..100755 --- a/operations/dcae/dcae.sh +++ b/operations/dcae/dcae.sh diff --git a/operations/dcae/rapps.sh b/operations/dcae/rapps.sh index 9af8284..8d51f5b 100644..100755 --- a/operations/dcae/rapps.sh +++ b/operations/dcae/rapps.sh @@ -50,7 +50,14 @@ case "$operation" in rapp_filter=$2 # Create inputs. Currently the only input to be provided is database password and that is only # applicable for datacollector r-app at the moment; - . ./inputs_database_password.sh + if [[ -z ${DATABASE_PASSWORD:-} ]]; then + echo "DATABASE_PASSWORD value is missing!" + echo "Run: " + echo "\"kubectl get secret \`kubectl get secrets | grep mariadb-galera-db-root-password | awk '{print \$1}'\` -o jsonpath="{.data.password}" | base64 --decode\" in the ONAP k8s" + echo "and after that export DATABASE_PASSWORD=\${command_out}" + exit 1 + fi + deployment_inputs="database_password=${DATABASE_PASSWORD}" do_deploy() { local blueprint_file=$1 |