rename checkManifestConstraints function

This commit is contained in:
Girish Ramakrishnan
2024-03-30 18:25:33 +01:00
parent 781ee77280
commit 110e683318
+7 -7
View File
@@ -74,7 +74,7 @@ exports = module.exports = {
startExec,
getExec,
checkManifestConstraints,
checkManifestConstraints: checkManifest,
canAutoupdateApp,
autoupdateApps,
@@ -1347,7 +1347,7 @@ async function install(data, auditSource) {
let error = manifestFormat.parse(manifest);
if (error) throw new BoxError(BoxError.BAD_FIELD, `Manifest error: ${error.message}`);
error = checkManifestConstraints(manifest);
error = await checkManifest(manifest);
if (error) throw error;
error = validatePortBindings(data.portBindings || null, manifest);
@@ -1991,7 +1991,7 @@ async function updateApp(app, data, auditSource) {
error = manifestFormat.parse(manifest);
if (error) throw new BoxError(BoxError.BAD_FIELD, 'Manifest error:' + error.message);
error = checkManifestConstraints(manifest);
error = await checkManifest(manifest);
if (error) throw error;
const updateConfig = { skipBackup, manifest, appStoreId }; // this will clear appStoreId when updating from a repo and set it if passed in for update route
@@ -2136,7 +2136,7 @@ async function repair(app, data, auditSource) {
let error = manifestFormat.parse(data.manifest);
if (error) throw new BoxError(BoxError.BAD_FIELD, `manifest error: ${error.message}`);
error = checkManifestConstraints(data.manifest);
error = await checkManifest(data.manifest);
if (error) throw error;
if (!data.manifest.addons?.sendmail) { // clear if repair removed addon
@@ -2182,7 +2182,7 @@ async function restore(app, backupId, auditSource) {
if (backupInfo.encryptionVersion === 1) throw new BoxError(BoxError.BAD_FIELD, 'This encrypted backup was created with an older Cloudron version and has to be restored using the CLI tool');
// re-validate because this new box version may not accept old configs
error = checkManifestConstraints(manifest);
error = await checkManifest(manifest);
if (error) throw error;
const values = { manifest };
@@ -2333,7 +2333,7 @@ async function clone(app, data, user, auditSource) {
if (error) throw error;
// re-validate because this new box version may not accept old configs
error = checkManifestConstraints(manifest);
error = await checkManifest(manifest);
if (error) throw error;
error = validatePortBindings(data.portBindings || null, manifest);
@@ -2467,7 +2467,7 @@ async function restart(app, auditSource) {
return { taskId };
}
function checkManifestConstraints(manifest) {
async function checkManifest(manifest) {
assert(manifest && typeof manifest === 'object');
if (manifest.manifestVersion !== 2) return new BoxError(BoxError.BAD_FIELD, 'Manifest version must be 2');