def get_version(self, *args): """ 参数输入要获取版本信息的软件,支持sysos,syskernel,drbd,linstor,targetcli,pacemaker,corosync 返回数据的顺序与参数顺序一致 :param args: :return: """ result = [] for ssh in self.conn.list_ssh: host = action.Host(ssh) result.append(host.get_hostname()) for soft in args: if soft == 'sysos': result.append(host.get_sys_version()) elif soft == 'syskernel': result.append(host.get_kernel_version()) elif soft == 'drbd': drbd = action.DRBD(ssh) result.append(drbd.get_version()) elif soft == 'linstor': linstor = action.Linstor(ssh) result.append(linstor.get_version()) elif soft == 'targetcli': targetcli = action.TargetCLI(ssh) result.append(targetcli.get_version()) elif soft == 'pacemaker': pacemaker = action.Pacemaker(ssh) result.append(pacemaker.get_version()) elif soft == 'corosync': corosync = action.Corosync(ssh) result.append(corosync.get_version()) for i in range(0, len(result), len(args) + 1): yield result[i:i + len(args) + 1]
def uninstall_drbd(self): result_lst = [] for ssh in self.conn.list_ssh: handler = action.DRBD(ssh) handler.uninstall() result_lst.append(handler.uninstall()) return result_lst
def install_spc(self): result_lst = [] for ssh in self.conn.list_ssh: handler = action.DRBD(ssh) result_lst.append(handler.install_spc()) return result_lst
def install_drbd(self): for ssh in self.conn.list_ssh: handler = action.DRBD(ssh) handler.install_drbd()
def apt_update(self): for ssh in self.conn.list_ssh: handler = action.DRBD(ssh) handler.apt_update()