From 77b60eb53665d191adb4adcd657642b05038ea54 Mon Sep 17 00:00:00 2001 From: Jonathan Budzenski Date: Mon, 9 Nov 2020 20:30:58 -0600 Subject: [PATCH] only prompt to write if keys are generated --- src/cli_encryption_key/generate.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/cli_encryption_key/generate.js b/src/cli_encryption_key/generate.js index a49975fc4b73d..ca5be94c4c61b 100644 --- a/src/cli_encryption_key/generate.js +++ b/src/cli_encryption_key/generate.js @@ -41,14 +41,14 @@ export async function generate(encryptionConfig, command) { logger.log('No keys to write. Use the --force flag to generate new keys.'); } else { logger.log(safeDump(keys)); - } - if (command.interactive) { - const write = await confirm('Write to kibana.yml?'); - if (write) { - const kibanaYML = join(getConfigDirectory(), 'kibana.yml'); - appendFileSync(kibanaYML, safeDump(keys)); - logger.log(`Wrote ${Object.keys(keys).length} settings to kibana.yml.`); + if (command.interactive) { + const write = await confirm('Write to kibana.yml?'); + if (write) { + const kibanaYML = join(getConfigDirectory(), 'kibana.yml'); + appendFileSync(kibanaYML, safeDump(keys)); + logger.log(`Wrote ${Object.keys(keys).length} settings to kibana.yml.`); + } } } if (command.force && !command.quiet) {