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:
@@ -174,6 +174,15 @@ func TriggerPostContainerCreate(containerType string, containerID string, appNam
|
||||
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)
|
||||
}
|
||||
|
||||
@@ -208,6 +217,15 @@ func TriggerCorePostDeploy(appName string) {
|
||||
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 {
|
||||
processType, err := common.DockerInspect(containerID, "{{ index .Config.Labels \"com.dokku.process-type\"}}")
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user