[Agent][GO] - fix docker deploy version

This commit is contained in:
zeaslity
2024-07-17 11:00:42 +08:00
parent 975cc54766
commit 034ae3d25b
3 changed files with 17 additions and 3 deletions

View File

@@ -866,7 +866,7 @@ func (op *AgentOsOperator) installDockerExec(args []string) (bool, []string) {
// get by method
ok, log4 := HardCodeCommandExecutor("apt-cache madison docker-ce | grep 20.10.20 | awk '{print$3}'")
if ok {
if ok && log4 != nil && len(log4) > 0 {
specificDockerVersion = strings.TrimSpace(log4[0])
}

View File

@@ -183,7 +183,7 @@ func TestHardCodeCommandExecutor(t *testing.T) {
// get by method
ok, log4 := HardCodeCommandExecutor("apt-cache madison docker-ce | grep 20.10.20 | awk '{print$3}'")
if ok {
if ok && log4 != nil && len(log4) > 0 {
specificDockerVersion = strings.TrimSpace(log4[0])
}