fix: add device.csr_path to cloud profiles#3441
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files📢 Thoughts on this report? Let us know! 🚀 New features to boost your workflow:
|
Robot Results
|
rina23q
left a comment
There was a problem hiding this comment.
Waiting for a system test. Can be added under /tests/RobotFramework/tests/tedge/certificate_signing_request.robot
Signed-off-by: Krzysztof Piotrowski <krzysztof.piotrowski@inetum.com>
| File Should Not Exist /etc/tedge/device-certs/tedge-private-key.pem | ||
|
|
||
| Execute Command | ||
| ... tedge config set c8y.device.csr_path /etc/tedge/device-certs/example_dev_test0001-test1.csr |
There was a problem hiding this comment.
Extra spaces that are confusing robotframework ;-)
| ... tedge config set c8y.device.csr_path /etc/tedge/device-certs/example_dev_test0001-test1.csr | |
| ... tedge config set c8y.device.csr_path /etc/tedge/device-certs/example_dev_test0001-test1.csr |
| Execute Command | ||
| ... tedge config set c8y.device.csr_path /etc/tedge/device-certs/example_dev_test0001-test1.csr | ||
|
|
||
| Execute Command sudo tedge cert create-csr |
There was a problem hiding this comment.
For the failing test, the error message makes sense. Since there is no device certificate nor explicitly device ID is provided by --device-id option, there is no way for the command to know the CN.
So, either provide a device ID as the error message says, or create a certificate beforehand.
sudo tedge cert create-csr returned an unexpected exit code stdout: stderr: Error: missing configuration parameter Caused by: No device ID is provided. Use --device-id <name> option to specify the device ID.
Also adding c8y argument is forgotten. With the following change, the test will pass (confirmed in my local env).
| Execute Command sudo tedge cert create-csr | |
| Execute Command sudo tedge cert create-csr c8y --device-id test-user |
There was a problem hiding this comment.
Is this a new test though? If not, then the --device-id is not a mandatory flag, as it can pick up the value from the existing certificate or manually set device.id etc.
There was a problem hiding this comment.
Is this a new test though?
=> It is.
If the test setup was with certificate, as @reubenmiller says, there would be no need to give --device-id. But I'd say it's ok to give --device-id and setup without cert. Not so important for the test purpose I think.
[Setup] Setup Without Certificate
File Should Not Exist /etc/tedge/device-certs/tedge-certificate.pem
File Should Not Exist /etc/tedge/device-certs/tedge-private-key.pem
Signed-off-by: Krzysztof Piotrowski <krzysztof.piotrowski@inetum.com>
Proposed changes
As mentioned in #3413 user could not specified
device.csr_pathper cloud profile. This PR appends multi profile config withcsr_pathand replaces old approach of accessing config value intedge cert create-csr.Types of changes
Paste Link to the issue
Checklist
cargo fmtas mentioned in CODING_GUIDELINEScargo clippyas mentioned in CODING_GUIDELINESFurther comments