1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-26 06:50:09 +03:00

Feature #1304: Check that the requested Document has the right type

This commit is contained in:
Carlos Martín 2012-09-06 15:25:49 +02:00
parent a76982070a
commit 67641049a9

View File

@ -84,7 +84,13 @@ module OpenNebula
# @return [nil, OpenNebula::Error] nil in case of success, Error
# otherwise
def info()
super(DOCUMENT_METHODS[:info], 'DOCUMENT')
rc = super(DOCUMENT_METHODS[:info], 'DOCUMENT')
if !OpenNebula.is_error?(rc) && self['TYPE'].to_i != document_type
return OpenNebula::Error.new("[DocumentInfo] Error getting document [#{@pe_id}].")
end
return rc
end
# Allocates a new Document in OpenNebula