inspect the contents of the keystore directory when checking for init-time existing private keys

pull/3533/head
KPrasch 2024-07-31 21:26:57 +07:00
parent 3e37a106b3
commit f451a259e2
No known key found for this signature in database
1 changed files with 3 additions and 4 deletions

View File

@ -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",
)