feat: 完善数据库信息保存以及项目、redis相关操作

This commit is contained in:
meilin.huang
2021-07-28 18:03:19 +08:00
parent 3ebc3ee14d
commit bda3920c1e
153 changed files with 5527 additions and 1017 deletions

View File

@@ -42,7 +42,10 @@ func GetCli(machineId uint64, getMachine func(uint64) *entity.Machine) (*Cli, er
}
return c, nil
})
return cli.(*Cli), err
if cli != nil {
return cli.(*Cli), err
}
return nil, err
}
//根据机器信息创建客户端对象
@@ -204,3 +207,10 @@ func (c *Cli) RunTerminal(shell string, stdout, stderr io.Writer) error {
session.Run(shell)
return nil
}
// 关闭指定机器的连接
func Close(id uint64) {
if cli, ok := cliCache.Get(fmt.Sprint(id)); ok {
cli.(*Cli).Close()
}
}