Uc@s<dZddkZddkZddkZddkZddkZddkZddk i i Z ddk i iZddkZddkZddkZddkZddkZddkZddklZlZdZdZdZdZdZd Zd Zd Zd ei d d fdYZ!de"fdYZ#dS(s PlanDescription and _ActionPlan classes These classes are part of the public API, and any changes here may require bumping CURRENT_API_VERSION in pkg.api The PlanDescription class is a public interface which contains all the data associated with an image-modifying operation. The _ActionPlan class is a private interface used to keep track of actions modified within an image during an image-modifying operation. iN(t PackageInfot LicenseInfoiiiiiiiit _ActionPlans p src dstcBsheZdZgZeeiiiei i i ei i i gZ e ddZe ddZRS(svA named tuple used to keep track of all the actions that will be executed during an image-modifying procecure.cCs(tiitit|tid|S(sReturns the serialized state of this object in a format that that can be easily stored using JSON, pickle, etc.tje_state(tpkgtmisct json_encodeRt__name__ttuplet_ActionPlan__state__desc(tobjR((s9/usr/lib/python2.6/vendor-packages/pkg/client/plandesc.pytgetstateQscCs4ti}tii||tid|}t|S(s`Allocate a new object using previously serialized state obtained via getstate().tjd_state(RRRRt json_decodeR (tstateR tname((s9/usr/lib/python2.6/vendor-packages/pkg/client/plandesc.pyt fromstateXs N(Rt __module__t__doc__t __slots__RRtclienttpkgplantPkgPlantactionstgenerictNSGR t staticmethodtNoneR R(((s9/usr/lib/python2.6/vendor-packages/pkg/client/plandesc.pyRCs  tPlanDescriptioncBseZdZheiiid6hheiid6eiid6e 6d6ei i ei i fgd6e e fd6e ie hheiid6eiid6e 6d6eiid6eiid 6he e 6d 6he e ggd 6e ggd 6e ggd 6e ggd6d6e ied6hhe ge 6e 6d6hei i e 6d6hei i e 6d6e eighefgd6eigd6eigd6eigd6egd6eiid6eei i gd6heiei6d6eiiigd6egfd6egd6hei i e 6d6hei i e 6d 6egd!6Zeeiiieiiiei i gZdNd"Z e!dNe"d#Z#e!dNd$Z$e!dNd%Z%e"d&Z&d'Z'd(Z(e)d)Z*e)d*Z+e)d+Z,d,Z-e)d-Z.e)d.Z/e)d/Z0d0Z1d1Z2d2Z3d3Z4d4Z5d5Z6d6Z7dNd7Z8d8Z9d9Z:d:Z;e"d;Z<d<Z=d=Z>d>Z?e)d?Z@e)d@ZAe)dAZBe)dBZCe)dCZDe)dDZEe)dEZFe)dFZGe)dGZHe)dHZIe)dIZJe)dJZKe)dKZLe)dLZMe)dMZNRS(Os7A class which describes the changes the plan will make.t _actuatorstversionsimplementation-versiont_cfg_mediatorst _fmri_changest_new_avoid_obst_new_mediatorst _old_facetst _new_facetst _rm_aliasestmovedtremovedt installedtupdatedt _preservedt _item_msgst_pkg_actuatorst added_groupst added_userstchild_op_vectorstchildren_ignoredt children_noptchildren_plannedtinstall_actionst li_pfacetstli_ppkgstli_propst pkg_planst release_notestremoval_actionstremoved_groupst removed_userstupdate_actionscCs0t|_||_d|_h|_t|_d|_d|_ d|_ t|_ t|_ t it|_t|_ttf|_g|_hgd6gd6gd6gd6|_g|_d|_t|_t|_d|_h|_t|_t it|_g|_ g|_!g|_"g|_#t$i%i&i'|_(h|_)h|_*h|_+h|_,tgf|_-d|_.d|_/d|_0g|_1d|_2g|_3g|_4h|_5g|_6d|_7d|_8d|_9d|_:d|_;t|_<t|_=d|_>d|_?t|_@h|_AdS(NR&R'R(R)i(Bt UNEVALUATEDRt_opRt _image_lmRtFalset_varcets_changet _new_variantsR#R$t _facet_changet_masked_facet_changet collectionst defaultdicttsetR"t_mediators_changeR!R R*t_solver_summaryt_solver_errorst li_attacht frozensetR5tli_ppubsR6tTruet_li_pkg_updatestlistR+R7R9R<R3RRtactuatortActuatorRR-R.R:R;R8t _cbytes_addedt _bytes_addedt_need_boot_archiveR/R0R2R1R%t _salvagedtrelease_notes_namet _backup_bet_backup_be_namet_new_bet_be_namet _be_activatet _update_indext _cbytes_availt _bytes_availt_act_timed_outR,(tselftop((s9/usr/lib/python2.6/vendor-packages/pkg/client/plandesc.pyt__init__sr                                               cCs|o&|i}|i}d|_|_nti}tii||itidti d|}d||<|o|i|_|i|_n|S(sReturns the serialized state of this object in a format that that can be easily stored using JSON, pickle, etc.it commonizeR( R_R^RRRRRt__dict__t_PlanDescription__state__desct"_PlanDescription__state__commonize(R Rtreset_volatilesR_R^RR((s9/usr/lib/python2.6/vendor-packages/pkg/client/plandesc.pyR s        cCsxti}||djpt||=tii||tidtid|}|ii |d|_ d|_ dS(sjUpdate the state of this object using previously serialized state obtained via getstate().iRdR N( RRtAssertionErrorRRR RfRgRetupdateR^R_(R RR R((s9/usr/lib/python2.6/vendor-packages/pkg/client/plandesc.pytsetstates     cCs t}ti||||S(s`Allocate a new object using previously serialized state obtained via getstate().(RRk(RR trv((s9/usr/lib/python2.6/vendor-packages/pkg/client/plandesc.pyR1s cCsqti|d|}y.|iti||dd|iWn$tj o}ti|nX~dS(ssSave a json encoded representation of this plan description objects into the specified file object.Rhtencodingsutf-8N( RR ttruncatetjsontdumptflushtOSErrortapxt_convert_error(RatfobjRhRte((s9/usr/lib/python2.6/vendor-packages/pkg/client/plandesc.pyt_save9s   c Cs|itjpty2|idti|dddtii}Wn$t j o}t i |nXt i ||~dS(shLoad a json encoded representation of a plan description from the specified file object.iRmsutf-8t object_hookN(RR=RitseekRotloadRRt json_hookRrRsRtRRk(RaRuRRv((s9/usr/lib/python2.6/vendor-packages/pkg/client/plandesc.pyt_loadIs cCs^g|_h|_|ii|_tiii|_h|_ h|_ h|_ h|_ dS(s`A private interface used after a plan is successfully invoked to free up memory.N( R R*Rt timed_outR`RRRQRRR-R.R:R;(Ra((s9/usr/lib/python2.6/vendor-packages/pkg/client/plandesc.pyt _executed_okZs     cCs|ittgjS(sJA boolean indicating if we attempted to execute this plan.(Rt EXECUTED_OKtEXECUTED_ERROR(Ra((s9/usr/lib/python2.6/vendor-packages/pkg/client/plandesc.pytexecutediscCs/td|iiDdtiddS(s`Returns a list of string tuples describing affected services (action, SMF FMRI).css1x*|]#\}}t|t|fVqWdS(N(tstr(t.0tatsmf_fmri((s9/usr/lib/python2.6/vendor-packages/pkg/client/plandesc.pys ts tkeyii(tsortedRtget_services_listtoperatort itemgetter(Ra((s9/usr/lib/python2.6/vendor-packages/pkg/client/plandesc.pytservicesosc Cs#g}|i p|i o|i o|Sd}xtt|ii|iiD]}||i|\}}}}||i|\}} } } || jo.|| jo!||jo|| joq^n|||f| | ff||f|| fff} |i| q^W|S(sReturns a list of three-tuples containing information about the mediators. The first element in the tuple is the name of the mediator. The second element is a tuple containing the original version and source and the new version and source of the mediator. The third element is a tuple containing the original implementation and source and new implementation and source.cSsd}}}}||jo||id}||id}|o|i}n|o|o|d|7}n||id}||id}|o|i}n||id}n||||fS(Ntimplementationsimplementation-versions(@%s)simplementation-sourceRsversion-source(Rtgettget_short_version(t mediatorstmtmimpltmvert mimpl_sourcet mver_sourcet mimpl_ver((s9/usr/lib/python2.6/vendor-packages/pkg/client/plandesc.pyt get_mediations$         (RHRR"RRGtkeystappend( RatretRRt orig_impltorig_vertorig_impl_sourcetorig_ver_sourcetnew_impltnew_vertnew_impl_sourcetnew_ver_sourcetout((s9/usr/lib/python2.6/vendor-packages/pkg/client/plandesc.pyRys.          cCsHg}x;t|iD]*\}}}|\\}}\}}|\\} } \} } d|} |o%|o| d||||f7} n?|o| d||f7} n |o| d||f7} n| o%| o| d| | | | f7} n?| o| d| | f7} n | o| d| | f7} n|i| qW|S(s4Returns list of strings describing mediator changes.s mediator %s: s7 version: %s (%s default) -> %s (%s default) s, version: %s (%s default) -> None s, version: None -> %s (%s default) s7 implementation: %s (%s default) -> %s (%s default) s, implementation: %s (%s default) -> None s, implementation: None -> %s (%s default) (RRR(RaRRtvertimplRRRRRRRRR((s9/usr/lib/python2.6/vendor-packages/pkg/client/plandesc.pyt get_mediatorss< cCs|iS(sGet the proposed fmri changes.(R (Ra((s9/usr/lib/python2.6/vendor-packages/pkg/client/plandesc.pyt plan_descscCs|iS(sA list of tuples of items that were salvaged during plan execution. Each tuple is of the form (original_path, salvage_path). Where 'original_path' is the path of the item before it was salvaged, and 'salvage_path' is where the item was moved to. This property is only valid after plan execution has completed.(RV(Ra((s9/usr/lib/python2.6/vendor-packages/pkg/client/plandesc.pytsalvagedscCsg}|io|ii}n|iddg}|idjo ||fStg}|iD]A}|ii|D](\}}}|||f||ffq~qh~}tg} |iD]A}|ii|D](\}}}| ||f||ffqq~ } xYt|t| D]A\}}|||f\}}|i |d|||t fq*WxYt| t|D]A\}}| ||f\}}|i ||d|t |fqWxt|t| @D]\}}|||f| ||fjoqn|||f\} } | ||f\} }|i || | || |fqW|idd||fS(sReturns a tuple of two lists containing the facet and variant changes in this plan. The variant list contains tuples with the following format: (, ) The facet list contains tuples with the following format: (, , , , , ) RcSs|dS(i((tx((s9/usr/lib/python2.6/vendor-packages/pkg/client/plandesc.pytscSs|dS(i((R((s9/usr/lib/python2.6/vendor-packages/pkg/client/plandesc.pyR-sN( RBtitemstsortR$RtdictR#t _src_valuesRGRR@(Ratvstfst_[1]tftvtsrctmaskedt old_facetst_[2]t new_facetstv_oldtm_oldtv_newtm_new((s9/usr/lib/python2.6/vendor-packages/pkg/client/plandesc.pytvarcetss@   G G # # !#c Cs|i\}}g}|D]!\}}|d|d|fq~}td}xu|D]m\}}} } } } | o|pd} | o|pd} d|d| | | || f} |i| qWW|S(sgReturns a formatted list of strings representing the variant/facet changes in this plansvariant %s: %sis (masked)ts facet %s (%s): %s%s -> %s%si(Rt_R(RaRRRRtvalRlt masked_strRRRRRtmsg((s9/usr/lib/python2.6/vendor-packages/pkg/client/plandesc.pyt get_varcets1s. ccstidd}x|t|id|D]e}|i}|i}||joti|}}nti|}ti|}||fVq(WdS(s>A generator function that yields tuples of PackageInfo objects of the form (src_pi, dest_pi). If 'src_pi' is None, then 'dest_pi' is the package being installed. If 'src_pi' is not None, and 'dest_pi' is None, 'src_pi' is the package being removed. If 'src_pi' is not None, and 'dest_pi' is not None, then 'src_pi' is the original version of the package, and 'dest_pi' is the new version of the package it is being upgraded to.t origin_fmritdestination_fmriRN(Rt attrgetterRR7RRRtbuild_from_fmri(RaRtpptsfmritdfmritsinfotdinfo((s9/usr/lib/python2.6/vendor-packages/pkg/client/plandesc.pyt get_changesBs   cCsTd|idDd|idDd|idDd|idDfS( s'This function returns a tuple of generators that yield tuples of the form (src, dest) of the preserved ("editable") files that will be installed, moved, removed, or updated. The returned list of generators is (moved, removed, installed, updated).cssx|] }|VqWdS(N((Rtentry((s9/usr/lib/python2.6/vendor-packages/pkg/client/plandesc.pys ds R&css#x|]}|ddfVqWdS(iN(R(RR((s9/usr/lib/python2.6/vendor-packages/pkg/client/plandesc.pys es R'css#x|]}d|dfVqWdS(iN(R(RR((s9/usr/lib/python2.6/vendor-packages/pkg/client/plandesc.pys fs R(css'x |]}|d|dfVqWdS(iN((RR((s9/usr/lib/python2.6/vendor-packages/pkg/client/plandesc.pys hs R)(R*(Ra((s9/usr/lib/python2.6/vendor-packages/pkg/client/plandesc.pytget_editable_changes]s ccsEx>ti|i|i|iD]\}}}d||fVqWdS(spA generator function that yields action change descriptions in the order they will be performed.s%s -> %sN(t itertoolstchainR9R<R3(Ratpplanto_acttd_act((s9/usr/lib/python2.6/vendor-packages/pkg/client/plandesc.pyt get_actionsls   cCst|idS(s-True if there are release notes for this plani(tboolR8(Ra((s9/usr/lib/python2.6/vendor-packages/pkg/client/plandesc.pythas_release_notesxscCs |idS(s+True if the release notes must be displayedi(R8(Ra((s9/usr/lib/python2.6/vendor-packages/pkg/client/plandesc.pytmust_display_notes|sccs!x|idD] }|VqWdS(s8A generator that returns the release notes for this planiN(R8(Ratnotes((s9/usr/lib/python2.6/vendor-packages/pkg/client/plandesc.pytget_release_notessc csx|iD]}|i}|o||joq nx|iD]\}}|d}d}|ot|i|d|i}n|d}d} |ot|i|d|i} n|i|| |d|dfVqAW|oPq q WdS(sA generator function that yields information about the licenses related to the current plan in tuples of the form (dest_fmri, src, dest, accepted, displayed) for the given package FMRI or all packages in the plan. This is only available for licenses that are being installed or updated. 'dest_fmri' is the FMRI of the package being installed. 'src' is a LicenseInfo object if the license of the related package is being updated; otherwise it is None. 'dest' is the LicenseInfo object for the license that is being installed. 'accepted' is a boolean value indicating that the license has been marked as accepted for the current plan. 'displayed' is a boolean value indicating that the license has been marked as displayed for the current plan.Rtimgtdesttacceptedt displayedN(R7Rt get_licensesRRRtimage( RatpfmriRRtlidRRtsrc_liRtdest_li((s9/usr/lib/python2.6/vendor-packages/pkg/client/plandesc.pyRs,        cCsC|itjptd|itf|idjogS|iS(sReturns a list of strings for all FMRIs evaluated by the solver explaining why they were rejected. (All packages found in solver's trim database.) Only available if DebugValues["plan"] was set when the plan was created. s%s >= %sN(RtEVALUATED_PKGSRiRJR(Ra((s9/usr/lib/python2.6/vendor-packages/pkg/client/plandesc.pytget_solver_errorss cCs!|i|i|||gdS(sKAdd a new message with its time, type and text for an item.N(R+R(Ratitem_idtmsg_timetmsg_typetmsg_text((s9/usr/lib/python2.6/vendor-packages/pkg/client/plandesc.pytadd_item_messagescCs|i|i|dS(sAdd new messages to an item.N(R+textend(RaRtmessages((s9/usr/lib/python2.6/vendor-packages/pkg/client/plandesc.pytextend_item_messagessccs|oot|iidd}x|D]B}|d}x/|i|D] \}}}||||fVqJWq,WnGxC|iD]8}x/|i|D] \}}}||||fVqWqWdS(sReturn all item messages. 'ordered' is an optional boolean value that indicates that item messages will be sorted by msg_time. If False, item messages will be in an arbitrary order.RcSs|\}}|ddS(i((RtkR((s9/usr/lib/python2.6/vendor-packages/pkg/client/plandesc.pyRsiN(RR+t iteritems(Ratorderedt ordered_listtitemRRRR((s9/usr/lib/python2.6/vendor-packages/pkg/client/plandesc.pytgen_item_messagess$       cCs1t|tjp td|ii|dS(s&Set timeout for synchronous actuators.s$Actuator timeout must be an integer.N(ttypetintRiRt set_timeout(Rattimeout((s9/usr/lib/python2.6/vendor-packages/pkg/client/plandesc.pytset_actuator_timeoutscCs||ijo]||i|jo1|i||i||i||iq|g|i||(Ra((s9/usr/lib/python2.6/vendor-packages/pkg/client/plandesc.pyt plan_type scCs|iS(sfBoolean indicating if indexes will be updated as part of an image-modifying operation.(R](Ra((s9/usr/lib/python2.6/vendor-packages/pkg/client/plandesc.pyt update_indexscCs|iS(sEither None, True, or False. If None then executing this plan may create a backup BE. If False, then executing this plan will not create a backup BE. If True, then executing this plan will create a backup BE.(RX(Ra((s9/usr/lib/python2.6/vendor-packages/pkg/client/plandesc.pyt backup_bescCs|iS(sSThe name of a new BE that will be created if this plan is executed.(R[(Ra((s9/usr/lib/python2.6/vendor-packages/pkg/client/plandesc.pytbe_namescCs|iS(sZThe name of a new backup BE that will be created if this plan is executed.(RY(Ra((s9/usr/lib/python2.6/vendor-packages/pkg/client/plandesc.pytbackup_be_name%scCs|iS(slA boolean value indicating whether any new boot environment will be set active on next boot.(R\(Ra((s9/usr/lib/python2.6/vendor-packages/pkg/client/plandesc.pyt activate_be+scCs |iiS(sA boolean value indicating that execution of the plan will require a restart of the system to take effect if the target image is an existing boot environment.(Rt reboot_needed(Ra((s9/usr/lib/python2.6/vendor-packages/pkg/client/plandesc.pyR1scCs|iS(sA boolean value indicating that execution of the plan will take place in a clone of the current live environment(RZ(Ra((s9/usr/lib/python2.6/vendor-packages/pkg/client/plandesc.pytnew_be8scCs|iS(sZA boolean value indicating whether or not the boot archive will be rebuilt(RU(Ra((s9/usr/lib/python2.6/vendor-packages/pkg/client/plandesc.pytupdate_boot_archive>scCs|iS(sEstimated number of bytes added(RT(Ra((s9/usr/lib/python2.6/vendor-packages/pkg/client/plandesc.pyt bytes_addedDscCs|iS(s.Estimated number of download cache bytes added(RS(Ra((s9/usr/lib/python2.6/vendor-packages/pkg/client/plandesc.pyt cbytes_addedIscCs|iS(s.Estimated number of bytes available in image /(R_(Ra((s9/usr/lib/python2.6/vendor-packages/pkg/client/plandesc.pyt bytes_availNscCs|iS(s5Estimated number of bytes available in download cache(R^(Ra((s9/usr/lib/python2.6/vendor-packages/pkg/client/plandesc.pyt cbytes_availSscCs(|idjodStii|iS(sTIf facets are changing, this is the new set of facets being applied.N(R$RRtfacettFacets(Ra((s9/usr/lib/python2.6/vendor-packages/pkg/client/plandesc.pyRXsN(ORRRRRRQRRRtVersionRtfmritPkgFmriRGRERFR R RPtlitLinkedImageNameRRRLt PROP_NAMERRRfRRRRgRRcRR@R RkRRwR|R~tpropertyRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR R R R(((s9/usr/lib/python2.6/vendor-packages/pkg/client/plandesc.pyRhs                  ^    A $ D       /       ($RRERRt simplejsonRot pkg.actionsRtpkg.client.actuatortpkg.client.api_errorsRt api_errorsRstpkg.client.linkedimaget linkedimageRtpkg.client.pkgplant pkg.facettpkg.fmritpkg.misct pkg.versiontpkg.api_commonRRR=Rt MERGED_OKt EVALUATED_OKtPREEXECUTED_OKtPREEXECUTED_ERRORRRt namedtupleRtobjectR(((s9/usr/lib/python2.6/vendor-packages/pkg/client/plandesc.pyt&s2            "%