diff --git a/confluent_server/bin/confluentdbutil b/confluent_server/bin/confluentdbutil index 4ea6726f..70484e1d 100755 --- a/confluent_server/bin/confluentdbutil +++ b/confluent_server/bin/confluentdbutil @@ -34,6 +34,8 @@ import confluent.noderange as noderange argparser = optparse.OptionParser( usage="Usage: %prog [options] [dump|restore|merge] [path]\n" " %prog [-u] [-v] showattrib ...") +argparser.add_option('-d', '--directory', dest='directory', default=None, + help='Directory of binary confluent configuration, defaults to /etc/confluent/cfg') argparser.add_option('-p', '--password', help='Password to use to protect/unlock a protected dump') argparser.add_option('-i', '--interactivepassword', help='Prompt for password', @@ -86,7 +88,7 @@ def show_attrib(options, args): # otherwise the key is stored unprotected and init_masterkey unlocks it # without any password. autogen=False keeps this read-only (never create a # key). - cfm.init() + cfm.init(cfgdir=options.directory) try: main._initsecurity(conf.get_config()) if not cfm._masterkey: @@ -180,7 +182,7 @@ if args[0] in ('restore', 'merge'): password = getpass.getpass('Enter password to restore backup: ') try: stateless = args[0] == 'restore' - cfm.init(stateless) + cfm.init(stateless, cfgdir=options.directory) cfm.statelessmode = stateless skipped = {'nodes': [], 'nodegroups': []} diff --git a/confluent_server/confluent/config/configmanager.py b/confluent_server/confluent/config/configmanager.py index d24856da..2ad6cccd 100644 --- a/confluent_server/confluent/config/configmanager.py +++ b/confluent_server/confluent/config/configmanager.py @@ -3291,9 +3291,11 @@ def _init_indexes(): ConfigManager._bg_sync_to_file() -def init(stateless=False): +def init(stateless=False, cfgdir=None): global _cfgstore global _ready + if cfgdir is not None: + ConfigManager._cfgdir = cfgdir if stateless: _cfgstore = {} return