instruction
stringclasses
14 values
output
stringlengths
105
12.9k
input
stringlengths
0
4.12k
def is_couchbase_installed(self): """ Check if Couchbase is installed on the remote server. This checks if the couchbase is installed in default or non default path. :return: True if Couchbase is installed on the remote server else False """ if self.nonroot: if self.file_exists("/home/%s/" % self.username, NR_INSTALL_LOCATION_FILE): output, error = self.execute_command("cat %s" % NR_INSTALL_LOCATION_FILE) if output and output[0]: log.info("Couchbase Server was installed in non default path %s" % output[0]) self.nr_home_path = output[0] file_path = self.nr_home_path + self.cb_path if self.file_exists(file_path, self.version_file): log.info("non root couchbase installed at %s " % self.ip) return True else: if self.file_exists(self.cb_path, self.version_file): log.info("{0} **** The linux version file {1} {2} exists" .format(self.ip, self.cb_path, self.version_file)) return True return False
Check if Couchbase is installed on the remote server. This checks if the couchbase is installed in default or non default path.
generate comment:
def populate_build_url(self): """ Populates the build url variable. :return: None """ self.node_install_info.build_url = self.__construct_build_url() self.log.info("{} - Build url :: {}" .format(self.node_install_info.server.ip, self.node_install_info.build_url))
def populate_build_url(self): self.node_install_info.build_url = self.__construct_build_url() self.log.info("{} - Build url :: {}" .format(self.node_install_info.server.ip, self.node_install_info.build_url))
Code the following:
def __init__(self, logger): """ Creates an instance of InstallHelper object :param logger: logger object """ self.log = logger
Creates an instance of InstallHelper object
generate python code for
from shell_util.remote_connection import RemoteMachineShellConnection def check_server_state(self, servers): """ Checks if the servers are reachable :param servers: list of servers to check :return: True if the servers are all reachable else False """ result = True reachable = list() unreachable = list() for server in servers: try: shell = RemoteMachineShellConnection(server) shell.disconnect() reachable.append(server.ip) except Exception as e: self.log.error(e) unreachable.append(server.ip) if len(unreachable) > 0: self.log.info("-" * 100) for server in unreachable: self.log.error("INSTALL FAILED ON: \t{0}".format(server)) self.log.info("-" * 100) for server in reachable: self.log.info("INSTALL COMPLETED ON: \t{0}".format(server)) self.log.info("-" * 100) result = False return result
Checks if the servers are reachable
generate python code for the above
def __check_if_cb_service_stopped(self, service_name=None): """ Check if a couchbase service is stopped :param service_name: service name to check :return: True if service is stopped else False """ if service_name: o, r = self.execute_command('sc query {0}'.format(service_name)) for res in o: if "STATE" in res: info = res.split(":") is_stopped = "STOPPED" in str(info[1]) return is_stopped log.error("Cannot identify service state for service {0}. " "Host response is: {1}".format(service_name, str(o))) return True log.error("Service name is not specified!") return False
Check if a couchbase service is stopped
generate python code for the following
def restart_couchbase(self): """ Restarts the Couchbase server on the remote server :return: None """ o, r = self.execute_command("net stop couchbaseserver") self.log_command_output(o, r) o, r = self.execute_command("net start couchbaseserver") self.log_command_output(o, r)
Restarts the Couchbase server on the remote server
generate comment for following function:
def get_ram_info(self, win_info=None, mac=False): """ Get ram info of a remote server :param win_info: windows info :param mac: get ram info from macOS if True :return: ram info of remote server """ if win_info: if 'Virtual Memory Max Size' not in win_info: win_info = self.create_windows_info() o = "Virtual Memory Max Size =" + win_info['Virtual Memory Max Size'] + '\n' o += "Virtual Memory Available =" + win_info['Virtual Memory Available'] + '\n' o += "Virtual Memory In Use =" + win_info['Virtual Memory In Use'] elif mac: o, r = self.execute_command_raw('/sbin/sysctl -n hw.memsize', debug=False) else: o, r = self.execute_command_raw('cat /proc/meminfo', debug=False) if o: return o
def get_ram_info(self, win_info=None, mac=False): if win_info: if 'Virtual Memory Max Size' not in win_info: win_info = self.create_windows_info() o = "Virtual Memory Max Size =" + win_info['Virtual Memory Max Size'] + '\n' o += "Virtual Memory Available =" + win_info['Virtual Memory Available'] + '\n' o += "Virtual Memory In Use =" + win_info['Virtual Memory In Use'] elif mac: o, r = self.execute_command_raw('/sbin/sysctl -n hw.memsize', debug=False) else: o, r = self.execute_command_raw('cat /proc/meminfo', debug=False) if o: return o
give a code to
def unmount_partition(self, location): """ Unmount the partition at the specified location. :param location: Location of the partition which has to be unmounted :return: Output and error message from the umount command """ command = "umount -l {0}; df -Th".format(location) output, error = self.execute_command(command) return output, error
Unmount the partition at the specified location.
generate doc string for following function:
def kill_memcached(self, num_retries=10, poll_interval=2): """ Kill memcached process on remote server :param num_retries: number of times to retry killing the memcached process :param poll_interval: time to wait before each retry in seconds :return: output and error of command killing memcached process """ # Changed from kill -9 $(ps aux | grep 'memcached' | awk '{print $2}' # as grep was also returning eventing # process which was using memcached-cert o, r = self.execute_command("kill -9 $(ps aux | pgrep 'memcached')", debug=True) self.log_command_output(o, r, debug=False) while num_retries > 0: self.sleep(poll_interval, "waiting for memcached to start") out, err = self.execute_command('pgrep memcached') if out and out != "": self.log.info("memcached pid:{} and err: {}".format(out, err)) break else: num_retries -= 1 return o, r
def kill_memcached(self, num_retries=10, poll_interval=2): # Changed from kill -9 $(ps aux | grep 'memcached' | awk '{print $2}' # as grep was also returning eventing # process which was using memcached-cert o, r = self.execute_command("kill -9 $(ps aux | pgrep 'memcached')", debug=True) self.log_command_output(o, r, debug=False) while num_retries > 0: self.sleep(poll_interval, "waiting for memcached to start") out, err = self.execute_command('pgrep memcached') if out and out != "": self.log.info("memcached pid:{} and err: {}".format(out, err)) break else: num_retries -= 1 return o, r
generate python code for the above
def pause_memcached(self, timesleep=30, delay=0): """ Pauses the memcached process on remote server :param timesleep: time to wait after pause (in seconds) :param delay: time to delay pause of memcached process (in seconds) :return: None """ log.info("*** pause memcached process ***") if delay: time.sleep(delay) if self.nonroot: o, r = self.execute_command("killall -SIGSTOP memcached.bin") else: o, r = self.execute_command("killall -SIGSTOP memcached") self.log_command_output(o, r) log.info("wait %s seconds to make node down." % timesleep) time.sleep(timesleep)
Pauses the memcached process on remote server
generate code for the above:
def reset_env_variables(self): """ Reset environment previously set and restart couchbase server :return: None """ shell = self._ssh_client.invoke_shell() if getattr(self, "info", None) is None: self.info = self.extract_remote_info() init_file = "couchbase-server" file_path = "/opt/couchbase/bin/" backupfile = file_path + init_file + ".bak" sourceFile = file_path + init_file o, r = self.execute_command("mv " + backupfile + " " + sourceFile) self.log_command_output(o, r) # Restart Couchbase o, r = self.execute_command("service couchbase-server restart") self.log_command_output(o, r) shell.close()
Reset environment previously set and restart couchbase server
generate doc string for following function:
def reset_env_variables(self): """ Reset environment previously set and restart couchbase server :return: None """ shell = self._ssh_client.invoke_shell() if getattr(self, "info", None) is None: self.info = self.extract_remote_info() init_file = "couchbase-server" file_path = "/opt/couchbase/bin/" backupfile = file_path + init_file + ".bak" sourceFile = file_path + init_file o, r = self.execute_command("mv " + backupfile + " " + sourceFile) self.log_command_output(o, r) # Restart Couchbase o, r = self.execute_command("service couchbase-server restart") self.log_command_output(o, r) shell.close()
def reset_env_variables(self): shell = self._ssh_client.invoke_shell() if getattr(self, "info", None) is None: self.info = self.extract_remote_info() init_file = "couchbase-server" file_path = "/opt/couchbase/bin/" backupfile = file_path + init_file + ".bak" sourceFile = file_path + init_file o, r = self.execute_command("mv " + backupfile + " " + sourceFile) self.log_command_output(o, r) # Restart Couchbase o, r = self.execute_command("service couchbase-server restart") self.log_command_output(o, r) shell.close()
give python code to
def unpause_memcached(self): """ Unpauses the memcached process on remote server Override method for Windows :param os: os type of remote server :return: None """ self.log.info("*** unpause memcached process ***") cmd = "pssuspend -r $(tasklist | grep memcached | gawk '{printf $2}')" o, r = self.execute_command(cmd) self.log_command_output(o, [])
Unpauses the memcached process on remote server Override method for Windows
generate code for the following
def get_ram_info(self, win_info=None, mac=False): """ Get ram info of a remote server :param win_info: windows info :param mac: get ram info from macOS if True :return: ram info of remote server """ if win_info: if 'Virtual Memory Max Size' not in win_info: win_info = self.create_windows_info() o = "Virtual Memory Max Size =" + win_info['Virtual Memory Max Size'] + '\n' o += "Virtual Memory Available =" + win_info['Virtual Memory Available'] + '\n' o += "Virtual Memory In Use =" + win_info['Virtual Memory In Use'] elif mac: o, r = self.execute_command_raw('/sbin/sysctl -n hw.memsize', debug=False) else: o, r = self.execute_command_raw('cat /proc/meminfo', debug=False) if o: return o
Get ram info of a remote server
generate python code for the above
def __init__(self, server, server_info, os_type, version, edition): """ Creats an instance of the NodeInstallInfo class. :param server: server object of type TestInputServer :param server_info: server info with information of the server :param os_type: OS type of the server :param version: version of the couchbase server :param edition: type of Couchbase Server """ self.server = server self.server_info = server_info self.os_type = os_type self.version = version self.edition = edition self.build_url = None self.debug_build_url = None self.non_root_package_mgr = None self.state = "not_started"
Creats an instance of the NodeInstallInfo class.
Code the following:
def install(self, build_url): """ Installs Couchbase server on Unix machine :param build_url: build url to get the Couchbase package from :return: True on successful installation else False """ cmd = self.cmds["install"] if self.shell.nonroot: cmd = self.non_root_cmds["install"] f_name = build_url.split("/")[-1] cmd = cmd.replace("buildpath", "{}/{}" .format(self.download_dir, f_name)) self.shell.execute_command(cmd) output, err = self.shell.execute_command(cmd) if output[0] == '1': return True self.shell.log.critical("Output: {}, Error: {}".format(output, err)) return False
Installs Couchbase server on Unix machine
generate comment for above
def get_process_statistics_parameter(self, parameter, process_name=None, process_pid=None): """ Get the process statistics for given parameter :param parameter: parameter to get statistics for :param process_name: name of process to get statistics for :param process_pid: pid of process to get statistics for :return: process statistics for parameter if present else None """ if not parameter: self.log.error("parameter cannot be None") parameters_list = self.get_process_statistics(process_name, process_pid) if not parameters_list: self.log.error("no statistics found") return None parameters_dic = dict(item.split(' = ') for item in parameters_list) if parameter in parameters_dic: return parameters_dic[parameter] else: self.log.error("parameter '{0}' is not found".format(parameter)) return None
def get_process_statistics_parameter(self, parameter, process_name=None, process_pid=None): if not parameter: self.log.error("parameter cannot be None") parameters_list = self.get_process_statistics(process_name, process_pid) if not parameters_list: self.log.error("no statistics found") return None parameters_dic = dict(item.split(' = ') for item in parameters_list) if parameter in parameters_dic: return parameters_dic[parameter] else: self.log.error("parameter '{0}' is not found".format(parameter)) return None
generate code for the above:
def delete_files(self, file_location, debug=False): """ Delete the files in the specified location :param file_location: path to files to delete :param debug: print debug information if True :return: None """ command = "%s%s" % ("rm -rf ", file_location) output, error = self.execute_command(command, debug=debug) if debug: self.log_command_output(output, error)
Delete the files in the specified location
generate code for the following
def disable_disk_readonly(self, disk_location): """ Disables read-only mode for the specified disk location. :param disk_location: disk location to disable read-only mode. :return: None """ o, r = self.execute_command("chmod -R 777 {}".format(disk_location)) self.log_command_output(o, r)
Disables read-only mode for the specified disk location.
def get_processes_binding_to_ip_family(self, ip_family="ipv4"): """ Get all the processes binding to a particular ip family Override method for Windows :param ip_family: ip family to get processes binding of :return: list of processes binding to ip family """ if ip_family == "ipv4": ip_family = "tcp" else: ip_family = "tcpv6" output_win, error = self.execute_command( "netstat -a -b -p {0} | grep exe | sort | uniq | sed \'s/\[//g; s/\]//g;\'". format(ip_family), debug=True) self.log_command_output(output_win, error, debug=True) output = list() for op in output_win: op = op.strip() if op in WIN_PROCESSES_SPAWNED: output.append(op) return output
def get_processes_binding_to_ip_family(self, ip_family="ipv4"): if ip_family == "ipv4": ip_family = "tcp" else: ip_family = "tcpv6" output_win, error = self.execute_command( "netstat -a -b -p {0} | grep exe | sort | uniq | sed \'s/\[//g; s/\]//g;\'". format(ip_family), debug=True) self.log_command_output(output_win, error, debug=True) output = list() for op in output_win: op = op.strip() if op in WIN_PROCESSES_SPAWNED: output.append(op) return output
def get_cbversion(self): """ Get the installed version of Couchbase Server installed on the remote server. This gets the versions from both default path or non-default paths. Returns in format fv = a.b.c-xxxx, sv = a.b.c, bn = xxxx :return: full version, main version and the build version of the Couchbase Server installed """ fv = sv = bn = "" if self.file_exists(WIN_CB_PATH_PARA, VERSION_FILE): output = self.read_remote_file(WIN_CB_PATH_PARA, VERSION_FILE) if output: for x in output: x = x.strip() if x and x[:5] in CB_RELEASE_BUILDS.keys() and "-" in x: fv = x tmp = x.split("-") sv = tmp[0] bn = tmp[1] break else: self.log.info("{} - Couchbase Server not found".format(self.ip)) return fv, sv, bn
def get_cbversion(self): fv = sv = bn = "" if self.file_exists(WIN_CB_PATH_PARA, VERSION_FILE): output = self.read_remote_file(WIN_CB_PATH_PARA, VERSION_FILE) if output: for x in output: x = x.strip() if x and x[:5] in CB_RELEASE_BUILDS.keys() and "-" in x: fv = x tmp = x.split("-") sv = tmp[0] bn = tmp[1] break else: self.log.info("{} - Couchbase Server not found".format(self.ip)) return fv, sv, bn
generate python code for the following
def kill_cbft_process(self): """ Kill the full text search process on remote server :return: output and error of command killing FTS process """ o, r = self.execute_command("killall -9 cbft") self.log_command_output(o, r) if r and r[0] and "command not found" in r[0]: o, r = self.execute_command("pkill cbft") self.log_command_output(o, r) return o, r
Kill the full text search process on remote server
def install(self, build_url): """ Installs Couchbase server on Windows machine :param build_url: build url to get the Couchbase package from :return: True on successful installation else False """ cmd = self.cmds["install"] f_name = build_url.split("/")[-1] cmd = cmd.replace("buildpath", "{}/{}" .format(self.download_dir, f_name)) self.shell.execute_command(cmd) output, err = self.shell.execute_command(cmd) if output[0] == '1': return True self.shell.log.critical("Output: {}, Error: {}".format(output, err)) return False
def install(self, build_url): cmd = self.cmds["install"] f_name = build_url.split("/")[-1] cmd = cmd.replace("buildpath", "{}/{}" .format(self.download_dir, f_name)) self.shell.execute_command(cmd) output, err = self.shell.execute_command(cmd) if output[0] == '1': return True self.shell.log.critical("Output: {}, Error: {}".format(output, err)) return False
generate code for the following
def get_process_statistics_parameter(self, parameter, process_name=None, process_pid=None): """ Get the process statistics for given parameter :param parameter: parameter to get statistics for :param process_name: name of process to get statistics for :param process_pid: pid of process to get statistics for :return: process statistics for parameter if present else None """ if not parameter: self.log.error("parameter cannot be None") parameters_list = self.get_process_statistics(process_name, process_pid) if not parameters_list: self.log.error("no statistics found") return None parameters_dic = dict(item.split(' = ') for item in parameters_list) if parameter in parameters_dic: return parameters_dic[parameter] else: self.log.error("parameter '{0}' is not found".format(parameter)) return None
Get the process statistics for given parameter
def configure_log_location(self, new_log_location): """ Configure the log location for Couchbase server on remote server :param new_log_location: path to new location to store logs :return: None """ mv_logs = testconstants.LINUX_LOG_PATH + '/' + new_log_location print((" MV LOGS %s" % mv_logs)) error_log_tag = "error_logger_mf_dir" # ADD NON_ROOT user config_details log.info("CHANGE LOG LOCATION TO %s".format(mv_logs)) output, error = self.execute_command("rm -rf %s" % mv_logs) self.log_command_output(output, error) output, error = self.execute_command("mkdir %s" % mv_logs) self.log_command_output(output, error) output, error = self.execute_command("chown -R couchbase %s" % mv_logs) self.log_command_output(output, error) output, error = self.execute_command("sed -i '/%s, /c \\{%s, \"%s\"\}.' %s" % (error_log_tag, error_log_tag, mv_logs, testconstants.LINUX_STATIC_CONFIG)) self.log_command_output(output, error)
Configure the log location for Couchbase server on remote server
generate python code for the following
def get_ram_info(self, win_info=None, mac=False): """ Get the RAM info of the remote server :param win_info: Windows info in case of windows :param mac: Get info for macOS if True :return: RAM info of the remote server if found else None """ if win_info: if 'Virtual Memory Max Size' not in win_info: win_info = self.create_windows_info() o = "Virtual Memory Max Size =" \ + win_info['Virtual Memory Max Size'] + '\n' \ + "Virtual Memory Available =" \ + win_info['Virtual Memory Available'] + '\n' \ + "Virtual Memory In Use =" + win_info['Virtual Memory In Use'] elif mac: o, r = self.execute_command_raw( '/sbin/sysctl -n hw.memsize', debug=False) else: o, r = self.execute_command_raw('cat /proc/meminfo', debug=False) if o: return o
Get the RAM info of the remote server
def terminate_processes(self, info, p_list): """ Terminate a list of processes on remote server :param info: None :param p_list: List of processes to terminate :return: None """ for process in p_list: # set debug=False if does not want to show log self.execute_command("taskkill /F /T /IM {0}" .format(process), debug=False)
Terminate a list of processes on remote server
generate comment for above
def get_server_ips(config, section): """ Get server IPs from config :param config: config :param section: section to get server IPs from :return: list of IP addresses """ ips = [] options = config.options(section) for option in options: ips.append(config.get(section, option)) return ips
def get_server_ips(config, section): ips = [] options = config.options(section) for option in options: ips.append(config.get(section, option)) return ips
generate comment for above
def create_new_partition(self, location, size=None): """ Create a new partition at the location specified and of the size specified :param location: Location to create the new partition at. :param size: Size of the partition in MB :return: None """ command = "umount -l {0}".format(location) output, error = self.execute_command(command) command = "rm -rf {0}".format(location) output, error = self.execute_command(command) command = "rm -rf /usr/disk-img/disk-quota.ext3" output, error = self.execute_command(command) command = "mkdir -p {0}".format(location) output, error = self.execute_command(command) if size: count = (size * 1024 * 1024) // 512 else: count = (5 * 1024 * 1024 * 1024) // 512 command = "mkdir -p /usr/disk-img" output, error = self.execute_command(command) command = "dd if=/dev/zero of=/usr/disk-img/disk-quota.ext3 count={0}".format(count) output, error = self.execute_command(command) command = "/sbin/mkfs -t ext3 -q /usr/disk-img/disk-quota.ext3 -F" output, error = self.execute_command(command) command = "mount -o loop,rw,usrquota,grpquota /usr/disk-img/disk-quota.ext3 {0}".format(location) output, error = self.execute_command(command) command = "chown 'couchbase' {0}".format(location) output, error = self.execute_command(command) command = "chmod 777 {0}".format(location) output, error = self.execute_command(command)
def create_new_partition(self, location, size=None): command = "umount -l {0}".format(location) output, error = self.execute_command(command) command = "rm -rf {0}".format(location) output, error = self.execute_command(command) command = "rm -rf /usr/disk-img/disk-quota.ext3" output, error = self.execute_command(command) command = "mkdir -p {0}".format(location) output, error = self.execute_command(command) if size: count = (size * 1024 * 1024) // 512 else: count = (5 * 1024 * 1024 * 1024) // 512 command = "mkdir -p /usr/disk-img" output, error = self.execute_command(command) command = "dd if=/dev/zero of=/usr/disk-img/disk-quota.ext3 count={0}".format(count) output, error = self.execute_command(command) command = "/sbin/mkfs -t ext3 -q /usr/disk-img/disk-quota.ext3 -F" output, error = self.execute_command(command) command = "mount -o loop,rw,usrquota,grpquota /usr/disk-img/disk-quota.ext3 {0}".format(location) output, error = self.execute_command(command) command = "chown 'couchbase' {0}".format(location) output, error = self.execute_command(command) command = "chmod 777 {0}".format(location) output, error = self.execute_command(command)
def download_build(self, node_installer, build_url, non_root_installer=False): """ Download the Couchbase build on the remote server :param node_installer: node installer object :param build_url: build url to download the Couchbase build from. :param non_root_installer: Change the downloaded build to executable if True :return: None """ download_dir = self.get_download_dir(node_installer) f_name = build_url.split("/")[-1] # Remove old build (if exists) cmd = "rm -f {}/couchbase-server*".format(download_dir) node_installer.shell.execute_command(cmd) # Download the build cmd = node_installer.wget_cmd.format(download_dir, build_url) node_installer.shell.execute_command(cmd) if non_root_installer: node_installer.shell.execute_cmd("chmod a+x {}/{}" .format(download_dir, f_name)) node_installer.shell.disconnect()
Download the Couchbase build on the remote server
give python code to
def create_new_partition(self, location, size=None): """ Create a new partition at the location specified and of the size specified :param location: Location to create the new partition at. :param size: Size of the partition in MB :return: None """ command = "umount -l {0}".format(location) output, error = self.execute_command(command) command = "rm -rf {0}".format(location) output, error = self.execute_command(command) command = "rm -rf /usr/disk-img/disk-quota.ext3" output, error = self.execute_command(command) command = "mkdir -p {0}".format(location) output, error = self.execute_command(command) if size: count = (size * 1024 * 1024) // 512 else: count = (5 * 1024 * 1024 * 1024) // 512 command = "mkdir -p /usr/disk-img" output, error = self.execute_command(command) command = "dd if=/dev/zero of=/usr/disk-img/disk-quota.ext3 count={0}".format(count) output, error = self.execute_command(command) command = "/sbin/mkfs -t ext3 -q /usr/disk-img/disk-quota.ext3 -F" output, error = self.execute_command(command) command = "mount -o loop,rw,usrquota,grpquota /usr/disk-img/disk-quota.ext3 {0}".format(location) output, error = self.execute_command(command) command = "chown 'couchbase' {0}".format(location) output, error = self.execute_command(command) command = "chmod 777 {0}".format(location) output, error = self.execute_command(command)
Create a new partition at the location specified and of the size specified
generate python code for the following
def create_multiple_dir(self, dir_paths): """ This function will remove the automation directory in windows and create directory in the path specified in dir_paths :param dir_paths: list of paths to create the directories :return: None """ sftp = self._ssh_client.open_sftp() try: for dir_path in dir_paths: if dir_path != '/cygdrive/c/tmp': output = self.remove_directory('/cygdrive/c/automation') if output: log.info("{0} directory is removed.".format(dir_path)) else: log.error("Can not delete {0} directory or directory {0} does not exist.".format(dir_path)) self.create_directory(dir_path) sftp.close() except IOError: pass
This function will remove the automation directory in windows and create directory in the path specified in dir_paths
generate python code for the following
def terminate_process(self, info=None, process_name=None, force=False): """ Terminate a list of processes on remote server :param info: None :param p_list: List of processes to terminate :return: None """ if not process_name: log.info("Please specify process name to be terminated.") return o, r = self.execute_command("taskkill /F /T /IM {0}*"\ .format(process_name), debug=False) self.log_command_output(o, r)
Terminate a list of processes on remote server
generate comment for above
def run(self): """ Runs the NodeInstaller thread to run various installation steps in the remote server :return: None """ installer = InstallSteps(self.log, self.node_install_info) node_installer = installer.get_node_installer( self.node_install_info) for step in self.steps: self.log.info("{} - Running '{}'" .format(self.node_install_info.server.ip, step)) if step == "populate_build_url": # To download the main build url self.node_install_info.state = "construct_build_url" installer.populate_build_url() elif step == "populate_debug_build_url": # To download the debug_info build url for backtraces self.node_install_info.state = "construct_debug_build_url" installer.populate_debug_build_url() elif step == "check_url_status": self.node_install_info.state = "checking_url_status" installer.check_url_status(self.node_install_info.build_url) if self.node_install_info.debug_build_url: installer.check_url_status( self.node_install_info.debug_build_url) elif step == "local_download_build": self.node_install_info.state = "downloading_build_on_executor" build_urls = [self.node_install_info.build_url] if self.node_install_info.debug_build_url: build_urls.append(self.node_install_info.debug_build_url) for build_url in build_urls: f_name, res = installer.download_build_locally(build_url) self.log.debug("File saved as '{}'".format(f_name)) self.log.debug("File size: {}".format(res["Content-Length"])) self.log.debug("File create date: {}".format(res["Date"])) elif step == "copy_local_build_to_server": self.node_install_info.state = "copying_build_to_remote_server" build_urls = [self.node_install_info.build_url] if self.node_install_info.debug_build_url: build_urls.append(self.node_install_info.build_url) for build_url in build_urls: installer.result = installer.result and \ installer.copy_build_to_server(node_installer, build_url) elif step == "download_build": self.node_install_info.state = "downloading_build" installer.download_build(node_installer, self.node_install_info.build_url) if self.node_install_info.debug_build_url: installer.download_build(node_installer, self.node_install_info.build_url) elif step == "uninstall": self.node_install_info.state = "uninstalling" node_installer.uninstall() elif step == "deep_cleanup": self.node_install_info.state = "deep_cleaning" elif step == "pre_install": self.node_install_info.state = "pre_install_procedure" elif step == "install": self.node_install_info.state = "installing" node_installer.install(self.node_install_info.build_url) node_installer.post_install() elif step == "init_cluster": self.node_install_info.state = "init_cluster" node_installer.init_cluster(self.node_install_info.server) elif step == "post_install": self.node_install_info.state = "post_install_procedure" elif step == "post_install_cleanup": self.node_install_info.state = "post_install_cleanup" else: self.log.critical("Invalid step '{}'".format(step)) installer.result = False if installer.result is False: break node_installer.shell.disconnect() self.result = installer.result
def run(self): installer = InstallSteps(self.log, self.node_install_info) node_installer = installer.get_node_installer( self.node_install_info) for step in self.steps: self.log.info("{} - Running '{}'" .format(self.node_install_info.server.ip, step)) if step == "populate_build_url": # To download the main build url self.node_install_info.state = "construct_build_url" installer.populate_build_url() elif step == "populate_debug_build_url": # To download the debug_info build url for backtraces self.node_install_info.state = "construct_debug_build_url" installer.populate_debug_build_url() elif step == "check_url_status": self.node_install_info.state = "checking_url_status" installer.check_url_status(self.node_install_info.build_url) if self.node_install_info.debug_build_url: installer.check_url_status( self.node_install_info.debug_build_url) elif step == "local_download_build": self.node_install_info.state = "downloading_build_on_executor" build_urls = [self.node_install_info.build_url] if self.node_install_info.debug_build_url: build_urls.append(self.node_install_info.debug_build_url) for build_url in build_urls: f_name, res = installer.download_build_locally(build_url) self.log.debug("File saved as '{}'".format(f_name)) self.log.debug("File size: {}".format(res["Content-Length"])) self.log.debug("File create date: {}".format(res["Date"])) elif step == "copy_local_build_to_server": self.node_install_info.state = "copying_build_to_remote_server" build_urls = [self.node_install_info.build_url] if self.node_install_info.debug_build_url: build_urls.append(self.node_install_info.build_url) for build_url in build_urls: installer.result = installer.result and \ installer.copy_build_to_server(node_installer, build_url) elif step == "download_build": self.node_install_info.state = "downloading_build" installer.download_build(node_installer, self.node_install_info.build_url) if self.node_install_info.debug_build_url: installer.download_build(node_installer, self.node_install_info.build_url) elif step == "uninstall": self.node_install_info.state = "uninstalling" node_installer.uninstall() elif step == "deep_cleanup": self.node_install_info.state = "deep_cleaning" elif step == "pre_install": self.node_install_info.state = "pre_install_procedure" elif step == "install": self.node_install_info.state = "installing" node_installer.install(self.node_install_info.build_url) node_installer.post_install() elif step == "init_cluster": self.node_install_info.state = "init_cluster" node_installer.init_cluster(self.node_install_info.server) elif step == "post_install": self.node_install_info.state = "post_install_procedure" elif step == "post_install_cleanup": self.node_install_info.state = "post_install_cleanup" else: self.log.critical("Invalid step '{}'".format(step)) installer.result = False if installer.result is False: break node_installer.shell.disconnect() self.result = installer.result
generate python code for
def set_environment_variable(self, name, value): """Request an interactive shell session, export custom variable and restart Couchbase server. Shell session is necessary because basic SSH client is stateless. :param name: environment variable :param value: environment variable value :return: None """ shell = self._ssh_client.invoke_shell() shell.send('export {0}={1}\n'.format(name, value)) if self.info.distribution_version.lower() in SYSTEMD_SERVER: """from watson, systemd is used in centos 7 """ log.info("this node is centos 7.x") shell.send("systemctl restart couchbase-server.service\n") else: shell.send('/etc/init.d/couchbase-server restart\n') shell.close()
Request an interactive shell session, export custom variable and restart Couchbase server. Shell session is necessary because basic SSH client is stateless.
generate comment.
def start_memcached(self): """ Start memcached process on remote server :return: None """ o, r = self.execute_command("taskkill /F /T /IM memcached") self.log_command_output(o, r, debug=False)
def start_memcached(self): o, r = self.execute_command("taskkill /F /T /IM memcached") self.log_command_output(o, r, debug=False)
generate python code for the following
def start_server(self): """ Starts the Couchbase server on the remote server. The method runs the sever from non-default location if it's run as nonroot user. Else from default location. :return: None """ o, r = self.execute_command("open /Applications/Couchbase\ Server.app") self.log_command_output(o, r)
Starts the Couchbase server on the remote server. The method runs the sever from non-default location if it's run as nonroot user. Else from default location.
generate comment:
def stop_couchbase(self, num_retries=5, poll_interval=10): """ Stop couchbase service on remote server :param num_retries: None :param poll_interval: None :return: None """ if self.nonroot: log.info("Stop Couchbase Server with non root method") o, r = self.execute_command( '%s%scouchbase-server -k' % (self.nr_home_path, LINUX_COUCHBASE_BIN_PATH)) else: o, r = self.execute_command("systemctl stop couchbase-server.service") self.log_command_output(o, r)
def stop_couchbase(self, num_retries=5, poll_interval=10): if self.nonroot: log.info("Stop Couchbase Server with non root method") o, r = self.execute_command( '%s%scouchbase-server -k' % (self.nr_home_path, LINUX_COUCHBASE_BIN_PATH)) else: o, r = self.execute_command("systemctl stop couchbase-server.service") self.log_command_output(o, r)
generate comment:
def pause_memcached(self, timesleep=30, delay=0): """ Pauses the memcached process on remote server :param timesleep: time to wait after pause (in seconds) :param delay: time to delay pause of memcached process (in seconds) :return: None """ log.info("*** pause memcached process ***") if delay: time.sleep(delay) if self.nonroot: o, r = self.execute_command("killall -SIGSTOP memcached.bin") else: o, r = self.execute_command("killall -SIGSTOP memcached") self.log_command_output(o, r) log.info("wait %s seconds to make node down." % timesleep) time.sleep(timesleep)
def pause_memcached(self, timesleep=30, delay=0): log.info("*** pause memcached process ***") if delay: time.sleep(delay) if self.nonroot: o, r = self.execute_command("killall -SIGSTOP memcached.bin") else: o, r = self.execute_command("killall -SIGSTOP memcached") self.log_command_output(o, r) log.info("wait %s seconds to make node down." % timesleep) time.sleep(timesleep)
generate comment:
def write_remote_file_single_quote(self, remote_path, filename, lines): """ Writes content to a remote file specified by the path. :param remote_path: Remote path to write the file to. :param filename: Name of the file to write to. :param lines: Lines to write to the file. :return: None """ cmd = 'echo \'%s\' > %s/%s' % (''.join(lines), remote_path, filename) self.execute_command(cmd)
def write_remote_file_single_quote(self, remote_path, filename, lines): cmd = 'echo \'%s\' > %s/%s' % (''.join(lines), remote_path, filename) self.execute_command(cmd)
generate code for the following
def start_server(self): """ Starts the Couchbase server on the remote server. The method runs the sever from non-default location if it's run as nonroot user. Else from default location. :return: None """ o, r = self.execute_command("net start couchbaseserver") self.log_command_output(o, r)
Starts the Couchbase server on the remote server. The method runs the sever from non-default location if it's run as nonroot user. Else from default location.
Code the following:
def _check_output(self, word_check, output): """ Check if certain word is present in the output :param word_check: string or list of strings to check :param output: the output to check against :return: True if word is present in the output else False """ found = False if len(output) >= 1: if isinstance(word_check, list): for ele in word_check: for x in output: if ele.lower() in str(x.lower()): log.info("Found '{0} in output".format(ele)) found = True break elif isinstance(word_check, str): for x in output: if word_check.lower() in str(x.lower()): log.info("Found '{0}' in output".format(word_check)) found = True break else: self.log.error("invalid {0}".format(word_check)) return found
Check if certain word is present in the output
give python code to
from shell_util.shell_conn import ShellConnection def get_info_for_server(server): """ Get info about given server, if available :param server: server to get the information of :return: information of the server if available else None """ if server.ip in RemoteMachineShellConnection.__info_dict: return RemoteMachineShellConnection.__info_dict[server.ip]
Get info about given server, if available
generate code for the following
def terminate_processes(self, info, p_list): """ Terminate a list of processes on remote server Override for Unix systems :param info: None :param p_list: List of processes to terminate :return: None """ raise NotImplementedError
Terminate a list of processes on remote server Override for Unix systems
generate python code for
import os def copy_files_local_to_remote(self, src_path, des_path): """ Copy multi files from local to remote server :param src_path: source path of the files to be copied :param des_path: destination path of the files to be copied :return: None """ files = os.listdir(src_path) self.log.info("copy files from {0} to {1}".format(src_path, des_path)) # self.execute_batch_command("cp -r {0}/* {1}".format(src_path, des_path)) for file in files: if file.find("wget") != 1: a = "" full_src_path = os.path.join(src_path, file) full_des_path = os.path.join(des_path, file) self.copy_file_local_to_remote(full_src_path, full_des_path)
Copy multi files from local to remote server
generate python code for the following
def copy_file_local_to_remote(self, src_path, des_path): """ Copy file from local to remote server :param src_path: source path of the file to be copied :param des_path: destination path of the file to be copied :return: True if the file was successfully copied else False """ result = True sftp = self._ssh_client.open_sftp() try: sftp.put(src_path, des_path) except IOError: self.log.error('Can not copy file') result = False finally: sftp.close() return result
Copy file from local to remote server
generate python code for the above
def __init__(self, logger, node_install_info, steps): """ Creates an instance of the NodeInstaller object. This object is used to install Couchbase server builds on remote servers. :param logger: logger object for logging :param node_install_info: node install info of type NodeInstallInfo :param steps: list of steps to run in the installation process """ super(NodeInstaller, self).__init__() self.log = logger self.steps = steps self.node_install_info = node_install_info self.result = False
Creates an instance of the NodeInstaller object. This object is used to install Couchbase server builds on remote servers.
give python code to
def kill_erlang(self, os="unix", delay=0): """ Kill the erlang process in the remote server. If delay is specified, the process is killed after the delay :param delay: time to delay the process kill :return: output and error of executing process kill command """ if delay: time.sleep(delay) o, r = self.execute_command("taskkill /F /T /IM epmd.exe*") self.log_command_output(o, r) o, r = self.execute_command("taskkill /F /T /IM erl.exe*") self.log_command_output(o, r) o, r = self.execute_command("tasklist | grep erl.exe") kill_all = False count = 0 while len(o) >= 1 and not kill_all: if o and "erl.exe" in o[0]: self.execute_command("taskkill /F /T /IM erl.exe*") self.sleep(1) o, r = self.execute_command("tasklist | grep erl.exe") if len(o) == 0: kill_all = True log.info("all erlang processes were killed") else: count += 1 if count == 5: log.error("erlang process is not killed") break
Kill the erlang process in the remote server. If delay is specified, the process is killed after the delay
generate code for the above:
def is_couchbase_installed(self): """ Check if Couchbase is installed on the remote server. This checks if the couchbase is installed in default or non default path. :return: True if Couchbase is installed on the remote server else False """ output, error = self.execute_command('ls %s%s' % (self.cb_path, self.version_file)) self.log_command_output(output, error) for line in output: if line.find('No such file or directory') == -1: return True return False
Check if Couchbase is installed on the remote server. This checks if the couchbase is installed in default or non default path.
def log_command_output(self, output, error, track_words=(), debug=True): """ Check for errors and tracked words in the output success means that there are no track_words in the output and there are no errors at all, if track_words is not empty if track_words=(), the result is not important, and we return True :param output: output to check in :param error: errors to check in the output :param track_words: words to track in the output :param debug: whether to log the errors and track words if found :return: True if all error and track words were not found in output else False """ success = True for line in error: if debug: self.log.error(line) if track_words: if "Warning" in line and "hugepages" in line: self.log.info( "There is a warning about transparent_hugepage " "may be in used when install cb server.\ So we will disable transparent_hugepage in this vm") output, error = self.execute_command( "echo never > " "/sys/kernel/mm/transparent_hugepage/enabled") self.log_command_output(output, error) success = True elif "Warning" in line and "systemctl daemon-reload" in line: self.log.info( "Unit file of couchbase-server.service changed on " "disk, we will run 'systemctl daemon-reload'") output, error = self.execute_command("systemctl daemon-reload") self.log_command_output(output, error) success = True elif "Warning" in line and "RPMDB altered outside of yum" in line: self.log.info("Warming: RPMDB altered outside of yum") success = True elif "dirname" in line: self.log.warning( "Ignore dirname error message during couchbase " "startup/stop/restart for CentOS 6.6 (MB-12536)") success = True elif "Created symlink from /etc/systemd/system" in line: self.log.info( "This error is due to fix_failed_install.py script " "that only happens in centos 7") success = True elif "Created symlink /etc/systemd/system/multi-user.target.wants/couchbase-server.service" in line: self.log.info(line) self.log.info( "This message comes only in debian8 and debian9 " "during installation. This can be ignored.") success = True else: self.log.info( "If couchbase server is running with this error. Go to" " log_command_output to add error mesg to bypass it.") success = False if self._check_output(list(track_words), output): success = False install_ok = False if self._check_output("hugepages", output): self.log.info( "There is a warning about transparent_hugepage may be " "in used when install cb server. So we will" "So we will disable transparent_hugepage in this vm") output, error = self.execute_command( "echo never > /sys/kernel/mm/transparent_hugepage/enabled") success = True install_ok = True if self._check_output("successfully installed couchbase server", output): success = True install_ok = True if not install_ok: self.log.error( 'something wrong happened on {0}!!! output:{1}, ' 'error:{2}, track_words:{3}' .format(self.ip, output, error, track_words)) elif debug and output: for line in output: self.log.info(line) return success
def log_command_output(self, output, error, track_words=(), debug=True): success = True for line in error: if debug: self.log.error(line) if track_words: if "Warning" in line and "hugepages" in line: self.log.info( "There is a warning about transparent_hugepage " "may be in used when install cb server.\ So we will disable transparent_hugepage in this vm") output, error = self.execute_command( "echo never > " "/sys/kernel/mm/transparent_hugepage/enabled") self.log_command_output(output, error) success = True elif "Warning" in line and "systemctl daemon-reload" in line: self.log.info( "Unit file of couchbase-server.service changed on " "disk, we will run 'systemctl daemon-reload'") output, error = self.execute_command("systemctl daemon-reload") self.log_command_output(output, error) success = True elif "Warning" in line and "RPMDB altered outside of yum" in line: self.log.info("Warming: RPMDB altered outside of yum") success = True elif "dirname" in line: self.log.warning( "Ignore dirname error message during couchbase " "startup/stop/restart for CentOS 6.6 (MB-12536)") success = True elif "Created symlink from /etc/systemd/system" in line: self.log.info( "This error is due to fix_failed_install.py script " "that only happens in centos 7") success = True elif "Created symlink /etc/systemd/system/multi-user.target.wants/couchbase-server.service" in line: self.log.info(line) self.log.info( "This message comes only in debian8 and debian9 " "during installation. This can be ignored.") success = True else: self.log.info( "If couchbase server is running with this error. Go to" " log_command_output to add error mesg to bypass it.") success = False if self._check_output(list(track_words), output): success = False install_ok = False if self._check_output("hugepages", output): self.log.info( "There is a warning about transparent_hugepage may be " "in used when install cb server. So we will" "So we will disable transparent_hugepage in this vm") output, error = self.execute_command( "echo never > /sys/kernel/mm/transparent_hugepage/enabled") success = True install_ok = True if self._check_output("successfully installed couchbase server", output): success = True install_ok = True if not install_ok: self.log.error( 'something wrong happened on {0}!!! output:{1}, ' 'error:{2}, track_words:{3}' .format(self.ip, output, error, track_words)) elif debug and output: for line in output: self.log.info(line) return success
generate python code for the following
def reset_env_variables(self): """ Reset environment previously set and restart couchbase server :return: None """ shell = self._ssh_client.invoke_shell() if getattr(self, "info", None) is None: self.info = self.extract_remote_info() init_file = "couchbase-server" file_path = "/opt/couchbase/bin/" backupfile = file_path + init_file + ".bak" sourceFile = file_path + init_file o, r = self.execute_command("mv " + backupfile + " " + sourceFile) self.log_command_output(o, r) # Restart Couchbase o, r = self.execute_command("service couchbase-server restart") self.log_command_output(o, r) shell.close()
Reset environment previously set and restart couchbase server
generate code for the following
import re import configparser def parse_from_file(file): """ Parse the test inputs from file :param file: path to file to parse :return: TestInput object """ count = 0 start = 0 end = 0 servers = list() ips = list() input = TestInput() config = configparser.ConfigParser(interpolation=None) config.read(file) sections = config.sections() global_properties = dict() cluster_ips = list() clusters = dict() client_ips = list() input.cbbackupmgr = dict() for section in sections: result = re.search('^cluster', section) if section == 'servers': ips = TestInputParser.get_server_ips(config, section) elif section == 'clients': client_ips = TestInputParser.get_server_ips(config, section) elif section == 'membase': input.membase_settings = TestInputParser.get_membase_settings(config, section) elif section == 'global': #get global stuff and override for those unset for option in config.options(section): global_properties[option] = config.get(section, option) elif section == 'elastic': input.elastic = TestInputParser.get_elastic_config(config, section, global_properties) elif section == 'bkrs_client': input.bkrs_client = TestInputParser.get_bkrs_client_config(config, section, global_properties, input.membase_settings) elif section == 'cbbackupmgr': input.cbbackupmgr = TestInputParser.get_cbbackupmgr_config(config, section) elif result is not None: cluster_list = TestInputParser.get_server_ips(config, section) cluster_ips.extend(cluster_list) clusters[count] = len(cluster_list) count += 1 # Setup 'cluster#' tag as dict # input.clusters -> {0: [ip:10.1.6.210 ssh_username:root, ip:10.1.6.211 ssh_username:root]} for cluster_ip in cluster_ips: servers.append(TestInputParser.get_server(cluster_ip, config)) servers = TestInputParser.get_server_options(servers, input.membase_settings, global_properties) for key, value in list(clusters.items()): end += value input.clusters[key] = servers[start:end] start += value # Setting up 'servers' tag servers = [] for ip in ips: servers.append(TestInputParser.get_server(ip, config)) input.servers = TestInputParser.get_server_options(servers, input.membase_settings, global_properties) if 'cbbackupmgr' not in sections: input.cbbackupmgr["name"] = "local_bkrs" if 'bkrs_client' not in sections: input.bkrs_client = None # Setting up 'clients' tag input.clients = client_ips return input
Parse the test inputs from file
give python code to
def pause_memcached(self, timesleep=30, delay=0): """ Pauses the memcached process on remote server Override method for Windows :param timesleep: time to wait after pause (in seconds) :param delay: time to delay pause of memcached process (in seconds) :return: None """ self.log.info("*** pause memcached process ***") if delay: self.sleep(delay) self.check_cmd("pssuspend") cmd = "pssuspend $(tasklist | grep memcached | gawk '{printf $2}')" o, r = self.execute_command(cmd) self.log_command_output(o, []) self.log.info("wait %s seconds to make node down." % timesleep) self.sleep(timesleep)
Pauses the memcached process on remote server Override method for Windows
generate code for the following
def kill_goxdcr(self): """ Kill XDCR process on remote server :return: None """ o, r = self.execute_command("killall -9 goxdcr") self.log_command_output(o, r)
Kill XDCR process on remote server
generate comment.
def log_command_output(self, output, error, track_words=(), debug=True): """ Check for errors and tracked words in the output success means that there are no track_words in the output and there are no errors at all, if track_words is not empty if track_words=(), the result is not important, and we return True :param output: output to check in :param error: errors to check in the output :param track_words: words to track in the output :param debug: whether to log the errors and track words if found :return: True if all error and track words were not found in output else False """ success = True for line in error: if debug: self.log.error(line) if track_words: if "Warning" in line and "hugepages" in line: self.log.info( "There is a warning about transparent_hugepage " "may be in used when install cb server.\ So we will disable transparent_hugepage in this vm") output, error = self.execute_command( "echo never > " "/sys/kernel/mm/transparent_hugepage/enabled") self.log_command_output(output, error) success = True elif "Warning" in line and "systemctl daemon-reload" in line: self.log.info( "Unit file of couchbase-server.service changed on " "disk, we will run 'systemctl daemon-reload'") output, error = self.execute_command("systemctl daemon-reload") self.log_command_output(output, error) success = True elif "Warning" in line and "RPMDB altered outside of yum" in line: self.log.info("Warming: RPMDB altered outside of yum") success = True elif "dirname" in line: self.log.warning( "Ignore dirname error message during couchbase " "startup/stop/restart for CentOS 6.6 (MB-12536)") success = True elif "Created symlink from /etc/systemd/system" in line: self.log.info( "This error is due to fix_failed_install.py script " "that only happens in centos 7") success = True elif "Created symlink /etc/systemd/system/multi-user.target.wants/couchbase-server.service" in line: self.log.info(line) self.log.info( "This message comes only in debian8 and debian9 " "during installation. This can be ignored.") success = True else: self.log.info( "If couchbase server is running with this error. Go to" " log_command_output to add error mesg to bypass it.") success = False if self._check_output(list(track_words), output): success = False install_ok = False if self._check_output("hugepages", output): self.log.info( "There is a warning about transparent_hugepage may be " "in used when install cb server. So we will" "So we will disable transparent_hugepage in this vm") output, error = self.execute_command( "echo never > /sys/kernel/mm/transparent_hugepage/enabled") success = True install_ok = True if self._check_output("successfully installed couchbase server", output): success = True install_ok = True if not install_ok: self.log.error( 'something wrong happened on {0}!!! output:{1}, ' 'error:{2}, track_words:{3}' .format(self.ip, output, error, track_words)) elif debug and output: for line in output: self.log.info(line) return success
def log_command_output(self, output, error, track_words=(), debug=True): success = True for line in error: if debug: self.log.error(line) if track_words: if "Warning" in line and "hugepages" in line: self.log.info( "There is a warning about transparent_hugepage " "may be in used when install cb server.\ So we will disable transparent_hugepage in this vm") output, error = self.execute_command( "echo never > " "/sys/kernel/mm/transparent_hugepage/enabled") self.log_command_output(output, error) success = True elif "Warning" in line and "systemctl daemon-reload" in line: self.log.info( "Unit file of couchbase-server.service changed on " "disk, we will run 'systemctl daemon-reload'") output, error = self.execute_command("systemctl daemon-reload") self.log_command_output(output, error) success = True elif "Warning" in line and "RPMDB altered outside of yum" in line: self.log.info("Warming: RPMDB altered outside of yum") success = True elif "dirname" in line: self.log.warning( "Ignore dirname error message during couchbase " "startup/stop/restart for CentOS 6.6 (MB-12536)") success = True elif "Created symlink from /etc/systemd/system" in line: self.log.info( "This error is due to fix_failed_install.py script " "that only happens in centos 7") success = True elif "Created symlink /etc/systemd/system/multi-user.target.wants/couchbase-server.service" in line: self.log.info(line) self.log.info( "This message comes only in debian8 and debian9 " "during installation. This can be ignored.") success = True else: self.log.info( "If couchbase server is running with this error. Go to" " log_command_output to add error mesg to bypass it.") success = False if self._check_output(list(track_words), output): success = False install_ok = False if self._check_output("hugepages", output): self.log.info( "There is a warning about transparent_hugepage may be " "in used when install cb server. So we will" "So we will disable transparent_hugepage in this vm") output, error = self.execute_command( "echo never > /sys/kernel/mm/transparent_hugepage/enabled") success = True install_ok = True if self._check_output("successfully installed couchbase server", output): success = True install_ok = True if not install_ok: self.log.error( 'something wrong happened on {0}!!! output:{1}, ' 'error:{2}, track_words:{3}' .format(self.ip, output, error, track_words)) elif debug and output: for line in output: self.log.info(line) return success