Repository navigation
fix: reusing certificate was failing - #100
Merged
Merged
Conversation
Signed-off-by: Maximilian Deubel <maximilian.deubel@nordicsemi.no>
There was a problem hiding this comment.
🟡 Changes recommended
The regression test’s serial fake rejects the private-key write needed to reach CSV generation.
1 open issue
What changed in this PR
Fixes onboarding CSV generation when reusing certificates loaded from disk.
Changes:
- Preserves string certificates while retaining decoding for byte inputs.
- Adds a save-then-reuse regression test.
| File | Description |
|---|---|
| tests/test_device_credentials_installer.py | Adds coverage for CSV generation with reused credentials. |
| src/nrfcloud_utils/cli_helpers.py | Handles string and byte certificates during CSV serialization. |
Review effort: Balanced
Comment on lines
+115
to
+116
| device_credentials_installer.main( | ||
| f"{base} --id-str {dev_id} --path {tmp_dir}{os.sep} --csv {csv_file}".split()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Note
Low Risk
Small CSV serialization fix with a regression test; no auth or device-write behavior changes beyond fixing the reuse path.
Overview
Fixes onboarding CSV generation when reusing credentials loaded from disk (
--pathwith existing*_crt.pem/*_prv.pem). Those certs are read as strings, butsave_onboarding_csvalways didstr(dev, encoding=...), which breaks forstrinputs and caused the “reusing certificate” failure.The helper now uses the cert text as-is when
devis already astr, and only decodes withfull_encodingwhen it is bytes. A new installer test runs save-then-reuse and asserts the onboarding CSV contains a valid PEM cert.Reviewed by Cursor Bugbot for commit 1bccbc0. Bugbot is set up for automated code reviews on this repo. Configure here.