mirror of
https://github.com/theupdateframework/python-tuf
synced 2026-05-24 10:08:28 +00:00
Make sure the keystore directory exists when moving default keys
Signed-off-by: Vladimir Diaz <vladimir.v.diaz@gmail.com>
This commit is contained in:
parent
274aa35efa
commit
dfd88860c6
1 changed files with 10 additions and 4 deletions
|
|
@ -296,10 +296,16 @@ def gen_key(parsed_arguments):
|
|||
# working directory. By default, the filenames are written to <KEYID>.pub
|
||||
# and <KEYID> (private key). Move them from the CWD to the repo's keystore.
|
||||
if not parsed_arguments.filename:
|
||||
shutil.move(keypath, os.path.join(parsed_arguments.path,
|
||||
KEYSTORE_DIR, os.path.basename(keypath)))
|
||||
shutil.move(keypath + '.pub', os.path.join(parsed_arguments.path,
|
||||
KEYSTORE_DIR, os.path.basename(keypath + '.pub')))
|
||||
privkey_repo_path = os.path.join(parsed_arguments.path,
|
||||
KEYSTORE_DIR, os.path.basename(keypath))
|
||||
pubkey_repo_path = os.path.join(parsed_arguments.path,
|
||||
KEYSTORE_DIR, os.path.basename(keypath + '.pub'))
|
||||
|
||||
securesystemslib.util.ensure_parent_dir(privkey_repo_path)
|
||||
securesystemslib.util.ensure_parent_dir(pubkey_repo_path)
|
||||
|
||||
shutil.move(keypath, privkey_repo_path)
|
||||
shutil.move(keypath + '.pub', pubkey_repo_path)
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue