From f30b074053389d7691a4ebdae24fec6f7c6b05de Mon Sep 17 00:00:00 2001 From: Roman Lazoryshchak Date: Thu, 30 Jul 2020 14:12:03 +0300 Subject: [PATCH] Fix resource pool creation with '/' in name #261 --- lib/fog/vsphere/requests/compute/create_resource_pool.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/fog/vsphere/requests/compute/create_resource_pool.rb b/lib/fog/vsphere/requests/compute/create_resource_pool.rb index a382150a..5d60a29f 100644 --- a/lib/fog/vsphere/requests/compute/create_resource_pool.rb +++ b/lib/fog/vsphere/requests/compute/create_resource_pool.rb @@ -6,17 +6,19 @@ def create_resource_pool(attributes = {}) cluster = get_raw_cluster(attributes[:cluster], attributes[:datacenter]) root_resource_pool = if attributes[:root_resource_pool_name] - cluster.resourcePool.find attributes[:root_resource_pool_name] + cluster.resourcePool.find attributes[:root_resource_pool_name].gsub('/', '%2f') else cluster.resourcePool end - root_resource_pool.CreateResourcePool( + raise ArgumentError, 'Root resource pool could not be found' if root_resource_pool.nil? + + resource_pool = root_resource_pool.CreateResourcePool( name: attributes[:name], spec: get_resource_pool_spec(attributes) ) - get_resource_pool(attributes[:name], attributes[:cluster], attributes[:datacenter]) + resource_pool_attributes(resource_pool, attributes[:cluster], attributes[:datacenter]) end private