Skip to content

Already saved private key is deleted if trying to provision already provisioned board #142

Open
@jesperbnp

Description

@jesperbnp

This check deletes the previously saved private key if trying to re-provision a board.

get_variable private-key > "${KEYPAIR_DIR}/${TARGET_DEVICE_SERIAL}.der" || N_ALREADY_PROVISIONED=$?

Suggest changing to something like this:

N_ALREADY_PROVISIONED=0
PRIVATE_KEY=$(get_variable private-key) || N_ALREADY_PROVISIONED=$?
if [ 0 -ne "$N_ALREADY_PROVISIONED" ]; then
    keywriter_log "Warning: Unable to retrieve device private key; already provisioned"
else
    echo ${PRIVATE_KEY} > "${KEYPAIR_DIR}/${TARGET_DEVICE_SERIAL}.der"
fi
get_variable public-key > "${KEYPAIR_DIR}/${TARGET_DEVICE_SERIAL}.pub"

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions