Skip to content

The spec.hosts[*].files Paths Are Relative to CWD, Not Config File Location #972

@shikanime

Description

@shikanime

Description

When using k0sctl apply -c <path/to/config.yaml>, paths specified in the spec.hosts[*].files section of the configuration file are incorrectly interpreted as relative to the current working directory (CWD) from which the command is executed, rather than being relative to the location of the configuration file itself (config.yaml).

Expected Behavior

The file paths defined within spec.hosts[*].files in the configuration file should be interpreted as relative to the location of the config.yaml file.

For example, if the command is executed as:
k0sctl apply -c foo/bar/config.yaml

And the config.yaml content is:

spec:
  hosts:
    - role: controller
      files:
        - name: my-script.sh
          # This should look for the file at 'foo/bar/my-script.sh'
          src: my-script.sh 
          dst: /tmp/my-script.sh

The application should look for the source file at foo/bar/my-script.sh.

Actual Behavior

The application looks for the source file at <CWD>/my-script.sh, leading to an error if the file is not present in the current execution directory.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions