OPSEXP-2250 Fix s3 download command in init aps (#8842)

This commit is contained in:
Giovanni Toraldo 2023-08-22 17:03:09 +02:00 committed by GitHub
parent b58e6f628a
commit a8be9d64e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -435,17 +435,23 @@ async function authorizeUserToContentWithBasic(username: string, contentId: stri
} }
async function downloadLicenseFile(apsLicensePath: string) { async function downloadLicenseFile(apsLicensePath: string) {
try { const args = [
spawnSync(` aws s3 cp ${apsLicensePath} ./ `, { `s3`,
cwd: path.resolve(__dirname, `./`), `cp`,
shell: false apsLicensePath,
}); `./`
logger.info(`Aps license file download from S3 bucket`); ];
return true; const result = spawnSync(`aws`, args, {
} catch (error) { cwd: path.resolve(__dirname, `./`),
logger.error(`Not able to download the APS license from S3 bucket` ); shell: false
});
if (result.status !== 0) {
logger.error(`Not able to download the APS license from S3 bucket.\nCommand aws ${args.join(' ')} - failed with:\n${result.output}`);
return false; return false;
} }
logger.info(`Aps license file download from S3 bucket`);
return true;
} }
function sleep(delay: number) { function sleep(delay: number) {