From 269e4e7ebac6b524bd505fca9dc12ff941ff4b32 Mon Sep 17 00:00:00 2001 From: Chirag Jog Date: Fri, 8 Mar 2013 21:31:31 +0530 Subject: [PATCH] Check if a template requires a password or not --- lib/fog/vcloud/models/compute/catalog_item.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/fog/vcloud/models/compute/catalog_item.rb b/lib/fog/vcloud/models/compute/catalog_item.rb index a1b236993..da0fb0935 100644 --- a/lib/fog/vcloud/models/compute/catalog_item.rb +++ b/lib/fog/vcloud/models/compute/catalog_item.rb @@ -23,6 +23,14 @@ module Fog end end + def password_enabled? + load_unless_loaded! + customization_options = service.get_vapp_template(self.entity[:href]).body[:Children][:Vm][:GuestCustomizationSection] + return false if customization_options[:AdminPasswordEnabled] == "false" + return true if customization_options[:AdminPasswordEnabled] == "true" \ + and customization_options[:AdminPasswordAuto] == "false" \ + and ( options[:password].nil? or options[:password].empty? ) + end end end end