[metadata] -> configparser
This commit is contained in:
parent
cff6a4021f
commit
431a6f6d9b
1 changed files with 2 additions and 4 deletions
|
@ -3,7 +3,7 @@ import os
|
||||||
from flask import Flask, request
|
from flask import Flask, request
|
||||||
from flask_restful import Resource, Api
|
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__)
|
app = Flask(__name__)
|
||||||
api = Api(app)
|
api = Api(app)
|
||||||
|
@ -43,9 +43,7 @@ class Root(Resource):
|
||||||
if not data:
|
if not data:
|
||||||
return {'message': 'Metadata for such VM does not exists.'}, 404
|
return {'message': 'Metadata for such VM does not exists.'}, 404
|
||||||
else:
|
else:
|
||||||
|
etcd_key = os.path.join(config['etcd']['USER_PREFIX'], data.value['owner_realm'],
|
||||||
# {env_vars.get('USER_PREFIX')}/{realm}/{name}/key
|
|
||||||
etcd_key = os.path.join(env_vars.get('USER_PREFIX'), data.value['owner_realm'],
|
|
||||||
data.value['owner'], 'key')
|
data.value['owner'], 'key')
|
||||||
etcd_entry = etcd_client.get_prefix(etcd_key, value_in_json=True)
|
etcd_entry = etcd_client.get_prefix(etcd_key, value_in_json=True)
|
||||||
user_personal_ssh_keys = [key.value for key in etcd_entry]
|
user_personal_ssh_keys = [key.value for key in etcd_entry]
|
||||||
|
|
Loading…
Reference in a new issue