yosi
May 16, 2017, 7:36am
1
Hello,
My Couchbase password contains parentheses and that causes trouble with cbbackupwrapper (cbbackup works fine, though).
This is the command I’m running:
cbbackupwrapper http://HOST:8091 /backup-dir --username Administrator --password ‘xxxx(xxxxxxxx’ --mode diff --bucket-source bucket_name --single-node
This is the output:
Waiting for the backup to complete…
/bin/sh: 1: Syntax error: “(” unexpected
/bin/sh: 1: Syntax error: “(” unexpected
/bin/sh: 1: Syntax error: “(” unexpected
/bin/sh: 1: Syntax error: “(” unexpected
/bin/sh: 1: Syntax error: “(” unexpected
/bin/sh: 1: Syntax error: “(” unexpected
/bin/sh: 1: Syntax error: “(” unexpected
/bin/sh: 1: Syntax error: “(” unexpected
/bin/sh: 1: Syntax error: “(” unexpected
/bin/sh: 1: Syntax error: “(” unexpected
/bin/sh: 1: Syntax error: “(” unexpected
SUCCESSFULLY COMPLETED!
Needless to say the backup finishes too fast and isn’t completed successfully.
Ideas anyone?
avsej
May 16, 2017, 8:07am
2
It seems like a bug in the python script, it should really quote the password (and maybe other arguments) when building command line. This patch fixes the issue:
--- /opt/couchbase/lib/python/cbbackupwrapper.orig 2017-05-16 11:03:36.045523102 +0300
+++ /opt/couchbase/lib/python/cbbackupwrapper 2017-05-16 11:04:08.427692842 +0300
@@ -17,6 +17,7 @@
import threading
import time
import urllib2
+import pipes
"""Written by Daniel Owen owend@couchbase.com on 27 June 2014
Version 1.4 Last updated 10 July 2014
@@ -356,7 +357,7 @@
command_line = '"' + os.path.join(path, backup_exe) + '"' + ' -v -t 1 --vbucket-list=' \
+ ''.join(str(chunk).split()) + ' http://' + node + ':' + rest + ' ' \
+ '"' + os.path.join(backupDir, vbucketsname) + '"' + ' -u ' + args.username \
- + ' -p ' + args.password + extra_options + mode_options + ssl_option + specific_bucket \
+ + ' -p ' + pipes.quote(args.password) + extra_options + mode_options + ssl_option + specific_bucket \
+ ' 2> ' + '"' + os.path.join(backupDir, 'logs', vbucketsname) + '.err' + '"'
process_queue.put(command_line)