From 5e5b151469286b84c61edf4620cbc52145b670c5 Mon Sep 17 00:00:00 2001 From: XaverStiensmeier Date: Wed, 20 Sep 2023 12:27:00 +0200 Subject: [PATCH] update is now able to use gateway if given. --- bibigrid/core/actions/update.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/bibigrid/core/actions/update.py b/bibigrid/core/actions/update.py index c3492b3e..ed866a12 100644 --- a/bibigrid/core/actions/update.py +++ b/bibigrid/core/actions/update.py @@ -2,27 +2,24 @@ Module that contains methods to update the master playbook """ -import logging - from bibigrid.core.utility import ansible_commands as aC from bibigrid.core.utility.handler import ssh_handler from bibigrid.core.utility.paths import ansible_resources_path as aRP from bibigrid.core.utility.paths import bin_path as biRP from bibigrid.core.utility.handler import cluster_ssh_handler -LOG = logging.getLogger("bibigrid") - -def update(cluster_id, master_provider, master_configuration): - LOG.info("Starting update...") +def update(cluster_id, master_provider, master_configuration, log): + log.info("Starting update...") master_ip, ssh_user, used_private_key = cluster_ssh_handler.get_ssh_connection_info(cluster_id, master_provider, - master_configuration, LOG) + master_configuration, log) if master_ip and ssh_user and used_private_key: - LOG.info("Trying to update %s@%s", master_ip, ssh_user) + log.info("Trying to update %s@%s", master_ip, ssh_user) ssh_handler.execute_ssh(floating_ip=master_ip, private_key=used_private_key, username=ssh_user, + log=log, + gateway=master_configuration.get("gateway", {}), commands=[aC.EXECUTE], filepaths=[(aRP.PLAYBOOK_PATH, aRP.PLAYBOOK_PATH_REMOTE), (biRP.BIN_PATH, biRP.BIN_PATH_REMOTE)]) return 0 - return 1