From 67705afe3c6ca986e1fdbf2d971f45e6ad7f6383 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sun, 4 Sep 2016 19:26:00 -0400 Subject: [PATCH] Use apps_create method when renaming an application. Closes #2252 Since they are separate resources, triggering the normal app creation flow makes the most sense. We still remove the cache directory because we want the correct cache permissions for the new application. --- plugins/apps/subcommands/rename | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/apps/subcommands/rename b/plugins/apps/subcommands/rename index 7ad59b08d..34da3df31 100755 --- a/plugins/apps/subcommands/rename +++ b/plugins/apps/subcommands/rename @@ -13,11 +13,11 @@ apps_rename_cmd() { local NEW_APP="$3" local OLD_CACHE_DIR="$DOKKU_ROOT/$OLD_APP/cache" - mkdir -p "$DOKKU_ROOT/$NEW_APP" if [[ -d "$OLD_CACHE_DIR" ]] && ! rmdir "$OLD_CACHE_DIR"; then docker run "$DOKKU_GLOBAL_RUN_ARGS" --rm -v "$OLD_CACHE_DIR:/cache" "dokku/$OLD_APP" chmod 777 -R /cache fi rm -rf "$OLD_CACHE_DIR" + apps_create "$NEW_APP" cp -a "$DOKKU_ROOT/$OLD_APP/." "$DOKKU_ROOT/$NEW_APP" DOKKU_APPS_FORCE_DELETE=1 apps_destroy "$OLD_APP" [[ -f "$DOKKU_ROOT/$NEW_APP/URLS" ]] && sed -i -e "s/$OLD_APP/$NEW_APP/g" "$DOKKU_ROOT/$NEW_APP/URLS"