forked from uncloud/uncloud
prefix is renamed to base_prefix, uncloud now respects base_prefix and put things under it
This commit is contained in:
parent
6046015c3d
commit
5a646aeac9
5 changed files with 21 additions and 48 deletions
|
|
@ -36,15 +36,15 @@ class Settings(object):
|
|||
|
||||
self.config_parser = CustomConfigParser(allow_no_value=True)
|
||||
self.config_parser.add_section('etcd')
|
||||
self.config_parser.set('etcd', 'prefix', '/')
|
||||
|
||||
self.config_key = join_path(self['etcd']['prefix'], '/uncloud/config/')
|
||||
self.config_parser.set('etcd', 'base_prefix', '/')
|
||||
|
||||
try:
|
||||
self.config_parser.read(self.config_file)
|
||||
except Exception as err:
|
||||
logger.error('%s', err)
|
||||
|
||||
self.config_key = join_path(self['etcd']['base_prefix'] + 'uncloud/config/')
|
||||
|
||||
self.read_internal_values()
|
||||
|
||||
def get_etcd_client(self):
|
||||
|
|
@ -78,18 +78,22 @@ class Settings(object):
|
|||
return wrapper
|
||||
|
||||
def read_internal_values(self):
|
||||
prefix = self['etcd']['prefix']
|
||||
base_prefix = self['etcd']['base_prefix']
|
||||
self.config_parser.read_dict(
|
||||
{
|
||||
'etcd': {
|
||||
'file_prefix': join_path(prefix, '/files/'),
|
||||
'host_prefix': join_path(prefix, '/hosts/'),
|
||||
'image_prefix': join_path(prefix, '/images/'),
|
||||
'image_store_prefix': join_path(prefix, '/imagestore/'),
|
||||
'network_prefix': join_path(prefix, '/networks/'),
|
||||
'request_prefix': join_path(prefix, '/requests/'),
|
||||
'user_prefix': join_path(prefix, '/users/'),
|
||||
'vm_prefix': join_path(prefix, '/vms/'),
|
||||
'file_prefix': join_path(base_prefix, 'files/'),
|
||||
'host_prefix': join_path(base_prefix, 'hosts/'),
|
||||
'image_prefix': join_path(base_prefix, 'images/'),
|
||||
'image_store_prefix': join_path(base_prefix, 'imagestore/'),
|
||||
'network_prefix': join_path(base_prefix, 'networks/'),
|
||||
'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')
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue