def kubectl_ready_test(self): while True: res = common.execute_shell_return("kubectl get node", "There will be a delay after installing, please wait.") if res == True: break
def kubectl_ready_test(self): times = 0 while True: res = common.execute_shell_return( "kubectl get node", "There will be a delay after installing, please wait.") times = times + 1 if res == True: break if times == 30: self.logger.error("kubectl ready test failed. Exit paictl.") sys.exit(1)
def job_executer_clean_up_node(self): self.logger.info("{0} job begins !".format(self.jobname)) commandline = "kubectl delete node {0}".format( self.node_config['nodename']) common.execute_shell_return( commandline, "Failed to delete node {0}".format(self.node_config['nodename'])) # sftp your script to remote host with paramiko. srcipt_package = "{0}.tar".format(self.jobname) src_local = "parcel-center/{0}".format(self.node_config["nodename"]) dst_remote = common.get_user_dir(self.node_config) if common.sftp_paramiko(src_local, dst_remote, srcipt_package, self.node_config) == False: sys.exit(1) commandline = "tar -xvf {0}.tar".format(self.jobname, self.node_config['hostip']) if common.ssh_shell_paramiko(self.node_config, commandline) == False: self.logger.error("Failed to uncompress {0}.tar".format( self.jobname)) sys.exit(1) commandline = "sudo /bin/bash {0}/kubernetes-cleanup.sh".format( self.jobname) if common.ssh_shell_with_password_input_paramiko( self.node_config, commandline) == False: self.logger.error( "Failed to cleanup the kubernetes deployment on {0}".format( self.node_config['hostip'])) sys.exit(1) self.logger.info("Successfully running {0} job on node {1}".format( self.jobname, self.node_config["nodename"]))
def kubectl_ready_test(self): times = 0 while True: res = common.execute_shell_return("kubectl get node", "There will be a delay after installing, please wait.") times = times + 1 if res == True: break if times == 30: self.logger.error("kubectl ready test failed. Exit paictl.") sys.exit(1) self.logger.info("Wait 5s, and retry it later.") time.sleep(5) self.logger.info("Successfully install kubectl and configure it!")