fix: ensure the new service does not exist when cloning an existing service

This commit is contained in:
Jose Diaz-Gonzalez
2022-07-06 01:47:31 -04:00
parent 78c2d69811
commit 20164dca78
2 changed files with 11 additions and 0 deletions

View File

@@ -27,6 +27,9 @@ service-clone-cmd() {
[[ -z "$SERVICE" ]] && dokku_log_fail "Please specify a valid name for the service"
[[ -z "$NEW_SERVICE" ]] && dokku_log_fail "Please specify a name for the new service"
verify_service_name "$SERVICE"
if service_exists "$NEW_SERVICE"; then
dokku_log_fail "Invalid service name $NEW_SERVICE. Verify the service name is not already in use."
fi
local SERVICE_ROOT="$PLUGIN_DATA_ROOT/$SERVICE"
local ID="$(cat "$SERVICE_ROOT/ID")"