-
Notifications
You must be signed in to change notification settings - Fork 35
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
Handle the ssh port collisions on a vagrant file with multiple hosts #63
base: master
Are you sure you want to change the base?
Conversation
…h multiple hosts in it.
Thanks for the pr, I will check it later. |
Here is a sample Vagrant file that should boot 3 different systems on a M2/3/4-based mac with qemu. |
May I ask why not just specify the ssh port for each machine? |
Two reasons, this is normally generated automatically by molecule, and while one could specify it for 3 machines in the config, as soon as you start sharing the config across scenarios, and you try to start two scenarios or CI runs at the same time, we are back in conflict mode, and need this anyway. |
Thanks, I check your PR carefully, there are some areas for improvement:
I did a little hack in the
|
Removed this file, and changed to use your patch
Yes there is a way, just less library use. direct calls to
I'm not sure what you meant here, so I have not changed this part.
Sorry about that, I had changed it to make gem files, and it got included
Thanks, I included it in my repairs |
In using vargrant-qemu under an ansible molecule configuration, I needed to be able not to have port collisions when there were multiple hosts in the VagrantFile, much like I have enjoyed with the vagrant-virtualbox implementation.
This patch adds the needed code to detect collisions using the sys/protectable gem and parse out the forwarded ports.
This patch also adds code to be sure that the
vagrant ssh-config
calls return the proper ports.This patch uses a modified version of the
handle_forwarded_port_collisions.rb
action copied from the vagrant source code to modify the ssh_port appropriately.I am not in ruby every day, and this is my first time hacking on vagrant plugins, so if there are better ways to do some of these things, please suggest them and I will re-write