-
-
Notifications
You must be signed in to change notification settings - Fork 606
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
Use Ruby for ssh-config trigger #1053
Conversation
@@ -136,10 +136,10 @@ Vagrant.configure('2') do |config| | |||
if !Vagrant::Util::Platform.windows? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be enabled on Windows now that it no longer relies on bash? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
~/.ssh/config
is a safe assumption on Windows as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
%userprofile%/.ssh/config
in windows parlance, where userprofile
is an environment variable to the user's home directory. while not all versions of windows come with openssh (windows 10 comes with it since earlier this year), git requires ssh, and so most windows users who are using trellis will probably have openssh and this is a safe assumption in those cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And if that file exists, we can safely assume it's the same format I'm guessing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it follows the same format, but one thing that would concern is me is whether the path to the private key is in the windows (e.g., d:\Sites\example.com\trellis\etc...
) or unix (e.g., /mnt/d/Sites/example.com/trellis/etc...
) format. There's probably not an easy way to handle this, but I'm thinking we could rely on Ruby/Vagrant to figure it out.
My Ruby is terrible, but I can test whatever you wanna send me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's do this separately after I merge this 👍
Vagrantfile
Outdated
args: [main_hostname] | ||
} | ||
trigger.info = "Adding vagrant ssh-config for #{main_hostname } to ~/.ssh/config" | ||
trigger.ruby do |_, _| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we omit the block parameters?
- trigger.ruby do |_, _|
+ trigger.ruby do
39241d5
to
a5bc6e0
Compare
This replaces the bash implementation in #1042 with a Ruby one instead.
It has some improvements and safety guards. Most important of all, it creates a backup of the existing config file before doing anything.