diff --git a/enoslib/infra/enos_g5k/configuration.py b/enoslib/infra/enos_g5k/configuration.py index 8df7094e74ae4af4e9d58cd569178fe3e8b86ca4..7e2a4ca6b59fbaaef5ab98a0aa8e5bf89140cd4a 100644 --- a/enoslib/infra/enos_g5k/configuration.py +++ b/enoslib/infra/enos_g5k/configuration.py @@ -15,6 +15,7 @@ class Configuration(BaseConfiguration): self.env_name = DEFAULT_ENV_NAME self.job_name = DEFAULT_JOB_NAME self.job_type = DEFAULT_JOB_TYPE + self.key = None self.oargrid_jobid = None self.oar_jobid = None self.oar_site = None diff --git a/enoslib/infra/enos_g5k/constants.py b/enoslib/infra/enos_g5k/constants.py index 308be062f83b57dfe66f8bc87bfa8c38b1159426..086281ec49e86a8d00fbe7575d5d13ab561b8f68 100644 --- a/enoslib/infra/enos_g5k/constants.py +++ b/enoslib/infra/enos_g5k/constants.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +from pathlib import Path JOB_TYPE_DEPLOY = "deploy" DEFAULT_ENV_NAME = "debian9-x64-nfs" @@ -7,5 +8,6 @@ DEFAULT_JOB_TYPE = JOB_TYPE_DEPLOY DEFAULT_QUEUE = "default" DEFAULT_WALLTIME = "02:00:00" DEFAULT_NUMBER = 1 +DEFAULT_SSH_KEYFILE = Path.home().joinpath(".ssh", "id_rsa.pub") NAMESERVER = "dns.grid5000.fr" diff --git a/enoslib/infra/enos_g5k/utils.py b/enoslib/infra/enos_g5k/utils.py index eefc0cd3c49711492f58beed4fd5aa19445eeb65..369c3e6ed74a57c6c48a8938a011a27f03ea869d 100644 --- a/enoslib/infra/enos_g5k/utils.py +++ b/enoslib/infra/enos_g5k/utils.py @@ -1,10 +1,8 @@ # -*- coding: utf-8 -*- from collections import defaultdict -from pathlib import Path import copy import logging -import os import time from execo import Host @@ -13,7 +11,7 @@ import execo_g5k.api_utils as api from netaddr import IPAddress, IPNetwork, IPSet from enoslib.errors import EnosError -from enoslib.infra.enos_g5k import remote +from enoslib.infra.enos_g5k import remote, constants from enoslib.infra.enos_g5k.error import (MissingNetworkError, NotEnoughNodesError) from enoslib.infra.enos_g5k.schema import (PROD, KAVLAN_GLOBAL, KAVLAN_LOCAL, @@ -342,7 +340,7 @@ def grid_deploy(gk, site, nodes, force_deploy, options): environment = options.pop("env_name") options.update(environment=environment) options.update(nodes=nodes) - key_path = Path.home().joinpath(".ssh", "id_rsa.pub") + key_path = constants.DEFAULT_SSH_KEYFILE options.update(key=key_path.read_text()) logger.info("Deploying %s with options %s" % (nodes, options)) deployment = gk.sites[site].deployments.create(options)