#NEWLINE# def get_object_properties_dict( vim , moref , properties_to_collect ) : #NEWLINE# #INDENT# 'Get properties of the given managed object as a dict.\n\n    :param vim: Vim object\n    :param moref: managed object reference\n    :param properties_to_collect: names of the managed object properties to be\n                                  collected\n    :returns: a dict of properties of the given managed object\n    :raises: VimException, VimFaultException, VimAttributeException,\n             VimSessionOverLoadException, VimConnectionException\n    ' #NEWLINE# obj_contents = get_object_properties ( vim , moref , properties_to_collect ) #NEWLINE# if ( obj_contents is None ) : #NEWLINE# #INDENT# return { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# property_dict = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# if hasattr ( obj_contents [ 0 ] , 'propSet' ) : #NEWLINE# #INDENT# dynamic_properties = obj_contents [ 0 ] . propSet #NEWLINE# if dynamic_properties : #NEWLINE# #INDENT# for prop in dynamic_properties : #NEWLINE# #INDENT# property_dict [ prop . name ] = prop . val #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# if hasattr ( obj_contents [ 0 ] , 'missingSet' ) : #NEWLINE# #INDENT# for m in dynamic_properties [ 0 ] . missingSet : #NEWLINE# #INDENT# LOG . warning ( _LW ( 'Unable to retrieve value for %(path)s Reason: %(reason)s' ) , { #NEWLINE# #INDENT# 'path' : m . path , #NEWLINE# 'reason' : m . fault . localizedMessage , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# #UNINDENT# return property_dict