mirror of
https://github.com/vagrant-libvirt/vagrant-libvirt.git
synced 2025-02-25 18:55:27 -06:00
Fix remote libvirt functionality through LIBVIRT_DEFAULT_URI (#1218)
One can now set `LIBVIRT_DEFAULT_URI` to something like `qemu+ssh://user@beefy/system` along with `connect_via_ssh` option to true and use vagrant on remote machines, without needing to duplicate/hardcode remote server username and identity key inside the Vagrantfile. Partial Fixes: #1217
This commit is contained in:
committed by
GitHub
parent
ba4235add9
commit
b15489c557
@@ -764,9 +764,11 @@ module VagrantPlugins
|
||||
@uri = _generate_uri(@qemu_use_session == UNSET_VALUE ? false : @qemu_use_session)
|
||||
end
|
||||
|
||||
# Parse uri to extract individual components
|
||||
uri = _parse_uri(@uri)
|
||||
|
||||
# Set qemu_use_session based on the URI if it wasn't set by the user
|
||||
if @qemu_use_session == UNSET_VALUE
|
||||
uri = _parse_uri(@uri)
|
||||
if (uri.scheme.start_with? "qemu") && (uri.path.include? "session")
|
||||
@qemu_use_session = true
|
||||
else
|
||||
@@ -774,6 +776,12 @@ module VagrantPlugins
|
||||
end
|
||||
end
|
||||
|
||||
# Extract host and username values from uri if not set when connect_via_ssh option is used
|
||||
if @connect_via_ssh
|
||||
@host = uri.host if @host == nil
|
||||
@username = uri.user if @username == nil
|
||||
end
|
||||
|
||||
# Domain specific settings.
|
||||
@title = '' if @title == UNSET_VALUE
|
||||
@description = '' if @description == UNSET_VALUE
|
||||
|
||||
Reference in New Issue
Block a user