本文整理汇总了Python中remote.remote_util.RemoteMachineShellConnection.execute_couchbase_cli方法的典型用法代码示例。如果您正苦于以下问题:Python RemoteMachineShellConnection.execute_couchbase_cli方法的具体用法?Python RemoteMachineShellConnection.execute_couchbase_cli怎么用?Python RemoteMachineShellConnection.execute_couchbase_cli使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类remote.remote_util.RemoteMachineShellConnection
的用法示例。
在下文中一共展示了RemoteMachineShellConnection.execute_couchbase_cli方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testClusterInit
# 需要导入模块: from remote.remote_util import RemoteMachineShellConnection [as 别名]
# 或者: from remote.remote_util.RemoteMachineShellConnection import execute_couchbase_cli [as 别名]
def testClusterInit(self):
cluster_init_username = self.input.param("cluster_init_username", "Administrator")
cluster_init_password = self.input.param("cluster_init_password", "password")
cluster_init_port = self.input.param("cluster_init_port", 8091)
cluster_init_ramsize = self.input.param("cluster_init_ramsize", 300)
command_init = self.input.param("command_init", "cluster-init")
param_prefix = self.input.param("param_prefix", "--cluster-init")
server = self.servers[-1]
remote_client = RemoteMachineShellConnection(server)
rest = RestConnection(server)
rest.force_eject_node()
self.sleep(5)
try:
cli_command = command_init
options = "--cluster-init-username={0} {1}-password={2} {3}-port={4} {5}-ramsize={6}".\
format(cluster_init_username, param_prefix, cluster_init_password, param_prefix, cluster_init_port, param_prefix, cluster_init_ramsize)
output, error = remote_client.execute_couchbase_cli(cli_command=cli_command, options=options, cluster_host="localhost", user="Administrator", password="password")
self.assertEqual(output[0], "SUCCESS: init localhost")
options = "{0}-username={1} {2}-password={3} {4}-port={5}".\
format(param_prefix, cluster_init_username + "1", param_prefix, cluster_init_password + "1", param_prefix, str(cluster_init_port)[:-1] + "9")
output, error = remote_client.execute_couchbase_cli(cli_command=cli_command, options=options, cluster_host="localhost", user=cluster_init_username, password=cluster_init_password)
# MB-8202 cluster-init/edit doesn't provide status
self.assertTrue(output == [])
server.rest_username = cluster_init_username + "1"
server.rest_password = cluster_init_password + "1"
server.port = str(cluster_init_port)[:-1] + "9"
cli_command = "server-list"
output, error = remote_client.execute_couchbase_cli(cli_command=cli_command, cluster_host="localhost", cluster_port=str(cluster_init_port)[:-1] + "9", user=cluster_init_username + "1", password=cluster_init_password + "1")
self.assertTrue("{0} healthy active".format(str(cluster_init_port)[:-1] + "9") in output[0])
server_info = self._get_cluster_info(remote_client, cluster_port=server.port, user=server.rest_username, password=server.rest_password)
result = server_info["otpNode"] + " " + server_info["hostname"] + " " + server_info["status"] + " " + server_info["clusterMembership"]
self.assertTrue("{0} healthy active".format(str(cluster_init_port)[:-1] + "9") in result)
cli_command = command_init
options = "{0}-username={1} {2}-password={3} {4}-port={5}".\
format(param_prefix, cluster_init_username, param_prefix, cluster_init_password, param_prefix, cluster_init_port)
output, error = remote_client.execute_couchbase_cli(cli_command=cli_command, options=options, cluster_host="localhost", cluster_port=str(cluster_init_port)[:-1] + "9", user=(cluster_init_username + "1"), password=cluster_init_password + "1")
# MB-8202 cluster-init/edit doesn't provide status
self.assertTrue(output == [])
server.rest_username = cluster_init_username
server.rest_password = cluster_init_password
server.port = cluster_init_port
remote_client = RemoteMachineShellConnection(server)
cli_command = "server-list"
output, error = remote_client.execute_couchbase_cli(cli_command=cli_command, cluster_host="localhost", user=cluster_init_username, password=cluster_init_password)
self.assertTrue("{0} healthy active".format(str(cluster_init_port)) in output[0])
server_info = self._get_cluster_info(remote_client, cluster_port=server.port, user=server.rest_username, password=server.rest_password)
result = server_info["otpNode"] + " " + server_info["hostname"] + " " + server_info["status"] + " " + server_info["clusterMembership"]
self.assertTrue("{0} healthy active".format(str(cluster_init_port)) in result)
remote_client.disconnect()
finally:
rest = RestConnection(server)
rest.force_eject_node()
self.sleep(5)
rest.init_cluster()
示例2: testXDCRSetup
# 需要导入模块: from remote.remote_util import RemoteMachineShellConnection [as 别名]
# 或者: from remote.remote_util.RemoteMachineShellConnection import execute_couchbase_cli [as 别名]
def testXDCRSetup(self):
'''xdcr-setup OPTIONS:
--create create a new xdcr configuration
--edit modify existed xdcr configuration
--delete delete existed xdcr configuration
--xdcr-cluster-name=CLUSTERNAME cluster name
--xdcr-hostname=HOSTNAME remote host name to connect to
--xdcr-username=USERNAME remote cluster admin username
--xdcr-password=PASSWORD remtoe cluster admin password'''
remote_client = RemoteMachineShellConnection(self.master)
try:
#rest = RestConnection(self.master)
#xdcr_cluster_name & xdcr_hostname=the number of server in ini file to add to master as replication
xdcr_cluster_name = self.input.param("xdcr-cluster-name", None)
xdcr_hostname = self.input.param("xdcr-hostname", None)
xdcr_username = self.input.param("xdcr-username", None)
xdcr_password = self.input.param("xdcr-password", None)
output_error = ""
ip = None
if xdcr_cluster_name is not None:
ip = self.servers[xdcr_cluster_name].ip
# if ip is not None:
# output_error = 'SUCCESS: init {0}'.format(ip)
output_error = self.input.param("output_error", 'SUCCESS: init HOSTIP').replace(";", ",")
if ip is not None:
output_error = output_error.replace("HOSTIP", ip)
cli_command = "xdcr-setup"
options = "--create"
options += (" --xdcr-cluster-name={0}".format(ip), "")[xdcr_cluster_name is None]
if xdcr_hostname is not None:
options += " --xdcr-hostname={0}".format(self.servers[xdcr_hostname].ip)
options += (" --xdcr-username={0}".format(xdcr_username), "")[xdcr_username is None]
options += (" --xdcr-password={0}".format(xdcr_password), "")[xdcr_password is None]
output, error = remote_client.execute_couchbase_cli(cli_command=cli_command, options=options, cluster_host="localhost", user="Administrator", password="password")
self.assertEqual([s.rstrip() for s in output], [s for s in output_error.split(',')])
if "SUCCESS: init" in output_error:
#MB-8570 add verification when will be fixed
options = options.replace("--create ", "--edit ")
output, error = remote_client.execute_couchbase_cli(cli_command=cli_command, options=options, cluster_host="localhost", user="Administrator", password="password")
if "SUCCESS: init" in output_error and xdcr_cluster_name is None:
#MB-8573 couchbase-cli: quotes are not supported when try to remove remote xdcr cluster that has white spaces in the name
options = "--delete --xdcr-cluster-name={0}".format("remote%20cluster")
else:
options = "--delete --xdcr-cluster-name={0}".format(self.servers[xdcr_cluster_name].ip)
output, error = remote_client.execute_couchbase_cli(cli_command=cli_command, options=options, cluster_host="localhost", user="Administrator", password="password")
if "SUCCESS: init" in output_error:
self.assertEqual(output, ["SUCCESS: delete {0}".format(self.servers[xdcr_cluster_name].ip)])
else:
self.assertEqual(output, ["ERROR: unable to delete xdcr remote site localhost (404) Object Not Found", "unknown remote cluster"])
finally:
remote_client.disconnect()
self._teardown_xdcr()
示例3: testBucketModification
# 需要导入模块: from remote.remote_util import RemoteMachineShellConnection [as 别名]
# 或者: from remote.remote_util.RemoteMachineShellConnection import execute_couchbase_cli [as 别名]
def testBucketModification(self):
cli_command = "bucket-edit"
bucket_type = self.input.param("bucket_type", "couchbase")
bucket_password = self.input.param("bucket_password", None)
bucket_port = self.input.param("bucket_port", 11211)
enable_flush = self.input.param("enable_flush", None)
bucket_port_new = self.input.param("bucket_port_new", None)
bucket_password_new = self.input.param("bucket_password_new", None)
bucket_ramsize_new = self.input.param("bucket_ramsize_new", None)
enable_flush_new = self.input.param("enable_flush_new", None)
enable_index_replica_new = self.input.param("enable_index_replica_new", None)
bucket_ramsize_new = self.input.param("bucket_ramsize_new", None)
bucket = self.input.param("bucket", "default")
bucket_ramsize = self.input.param("bucket_ramsize", 200)
bucket_replica = self.input.param("bucket_replica", 1)
enable_flush = self.input.param("enable_flush", None)
enable_index_replica = self.input.param("enable_index_replica", None)
wait = self.input.param("wait", False)
remote_client = RemoteMachineShellConnection(self.master)
self._create_bucket(remote_client, bucket, bucket_type=bucket_type, bucket_port=bucket_port, bucket_password=bucket_password, \
bucket_ramsize=bucket_ramsize, bucket_replica=bucket_replica, wait=wait, enable_flush=enable_flush, enable_index_replica=enable_index_replica)
cli_command = "bucket-edit"
options = "--bucket={0}".format(bucket)
options += (" --enable-flush={0}".format(enable_flush_new), "")[enable_flush_new is None]
options += (" --enable-index-replica={0}".format(enable_index_replica_new), "")[enable_index_replica_new is None]
options += (" --bucket-port={0}".format(bucket_port_new), "")[bucket_port_new is None]
options += (" --bucket-password={0}".format(bucket_password_new), "")[bucket_password_new is None]
options += (" --bucket-ramsize={0}".format(bucket_ramsize_new), "")[bucket_ramsize_new is None]
output, error = remote_client.execute_couchbase_cli(cli_command=cli_command, options=options, cluster_host="localhost", user=self.ldapUser, password=self.ldapPass)
expectedResults = {'bucket_name':'BBB', 'ram_quota':465567744, 'num_replicas':1,
'replica_index':True, 'eviction_policy':'value_only', 'type':'membase', \
'auth_type':'none', "autocompaction":'false', "purge_interval":"undefined", \
"flush_enabled":True, "num_threads":3, "source":self.source, \
"user":self.ldapUser, "ip":'127.0.0.1', "port":57457, 'sessionid':'',
"moxi_port":1224 }
self.checkConfig(8202, self.master, expectedResults)
cli_command = "bucket-flush --force"
options = "--bucket={0}".format(bucket)
if enable_flush_new is not None:
output, error = remote_client.execute_couchbase_cli(cli_command=cli_command, options=options, cluster_host="localhost", user=self.ldapUser, password=self.ldapPass)
expectedResults = {"bucket_name":"BBB", "source":self.source, "user":self.ldapUser, "ip":"127.0.0.1", 'port':57457}
self.checkConfig(8204, self.master, expectedResults)
cli_command = "bucket-delete"
output, error = remote_client.execute_couchbase_cli(cli_command=cli_command, options=options, cluster_host="localhost", user=self.ldapUser, password=self.ldapPass)
expectedResults = {"bucket_name":"BBB", "source":self.source, "user":self.ldapUser, "ip":"127.0.0.1", "port":57457}
self.checkConfig(8203, self.master, expectedResults)
remote_client.disconnect()
示例4: testInfoCommands
# 需要导入模块: from remote.remote_util import RemoteMachineShellConnection [as 别名]
# 或者: from remote.remote_util.RemoteMachineShellConnection import execute_couchbase_cli [as 别名]
def testInfoCommands(self):
remote_client = RemoteMachineShellConnection(self.master)
cli_command = "server-list"
output, error = remote_client.execute_couchbase_cli(cli_command=cli_command, cluster_host="localhost", user="Administrator", password="password")
server_info = self._get_cluster_info(remote_client)
result = server_info["otpNode"] + " " + server_info["hostname"] + " " + server_info["status"] + " " + server_info["clusterMembership"]
self.assertEqual(result, "[email protected]{0} {0}:8091 healthy active".format("127.0.0.1"))
cli_command = "bucket-list"
output, error = remote_client.execute_couchbase_cli(cli_command=cli_command, cluster_host="localhost", user="Administrator", password="password")
self.assertEqual([], output)
remote_client.disconnect()
示例5: testBucketModification
# 需要导入模块: from remote.remote_util import RemoteMachineShellConnection [as 别名]
# 或者: from remote.remote_util.RemoteMachineShellConnection import execute_couchbase_cli [as 别名]
def testBucketModification(self):
if self.role in ['replication_admin','views_admin[*]']:
result = "Forbidden"
elif self.role in ['admin','cluster_admin','bucket_admin[*]']:
result = 'SUCCESS'
cli_command = "bucket-edit"
bucket_type = self.input.param("bucket_type", "couchbase")
enable_flush = self.input.param("enable_flush", None)
bucket_port_new = self.input.param("bucket_port_new", None)
bucket_password_new = self.input.param("bucket_password_new", None)
bucket_ramsize_new = self.input.param("bucket_ramsize_new", None)
enable_flush_new = self.input.param("enable_flush_new", None)
enable_index_replica_new = self.input.param("enable_index_replica_new", None)
bucket_ramsize_new = self.input.param("bucket_ramsize_new", None)
bucket = self.input.param("bucket", "default")
bucket_ramsize = self.input.param("bucket_ramsize", 200)
bucket_replica = self.input.param("bucket_replica", 1)
enable_flush = self.input.param("enable_flush", None)
enable_index_replica = self.input.param("enable_index_replica", None)
wait = self.input.param("wait", False)
remote_client = RemoteMachineShellConnection(self.master)
self._create_bucket(remote_client, bucket, bucket_type=bucket_type, bucket_ramsize=bucket_ramsize,
bucket_replica=bucket_replica, wait=wait, enable_flush=enable_flush,
enable_index_replica=enable_index_replica,user="Administrator",password='password')
cli_command = "bucket-edit"
options = "--bucket={0}".format(bucket)
options += (" --enable-flush={0}".format(enable_flush_new), "")[enable_flush_new is None]
options += (" --enable-index-replica={0}".format(enable_index_replica_new), "")[enable_index_replica_new is None]
#options += (" --bucket-port={0}".format(bucket_port_new), "")[bucket_port_new is None]
options += (" --bucket-ramsize={0}".format(bucket_ramsize_new), "")[bucket_ramsize_new is None]
output, error = remote_client.execute_couchbase_cli(cli_command=cli_command, options=options, cluster_host="localhost", user=self.ldapUser, password=self.ldapPass)
self._validate_roles(output,result)
cli_command = "bucket-flush --force"
options = "--bucket={0}".format(bucket)
if enable_flush_new is not None:
output, error = remote_client.execute_couchbase_cli(cli_command=cli_command, options=options, cluster_host="localhost", user=self.ldapUser, password=self.ldapPass)
self._validate_roles(output,result)
cli_command = "bucket-delete"
output, error = remote_client.execute_couchbase_cli(cli_command=cli_command, options=options, cluster_host="localhost", user=self.ldapUser, password=self.ldapPass)
expectedResults = {"bucket_name":"BBB", "source":self.source, "user":self.ldapUser, "ip":"127.0.0.1", "port":57457}
self._validate_roles(output,result)
remote_client.disconnect()
示例6: testStartStopRebalance
# 需要导入模块: from remote.remote_util import RemoteMachineShellConnection [as 别名]
# 或者: from remote.remote_util.RemoteMachineShellConnection import execute_couchbase_cli [as 别名]
def testStartStopRebalance(self):
nodes_add = self.input.param("nodes_add", 1)
nodes_rem = self.input.param("nodes_rem", 1)
remote_client = RemoteMachineShellConnection(self.master)
cli_command = "rebalance-status"
output, error = remote_client.execute_couchbase_cli(cli_command=cli_command, cluster_host="localhost", user="Administrator", password="password")
self.assertEqual(output, ["(u'none', None)"])
cli_command = "server-add"
for num in xrange(nodes_add):
options = "--server-add={0}:8091 --server-add-username=Administrator --server-add-password=password".format(self.servers[num + 1].ip)
output, error = remote_client.execute_couchbase_cli(cli_command=cli_command, options=options, cluster_host="localhost", user="Administrator", password="password")
self.assertEqual(output, ["SUCCESS: server-add {0}:8091".format(self.servers[num + 1].ip)])
cli_command = "rebalance-status"
output, error = remote_client.execute_couchbase_cli(cli_command=cli_command, cluster_host="localhost", user="Administrator", password="password")
self.assertEqual(output, ["(u'none', None)"])
self._create_bucket(remote_client)
cli_command = "rebalance"
t = Thread(target=remote_client.execute_couchbase_cli, name="rebalance_after_add",
args=(cli_command, "localhost", '', None, "Administrator", "password"))
t.start()
self.sleep(5)
cli_command = "rebalance-status"
output, error = remote_client.execute_couchbase_cli(cli_command=cli_command, cluster_host="localhost", user="Administrator", password="password")
self.assertEqual(output, ["(u'running', None)"])
t.join()
cli_command = "rebalance"
for num in xrange(nodes_rem):
options = "--server-remove={0}:8091".format(self.servers[nodes_add - num].ip)
t = Thread(target=remote_client.execute_couchbase_cli, name="rebalance_after_add",
args=(cli_command, "localhost", options, None, "Administrator", "password"))
t.start()
self.sleep(5)
cli_command = "rebalance-status"
output, error = remote_client.execute_couchbase_cli(cli_command=cli_command, cluster_host="localhost", user="Administrator", password="password")
self.assertEqual(output, ["(u'running', None)"])
cli_command = "rebalance-stop"
output, error = remote_client.execute_couchbase_cli(cli_command=cli_command, cluster_host="localhost", user="Administrator", password="password")
t.join()
cli_command = "rebalance"
output, error = remote_client.execute_couchbase_cli(cli_command=cli_command, cluster_host="localhost", user="Administrator", password="password")
self.assertEqual(output[1], "SUCCESS: rebalanced cluster")
cli_command = "rebalance-status"
output, error = remote_client.execute_couchbase_cli(cli_command=cli_command, cluster_host="localhost", user="Administrator", password="password")
self.assertEqual(output, ["(u'none', None)"])
remote_client.disconnect()
示例7: _download_node_cert
# 需要导入模块: from remote.remote_util import RemoteMachineShellConnection [as 别名]
# 或者: from remote.remote_util.RemoteMachineShellConnection import execute_couchbase_cli [as 别名]
def _download_node_cert(self,server):
cli_command = 'ssl-manage'
options = "--node-cert-info"
remote_client = RemoteMachineShellConnection(server)
output, error = remote_client.execute_couchbase_cli(cli_command=cli_command, \
options=options, cluster_host=server.ip + ":8091", user=self.ldapUser, password=self.ldapPass)
return output, error
示例8: execute_admin_role_manage
# 需要导入模块: from remote.remote_util import RemoteMachineShellConnection [as 别名]
# 或者: from remote.remote_util.RemoteMachineShellConnection import execute_couchbase_cli [as 别名]
def execute_admin_role_manage(self, options):
cli_command = 'user-manage'
options = options
remote_client = RemoteMachineShellConnection(self.master)
output, error = remote_client.execute_couchbase_cli(cli_command=cli_command, \
options=options, cluster_host="localhost", user=self.ldapUser, password=self.ldapPass)
return output, error
示例9: test_enableDisableLdap
# 需要导入模块: from remote.remote_util import RemoteMachineShellConnection [as 别名]
# 或者: from remote.remote_util.RemoteMachineShellConnection import execute_couchbase_cli [as 别名]
def test_enableDisableLdap(self):
rest = RestConnection(self.master)
remote_client = RemoteMachineShellConnection(self.master)
origState = rest.ldapRestOperationGetResponse()['enabled']
cli_command = 'setting-ldap'
options = "--ldap-enable=0"
output, error = remote_client.execute_couchbase_cli(cli_command=cli_command, \
options=options, cluster_host="localhost", user=self.ldapUser, password=self.ldapPass)
tempStatus = rest.ldapRestOperationGetResponse()['enabled']
self.assertFalse(tempStatus, "Issues with setting LDAP enable/disable")
cli_command = 'setting-ldap'
options = "--ldap-enable=1"
output, error = remote_client.execute_couchbase_cli(cli_command=cli_command, \
options=options, cluster_host="localhost", user="Administrator", password="password")
tempStatus = rest.ldapRestOperationGetResponse()['enabled']
self.assertTrue(tempStatus, "Issues with setting LDAP enable/disable")
示例10: testSettingCompacttion
# 需要导入模块: from remote.remote_util import RemoteMachineShellConnection [as 别名]
# 或者: from remote.remote_util.RemoteMachineShellConnection import execute_couchbase_cli [as 别名]
def testSettingCompacttion(self):
'''setting-compacttion OPTIONS:
--compaction-db-percentage=PERCENTAGE at which point database compaction is triggered
--compaction-db-size=SIZE[MB] at which point database compaction is triggered
--compaction-view-percentage=PERCENTAGE at which point view compaction is triggered
--compaction-view-size=SIZE[MB] at which point view compaction is triggered
--compaction-period-from=HH:MM allow compaction time period from
--compaction-period-to=HH:MM allow compaction time period to
--enable-compaction-abort=[0|1] allow compaction abort when time expires
--enable-compaction-parallel=[0|1] allow parallel compaction for database and view'''
compaction_db_percentage = self.input.param("compaction-db-percentage", None)
compaction_db_size = self.input.param("compaction-db-size", None)
compaction_view_percentage = self.input.param("compaction-view-percentage", None)
compaction_view_size = self.input.param("compaction-view-size", None)
compaction_period_from = self.input.param("compaction-period-from", None)
compaction_period_to = self.input.param("compaction-period-to", None)
enable_compaction_abort = self.input.param("enable-compaction-abort", None)
enable_compaction_parallel = self.input.param("enable-compaction-parallel", None)
bucket = self.input.param("bucket", "default")
output = self.input.param("output", '')
remote_client = RemoteMachineShellConnection(self.master)
cli_command = "setting-compaction"
options = (" --compaction-db-percentage={0}".format(compaction_db_percentage), "")[compaction_db_percentage is None]
options += (" --compaction-db-size={0}".format(compaction_db_size), "")[compaction_db_size is None]
options += (" --compaction-view-percentage={0}".format(compaction_view_percentage), "")[compaction_view_percentage is None]
options += (" --compaction-view-size={0}".format(compaction_view_size), "")[compaction_view_size is None]
options += (" --compaction-period-from={0}".format(compaction_period_from), "")[compaction_period_from is None]
options += (" --compaction-period-to={0}".format(compaction_period_to), "")[compaction_period_to is None]
options += (" --enable-compaction-abort={0}".format(enable_compaction_abort), "")[enable_compaction_abort is None]
options += (" --enable-compaction-parallel={0}".format(enable_compaction_parallel), "")[enable_compaction_parallel is None]
output, error = remote_client.execute_couchbase_cli(cli_command=cli_command, options=options, cluster_host="localhost", user="Administrator", password="password")
expectedResults = {"parallel_db_and_view_compaction":False, "database_fragmentation_threshold:size":10485760, "database_fragmentation_threshold:view_fragmentation_threshold":{}, "real_userid:source":"ns_server", "real_userid:user":"Administrator", "remote:ip":"127.0.0.1", "remote:port":60019}
self.checkConfig(8225, self.master, expectedResults)
remote_client.disconnect()
示例11: execute_password_policy
# 需要导入模块: from remote.remote_util import RemoteMachineShellConnection [as 别名]
# 或者: from remote.remote_util.RemoteMachineShellConnection import execute_couchbase_cli [as 别名]
def execute_password_policy(self, options):
cli_command = 'setting-password-policy'
options = options
remote_client = RemoteMachineShellConnection(self.master)
output, error = remote_client.execute_couchbase_cli(cli_command=cli_command, \
options=options, cluster_host="localhost", user=self.ldapUser, password=self.ldapPass)
return output, error
示例12: _retrieve_cluster_cert_extended
# 需要导入模块: from remote.remote_util import RemoteMachineShellConnection [as 别名]
# 或者: from remote.remote_util.RemoteMachineShellConnection import execute_couchbase_cli [as 别名]
def _retrieve_cluster_cert_extended(self,server):
cli_command = 'ssl-manage'
options = "--cluster-cert-info --extended"
remote_client = RemoteMachineShellConnection(server)
output, error = remote_client.execute_couchbase_cli(cli_command=cli_command, \
options=options, cluster_host="localhost", user=self.ldapUser, password=self.ldapPass)
return output, error
示例13: testClusterInitNegative
# 需要导入模块: from remote.remote_util import RemoteMachineShellConnection [as 别名]
# 或者: from remote.remote_util.RemoteMachineShellConnection import execute_couchbase_cli [as 别名]
def testClusterInitNegative(self):
cluster_init_username = self.input.param("cluster_init_username", None)
cluster_init_password = self.input.param("cluster_init_password", None)
cluster_init_port = self.input.param("cluster_init_port", None)
cluster_init_ramsize = self.input.param("cluster_init_ramsize", None)
command_init = self.input.param("command_init", "cluster-init")
server = self.servers[-1]
remote_client = RemoteMachineShellConnection(server)
rest = RestConnection(server)
rest.force_eject_node()
self.sleep(5)
try:
cli_command = command_init
options = ""
if cluster_init_username is not None:
options += "--cluster-init-username={0} ".format(cluster_init_username)
if cluster_init_password is not None:
options += "--cluster-init-password={0} ".format(cluster_init_password)
if cluster_init_port is not None:
options += "--cluster-init-port={0} ".format(cluster_init_port)
if cluster_init_ramsize is None:
options += "--cluster-init-ramsize={0} ".format(cluster_init_ramsize)
output, error = remote_client.execute_couchbase_cli(cli_command=cli_command, options=options, cluster_host="localhost", user=None, password=None)
self.assertEqual(output[0], 'ERROR: unable to init localhost (400) Bad Request')
self.assertTrue(output[1] == "[u'Username and password are required.']" or output[1] == "[u'The password must be at least six characters.']")
remote_client.disconnect()
finally:
rest = RestConnection(server)
rest.force_eject_node()
self.sleep(5)
rest.init_cluster()
示例14: test_full_eviction_changed_to_value_eviction
# 需要导入模块: from remote.remote_util import RemoteMachineShellConnection [as 别名]
# 或者: from remote.remote_util.RemoteMachineShellConnection import execute_couchbase_cli [as 别名]
def test_full_eviction_changed_to_value_eviction(self):
KEY_NAME = 'key1'
gen_create = BlobGenerator('eviction', 'eviction-', self.value_size, end=self.num_items)
gen_create2 = BlobGenerator('eviction2', 'eviction2-', self.value_size, end=self.num_items)
self._load_all_buckets(self.master, gen_create, "create", 0)
self._wait_for_stats_all_buckets(self.servers[:self.nodes_init])
self._verify_stats_all_buckets(self.servers[:self.nodes_init])
remote = RemoteMachineShellConnection(self.master)
for bucket in self.buckets:
output, _ = remote.execute_couchbase_cli(cli_command='bucket-edit',
cluster_host="localhost",
user=self.master.rest_username,
password=self.master.rest_password,
options='--bucket=%s --bucket-eviction-policy=valueOnly' % bucket.name)
self.assertTrue(' '.join(output).find('SUCCESS') != -1, 'Eviction policy wasn\'t changed')
ClusterOperationHelper.wait_for_ns_servers_or_assert(
self.servers[:self.nodes_init], self,
wait_time=self.wait_timeout, wait_if_warmup=True)
self.sleep(10, 'Wait some time before next load')
#self._load_all_buckets(self.master, gen_create2, "create", 0)
#import pdb;pdb.set_trace()
rest = RestConnection(self.master)
client = VBucketAwareMemcached(rest, 'default')
mcd = client.memcached(KEY_NAME)
try:
rc = mcd.set(KEY_NAME, 0,0, json.dumps({'value':'value2'}))
self.fail('Bucket is incorrectly functional')
except MemcachedError, e:
pass # this is the exception we are hoping for
示例15: testSSLManage
# 需要导入模块: from remote.remote_util import RemoteMachineShellConnection [as 别名]
# 或者: from remote.remote_util.RemoteMachineShellConnection import execute_couchbase_cli [as 别名]
def testSSLManage(self):
"""ssl-manage OPTIONS:
--retrieve-cert=CERTIFICATE retrieve cluster certificate AND save to a pem file
--regenerate-cert=CERTIFICATE regenerate cluster certificate AND save to a pem file"""
xdcr_cert = self.input.param("xdcr-certificate", None)
xdcr_cert = "/tmp/" + xdcr_cert
cli_command = "ssl-manage"
remote_client = RemoteMachineShellConnection(self.master)
options = "--regenerate-cert={0}".format(xdcr_cert)
output, error = remote_client.execute_couchbase_cli(
cli_command=cli_command,
options=options,
cluster_host="localhost",
user=self.ldapUser,
password=self.ldapPass,
)
self.assertFalse(error, "Error thrown during CLI execution %s" % error)
self.shell.execute_command("rm {0}".format(xdcr_cert))
expectedResults = {
"real_userid:source": self.source,
"real_userid:user": self.ldapUser,
"remote:ip": "127.0.0.1",
"port": 60035,
}
self.checkConfig(8226, self.master, expectedResults)