Skip to content
This repository was archived by the owner on Feb 4, 2022. It is now read-only.
This repository was archived by the owner on Feb 4, 2022. It is now read-only.

Tilde (~) not recognized in key file path #9

@Samyak2

Description

@Samyak2

The issue

Heiko allows a custom SSH private key to be used for auth, instead of the one generated by heiko. This can be set in the configuration as shown:
https://github.com/psiayn/heiko/blob/fb8b464ec2d4308fde9a4d6cfbcc2762d2851783/examples/sample-config.yml#L9

Generally, these keys are stored in ~/.ssh (which is $HOME/.ssh). Providing the path with the ~ (tilde) in it is not recognized by heiko, it exits with this error:

init: SSH Key ~/.ssh/somekey.pub for node somenode does not exist: stat ~/.ssh/somekey.pub: no such file or directory

The solution

When the paths are read on this line:
https://github.com/psiayn/heiko/blob/fb8b464ec2d4308fde9a4d6cfbcc2762d2851783/internal/config/sshSetup.go#L110-L112

If it starts with ~/, it must be expanded appropriately. Possible approaches for this are here and here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or requestgood first issueGood for newcomers

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions