Skip to content
This repository has been archived by the owner on Aug 15, 2023. It is now read-only.

Commit

Permalink
Remove file when force-bootstrapping
Browse files Browse the repository at this point in the history
Changelog: None
Signed-off-by: Ole Petter <ole.orhagen@northern.tech>
  • Loading branch information
Ole Petter committed Mar 1, 2021
1 parent e76867e commit 1871e11
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/mender/bootstrap/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

import logging as log
import os.path
from typing import Optional

from cryptography.hazmat.primitives.asymmetric.rsa import RSAPrivateKeyWithSerialization
Expand Down Expand Up @@ -40,6 +41,8 @@ def now(
private_key = key_already_generated(private_key_path)
if not private_key:
log.info("Generating a new RSA key pair..")
if force_bootstrap and os.path.exists(private_key_path):
os.unlink(private_key_path)
private_key = key.generate_key()
key.store_key(private_key, private_key_path)
log.info("Device bootstrapped successfully")
Expand Down

0 comments on commit 1871e11

Please sign in to comment.