a ì)g»!ã@sèddlmZmZmZeZddlZddlmZddlm Z ddl m Z ddl mZddlmZmZddlmZdd lmZdd lmZmZeƒZd d d œZdd„Zddd„Zdd„Zddd„Zd dd„Zd!dd„Z d"dd„Z!d#dd„Z"dS)$é)Úabsolute_importÚdivisionÚprint_functionN)Úcontext)Ú constants)Úlist_collections)Ú AnsibleError)Ú to_nativeÚto_bytes)Úloader)ÚDisplay)Ú_get_collection_pathÚAnsibleCollectionRef)Z async_wrapper)Úbase)ÚmoduleÚcachecCsˆ|}d|vr|}n4|dkr(| d¡r(d}d | |›d¡dd…¡}|g}|rp| | tjj¡|dd…¡| t|ƒ¡d |¡S)NÚ.úansible.legacyzansible.builtin.úansible.builtinééÿÿÿÿ) Ú startswithÚjoinÚsplitÚextendÚosÚpathÚsepÚappendr )Ú collectionÚnamerÚdepthZresolved_collectionÚ resource_nameZ composite©r#ú8/usr/lib/python3.9/site-packages/ansible/plugins/list.pyÚget_composite_names r%c Cs*i}|D]}t d |||¡¡t|ƒ}tj |¡ d¡r>qtj |¡rtj  |¡r|  ¡}t  |¡D]}| d¡r~qlt d |¡¡tj  |¡\} } t | ƒ} tj ||¡} tj  | ¡r|tjvrätj tj | d¡¡säql| t|t | ƒg||dd¡qlt| tjvt | ƒtjv| dv| t |d¡vtj | ¡gƒrDql|d vrÜzt|| || ƒ} WnHty¨}z.t d | t |ƒf¡WYd}~qlWYd}~n d}~00| D]*} t|| jtj t | ƒ¡|ƒ}| ||<q®qlt|| tj t | ƒ¡|ƒ}| ||<qlnt d  |¡¡qt d  |¡¡q|S) Nz&Searching '{0}'s '{1}' for {2} plugins)ó.s__zFound possible plugin: '{0}'s __init__.pyr)r!)s.ymls.yamls.jsonr#)ÚtestÚfilterzSkipping file %s: %sz6Skip listing plugins in '{0}' as it is not a directoryz2Skip listing plugins in '{0}' as it does not exist)ÚdisplayÚdebugÚformatr rrÚbasenamerÚexistsÚisdirÚlowerÚlistdirÚsplitextr rÚCZSYNTHETIC_COLLECTIONSÚupdateÚ_list_plugins_from_pathsÚanyZ IGNORE_FILESZ REJECT_EXTSÚIGNOREÚgetÚislinkÚ_list_j2_plugins_from_fileÚKeyErrorZwarningr%Ú ansible_nameÚdirname)ÚptypeÚdirsrr!ÚpluginsrÚb_pathZbkeyZ plugin_fileZb_pluginZb_extÚpluginÚ full_pathÚ file_pluginsÚeÚ plugin_namer#r#r$r4.sV   "  û " r4cCs"ttd |¡ƒ}| |||¡}|S)Nú {0}_loader)Úgetattrr r+Zget_contained_plugins)rZ plugin_pathr=rEÚploaderrCr#r#r$r9psr9c CsŠi}zttd |¡ƒ}Wn ty8td |¡ƒ‚Yn0| ¡D]˜}|dkrbdd„| ¡Dƒ}nf|dkrœdd„| ¡Dƒ}tj  dd¡rÈ|  tjd¡n,t t j   ||¡ƒ}ttj ||d |¡ƒg}| t|||ƒ¡qB|d vr| ¡D]}||df||<qîn€t| ¡ƒD]r}d} z|j |d d } WnDtyp} z*t d  ||||t| ƒ¡¡WYd} ~ n d} ~ 00||| f||<q|S)NrFz8Cannot list plugins, incorrect plugin type supplied: {0}rcSsg|]}|jr|j‘qSr#©Zinternalr©Ú.0Údr#r#r$Ú „óz+list_collection_plugins..rcSsg|]}|js|j‘qSr#rIrJr#r#r$rM‡rNZ module_pathsplugins)rT)Z class_onlyz8The '{0}' {1} plugin could not be loaded from '{2}': {3})rGr r+ÚAttributeErrorrÚkeysZ_get_paths_with_contextrZCLIARGSr7rr r2ZCOLLECTION_PTYPE_COMPATr rrrr3r4ÚlistÚ Exceptionr)Zvvv) r=Ú collectionsÚ search_pathsr?rHrr>Zb_ptyperAZpobjrDr#r#r$Úlist_collection_pluginsws4    4rUc Cs¸i}i}|dur4d|d<d|d<| t|dd¡nl|dkrNd||<d|d<nRztt|ƒƒ||<Wn<tyž}z$td |t|ƒ¡|d‚WYd}~n d}~00|r´| t||ƒ¡|S)NrNrrT)rTZdedupez'Cannot use supplied collection {0}: {1})Zorig_exc) r3rr r Ú ValueErrorrr+r rU)r=rrTr?rSrDr#r#r$Ú list_plugins¬s  .rWcCsdd„t||ƒDƒS)NcSsg|] }|j‘qSr#)r;)rKrAr#r#r$rMÈrNz%list_plugin_names..)rW©r=rr#r#r$Úlist_plugin_namesÇsrYcs t||ƒ‰‡fdd„ˆ ¡DƒS)Ncsg|]}ˆ|d‘qS)rr#©rKÚk©r?r#r$rMÍrNz%list_plugin_files..©rWrPrXr#r\r$Úlist_plugin_filesËs r^cs t||ƒ‰‡fdd„ˆ ¡DƒS)Ncsg|]}ˆ|d‘qS)rr#rZr\r#r$rMÒrNz'list_plugin_classes..r]rXr#r\r$Úlist_plugin_classesÐs r_)r)N)NN)N)N)N)#Z __future__rrrÚtypeZ __metaclass__rZansiblerrr2Zansible.collections.listrZansible.errorsrZansible.module_utils._textr r Zansible.pluginsr Zansible.utils.displayr Z2ansible.utils.collection_loader._collection_finderr rr)r6r%r4r9rUrWrYr^r_r#r#r#r$Ús,      ý B 5