ó i'dWc@s÷ddlZddlZddlZddlmZddlmZmZddlm Z ej ej de ƒZdZeejdƒƒZdZid d 6d d 6d d6edd6edd6ZdeefZd„Zdefd„ƒYZdS(iÿÿÿÿN(tetree(t SetUIDasEUIDt_(tINSTALL_LOGGER_NAMEt pretty_prints' s UnifiedArchive s2http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/s)http://www.w3.org/2001/XMLSchema-instancetxsis&http://schemas.dmtf.org/ovf/envelope/1tovfs2http://schemas.oracle.com/solaris/unifiedarchive/1tuatCIM_VirtualSystemSettingDatatvssdt!CIM_ResourceAllocationSettingDatatrasdshttp://schemas.dmtf.org/ovf/envelope/1 dsp8023_1.1.xsd http://schemas.oracle.com/solaris/unifiedarchive/1 unifiedarchive.xsd %sCIM_VirtualSystemSettingData CIM_VirtualSystemSettingData.xsd %sCIM_ResourceAllocationSettingData CIM_ResourceAllocationSettingData.xsdcCs:|jddƒ\}}|dkr(|Sdt||fS(Nt:is{%s}%s(tsplittNonet_NSMAP(ttagt namespacetelement((s ua_xml.pyt xml_nsmap8s tUnifiedArchiveDescriptorcBs)eZdZd„Zd„Zd„ZRS(sAn abstract XML generator for a UnifiedArchive's descriptor. Attributes: name The name of the new descriptor file path Path to the descriptor (in the staging area) Methods: commit() Write out the descriptor file. cCsDtjtƒ|_||_d|_d|_d|_|j ƒdS(sÒConstruct a new descriptor object. Arguments: ua An instance of UnifiedArchive, representing the Unified Archive for which to create a descriptor. N( tloggingt getLoggertILNt_loggerRRtnametpatht_roott _generate(tselfR((s ua_xml.pyt__init__Ms     cCstjtdƒdtƒ|_|jjtdƒtƒ|jj|jj ƒƒ|j j dƒ|j j dt |jƒƒdS(Ns ovf:Envelopetnsmapsxsi:schemaLocations=UnifiedArchiveDescriptor._generate(): XML generation completes%s( RtElementRRRtsett_XSI_SCHEMA_LOCATIONtextendRtbuild_descriptor_xmlRtdebugt_pp(R((s ua_xml.pyR^s cCsÑtƒ3tj|tjƒs8ttdƒ|ƒ‚nWdQX|jjd|_tj j ||jƒ|_ t |j dƒ7}|j t ƒ|j tƒ|j t|jƒƒWdQX|jjd|j ƒdS(sÓWrite the generated Unified Archive descriptor out to the file. Arguments: staging The staging directory where the descriptor should be written. s%s not writeableNs.ovfsw+s.UnifiedArchiveDescriptor.commit(): %s complete(RtostaccesstW_OKt SystemExitRRtuuidRRtjointopentwritet _XML_VERSIONt_HEADER_COMMENTR&RRR%(Rtstagingtdesc((s ua_xml.pytcommiths    (t__name__t __module__t__doc__RRR3(((s ua_xml.pyR@s   (t functoolsRR'tlxmlRtsolaris_installRRtsolaris_install.loggerRRtpartialttostringtTrueR&R/tCommentR0t_CIMBASERR"RtobjectR(((s ua_xml.pyts$