Skip to content

Commit e084c73

Browse files
jameseh96daverigby
authored andcommitted
MB-35282: Make cbvdiff use appropriate default user and bucket
Make bucket default to "default" and user default to bucket name. Follows the precedent set by cbstats. Not integrating cbvdiff with CliTool at this time due to the slightly different structure. Change-Id: Ibff1dde224ba8ad7fe5935844979f2f9a32a266b Reviewed-on: http://review.couchbase.org/113333 Tested-by: James Harrison <[email protected]> Reviewed-by: Dave Rigby <[email protected]>
1 parent 51101cb commit e084c73

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

engines/ep/management/cbvdiff

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@ def main():
1212
usage="usage: %prog ip1:memcachedport1,ip2:memcachedport2",
1313
version="%prog 1.1")
1414
parser.add_option('-b', "--bucketName", dest="bucketName",
15-
help="name of bucket. default, if unspecified")
15+
help="name of bucket. default, if unspecified",
16+
default="default")
1617
parser.add_option('-u', "--user", dest="user",
1718
help="Username for authentication")
1819
parser.add_option('-p', "--bucketPassword", dest="bucketPassword",
19-
help="password to authenticate to bucket")
20+
help="password to authenticate to bucket",
21+
default="")
2022
stat_cmd = "vbucket-details"
2123
vbstats = {}
2224
states = {}
@@ -37,15 +39,15 @@ def main():
3739
except socket.gaierror as e:
3840
print('Source %s connection error: %s' % (host, e))
3941
sys.exit(1)
40-
if options.bucketName:
41-
password = ""
42-
if options.bucketPassword:
43-
password = options.bucketPassword
44-
try:
45-
mc.sasl_auth_plain(options.user, password)
46-
except mc_bin_client.MemcachedError:
47-
print("Authentication error for %s" % options.bucketName)
48-
sys.exit(2)
42+
43+
user = options.user or options.bucketName
44+
password = options.bucketPassword
45+
46+
try:
47+
mc.sasl_auth_plain(user, password)
48+
except mc_bin_client.MemcachedError:
49+
print("Authentication error for %s" % options.bucketName)
50+
sys.exit(2)
4951
# ----- run cbstats to get the stats as a map ----
5052
mc.bucket_select(options.bucketName)
5153
try:

0 commit comments

Comments
 (0)