Fix application isLegacy check for rename and deploy

Change-type: patch
This commit is contained in:
JSReds
2023-03-10 15:54:31 +01:00
parent b0cae93ac9
commit ecf4b046b5
5 changed files with 6 additions and 6 deletions

View File

@ -340,7 +340,7 @@ ${dockerignoreHelp}
); );
let release: Release | ComposeReleaseInfo['release']; let release: Release | ComposeReleaseInfo['release'];
if (appType?.is_legacy) { if (appType.slug === 'legacy-v1' || appType.slug === 'legacy-v2') {
const { deployLegacy } = require('../utils/deploy-legacy'); const { deployLegacy } = require('../utils/deploy-legacy');
const msg = getChalk().yellow( const msg = getChalk().yellow(

View File

@ -80,7 +80,7 @@ export default class FleetRenameCmd extends Command {
const application = await getApplication(balena, params.fleet, { const application = await getApplication(balena, params.fleet, {
$expand: { $expand: {
application_type: { application_type: {
$select: ['is_legacy'], $select: ['slug'],
}, },
}, },
}); });
@ -92,7 +92,7 @@ export default class FleetRenameCmd extends Command {
// Check app supports renaming // Check app supports renaming
const appType = (application.application_type as ApplicationType[])?.[0]; const appType = (application.application_type as ApplicationType[])?.[0];
if (appType.is_legacy) { if (appType.slug === 'legacy-v1' || appType.slug === 'legacy-v2') {
throw new ExpectedError( throw new ExpectedError(
`Fleet ${params.fleet} is of 'legacy' type, and cannot be renamed.`, `Fleet ${params.fleet} is of 'legacy' type, and cannot be renamed.`,
); );

View File

@ -184,7 +184,7 @@ export async function getAppWithArch(
const options: BalenaSdk.PineOptions<BalenaSdk.Application> = { const options: BalenaSdk.PineOptions<BalenaSdk.Application> = {
$expand: { $expand: {
application_type: { application_type: {
$select: ['name', 'slug', 'supports_multicontainer', 'is_legacy'], $select: ['name', 'slug', 'supports_multicontainer'],
}, },
is_for__device_type: { is_for__device_type: {
$select: 'slug', $select: 'slug',

View File

@ -6,7 +6,7 @@
"name": "Starter", "name": "Starter",
"slug": "microservices-starter", "slug": "microservices-starter",
"supports_multicontainer": true, "supports_multicontainer": true,
"is_legacy": false, "is_legacy": true,
"__metadata": {} "__metadata": {}
} }
], ],

View File

@ -6,7 +6,7 @@
"name": "Starter", "name": "Starter",
"slug": "microservices-starter", "slug": "microservices-starter",
"supports_multicontainer": true, "supports_multicontainer": true,
"is_legacy": false, "is_legacy": true,
"__metadata": {} "__metadata": {}
} }
], ],