Skip to content

tedge cert create-csr output-path flag fails when given a relative address #3547

@reubenmiller

Description

@reubenmiller

Describe the bug

When creating a local CSR via tedge cert create-csr c8y and giving an explicit output path, the command fails
when a relative path is given.

$ tedge cert create-csr c8y --device-id example --output-path ./local.csr

Error: failed to Generate a Certificate Signing Request.

Caused by:
    Invalid device.cert_path path: Relative path: "./local.csr" is not permitted. Provide an absolute path instead.

However the command creates the CSR if the full path is given, however enforcing the user to provide the full path when calling a CLI command is unexpected.

$ tedge cert create-csr c8y --output-path "$(pwd)/local.csr"

To Reproduce

It can be reproduced by running:

$ tedge cert create-csr c8y --device-id example --output-path ./local.csr

Expected behavior

Relative paths should be supported when provided via the --output-path flag. The flag output should be expanded to the full path after parsing the command.

So it is expected that the following produce a local.csr file in the current working directory.

$ tedge cert create-csr c8y --device-id example --output-path ./local.csr

Screenshots

Environment (please complete the following information):

  • OS [incl. version]: macOS
  • Hardware [incl. revision]: aarch64
  • System-Architecture [e.g. result of "uname -a"]: Darwin example.local 23.6.0 Darwin Kernel Version 23.6.0: Thu Sep 12 23:35:29 PDT 2024; root:xnu-10063.141.1.701.1~1/RELEASE_ARM64_T6000 arm64
  • thin-edge.io version [e.g. 0.1.0]: tedge 1.4.3~428+g42bf3a1

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtheme:certificatesTheme: Device certificate topicstheme:cliTheme: cli related topics

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions