From da2674b9af4acc028f922d5a36d0b25b3cb76daa Mon Sep 17 00:00:00 2001 From: Darragh Bailey Date: Fri, 24 Sep 2021 13:11:51 +0100 Subject: [PATCH 1/2] Update to vagrant 2.2.18 for docker image (#1354) --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 6102ad0..d512b07 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # syntax = docker/dockerfile:1.0-experimental -ARG VAGRANT_VERSION=2.2.16 +ARG VAGRANT_VERSION=2.2.18 FROM ubuntu:bionic as base From c3e96d149ec94892fa2384ded19946cd88c95150 Mon Sep 17 00:00:00 2001 From: Darragh Bailey Date: Sat, 25 Sep 2021 10:24:00 +0100 Subject: [PATCH 2/2] Avoid blanking username if set by user (#1352) While the username may not be used unless the connection is via ssh, should avoid forcing to nil by accident when re-parsing from the uri. --- lib/vagrant-libvirt/config.rb | 6 ++++-- spec/unit/config_spec.rb | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/vagrant-libvirt/config.rb b/lib/vagrant-libvirt/config.rb index e664971..645d9fd 100644 --- a/lib/vagrant-libvirt/config.rb +++ b/lib/vagrant-libvirt/config.rb @@ -1037,10 +1037,12 @@ module VagrantPlugins end end - # Extract host and username values from uri if provided, otherwise nil + # Extract host values from uri if provided, otherwise nil @host = uri.host @port = uri.port - @username = uri.user + # only override username if there is a value provided + @username = nil if @username == UNSET_VALUE + @username = uri.user if uri.user if uri.query params = CGI.parse(uri.query) @id_ssh_key_file = params['keyfile'].first if params.has_key?('keyfile') diff --git a/spec/unit/config_spec.rb b/spec/unit/config_spec.rb index 8a44650..d993fdb 100644 --- a/spec/unit/config_spec.rb +++ b/spec/unit/config_spec.rb @@ -192,14 +192,14 @@ describe VagrantPlugins::ProviderLibvirt::Config do ], [ # when username explicitly set without ssh {:username => 'my_user' }, - {:uri => 'qemu:///system'}, + {:uri => 'qemu:///system', :username => 'my_user'}, { :env => {'LIBVIRT_DEFAULT_URI' => 'qemu://session'}, } ], [ # when username explicitly set with host but without ssh {:username => 'my_user', :host => 'remote'}, - {:uri => 'qemu://remote/system'}, + {:uri => 'qemu://remote/system', :username => 'my_user'}, { :env => {'LIBVIRT_DEFAULT_URI' => 'qemu://session'}, }