Use run dir instead of tmp

This commit also logs a message to handle the exception during the
node checks.

Fixes https://github.com/redhat-chaos/krkn/issues/356, https://github.com/redhat-chaos/krkn/issues/357
This commit is contained in:
Naga Ravi Chaitanya Elluri
2022-11-08 15:18:59 -05:00
parent 6ccc16a0ab
commit 1c207538b6
2 changed files with 7 additions and 6 deletions

View File

@@ -73,8 +73,9 @@ def check_service_status(node, service, ssh_private_key, timeout):
)
if connection is None:
break
except Exception:
pass
except Exception as e:
logging.error("Failed to ssh to instance: %s within the timeout duration of %s: %s" % (node, timeout, e))
for service_name in service:
logging.info("Checking status of Service: %s" % (service_name))
stdin, stdout, stderr = ssh.exec_command(

View File

@@ -7,19 +7,19 @@ import sys
# Installs a mutable grafana on the Kubernetes/OpenShift cluster and loads the performance dashboards
def setup(repo, distribution):
if distribution == "kubernetes":
command = "cd /tmp/performance-dashboards/dittybopper && ./k8s-deploy.sh"
command = "cd performance-dashboards/dittybopper && ./k8s-deploy.sh"
elif distribution == "openshift":
command = "cd /tmp/performance-dashboards/dittybopper && ./deploy.sh"
command = "cd performance-dashboards/dittybopper && ./deploy.sh"
else:
logging.error("Provided distribution: %s is not supported" % (distribution))
sys.exit(1)
delete_repo = "rm -rf /tmp/performance-dashboards || exit 0"
delete_repo = "rm -rf performance-dashboards || exit 0"
logging.info("Cloning, installing mutable grafana on the cluster and loading the dashboards")
try:
# delete repo to clone the latest copy if exists
subprocess.run(delete_repo, shell=True, universal_newlines=True, timeout=45)
# clone the repo
git.Repo.clone_from(repo, "/tmp/performance-dashboards")
git.Repo.clone_from(repo, "performance-dashboards")
# deploy performance dashboards
subprocess.run(command, shell=True, universal_newlines=True)
except Exception as e: