Skip to content

tedge config does not support using a symlink to tedge.toml as the symlink is replaced with a file on config updates #3323

@reubenmiller

Description

@reubenmiller

Describe the bug

When using a symlink for /etc/tedge/tedge.toml, the symlink is overwritten by thin-edge.io when the configuration file is modified via tedge config.

This may be more of a feature improvement, but since using symlinks is fairly standard in Linux, thin-edge.io should respect them.

The use-case where this came across is in the tedge-container-bundle project where a new PR was being developed to persist the tedge.toml across container update where the default tedge.toml location would be a symlink pointing to a persistent volume. A volume is not used for the entire /etc/tedge folder so that workflows, operation handlers etc. can be updated by container updates (which would not be the case if a named volume would be used for the entire /etc/tedge folder).

To Reproduce

  1. Create a symlink for the tedge.toml file

    ln -sf /data/tedge/tedge.toml /etc/tedge/tedge.toml
    touch /data/tedge/tedge.toml

    Then verify the symlink exists (used for comparison later on)

    ls -l /etc/tedge/tedge.toml
    $ ls -l /etc/tedge/tedge.toml
    lrwxrwxrwx    1 tedge    tedge           22 Jan  9 19:23 /etc/tedge/tedge.toml -> /data/tedge/tedge.toml
  2. Run tedge config list, this will trigger a writing of the tedge.toml to add the missing version info

  3. Check if the tedge.toml is still a symlink (it is expected that it still should be)

    ls -l /etc/tedge/tedge.toml
    $ ls -l /etc/tedge/tedge.toml
    -rw-r--r--    1 tedge    tedge           31 Jan  9 19:21 /etc/tedge/tedge.toml

Expected behavior

If the /etc/tedge/tedge.toml file is a symlink, then it should be preserved, and the target file (where the symlink is pointing to) should be updated.

Screenshots

Environment (please complete the following information):

  • OS [incl. version]: any
  • Hardware [incl. revision]: any
  • System-Architecture [e.g. result of "uname -a"]: any
  • thin-edge.io version [e.g. 0.1.0]: 1.4.1

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtheme:configurationTheme: Configuration management

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions