When deleting a site and then attempting to create a new site under the same domain name an error is generated that the key already exists in the hosting_context table that must be manually removed before the site can be created again.

Comments

realityloop’s picture

example error output when trying to create new site with same name:

user warning: Duplicate entry 'sitename.org.au' for key 2 query: INSERT INTO hosting_context (nid, name) VALUES (1355, 'sitename.org.au') in /var/aegir/hostmaster-0.4-alpha9/profiles/hostmaster/modules/hosting/hosting.module on line 745.

SeanBannister’s picture

Sub, just experienced the same issue.

SeanBannister’s picture

Just in case anyones interested, I just realized that deleting the sites node removes it from hosting_context.

adrian’s picture

Status: Active » Fixed

[master e4d3309] Fix for #874340 delete context on site delete task.
1 files changed, 6 insertions(+), 3 deletions(-)

there's this fix in head now.

Status: Fixed » Closed (fixed)

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

Anonymous’s picture

Version: 6.x-0.4-alpha3 » 6.x-1.x-dev
Component: Code » Documentation
Status: Closed (fixed) » Active

I just came across this same issue/error when trying to delete a site manually following these instructions: http://community.aegirproject.org/node/26
I didn't delete the site node as that step is 'not recommended'.

Can someone add the appropriate step(s) to the documentation (above) to account for this?

anarcat’s picture

Status: Active » Fixed

I am not sure I understand what you are refering to here. You deleted a site manually but didn't remove the site node, why would we remove the hosting_context?

Anonymous’s picture

Status: Fixed » Active

Sorry, I'll try to explain further...

I had a site in Aegir that didn't install properly, it also wouldn't delete properly. I therefore had to delete the site manually by following the 'Manually deleting the site' instructions here: http://community.aegirproject.org/node/26
As per those instructions, I didn't delete the site note itself as that's 'not recommended'.
So that all worked and the site was deleted, but the site node in Aegir remained.

However, I then tried to create a new site with the same domain name (essentially re-installing the same site after I fixed the error that caused the installation to fail the first time). This is when I got the error mentioned in this issue (see #1 above). This was because the site I manually deleted still had an entry in the hosting_context table and so was conflicting with the new site I was trying to create. Manually removing the original site's entry from the hosting_context table allowed me to finally re-install the site successfully.

My recommendation is to add a step to the 'Manually deleting the site' instructions linked above that explains how to delete that entry from the hosting_context table to prevent this issue in future (I'd do it myself but the instructions aren't setup like a wiki entry that I can edit...).

anarcat’s picture

Aaah, I see. Well, this *is* a wiki and you *should* be able to edit it, so go right ahead. :)

Anonymous’s picture

Status: Active » Closed (fixed)

Silly me, didn't realise I had to create an account to edit the page...
Done now, thanks.

  • Commit 27664e4 on dev-dns, dev-log_directory, dev-migrate_aliases, dev-multiserver-install, prod-koumbit, dev-ssl-ip-allocation-refactor, dev-1205458-move_sites_out_of_platforms, 7.x-3.x, dev-588728-views-integration, dev-1403208-new_roles, dev-helmo-3.x by adrian:
    Fix for #874340 delete context on site delete task.
    
    

  • Commit 27664e4 on dev-dns, dev-log_directory, dev-migrate_aliases, dev-multiserver-install, prod-koumbit, dev-ssl-ip-allocation-refactor, dev-1205458-move_sites_out_of_platforms, 7.x-3.x, dev-588728-views-integration, dev-1403208-new_roles, dev-helmo-3.x by adrian:
    Fix for #874340 delete context on site delete task.