refactor: bubble up error handling so that standard exit codes can be set at the top-level

LogFail shouldn't be called internally if at all possible.
This commit is contained in:
Jose Diaz-Gonzalez
2021-02-03 04:29:57 -05:00
parent ccdbaa84f9
commit d09a7506df
26 changed files with 113 additions and 80 deletions

View File

@@ -12,7 +12,7 @@ import (
)
// attachAppToNetwork attaches a container to a network
func attachAppToNetwork(containerID string, networkName string, appName string, phase string, processType string) {
func attachAppToNetwork(containerID string, networkName string, appName string, phase string, processType string) error {
cmdParts := []string{
common.DockerBin(),
"network",
@@ -50,8 +50,10 @@ func attachAppToNetwork(containerID string, networkName string, appName string,
_, err := attachCmd.Output()
if err != nil {
err = errors.New(strings.TrimSpace(stderr.String()))
common.LogFail(fmt.Sprintf("Unable to attach container to network: %v", err.Error()))
return fmt.Errorf("Unable to attach container to network: %v", err.Error())
}
return nil
}
// isConflictingPropertyValue returns true if the other attach property has a conflicting value