def get_region_from_config(ctx):
    client_config = None
    try:
        client_config = cli_util.build_config(ctx.obj)
        if 'region' not in client_config:
            return None
    except Exception:
        return None
    return client_config['region']
Example #2
0
    def __init__(self, ctx, appliance_profile):
        config_manager = ApplianceConfigManager(APPLIANCE_CONFIGS_BASE_DIR)
        appliance_config = config_manager.get_config(appliance_profile)
        self.auth_value = "{}:{}".format(APPLIANCE_AUTH_USER, appliance_config.get_access_token())
        self.serial_id = appliance_config.get_appliance_serial_id()

        config = cli_util.build_config(ctx.obj)
        host_name = appliance_config.get_appliance_url()
        self_signed_cert = "{}/{}".format(config_manager.get_config_dir(appliance_profile), APPLIANCE_CERT_FILE_NAME)
        self.nfs_dataset_client = NfsDatasetClient(
            config=config, service_endpoint=host_name, self_signed_cert=self_signed_cert)