nested dict doesn't play well with configparser

This commit is contained in:
ahmadbilalkhalid 2020-01-07 22:18:13 +05:00
parent 5a646aeac9
commit f8f790e7fc
2 changed files with 4 additions and 7 deletions

View file

@ -59,7 +59,7 @@ class CreateVM(Resource):
macs = [generate_mac() for _ in range(len(data['network']))] macs = [generate_mac() for _ in range(len(data['network']))]
tap_ids = [ tap_ids = [
counters.increment_etcd_counter( counters.increment_etcd_counter(
shared.etcd_client, settings['etcd']['counter']['tap'] shared.etcd_client, settings['etcd']['tap_counter']
) )
for _ in range(len(data['network'])) for _ in range(len(data['network']))
] ]
@ -470,7 +470,7 @@ class CreateNetwork(Resource):
network_entry = { network_entry = {
'id': counters.increment_etcd_counter( 'id': counters.increment_etcd_counter(
shared.etcd_client, settings['etcd']['counter']['vxlan'] shared.etcd_client, settings['etcd']['vxlan_counter']
), ),
'type': data['type'], 'type': data['type'],
} }

View file

@ -90,10 +90,8 @@ class Settings(object):
'request_prefix': join_path(base_prefix, 'requests/'), 'request_prefix': join_path(base_prefix, 'requests/'),
'user_prefix': join_path(base_prefix, 'users/'), 'user_prefix': join_path(base_prefix, 'users/'),
'vm_prefix': join_path(base_prefix, 'vms/'), 'vm_prefix': join_path(base_prefix, 'vms/'),
'counter': { 'vxlan_counter': join_path(base_prefix, 'counters/vxlan'),
'vxlan': join_path(base_prefix, 'counters/vxlan'), 'tap_counter': join_path(base_prefix, 'counters/tap')
'tap': join_path(base_prefix, 'counters/tap')
}
} }
} }
) )
@ -129,7 +127,6 @@ class Settings(object):
self.read_values_from_etcd() self.read_values_from_etcd()
except KeyError: except KeyError:
pass pass
return self.config_parser[key] return self.config_parser[key]