feat: ensure network exists before attempting to attach it to a container
This will give better feedback to developers than a potentially generic error.
This commit is contained in:
1 parent
52ef7e7cdc
commit
ab509a7424
1 file changed
+18
@@ -174,6 +174,15 @@ func TriggerPostContainerCreate(containerType string, containerID string, appNam
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
exists, err := networkExists(networkName)
|
||||||
|
if err != nil {
|
||||||
|
common.LogFail(err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
if !exists {
|
||||||
|
common.LogFail(fmt.Sprintf("Network %v does not exist", networkName))
|
||||||
|
}
|
||||||
|
|
||||||
attachAppToNetwork(containerID, networkName, appName, phase, processType)
|
attachAppToNetwork(containerID, networkName, appName, phase, processType)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -208,6 +217,15 @@ func TriggerCorePostDeploy(appName string) {
|
|||||||
common.LogFail(err.Error())
|
common.LogFail(err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
exists, err := networkExists(networkName)
|
||||||
|
if err != nil {
|
||||||
|
common.LogFail(err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
if !exists {
|
||||||
|
common.LogFail(fmt.Sprintf("Network %v does not exist", networkName))
|
||||||
|
}
|
||||||
|
|
||||||
for _, containerID := range containerIDs {
|
for _, containerID := range containerIDs {
|
||||||
processType, err := common.DockerInspect(containerID, "{{ index .Config.Labels \"com.dokku.process-type\"}}")
|
processType, err := common.DockerInspect(containerID, "{{ index .Config.Labels \"com.dokku.process-type\"}}")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in new issue
Block a user