From 202145f837d4f1153d3ad067821908b7ca6df86e Mon Sep 17 00:00:00 2001 From: Reed Date: Thu, 9 Aug 2018 15:49:42 -0500 Subject: [PATCH] Allow deployOvf to function even when DNS is not fully configured. We observed an issue when hosts were added to vCenter via a FQDN, but DNS was not functioning end to end in the environment, specifically at the location where the deployOvf call was initiated. Thus deploying an Ovf failed. This updates the upload command to always ensure a valid location by IP even when DNS is not available at the calling location:w. --- lib/rbvmomi/vim/OvfManager.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/rbvmomi/vim/OvfManager.rb b/lib/rbvmomi/vim/OvfManager.rb index dce7e0d4..5cd5fd05 100644 --- a/lib/rbvmomi/vim/OvfManager.rb +++ b/lib/rbvmomi/vim/OvfManager.rb @@ -133,6 +133,7 @@ def deployOVF opts end while i <= 5 && !ip raise "Couldn't get host's IP address" unless ip href = deviceUrl.url.gsub("*", ip) + href = href.gsub(URI.parse(href).host, ip) downloadCmd = "#{CURLBIN} -L '#{URI::escape(filename)}'" uploadCmd = "#{CURLBIN} -Ss -X #{method} --insecure -T - -H 'Content-Type: application/x-vnd.vmware-streamVmdk' '#{URI::escape(href)}'" # Previously we used to append "-H 'Content-Length: #{fileItem.size}'"