From f451a259e296325a9a6f3651e51827399c672282 Mon Sep 17 00:00:00 2001 From: KPrasch Date: Wed, 31 Jul 2024 21:26:57 +0700 Subject: [PATCH] inspect the contents of the keystore directory when checking for init-time existing private keys --- nucypher/cli/commands/ursula.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/nucypher/cli/commands/ursula.py b/nucypher/cli/commands/ursula.py index 1f0207e92..8601bbbfd 100644 --- a/nucypher/cli/commands/ursula.py +++ b/nucypher/cli/commands/ursula.py @@ -321,13 +321,12 @@ def init(general_config, config_options, force, config_root, key_material): if not config_root: config_root = general_config.config_root - config_path = Path(config_root) - keystore_path = config_path / Keystore._DEFAULT_DIR - if config_path.exists() and keystore_path.exists(): + keystore_path = Path(config_root) / Keystore._DIR_NAME + if keystore_path.exists() and any(keystore_path.iterdir()): click.clear() emitter.echo( f"There are existing secret keys in '{keystore_path}'.\n" - "The 'init' command is a one-time operation, do not run it again.\n\n", + "The 'init' command is a one-time operation, do not run it again.\n", color="red", )