2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-22 09:32:21 +00:00

Actually hook up the redact feature

This commit is contained in:
Jarrod Johnson 2017-01-30 16:12:49 -05:00
parent 9bd0b7af9d
commit 04781e0ece

View File

@ -28,7 +28,8 @@ import confluent.config.configmanager as cfm
import confluent.config.conf as conf
import confluent.main as main
argparser = optparse.OptionParser(usage="Usage: %prog [options] [dump|restore] [path]")
argparser = optparse.OptionParser(
usage="Usage: %prog [options] [dump|restore] [path]")
argparser.add_option('-p', '--password',
help='Password to use to protect/unlock a protected dump')
argparser.add_option('-r', '--redact', action='store_true',
@ -52,15 +53,15 @@ if args[0] == 'restore':
sys.exit(1)
cfm.restore_db_from_directory(dumpdir, options.password)
elif args[0] == 'dump':
if options.password is None and not options.unprotected:
if options.password is None and not (options.unprotected or options.redact):
print("Must indicate a password to protect or -u to opt opt of "
"secure value protection")
"secure value protection or -r to skip all protected data")
sys.exit(1)
os.umask(077)
main._initsecurity(conf.get_config())
if not os.path.exists(dumpdir):
os.makedirs(dumpdir)
cfm.dump_db_to_directory(dumpdir, options.password)
cfm.dump_db_to_directory(dumpdir, options.password, options.redact)