def before_all(context):
    """
    HOOK: To be executed before all.
        - Load project properties
        - Init Aiakos API Client
    """

    __logger__.info("Setting UP execution")

    # Load project properties.
    # The loaded properties will be available in 'configuration_manager.config' variable.
    __logger__.info("Loading project properties")
    configuration_manager.set_up_project()
    config = configuration_manager.config

    # Init Aiakos Client
    context.aiakos_client = \
        AiakosApiClient(protocol=config[PROPERTIES_CONFIG_AIAKOS][PROPERTIES_CONFIG_SERVICE_PROTOCOL],
                        host=config[PROPERTIES_CONFIG_AIAKOS][PROPERTIES_CONFIG_SERVICE_HOST],
                        port=config[PROPERTIES_CONFIG_AIAKOS][PROPERTIES_CONFIG_SERVICE_PORT],
                        base_resource=config[PROPERTIES_CONFIG_AIAKOS][PROPERTIES_CONFIG_SERVICE_RESOURCE])

    # Init remote-command client
    context.remote_executor = \
        FabricUtils(host_name=config[PROPERTIES_CONFIG_AIAKOS][PROPERTIES_CONFIG_SERVICE_HOST],
                    host_username=config[PROPERTIES_CONFIG_AIAKOS][PROPERTIES_CONFIG_SERVICE_HOST_USER],
                    host_ssh_key=config[PROPERTIES_CONFIG_AIAKOS][PROPERTIES_CONFIG_SERVICE_HOST_PKEY])
Exemple #2
0
    def __init__(self,
                 master_hostname,
                 master_username,
                 master_password,
                 configuration_file_path,
                 master_keyfile=None,
                 glancesyc_bin_path=None):
        """
        Init GlanceSync client.
        :param master_hostname (string): Hostname of Master.
        :param master_username (string): Username.
        :param master_password (string): Password.
        :param configuration_file_path (string): Path where configuration file is located
        :param master_keyfile (string): SSH private key file
        :param glancesyc_bin_path (string): Path where GlanceSyn binary are located
        :return:
        """

        self.fabric_utils = FabricUtils(master_hostname, master_username,
                                        master_password, master_keyfile)
        self.conf_file_path = configuration_file_path
        self.conf_file_backup_path = None
        self.bin_path = glancesyc_bin_path
        self.host = master_hostname