Skip to content

Commit

Permalink
Add an exception for the missing storage field
Browse files Browse the repository at this point in the history
  • Loading branch information
girijaasoni authored and chris1984 committed Apr 10, 2024
1 parent 4ed502b commit 3ab7712
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/fog/vsphere/requests/compute/create_vm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,11 @@ def get_storage_pod_from_volumes(attributes)
def vm_path_name(attributes)
return '' if get_storage_pod_from_volumes(attributes)
datastore = attributes[:volumes].first.datastore unless attributes[:volumes].empty?
datastore ||= 'datastore1'
"[#{datastore}]"
if datastore
"[#{datastore}]"
else
raise ArgumentError, 'Please mention the storage pod or the datastore'
end
end

def device_change(attributes)
Expand Down

0 comments on commit 3ab7712

Please sign in to comment.