2
0
mirror of https://github.com/xcat2/confluent.git synced 2026-09-21 08:33:23 +00:00

Allow confluentdbutil to operate on an alternate directory

This commit is contained in:
Jarrod Johnson
2026-07-24 08:12:02 -04:00
parent 61e0524a56
commit 538a51310b
2 changed files with 7 additions and 3 deletions
+4 -2
View File
@@ -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 <noderange> <attribute>...")
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': []}
@@ -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