Skip to content

Commit

Permalink
added keys customAnsibleCfg and customSlurmConf as keys that stop the…
Browse files Browse the repository at this point in the history
… automatic copying
  • Loading branch information
XaverStiensmeier committed May 6, 2024
1 parent 66ed330 commit edf4639
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions bibigrid/core/actions/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,6 @@ def get_identifier(identifier, cluster_id, additional=""):
WIREGUARD_SECURITY_GROUP_NAME = "wireguard" + SEPARATOR + "{cluster_id}"


def create_defaults():
if not os.path.isfile(a_rp.ANSIBLE_CFG_PATH):
shutil.copy(a_rp.ANSIBLE_CFG_DEFAULT_PATH, a_rp.ANSIBLE_CFG_PATH)
if not os.path.isfile(a_rp.SLURM_CONF_TEMPLATE_PATH):
shutil.copy(a_rp.SLURM_CONF_TEMPLATE_DEFAULT_PATH, a_rp.SLURM_CONF_TEMPLATE_PATH)


class Create: # pylint: disable=too-many-instance-attributes,too-many-arguments
"""
The class Create holds necessary methods to execute the Create-Action
Expand Down Expand Up @@ -108,6 +101,15 @@ def __init__(self, providers, configurations, config_path, log, debug=False, clu
"useMasterWithPublicIp", True)
self.log.debug("Keyname: %s", self.key_name)


def create_defaults(self):
if not self.configurations[0].get("customAnsibleCfg", False) or not os.path.isfile(a_rp.ANSIBLE_CFG_PATH):
shutil.copy(a_rp.ANSIBLE_CFG_DEFAULT_PATH, a_rp.ANSIBLE_CFG_PATH)
if not self.configurations[0].get("customSlurmConf", False) or not os.path.isfile(
a_rp.SLURM_CONF_TEMPLATE_PATH):
shutil.copy(a_rp.SLURM_CONF_TEMPLATE_DEFAULT_PATH, a_rp.SLURM_CONF_TEMPLATE_PATH)


def generate_keypair(self):
"""
Generates ECDSA Keypair using system-function ssh-keygen and uploads the generated public key to providers.
Expand Down Expand Up @@ -422,7 +424,7 @@ def create(self): # pylint: disable=too-many-branches,too-many-statements
try:
self.generate_keypair()
self.prepare_configurations()
create_defaults()
self.create_defaults()
self.generate_security_groups()
self.start_start_server_threads()
self.extended_network_configuration()
Expand Down

0 comments on commit edf4639

Please sign in to comment.