Skip to content

Commit

Permalink
update is now able to use gateway if given.
Browse files Browse the repository at this point in the history
  • Loading branch information
XaverStiensmeier committed Sep 20, 2023
1 parent 2b7d358 commit 5e5b151
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions bibigrid/core/actions/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 5e5b151

Please sign in to comment.