I have an existing platform named myplatform-8.x-0.1 and want to create an new platform version to migrate to named myplatform-8.x-0.2 using the same make file (but pulling in updated code from a git repo). I accidentally enter the old platform name of myplatform-8.x-0.1 when creating the new platform, which causes a database error (sorry I didn't grab a copy of this at the time and couldn't find it in the apache or mysql error logs, but it was something along the lines of ... PDO exception myplatform-8.x-0.1 already exists in db).

Although the new platform creation fails with that error, it corrupts the old platform and any site on the old platform. Sites can be disabled but sites using that platform and the platform itself can't be deleted.

Comments

inteja created an issue. See original summary.

inteja’s picture

Actually just tried again, cleaned out db entries manually and here's another error I get on site creation:

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'mysite.stage.example.com' for key 'name': INSERT INTO {hosting_context} (nid, name) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1); Array ( [:db_insert_placeholder_0] => 414 [:db_insert_placeholder_1] => mysite.stage.example.com ) in hosting_context_register() (line 1122 of /var/aegir/hostmaster-7.x-3.x-2016-01-15-0833/profiles/hostmaster/modules/aegir/hosting/hosting.module).

Deleting that row in hosting_context allowed me to then recreate the site again.

Sorry if all this isn't clear enough. The basic gist is that Aegir 3.2 doesn't seem to react well if you try to create a platform with a name that already exists, using the same makefile path.

ergonlogic’s picture

Looks like we're missing a bit of validation there.

ergonlogic’s picture

Indeed, the db_query() in hosting_platform_validate() looks like it needs some work.

Inteja, care to take a crack at a patch?

ergonlogic’s picture

Title: Entering pre-existing platform name causes cascade of issues » Ensure platform name is unique
Project: Provision » Hosting

  • ergonlogic committed fb8ce91 on 7.x-3.x
    Issue #2652448: Ensure platform name is unique.
    
ergonlogic’s picture

Fixed in fb8ce91.

Looks like we need to fix #2652802: Ensure platform path is unique too.

ergonlogic’s picture

Status: Active » Fixed
inteja’s picture

Thanks @ergonlogic.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.