Ñò –­PSc @sdZddkZddkZddkiiZddkiiZddk Z ddk l Z ddk ZdZdZdZdZdZd Zd Zd Zd Zd ZeeeeeegZdeifd„ƒYZdeifd„ƒYZd„Zd„Zd„Z d„Z!dS(s Zone linked image module classes. Zone linked images only support child attach. Zone linked image child configuration information is all derived from zonecfg(1m) options and this plugin, no child configuration information is stored within a parent image. iÿÿÿÿN(t DebugValuestglobalt configuredt incompletet unavailablet installedtreadytmountedtrunningt shutting_downtdowntLinkedImageZonePlugincBsºeZdZheei6ZeedgƒeddgƒgƒZd„Z ed„Z d„Z eed„Z d„Z ed „Zeed „Zd „Zd „Zd „Zd„ZRS(sSee parent class for docstring.s system/zonest SUNWzonert SUNWzoneucCsVtii|||ƒ||_||_|i|_d|_t ƒ|_ d|_ dS(sSee parent class for docstring.N( tlitLinkedImagePlugint__init__t_LinkedImageZonePlugin__pnamet_LinkedImageZonePlugin__linkedtimaget_LinkedImageZonePlugin__imgtNonet$_LinkedImageZonePlugin__in_gz_cachedtdictt _LinkedImageZonePlugin__childrent*_LinkedImageZonePlugin__zoneadm_list_cache(tselftpnametlinked((sA/usr/lib/python2.6/vendor-packages/pkg/client/linkedimage/zone.pyR‚s     cCs‘|idjo|iSytƒtj|_WnYtj o$}|otSti|ƒ‚n+tij o}|otS|‚nX|iS(sÅCheck if we're executing in the global zone. Note that this doesn't tell us anything about the image we're manipulating, just the environment that we're running in.N( RRt _zonenamet ZONE_GLOBALtOSErrortTruetapxt_convert_errortLinkedImageException(Rt ignore_errorste((sA/usr/lib/python2.6/vendor-packages/pkg/client/linkedimage/zone.pyt__in_gz’s c CstidƒotSd}|iii|}|djotS|ii}ti i ti i |dƒƒptSti i ti i |dƒƒptS|ii |ii ƒ}tg}|iƒD]\}}||qÆ~ƒ}x'|iD]} | |@| jotSqïWtS(sxCheck to see if zones are supported in the current image. i.e. can the current image have zone children.tzones_supportedsvariant.opensolaris.zoneRtetcs etc/zones(Rt get_valueR RtcfgtvariantstFalsetroottostpathtisdirtjoint get_catalogtIMG_CATALOG_INSTALLEDt frozensett pkg_namest!_LinkedImageZonePlugin__zone_pkgs( RtvarianttvalueR/tcatit_[1]tpubtstemt pkgs_insttpkgs((sA/usr/lib/python2.6/vendor-packages/pkg/client/linkedimage/zone.pyt__zones_supported¬s(  "")  c Csz|o d|_n|idjo%t|iƒtjpt‚|iS|iƒpg|_|iƒS|id|ƒpg|_|iƒSy"t|i i |i i ƒƒ}WnYt j o$}|ogSti|ƒ‚n+tij o}|ogS|‚nXg}xO|iƒD]A\}\}}tid|i|fƒ} |i| |gƒq"W||_|iƒS(sœList the zones associated with the current image. Since this involves forking and running zone commands, cache the results.R$s%s:%sN(RRttypetlisttAssertionErrort'_LinkedImageZonePlugin__zones_supportedt)_LinkedImageZonePlugin__list_zones_cachedt_LinkedImageZonePlugin__in_gzt _list_zonesRR-Rtget_path_transformRR!R"R#t iteritemsRtLinkedImageNameRtappend( RtnocacheR$tzdictR%tzlisttzoneR/tstatetlin((sA/usr/lib/python2.6/vendor-packages/pkg/client/linkedimage/zone.pyt__list_zones_cachedÛs:          cCs d|_dS(sSee parent class for docstring.N(RR(RR-((sA/usr/lib/python2.6/vendor-packages/pkg/client/linkedimage/zone.pyt init_rootscCsS|idtd|ƒ}|ptiS|iiitiƒti}ti|fS(sSee parent class for docstring.RKR$( RDR RtPATH_TRANSFORM_NONERR-trstripR.tsep(RR$RMR-((sA/usr/lib/python2.6/vendor-packages/pkg/client/linkedimage/zone.pytguess_path_transforms  c Csg}x8|iD]-}|i|ti}|i||gƒqWg}xi|i|d|ƒD]R\}}|g}|D]}||dqw~joq]n|i||gƒq]Wg} | i|ƒ| i|ƒx.| D]&\}}|i|ijpt‚qÚW| S(sSee parent class for docstring.R$i( RRt PROP_PATHRJRDtextendtlin_typeRRB( RRKR$tinmemoryRPR/tondiskR:titrv((sA/usr/lib/python2.6/vendor-packages/pkg/client/linkedimage/zone.pytget_child_list#s&  ,   cCsÔ||ijo |i|Stƒ}||ti s:     /ø   L