feat: call clone/destroy prop commands as necessary

This commit is contained in:
Jose Diaz-Gonzalez
2020-02-17 19:08:39 -05:00
parent d336d7c5c2
commit 63f4ec3867
18 changed files with 134 additions and 13 deletions

View File

@@ -153,12 +153,37 @@ func TriggerNetworkWritePort(appName string, processType string, containerIndex
}
}
// TriggerPostAppCloneSetup cleans up network files for a new app clone
func TriggerPostAppCloneSetup(appName string) {
success := PostAppCloneSetup(appName)
// TriggerPostAppCloneSetup creates new network files
func TriggerPostAppCloneSetup(oldAppName string, newAppName string) error {
success := ClearNetworkConfig(newAppName)
if !success {
os.Exit(1)
}
err := common.PropertyClone("network", oldAppName, newAppName)
if err != nil {
return err
}
return nil
}
// TriggerPostAppRenameSetup renames network files
func TriggerPostAppRenameSetup(oldAppName string, newAppName string) error {
success := ClearNetworkConfig(newAppName)
if !success {
os.Exit(1)
}
if err := common.PropertyClone("network", oldAppName, newAppName); err != nil {
return err
}
if err := common.PropertyDestroy("network", oldAppName); err != nil {
return err
}
return nil
}
// TriggerPostContainerCreate associates the container with a specified network