forked from uncloud/uncloud
Added --conf-dir, --etcd-{host,port,ca_cert,cert_cert,cert_key} parameters to cli and settings is now accessbile through uncloud.shared.shared.settings
This commit is contained in:
parent
e6d22a73c5
commit
c3b42aabc6
19 changed files with 176 additions and 154 deletions
|
|
@ -1,7 +1,6 @@
|
|||
import os
|
||||
import argparse
|
||||
|
||||
from uncloud.common.settings import settings
|
||||
from uncloud.common.shared import shared
|
||||
|
||||
arg_parser = argparse.ArgumentParser('configure', add_help=False)
|
||||
|
|
@ -40,19 +39,19 @@ ceph_storage_parser.add_argument('--ceph-image-pool', required=True)
|
|||
|
||||
|
||||
def update_config(section, kwargs):
|
||||
uncloud_config = shared.etcd_client.get(settings.config_key, value_in_json=True)
|
||||
uncloud_config = shared.etcd_client.get(shared.settings.config_key, value_in_json=True)
|
||||
if not uncloud_config:
|
||||
uncloud_config = {}
|
||||
else:
|
||||
uncloud_config = uncloud_config.value
|
||||
|
||||
uncloud_config[section] = kwargs
|
||||
shared.etcd_client.put(settings.config_key, uncloud_config, value_in_json=True)
|
||||
shared.etcd_client.put(shared.settings.config_key, uncloud_config, value_in_json=True)
|
||||
|
||||
|
||||
def main(**kwargs):
|
||||
subcommand = kwargs.pop('subcommand')
|
||||
def main(arguments):
|
||||
subcommand = arguments['subcommand']
|
||||
if not subcommand:
|
||||
arg_parser.print_help()
|
||||
else:
|
||||
update_config(subcommand, kwargs)
|
||||
update_config(subcommand, arguments)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue