New install: a failed or removed install's short name can be used again
Found in the VM test: after a failed install, retrying with the same short name was refused, and the unique short name per product would have blocked it anyway. A failed install's record is replaced; a removed one keeps its history under another name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -387,7 +387,14 @@ async function newInstall(input, admin, now = new Date()) {
|
||||
if (!server) throw fail(404, 'NOT_FOUND', 'Server not found.');
|
||||
const release = await releaseFor(product, input.version || null);
|
||||
await preflight(server, product, release.version, now);
|
||||
if (await prisma.deployment.findFirst({ where: { shortName, status: { not: 'removed' } } })) throw fail(409, 'SHORT_NAME_TAKEN', `The short name ${shortName} is already used.`);
|
||||
if (await prisma.deployment.findFirst({ where: { shortName, status: { notIn: ['removed', 'failed'] } } })) throw fail(409, 'SHORT_NAME_TAKEN', `The short name ${shortName} is already used.`);
|
||||
// The name is free again after a failed install (its ports were already freed) or an uninstall.
|
||||
// A failed install's record goes; a removed one keeps its history under another name (the
|
||||
// database allows one install per short name and product). Found in the VM test.
|
||||
await prisma.deployment.deleteMany({ where: { shortName, product, status: 'failed' } });
|
||||
for (const old of await prisma.deployment.findMany({ where: { shortName, product, status: 'removed' } })) {
|
||||
await prisma.deployment.update({ where: { id: old.id }, data: { shortName: `${shortName}~removed-${old.id.slice(0, 8)}` } });
|
||||
}
|
||||
const warnings = [];
|
||||
const dnsOk = await dnsPointsAtCentral(domain);
|
||||
if (dnsOk === false) warnings.push(`${domain} doesn't point at the central server yet (the install still runs).`);
|
||||
|
||||
Reference in New Issue
Block a user