diff --git a/src/commands/app/deploy.js b/src/commands/app/deploy.js index 42ce431b..aecdb37b 100644 --- a/src/commands/app/deploy.js +++ b/src/commands/app/deploy.js @@ -58,7 +58,12 @@ class Deploy extends BuildCommand { try { const aioConfig = this.getFullConfig().aio // 1. update log forwarding configuration - if (flags['log-forwarding-update'] && flags.actions) { + // note: it is possible that .aio file does not exist, which means there is no local lg config + if (aioConfig && + aioConfig.project && + aioConfig.project.workspace && + flags['log-forwarding-update'] && + flags.actions) { spinner.start('Updating log forwarding configuration') try { const lf = await LogForwarding.init(aioConfig) @@ -68,10 +73,12 @@ class Deploy extends BuildCommand { await lf.updateServerConfig(lfConfig) spinner.succeed(chalk.green(`Log forwarding is set to '${lfConfig.getDestination()}'`)) } else { - spinner.fail(chalk.green('Log forwarding is not updated: no configuration is provided')) + if (flags.verbose) { + spinner.info(chalk.dim('Log forwarding is not updated: no configuration is provided')) + } } } else { - spinner.fail(chalk.green('Log forwarding is not updated: configuration not changed since last update')) + spinner.info(chalk.dim('Log forwarding is not updated: configuration not changed since last update')) } } catch (error) { spinner.fail(chalk.red('Log forwarding is not updated.')) diff --git a/test/commands/app/deploy.test.js b/test/commands/app/deploy.test.js index 13371dc5..87bbdc8a 100644 --- a/test/commands/app/deploy.test.js +++ b/test/commands/app/deploy.test.js @@ -902,6 +902,15 @@ describe('run', () => { expect(mockLogForwarding.updateServerConfig).toBeCalledTimes(0) }) + test('log forwarding is not updated on server when local config is absent --verbose', async () => { + command.getAppExtConfigs.mockReturnValueOnce(createAppConfig(command.appConfig)) + const config = new LogForwarding.LogForwardingConfig() + mockLogForwarding.getLocalConfigWithSecrets.mockReturnValue(config) + command.argv = ['--verbose'] + await command.run() + expect(mockLogForwarding.updateServerConfig).toBeCalledTimes(0) + }) + test('log forwarding is not updated on server when local config not changed', async () => { command.getAppExtConfigs.mockReturnValueOnce(createAppConfig(command.appConfig)) mockLogForwarding.isLocalConfigChanged.mockReturnValue(false)