Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not attempt creating ssh config files if ssh_config.d doesn't exist #1708

Merged
merged 2 commits into from
Nov 12, 2023

Conversation

hellt
Copy link
Member

@hellt hellt commented Nov 10, 2023

reported by a user:

INFO[0025] Adding containerlab host entries to /etc/hosts file 
INFO[0025] Adding ssh config for containerlab nodes     
ERRO[0025] failed to create ssh config file: open /etc/ssh/ssh_config.d/clab-srl01.conf: no such file or directory 

this means the path did not exist and this PR ensures the path exists.
It might be that the OS user runs or OpenSSH there won't honor the newly created path either, but it seems still safe to create the path

@hellt hellt requested a review from steiler November 10, 2023 08:51
@steiler
Copy link
Collaborator

steiler commented Nov 10, 2023

Hmm my feeling is more like, if that path does not exist, we do not generate the config rather then generating something that is not used anyways.
Another option could be to add an Include to the /etc/ssh/ssh_config and create a /etc/clab/ssh_config.d directory anyways, like even when the /etc/ssh/ssh_config.d exists.

@hellt
Copy link
Member Author

hellt commented Nov 10, 2023

I will ask the user to create this file and see if his ssh client picks it up

@hellt hellt changed the title Ensure path exists when creating ssh lab config Do not attempt creating ssh config files if ssh_config.d doesn't exist Nov 12, 2023
@hellt
Copy link
Member Author

hellt commented Nov 12, 2023

@steiler re-applied the patch to follow the suggested logic, as old ssh clients do not respect the created path.

Copy link

codecov bot commented Nov 12, 2023

Codecov Report

❗ No coverage uploaded for pull request base (main@1784608). Click here to learn what that means.
The diff coverage is 50.00%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1708   +/-   ##
=======================================
  Coverage        ?   51.60%           
=======================================
  Files           ?      141           
  Lines           ?    13751           
  Branches        ?        0           
=======================================
  Hits            ?     7096           
  Misses          ?     5867           
  Partials        ?      788           
Files Coverage Δ
cmd/deploy.go 64.62% <100.00%> (ø)
clab/sshconfig.go 63.63% <42.85%> (ø)

@hellt hellt merged commit 3c24d9b into main Nov 12, 2023
22 checks passed
@hellt hellt deleted the create-ssh-config-path branch November 12, 2023 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants