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()
|
output := out.String()
|
||||||
parts := strings.Split(output, " ")
|
parts := strings.SplitN(output, " ", 5)
|
||||||
envVars, networks, volumes, ports := []string{}, []string{}, []string{}, []string{}
|
envVars, networks, volumes, ports := []string{}, []string{}, []string{}, []string{}
|
||||||
restartPolicy := ""
|
restartPolicy := ""
|
||||||
|
|
||||||
|
@ -176,11 +176,11 @@ func inspectContainer(containerID string) ([]string, []string, []string, []strin
|
||||||
}
|
}
|
||||||
|
|
||||||
func parseJSONStringArray(jsonStr string) []string {
|
func parseJSONStringArray(jsonStr string) []string {
|
||||||
jsonStr = strings.Trim(jsonStr, "[]")
|
jsonStr = strings.Trim(jsonStr, "[]\"")
|
||||||
if jsonStr == "" {
|
if jsonStr == "" {
|
||||||
return []string{}
|
return []string{}
|
||||||
}
|
}
|
||||||
return strings.Split(jsonStr, ",")
|
return strings.Split(jsonStr, "\",\"")
|
||||||
}
|
}
|
||||||
|
|
||||||
func parseJSONNetworkNames(jsonStr string) []string {
|
func parseJSONNetworkNames(jsonStr string) []string {
|
||||||
|
@ -201,7 +201,7 @@ func parseJSONVolumeMounts(jsonStr string) []string {
|
||||||
for _, data := range volumeData {
|
for _, data := range volumeData {
|
||||||
if strings.Contains(data, "\"Destination\"") {
|
if strings.Contains(data, "\"Destination\"") {
|
||||||
parts := strings.Split(data, "\"")
|
parts := strings.Split(data, "\"")
|
||||||
volumeMounts = append(volumeMounts, parts[3])
|
volumeMounts = append(volumeMounts, parts[3]+":"+parts[7])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return volumeMounts
|
return volumeMounts
|
||||||
|
@ -212,8 +212,9 @@ func parseJSONPorts(jsonStr string) []string {
|
||||||
portData := strings.Split(jsonStr, "},{")
|
portData := strings.Split(jsonStr, "},{")
|
||||||
for _, data := range portData {
|
for _, data := range portData {
|
||||||
if strings.Contains(data, "\"HostPort\"") {
|
if strings.Contains(data, "\"HostPort\"") {
|
||||||
parts := strings.Split(data, "\"")
|
hostPort := strings.Split(data, "\"")[3]
|
||||||
ports = append(ports, parts[3]+":"+parts[7])
|
containerPort := strings.Split(data, "\"")[7]
|
||||||
|
ports = append(ports, hostPort+":"+containerPort)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ports
|
return ports
|
||||||
|
|
Loading…
Reference in New Issue