From 9f203f75a2ecacef09a700bf9ed6f9d86616e988 Mon Sep 17 00:00:00 2001 From: "Brian J. Murrell" Date: Wed, 18 Apr 2018 10:51:30 -0400 Subject: [PATCH 1/2] Don't add _ after user defined default_prefix Forcing an underscore between a defined default_prefix and the machine name forces a naming format that the user might not want. If they define their own default_prefix and want an underscore between that and the machine name, they can/should add the underscore to the default_prefix. --- lib/vagrant-libvirt/action/set_name_of_domain.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/vagrant-libvirt/action/set_name_of_domain.rb b/lib/vagrant-libvirt/action/set_name_of_domain.rb index c421c9e..55896a6 100644 --- a/lib/vagrant-libvirt/action/set_name_of_domain.rb +++ b/lib/vagrant-libvirt/action/set_name_of_domain.rb @@ -51,7 +51,7 @@ module VagrantPlugins # don't have any prefix, not even "_" '' else - config.default_prefix.to_s.dup.concat('_') + config.default_prefix.to_s.dup end domain_name << env[:machine].name.to_s domain_name.gsub!(/[^-a-z0-9_\.]/i, '') From 2cfec56325c8f331b8e7e7c317514702732f0b8f Mon Sep 17 00:00:00 2001 From: "Brian J. Murrell" Date: Wed, 18 Apr 2018 10:59:19 -0400 Subject: [PATCH 2/2] Update unit test for building simple domain name Make the unit test match the new requirement that if a _ postfix is desired when default_prefix is defined, then it must be added to the default_prefix. --- spec/unit/action/set_name_of_domain_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/unit/action/set_name_of_domain_spec.rb b/spec/unit/action/set_name_of_domain_spec.rb index d1b3035..a30ff87 100644 --- a/spec/unit/action/set_name_of_domain_spec.rb +++ b/spec/unit/action/set_name_of_domain_spec.rb @@ -14,7 +14,7 @@ describe VagrantPlugins::ProviderLibvirt::Action::SetNameOfDomain do end it 'builds simple domain name' do - @env.default_prefix = 'pre' + @env.default_prefix = 'pre_' dmn = VagrantPlugins::ProviderLibvirt::Action::SetNameOfDomain.new(Object.new, @env) dmn.build_domain_name(@env).should eq('pre_') end