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) {
try {
spawnSync(` aws s3 cp ${apsLicensePath} ./ `, {
const args = [
`s3`,
`cp`,
apsLicensePath,
`./`
];
const result = spawnSync(`aws`, args, {
cwd: path.resolve(__dirname, `./`),
shell: false
});
logger.info(`Aps license file download from S3 bucket`);
return true;
} catch (error) {
logger.error(`Not able to download the APS license from S3 bucket` );
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;
}
logger.info(`Aps license file download from S3 bucket`);
return true;
}
function sleep(delay: number) {