ó –­PSc@sŽdZddlZddlZddlZddlZddlZddljZ ddlm Z ddl m Z dej fd„ƒYZdS(smodule describing a (symbolic) link packaging object This module contains the LinkAction class, which represents a link-type packaging object.iÿÿÿÿN(tmisc(tActionExecutionErrort LinkActioncBsueZdZgZdZdZd ZeZeZ dZ e j eZ d„Zd„Zd„Zd„Zd d„ZRS( s0Class representing a link-type packaging object.tlinktpathttargetcCs·|jd}|j|jjƒƒ}|j||ƒtjjtjj|ƒƒs|j tjj|ƒdt j d|j ƒntjj |ƒr£|j|ƒntj||ƒdS(s(Client-side method that installs a link.RtmodetfmriN(tattrstget_installed_pathtimagetget_roottfsobj_checkpathtosRtexiststdirnametmakedirsRt PKG_DIR_MODEtdestination_fmritlexiststremovetsymlink(tselftpkgplantorigRR((s6/usr/lib/python2.7/vendor-packages/pkg/actions/link.pytinstall8s   c Ksµ|jd}|j|jƒƒ}|j|tjƒ\}}}}} | re|sXt‚|||fStj|ƒ} || kr¨|j t dƒi| d6|d6ƒn|||fS(s»Returns a tuple of lists of the form (errors, warnings, info). The error list will be empty if the action has been correctly installed in the given image.Rs,Target: '%(found)s' should be '%(expected)s'tfoundtexpected( RR R tverify_fsobj_commontstattS_IFLNKtAssertionErrorR treadlinktappendt_( RtimgtargsRRtlstatterrorstwarningstinfotaborttatarget((s6/usr/lib/python2.7/vendor-packages/pkg/actions/link.pytverifyLs $    cCs(|j|jjƒƒ}|j||ƒS(s±Removes the installed link from the system. If something other than a link is found at the destination location, it will be removed or salvaged.(R R R t remove_fsobj(RRR((s6/usr/lib/python2.7/vendor-packages/pkg/actions/link.pyRcscsŠˆjdtjjˆjdƒdfˆjdtjjˆjddfg}dˆjkr†|j‡fd†ˆjjƒDƒƒn|S(swGenerates the indices needed by the search dictionary. See generic.py for a more detailed explanation.tbasenameRtmediatorc3s9|]/\}}|jdƒrˆj||dfVqdS(R.N(t startswithtnametNone(t.0tktv(R(s6/usr/lib/python2.7/vendor-packages/pkg/actions/link.pys vs N( R0R RR-RR1tseptextendt iteritems(Rtrval((Rs6/usr/lib/python2.7/vendor-packages/pkg/actions/link.pytgenerate_indicesks) c Cs›tjj|d|dtdd ddƒ}d|jkrŽd|jkrŽd|jkrŽd |jkrŽ|rŠtjj||d|ƒ‚nd S|jjdƒ}|jjdƒ}|jjdƒ}|jjd ƒ}| r |sï|sï|r |j dt d ƒfƒnP|d k r[t |t ƒ r[tj|ƒ\}}|s[|j d|fƒq[n|pd|sƒ|j dt d ƒfƒn|d k rÓt |t ƒ rÓtj|ƒ\}}|sÓ|j d|fƒqÓn|d k r#t |t ƒ r#tj|ƒ\}}|s#|j d|fƒq#n|d k rst |t ƒ rstj|ƒ\}}|ss|j d |fƒqsn|r—tjj||d|ƒ‚nd S(s9Performs additional validation of action attributes that for performance or other reasons cannot or should not be done during Action object creation. An ActionError exception (or subclass of) will be raised if any attributes are not valid. This is primarily intended for use during publication or during error handling to provide additional diagonostics. 'fmri' is an optional package FMRI (object or string) indicating what package contained this action.Rt raise_errorstrequired_attrsRt single_attrsR.smediator-versionsmediator-implementationsmediator-priorityNsma mediator must be provided when mediator-version, mediator-implementation, or mediator-priority is specifiedsYa mediator-version or mediator-implementation must be provided if a mediator is specified(starget(stargetsmediatorsmediator-versionsmediator-implementationsmediator-priority(tgenerictActiont _validatetFalseRtpkgtactionstInvalidActionAttributesErrortgetR!R"R1t isinstancetlisttmedtvalid_mediatortvalid_mediator_versiontvalid_mediator_implementationtvalid_mediator_priority( RRR&R.t med_versiontmed_implementationt med_prioritytvalidterror((s6/usr/lib/python2.7/vendor-packages/pkg/actions/link.pytvalidate|s\           (spathstargetN(t__name__t __module__t__doc__t __slots__R0tkey_attrt unique_attrstTruetglobally_identicalt refcountabletnamespace_groupR=t _orderdictt ordinalityRR+RR9R1RQ(((s6/usr/lib/python2.7/vendor-packages/pkg/actions/link.pyR+s     (RTterrnoR RR=t pkg.actionsRAt pkg.mediatorR.RGRtpkg.client.api_errorsRR>R(((s6/usr/lib/python2.7/vendor-packages/pkg/actions/link.pyts