cbbackupwrapper不使用包含括号的密码

时间:2017-05-16 07:40:36

标签: couchbase

我的Couchbase密码包含括号,这会导致cbbackupwrapper出现问题(但cbbackup工作正常)。

这是我正在运行的命令: cbbackupwrapper http://HOST:8091 / backup-dir --username Administrator --password' xxxx(xxxxxxxx' --mode diff --bucket-source bucket_name --single-node

这是输出:

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!

毋庸置疑,备份完成得太快,并未成功完成。

想点什么?

1 个答案:

答案 0 :(得分:1)

它似乎是python脚本中的一个错误,它应该在构建命令行时引用密码(可能还有其他参数)。此补丁修复了此问题:

--- /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)