diff --git a/src/deploy-actions.js b/src/deploy-actions.js index 0ccc368..8138eb6 100644 --- a/src/deploy-actions.js +++ b/src/deploy-actions.js @@ -174,12 +174,8 @@ async function deployWsk (scriptConfig, manifestContent, logFunc, filterEntities apihost: scriptConfig.ow.apihost, apiversion: scriptConfig.ow.apiversion, api_key: scriptConfig.ow.auth, - namespace: scriptConfig.ow.namespace - } - - // TODO: remove this once the feature flag is removed - if ('auth_handler' in scriptConfig.ow && scriptConfig.ow.auth_handler) { - owOptions.auth_handler = scriptConfig.ow.auth_handler + namespace: scriptConfig.ow.namespace, + auth_handler: scriptConfig.ow.auth_handler } const lastDeployedActionsPath = path.join(scriptConfig.root, 'dist', 'last-deployed-actions.json') diff --git a/src/print-action-logs.js b/src/print-action-logs.js index a071f06..470501c 100644 --- a/src/print-action-logs.js +++ b/src/print-action-logs.js @@ -39,12 +39,8 @@ async function printActionLogs (config, logger, limit, filterActions, strip, tai apihost: config.ow.apihost, apiversion: config.ow.apiversion, api_key: config.ow.auth, - namespace: config.ow.namespace - } - - // TODO: remove this once the feature flag is removed - if ('auth_handler' in config.ow && config.ow.auth_handler) { - runtimeOptions.auth_handler = config.ow.auth_handler + namespace: config.ow.namespace, + auth_handler: config.ow.auth_handler } const runtime = await new IOruntime().init(runtimeOptions) diff --git a/src/undeploy-actions.js b/src/undeploy-actions.js index 1324e1f..bf72eeb 100644 --- a/src/undeploy-actions.js +++ b/src/undeploy-actions.js @@ -31,12 +31,8 @@ async function undeployActions (config, logFunc) { apihost: config.ow.apihost, apiversion: config.ow.apiversion, api_key: config.ow.auth, - namespace: config.ow.namespace - } - - // TODO: remove this once the feature flag is removed - if ('auth_handler' in config.ow && config.ow.auth_handler) { - owOptions.auth_handler = config.ow.auth_handler + namespace: config.ow.namespace, + auth_handler: config.ow.auth_handler } // replace package name diff --git a/src/utils.js b/src/utils.js index 0d20a80..ceb5ee4 100644 --- a/src/utils.js +++ b/src/utils.js @@ -437,22 +437,21 @@ function getActionEntryFile (pkgJsonPath) { */ function zip (filePath, out, pathInZip = false) { aioLogger.debug(`Creating zip of file/folder ${filePath}`) - const stream = fs.createWriteStream(out) - const archive = archiver('zip', { zlib: { level: 9 } }) return new Promise((resolve, reject) => { - stream.on('close', () => resolve()) - archive.pipe(stream) - archive.on('error', err => reject(err)) - let stats try { stats = fs.lstatSync(filePath) // throws if ENOENT } catch (e) { - archive.destroy() - reject(e) + return reject(e) } + const stream = fs.createWriteStream(out) + const archive = archiver('zip', { zlib: { level: 9 } }) + stream.on('close', () => resolve()) + archive.pipe(stream) + archive.on('error', err => reject(err)) + if (stats.isDirectory()) { archive.directory(filePath, pathInZip) } else { diff --git a/test/utils.test.js b/test/utils.test.js index 5943d93..ba30cf7 100644 --- a/test/utils.test.js +++ b/test/utils.test.js @@ -2232,6 +2232,7 @@ describe('zip', () => { await expect(utils.zip('/notexist.js', '/out.zip')).rejects.toEqual(expect.objectContaining({ message: expect.stringContaining('ENOENT') })) + expect(archiver.mockFile).toHaveBeenCalledTimes(0) expect(archiver.mockDirectory).toHaveBeenCalledTimes(0) expect(fs.existsSync('/out.zip')).toEqual(false)