From f8f790e7fcdc8ee2787810d3b65d23f9a18a11a1 Mon Sep 17 00:00:00 2001 From: meow Date: Tue, 7 Jan 2020 22:18:13 +0500 Subject: [PATCH] nested dict doesn't play well with configparser --- uncloud/api/main.py | 4 ++-- uncloud/common/settings.py | 7 ++----- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/uncloud/api/main.py b/uncloud/api/main.py index d8beb49..e8e85fb 100644 --- a/uncloud/api/main.py +++ b/uncloud/api/main.py @@ -59,7 +59,7 @@ class CreateVM(Resource): macs = [generate_mac() for _ in range(len(data['network']))] tap_ids = [ counters.increment_etcd_counter( - shared.etcd_client, settings['etcd']['counter']['tap'] + shared.etcd_client, settings['etcd']['tap_counter'] ) for _ in range(len(data['network'])) ] @@ -470,7 +470,7 @@ class CreateNetwork(Resource): network_entry = { 'id': counters.increment_etcd_counter( - shared.etcd_client, settings['etcd']['counter']['vxlan'] + shared.etcd_client, settings['etcd']['vxlan_counter'] ), 'type': data['type'], } diff --git a/uncloud/common/settings.py b/uncloud/common/settings.py index 9db4afe..47ad5a7 100644 --- a/uncloud/common/settings.py +++ b/uncloud/common/settings.py @@ -90,10 +90,8 @@ class Settings(object): 'request_prefix': join_path(base_prefix, 'requests/'), 'user_prefix': join_path(base_prefix, 'users/'), 'vm_prefix': join_path(base_prefix, 'vms/'), - 'counter': { - 'vxlan': join_path(base_prefix, 'counters/vxlan'), - 'tap': join_path(base_prefix, 'counters/tap') - } + 'vxlan_counter': join_path(base_prefix, 'counters/vxlan'), + 'tap_counter': join_path(base_prefix, 'counters/tap') } } ) @@ -129,7 +127,6 @@ class Settings(object): self.read_values_from_etcd() except KeyError: pass - return self.config_parser[key]