From 431a6f6d9bc15ccb4bd479d21ec07391ea05fe57 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 8 Dec 2019 13:32:06 +0100 Subject: [PATCH] [metadata] -> configparser --- ucloud/metadata/main.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/ucloud/metadata/main.py b/ucloud/metadata/main.py index e7cb33b..9281d7c 100644 --- a/ucloud/metadata/main.py +++ b/ucloud/metadata/main.py @@ -3,7 +3,7 @@ import os from flask import Flask, request from flask_restful import Resource, Api -from ucloud.config import etcd_client, env_vars, vm_pool +from ucloud.config import etcd_client, config, vm_pool app = Flask(__name__) api = Api(app) @@ -43,9 +43,7 @@ class Root(Resource): if not data: return {'message': 'Metadata for such VM does not exists.'}, 404 else: - - # {env_vars.get('USER_PREFIX')}/{realm}/{name}/key - etcd_key = os.path.join(env_vars.get('USER_PREFIX'), data.value['owner_realm'], + etcd_key = os.path.join(config['etcd']['USER_PREFIX'], data.value['owner_realm'], data.value['owner'], 'key') etcd_entry = etcd_client.get_prefix(etcd_key, value_in_json=True) user_personal_ssh_keys = [key.value for key in etcd_entry]