ó oBú]c@sÌddlZddlZddlmZddlmZddlmZejdƒZej e ƒZ dZ dZ dZd efd „ƒYZd efd „ƒYZd „Zd„Zd„Zd„ZdS(iÿÿÿÿN(timporter(tlog(t type_utilss#(^[a-zA-Z_][A-Za-z0-9_]*)\((.*?)\)$slist()+dict()+str()tm_tMergert UnknownMergercBseZd„Zd„ZRS(cCs|S(N((tselft _meth_wantedtvaluet _merge_with((s>/usr/lib/python2.7/site-packages/cloudinit/mergers/__init__.pyt_handle_unknownscCs„tj|ƒ}|jƒ}d|}d}||g}t||ƒrXt||ƒ}n|sz|j}|jd|ƒn||ŒS(Ns_on_%si(Rtobj_nametlowertNonethasattrtgetattrR tinsert(Rtsourcet merge_witht type_namet method_nametmethtargs((s>/usr/lib/python2.7/site-packages/cloudinit/mergers/__init__.pytmerge%s    (t__name__t __module__R R(((s>/usr/lib/python2.7/site-packages/cloudinit/mergers/__init__.pyRs t LookupMergercBs&eZdd„Zd„Zd„ZRS(cCs2tj|ƒ|dkr%g|_n ||_dS(N(Rt__init__R t_lookups(Rtlookups((s>/usr/lib/python2.7/site-packages/cloudinit/mergers/__init__.pyR4s   cCsdt|jƒS(NsLookupMerger: (%s)(tlenR(R((s>/usr/lib/python2.7/site-packages/cloudinit/mergers/__init__.pyt__str__;scCsed}x3|jD](}t||ƒrt||ƒ}PqqW|sXtj||||ƒS|||ƒS(N(R RRRRR (Rt meth_wantedRRRtmerger((s>/usr/lib/python2.7/site-packages/cloudinit/mergers/__init__.pyR Cs  N(RRR RRR (((s>/usr/lib/python2.7/site-packages/cloudinit/mergers/__init__.pyR3s  cCsg}|jddƒ}|dkr9|jddƒ}n|dkrI|St|tjƒret|ƒSx—|D]}t|tƒr°|d}|jddƒjƒ}|d}n/|d}t |ƒdkrÙ|d }ng}|rl|j ||fƒqlqlW|S( Nt merge_howt merge_typetnamet-t_tsettingsiii( tpopR t isinstancetsixt string_typeststring_extract_mergerstdicttreplacetstripRtappend(tconfigtparsed_mergerst raw_mergerstmR$topts((s>/usr/lib/python2.7/site-packages/cloudinit/mergers/__init__.pytdict_extract_mergersQs(        cCsíg}xà|jdƒD]Ï}|jƒjƒ}|jddƒ}|sLqntj|ƒ}|szd|}t|ƒ‚n|jƒ\}}|jƒjdƒ}g|D]$}|jƒr¨|jƒjƒ^q¨}|j||fƒqW|S(Nt+R%R&s1Matcher identifer '%s' is not in the right formatt,( tsplitR R/R.t NAME_MTCHtmatcht ValueErrortgroupsR0(R"R2tm_nameR;tmsgtm_opsR4((s>/usr/lib/python2.7/site-packages/cloudinit/mergers/__init__.pyR,js 1cCstttƒƒS(N(ttupleR,tDEF_MERGE_TYPE(((s>/usr/lib/python2.7/site-packages/cloudinit/mergers/__init__.pytdefault_mergerssc Csg}x´|D]¬\}}|jtƒs;tt|ƒ}ntj|tgtgƒ\}}|s„d|t|f}t|ƒ‚q tj|dƒ}t |tƒ}|j ||fƒq Wg} t | ƒ} x*|D]"\} } | j | | | ƒƒqÖW| S(NsICould not find merger module named '%s' with attribute '%s' (searched %s)i( t startswitht MERGER_PREFIXtstrRt find_moduleRt MERGER_ATTRt ImportErrort import_moduleRR0R( R2t mergers_to_beR>R@t merger_locst looked_locsR?tmodtmod_attrtmergerstroottattrR5((s>/usr/lib/python2.7/site-packages/cloudinit/mergers/__init__.pyt constructƒs*   (treR*t cloudinitRRtloggingRtcompileR:t getLoggerRtLOGRBRERHtobjectRRR6R,RCRS(((s>/usr/lib/python2.7/site-packages/cloudinit/mergers/__init__.pyts