ó i'dWc@s«dZddlZddlZddlZddlZddlZddlmZddl m Z ddl m Z ddl mZeddƒZd efd „ƒYZdS( si configuration Configuration object class for handling the elements in the manifest. iÿÿÿÿN(tetree(t ParsingError(tDataObjectCache(tSimpleXmlHandlerBases /dev/nullsr+t ConfigurationcBs°eZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdddgZdddddgZd„Zd„Zed„ƒZed„ƒZRS(t configurationtnametsourcetarchivettypetdestt validationtpathtargston_errortnetworktusertsysconftzonetfilethttpthttpstftpcCsGtt|ƒj|ƒd|_d|_d|_d|_d|_dS(N( tsuperRt__init__tNoneRRR R R (tselfR((sconfiguration.pyREs     cCs3tjtjƒ}|jtj|jƒ|jdk rP|jtj |jƒn|j dk rx|jtj |j ƒn|j dk r |jtj |j ƒn|jdk rÈ|jtj|jƒn|jdk r/tj|tjƒ}x@|jjƒD],\}}|j||ƒ|j||ƒqüWn|S(N(RtElementRtTAG_NAMEtsett NAME_LABELRRRt SOURCE_LABELRtZONE_ARCHIVE_LABELR t TYPE_LABELR t DEST_LABELR t SubElementtVALIDATION_LABELtitems(Rtelementtvalidation_elementtkeytvalue((sconfiguration.pytto_xmlNs"  cCsl|j|jkrtS|j|jƒdkr2tSx3|j|jgD]}|j|ƒdk rEtSqEWtS(s© Returns True if element has: - the tag 'configuration' - a name attribute - a source attribute Otherwise returns False N( ttagRtFalsetgetRRR RtTrue(tclsR&tentry((sconfiguration.pyt can_handlehs cCsi}|j|jƒ}|j|jƒ}|j|jƒ}|j|jƒ}|j|jƒ}|j|jƒ}d}d} ||jkr«|dk r«|} |j} nA|} |j } t j |ƒj dkrìt d|j dƒ‚nt j | ddƒ} | j | kr7t d|j d| j | fƒ‚n|dk r™|dk r™t j |ddƒ} | j dkr™| jr™t d|j d ƒ‚q™nt j| ƒ}ytj|ƒ}WnYtk rñ}t d|j d | |fƒ‚n&tk r| j d krq‚nXxã|jƒD]Õ}|j|jkr$|j|jƒ}|j|jƒ} |j|jƒ}|dk r¾tjj|ƒr |||j's0of the manifest. Unable to open source (%s): %sRs/Invalid element specified in the %s section of s0the manifest. validation path does not exist: %ststdouttstderrsError reading %s soelement from the source manifest. Source manifest specified could not be validated: %s. CalledProcessError: %s((R-RRR"R!R RtTYPE_VALUE_ZONEtARCHIVE_SUPPORTED_SCHEMEStSOURCE_SUPPORTED_SCHEMESturlparseR2RRtnetloct urlunparseturllibturlopentIOErrort Exceptiont iterchildrenR+R$t PATH_LABELt ARGS_LABELtON_ERROR_LABELtosR texiststsplitt subprocesst check_callt_NULLtCalledProcessErrorRRR R RR (R/R&R RRR R RR R tcfg_srctschemestcfg_srcptsrcpt cfg_srcuptfileobjtioet subelementRtcmdterrorR((sconfiguration.pytfrom_xml~sœ                       (t__name__t __module__RRRR R!R"R$R@RARBtTYPE_VALUE_NETWORKtTYPE_VALUE_USERtTYPE_VALUE_SYSCONFR5R6R7RR*t classmethodR1RT(((sconfiguration.pyR1s( (t__doc__RFtsystos.pathRCR;R8tlxmlRtsolaris_install.data_objectRt!solaris_install.data_object.cacheRt"solaris_install.data_object.simpleRtopenRHR(((sconfiguration.pyt s