U nf @sFddlmZddlmZmZddlmZGdddeZd dd ZdS) ) OneException)MARKETPLACEAPP_STATESMARKETPLACEAPP_TYPES) b64decodec@s eZdZdS)OneHelperExceptionN)__name__ __module__ __qualname__r r ;/opt/hc_python/lib/python3.8/site-packages/pyone/helpers.pyrsrNc Cs ddd}|s8|j}|jD]}|jdkr|j}q8q|sDtd|j|}|jtj krdtd|j t j kr|j rt|j } nd} |s|j}| d||jf7} |j| ||d<d |jkrt|jd } |s|j}| d ||df7} |j| |d <ntd t |j j|S) aS Exports a market app to a suitable OpenNebula object :param one: the XMLRPC server :param appid: id of the marketplace app :param dsid: id of the datastore to save images, if not provided the datastore named "default" will be used. :param name: name of the new object, if not provided the same name as the App will be used :param vmtemplate_name: name for the VM Template, if the app has one. :return: a dictionary with the ID of the new Image as image and the ID of the new associated template as vmtemplate. If no template has been defined, it will return -1. )image vmtemplatedefaultzs