From b9874496aabd22ac6afbf314a392089ad3b7b2b7 Mon Sep 17 00:00:00 2001 From: Nick Osborn Date: Thu, 31 Oct 2013 15:30:46 +0000 Subject: [PATCH] [vcloud_director] Ensure task :Owner is always present. --- lib/fog/vcloud_director/requests/compute/get_task.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/fog/vcloud_director/requests/compute/get_task.rb b/lib/fog/vcloud_director/requests/compute/get_task.rb index ea8019f47..d191b04d5 100644 --- a/lib/fog/vcloud_director/requests/compute/get_task.rb +++ b/lib/fog/vcloud_director/requests/compute/get_task.rb @@ -75,13 +75,22 @@ module Fog # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-Task.html # @since vCloud API version 0.9 def get_task(id) - request( + response = request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "task/#{id}" ) + + # vCloud Director bug: Owner may be absent for some tasks, fix + # targeted for 5.1.3 (due out at the beginning Q1 2014). + # + # We'd prefer that Owner is always present; if nothing else, this + # let's the tests pass. + response.body[:Owner] ||= {:href => '', :name => nil, :type => nil} + + response end end