From f38ce7d5f4825081cfa56168f860e5154cbbd803 Mon Sep 17 00:00:00 2001 From: Christoph Hartmann Date: Mon, 5 Oct 2015 15:35:02 +0200 Subject: [PATCH] bugfix: fix error, where the winrm default path is not set properly by default --- lib/vulcano/backend.rb | 3 +++ test/unit/backend_test.rb | 14 ++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/lib/vulcano/backend.rb b/lib/vulcano/backend.rb index c3aa0df5e..d43dfb7a2 100644 --- a/lib/vulcano/backend.rb +++ b/lib/vulcano/backend.rb @@ -33,6 +33,9 @@ module Vulcano conf['path'] ||= uri.path end + # ensure path is nil, if its empty; e.g. required to reset defaults for winrm + conf['path'] = nil if !conf['path'].nil? && conf['path'].to_s.empty? + # return the updated config conf end diff --git a/test/unit/backend_test.rb b/test/unit/backend_test.rb index 1f755d56e..d1fe08ad6 100644 --- a/test/unit/backend_test.rb +++ b/test/unit/backend_test.rb @@ -43,6 +43,20 @@ describe 'Vulcano::Backend' do res.must_equal org end + it 'resolves a winrm target' do + org = { + 'target' => 'winrm://Administrator@192.168.10.140', + 'backend' => 'winrm', + 'host' => '192.168.10.140', + 'user' => 'Administrator', + 'password' => nil, + 'port' => nil, + 'path' => nil + } + res = Vulcano::Backend.target_config(org) + res.must_equal org + end + it 'keeps the configuration when incorrect target is supplied' do org = { 'target' => 'wrong',