fix: respond to pr comments
This commit is contained in:
3 files changed
+5
-22
No files matched your search
@@ -278,13 +278,14 @@ func convertLegacyMigratedMarker(appName, phase string) error {
|
|||||||
// previous release - who have `migrated-from-files` set AND `.migrated`
|
// previous release - who have `migrated-from-files` set AND `.migrated`
|
||||||
// files on disk - still get those files drained into properties.
|
// files on disk - still get those files drained into properties.
|
||||||
func migrateLegacyDockerOptionsFiles() error {
|
func migrateLegacyDockerOptionsFiles() error {
|
||||||
|
if common.PropertyGet("docker-options", "--global", "migrated-from-files") == "true" {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
apps, err := common.DokkuApps()
|
apps, err := common.DokkuApps()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if errors.Is(err, common.NoAppsExist) {
|
if errors.Is(err, common.NoAppsExist) {
|
||||||
if !common.PropertyExists("docker-options", "--global", "migrated-from-files") {
|
return common.PropertyWrite("docker-options", "--global", "migrated-from-files", "true")
|
||||||
return common.PropertyWrite("docker-options", "--global", "migrated-from-files", "true")
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -292,7 +293,6 @@ func migrateLegacyDockerOptionsFiles() error {
|
|||||||
// Upgrade-cycle conversion: drain any `.migrated` sentinels left
|
// Upgrade-cycle conversion: drain any `.migrated` sentinels left
|
||||||
// behind by the previous release into the new per-phase properties.
|
// behind by the previous release into the new per-phase properties.
|
||||||
// Always runs; cheap when nothing to do.
|
// Always runs; cheap when nothing to do.
|
||||||
// TODO(post-deprecation): remove this loop.
|
|
||||||
for _, appName := range apps {
|
for _, appName := range apps {
|
||||||
for _, phase := range availablePhases {
|
for _, phase := range availablePhases {
|
||||||
if err := convertLegacyMigratedMarker(appName, phase); err != nil {
|
if err := convertLegacyMigratedMarker(appName, phase); err != nil {
|
||||||
@@ -301,10 +301,6 @@ func migrateLegacyDockerOptionsFiles() error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if common.PropertyExists("docker-options", "--global", "migrated-from-files") {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, appName := range apps {
|
for _, appName := range apps {
|
||||||
for _, phase := range availablePhases {
|
for _, phase := range availablePhases {
|
||||||
legacyPath := filepath.Join(common.AppRoot(appName), "DOCKER_OPTIONS_"+strings.ToUpper(phase))
|
legacyPath := filepath.Join(common.AppRoot(appName), "DOCKER_OPTIONS_"+strings.ToUpper(phase))
|
||||||
@@ -355,14 +351,3 @@ func readLegacyOptionsFile(path string) ([]string, error) {
|
|||||||
}
|
}
|
||||||
return lines, nil
|
return lines, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// removeMigratedLegacyFiles deletes any leftover DOCKER_OPTIONS_*.migrated
|
|
||||||
// files for an app. Called from post-delete so we don't leak files into a
|
|
||||||
// directory that is about to be torn down anyway.
|
|
||||||
// TODO(post-deprecation): remove this helper and the call in TriggerPostDelete.
|
|
||||||
func removeMigratedLegacyFiles(appName string) {
|
|
||||||
for _, phase := range availablePhases {
|
|
||||||
path := filepath.Join(common.AppRoot(appName), "DOCKER_OPTIONS_"+strings.ToUpper(phase)+".migrated")
|
|
||||||
_ = os.Remove(path)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -44,7 +44,6 @@ func TriggerPostDelete(appName string) error {
|
|||||||
if err := common.PropertyDestroy("docker-options", appName); err != nil {
|
if err := common.PropertyDestroy("docker-options", appName); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
removeMigratedLegacyFiles(appName)
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -264,4 +264,3 @@ web: python3 -u web.py
|
|||||||
worker: python3 -u worker.py
|
worker: python3 -u worker.py
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
Reference in new issue
Block a user