extend token time limit
This commit is contained in:
parent
130968e4a9
commit
0693cb6876
|
@ -1,11 +1,5 @@
|
|||
package slurm
|
||||
|
||||
import (
|
||||
"gitlink.org.cn/JointCloud/pcm-hpc/utils"
|
||||
gossh "golang.org/x/crypto/ssh"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type client struct {
|
||||
adapterId string
|
||||
clusterId string
|
||||
|
@ -55,23 +49,23 @@ func newClient(options ClientOptions) (Client, error) {
|
|||
adaptMode: options.AdaptMode,
|
||||
clientVersion: options.ClientVersion,
|
||||
}
|
||||
cli := utils.Cli{
|
||||
Addr: strings.Split(options.URL, ":")[1][2:],
|
||||
User: options.CmdUserName,
|
||||
Pwd: options.Password,
|
||||
}
|
||||
// 建立连接对象
|
||||
cl, _ := cli.ConnectWithPrivateKey()
|
||||
// 退出时关闭连接
|
||||
defer func(Client *gossh.Client) {
|
||||
err := Client.Close()
|
||||
if err != nil {
|
||||
|
||||
}
|
||||
}(cl.Client)
|
||||
res, _ := cl.Run(`scontrol token username=root lifespan=30000`)
|
||||
arr := strings.Split(res, "=")
|
||||
c.token = strings.Replace(arr[1], "\n", "", -1)
|
||||
//cli := utils.Cli{
|
||||
// Addr: strings.Split(options.URL, ":")[1][2:],
|
||||
// User: options.CmdUserName,
|
||||
// Pwd: options.Password,
|
||||
//}
|
||||
//// 建立连接对象
|
||||
//cl, _ := cli.ConnectWithPrivateKey()
|
||||
//// 退出时关闭连接
|
||||
//defer func(Client *gossh.Client) {
|
||||
// err := Client.Close()
|
||||
// if err != nil {
|
||||
//
|
||||
// }
|
||||
//}(cl.Client)
|
||||
//res, _ := cl.Run(`scontrol token username=root lifespan=30000`)
|
||||
//arr := strings.Split(res, "=")
|
||||
//c.token = strings.Replace(arr[1], "\n", "", -1)
|
||||
|
||||
return c, nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue