forked from toolshed/abra
fix: more reliable syncing
This commit is contained in:
@ -130,11 +130,18 @@ func UpdateLabel(pattern, serviceName, label, recipeName string) error {
|
||||
old := fmt.Sprintf("coop-cloud.${STACK_NAME}.version=%s", value)
|
||||
replacedBytes := strings.Replace(string(bytes), old, label, -1)
|
||||
|
||||
if old == label {
|
||||
logrus.Warnf("%s is already set, nothing to do?", label)
|
||||
return nil
|
||||
}
|
||||
|
||||
logrus.Debugf("updating %s to %s in %s", old, label, compose.Filename)
|
||||
|
||||
if err := ioutil.WriteFile(compose.Filename, []byte(replacedBytes), 0644); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
logrus.Infof("synced label %s to service %s", label, serviceName)
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user