retry
This commit is contained in:
parent
f759a44e04
commit
628a734a37
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
13
main.go
13
main.go
|
@ -152,7 +152,7 @@ func inspectContainer(containerID string) ([]string, []string, []string, []strin
|
|||
}
|
||||
|
||||
output := out.String()
|
||||
parts := strings.Split(output, " ")
|
||||
parts := strings.SplitN(output, " ", 5)
|
||||
envVars, networks, volumes, ports := []string{}, []string{}, []string{}, []string{}
|
||||
restartPolicy := ""
|
||||
|
||||
|
@ -176,11 +176,11 @@ func inspectContainer(containerID string) ([]string, []string, []string, []strin
|
|||
}
|
||||
|
||||
func parseJSONStringArray(jsonStr string) []string {
|
||||
jsonStr = strings.Trim(jsonStr, "[]")
|
||||
jsonStr = strings.Trim(jsonStr, "[]\"")
|
||||
if jsonStr == "" {
|
||||
return []string{}
|
||||
}
|
||||
return strings.Split(jsonStr, ",")
|
||||
return strings.Split(jsonStr, "\",\"")
|
||||
}
|
||||
|
||||
func parseJSONNetworkNames(jsonStr string) []string {
|
||||
|
@ -201,7 +201,7 @@ func parseJSONVolumeMounts(jsonStr string) []string {
|
|||
for _, data := range volumeData {
|
||||
if strings.Contains(data, "\"Destination\"") {
|
||||
parts := strings.Split(data, "\"")
|
||||
volumeMounts = append(volumeMounts, parts[3])
|
||||
volumeMounts = append(volumeMounts, parts[3]+":"+parts[7])
|
||||
}
|
||||
}
|
||||
return volumeMounts
|
||||
|
@ -212,8 +212,9 @@ func parseJSONPorts(jsonStr string) []string {
|
|||
portData := strings.Split(jsonStr, "},{")
|
||||
for _, data := range portData {
|
||||
if strings.Contains(data, "\"HostPort\"") {
|
||||
parts := strings.Split(data, "\"")
|
||||
ports = append(ports, parts[3]+":"+parts[7])
|
||||
hostPort := strings.Split(data, "\"")[3]
|
||||
containerPort := strings.Split(data, "\"")[7]
|
||||
ports = append(ports, hostPort+":"+containerPort)
|
||||
}
|
||||
}
|
||||
return ports
|
||||
|
|
Loading…
Reference in New Issue