def deploy_ca_certs(file_path_list, remote_ip, user, password, dest_dir, no_delete=None): """ Copy files to remote node and remove local files """ CommonTools.remote_mkdir_with_mode(dest_dir, Constant.AUTH_COMMON_DIR_STR, remote_ip, user, password) for file_path in file_path_list: dest_file_path = os.path.join(dest_dir, os.path.basename(file_path)) status, output = CommonTools.remote_copy_files( remote_ip, user, password, file_path, dest_file_path) if status != 0: raise Exception(Errors.EXECUTE_RESULT['gauss_0406'] % (remote_ip, output)) g.logger.debug('Successfully copy [%s] to remote node[%s]' % (file_path, remote_ip)) if no_delete: file_path_list = [ file for file in file_path_list if file not in no_delete ] CommonTools.remove_files(file_path_list)
def _mk_remote_manager_dir(self): """ Create install path if the path is not exist. """ for node in self.agent_nodes: ip = node.get(Constant.NODE_IP) uname = node.get(Constant.NODE_USER) pwd = node.get(Constant.NODE_PWD) CommonTools.remote_mkdir_with_mode(self.manager_path, Constant.AUTH_COMMON_DIR_STR, ip, uname, pwd) g.logger.info('Successfully create manager path dir on node:[%s]' % ip)
def _copy_param_file_to_remote_node(self, path_from, path_to): """ Copy params file to remote agent node """ for node in self.agent_nodes: ip = node.get(Constant.NODE_IP) uname = node.get(Constant.NODE_USER) pwd = node.get(Constant.NODE_PWD) CommonTools.remote_mkdir_with_mode(os.path.dirname(path_to), Constant.AUTH_COMMON_DIR_STR, ip, uname, pwd) status, output = CommonTools.remote_copy_files( ip, uname, pwd, path_from, path_to) if status != 0: raise Exception(Errors.EXECUTE_RESULT['gauss_0406'] % (ip, output)) else: g.logger.info( 'Successfully copy install param file to node[%s].' % ip)
def _mk_remote_module_dir(self): """ Create install path if the path is not exist. """ for node in self.install_nodes: ip = node.get(Constant.NODE_IP) uname = node.get(Constant.NODE_USER) pwd = node.get(Constant.NODE_PWD) _, output = CommonTools.remote_mkdir_with_mode( os.path.dirname(self.module_path), Constant.AUTH_COMMON_DIR_STR, ip, uname, pwd) g.logger.info( 'Result of create module path dir on node:[%s], output:%s' % (ip, output))