
    Vh%                      d dl mZ d dlZd dlZd dlZd dlZd dlZd dlZd dlm	Z	m
Z
 d dlmZ d dlmZ d dlmc mc mZ ddlmZ ddlmZ d d	lmZ d d
lmZ d dlmZmZm Z m!Z! d dl"m#Z#m$Z$m%Z% d dl&m'Z' d dl(m)Z) d dl*m+Z+ d dl,m-Z-m.Z.m/Z/m0Z0 d dl1m2Z2m3Z3 d dl4m5Z5m6Z6 d dl7m8Z8 d dl9m:Z: d dl;m<Z< 	 d dl=m>Z> d dl?m@Z@ d dlBZ e	eC      ZD e8       ZE e
dddg      ZFd ZGd ZHdqdZId ZJ G d d eK      ZL G d! d"eK      ZM G d# d$      ZN G d% d&eN      ZOdrd'ZPd( ZQd) ZRd* ZSdsd+ZTdsd,ZU eNd-d.ej                  d/      ZW eNd0d1ej                  d2d34      ZY eNd5d6ej                  d7      Z[ eNd8d9ej                  d:      Z] eNd;d<ej                  d=d>d?id@A      Z_ eNdBdCdDdD      Z` eNdEdFej                  dG      Zb eNdEdHej                  dI      Zd eNdEdHej                  dI      Ze eNdJdKej                  dLdM4      Zg eOdNdOej                  dPe      Zi eOdQdRej                  dSe      Zk eNdTdUej                  dVdW4      Zm eNdXdYej                  dZd[4      Zo eNd\d]ej                  d^      Zq eNd_d`ej                  dadb4      Zs eNdcddej                  dedf4      Zu eNdgdhej                  di      Zw eNdjdkej                  dldm4      Zy eNdndoej                  dp      Z{y# eA$ r dZ>dZ@Y 'w xY w)t    )annotationsN)defaultdict
namedtuple)import_module)
format_exc   )AnsibleJinja2Filter)AnsibleJinja2Test)__version__)	constants)AnsibleErrorAnsiblePluginCircularRedirectAnsiblePluginRemovedError(AnsibleCollectionUnsupportedVersionError)to_bytesto_text	to_native)string_types)	from_yaml)AnsibleLoader)get_plugin_classMODULE_CACHE
PATH_CACHEPLUGIN_PATH_CACHE)AnsibleCollectionConfigAnsibleCollectionRef)_AnsibleCollectionFinder_get_collection_metadata)Display)add_fragments)
_is_unsafe)SpecifierSet)Versionget_with_context_resultobjectplugin_load_contextc                     t               j                         D  cg c]  \  } }t        |t              s| |f c}} S c c}} w N)globalsitems
isinstancePluginLoader)nameobjs     F/home/dcms/DCMS/lib/python3.12/site-packages/ansible/plugins/loader.pyget_all_plugin_loadersr0   8   s1    +29??+<^KT3
3P\@]T3K^^^s   ??c                   t         j                  j                  t        | d            }t         j                  j	                  |      rt               D ]  \  }}|j                  st         j                  j                  |t        |j                              }t         j                  j	                  |      sf|j                  t        |              yt        j                  dt        |       z         y)z3 add any existing plugin dirs in the path provided surrogate_or_stricterrorszFIgnoring invalid path provided to plugin path: '%s' is not a directoryN)ospath
expanduserr   isdirr0   subdirjoinadd_directoryr   displaywarning)r6   b_pathr-   r.   plugin_paths        r/   add_all_plugin_dirsr@   <   s    WW6K LMF	ww}}V/1 	<ID#zz ggll68CJJ3GH77==-%%gk&:;		< 	`cjkocppq    c                   | sd} |r}t        |t              rxt        j                  j	                  |      }	 t
        j                  |      }|At
        j                         D ]  }||j                  v s|j                  }  n nt        d      t
        j                  |       }|st        d| z        |rt        |d|       |S # t        $ r d }Y w xY w)Nshz;Either a shell type or a shell executable must be provided z.Could not find the shell plugin required (%s).
executable)r+   r   r5   r6   basenameshell_loaderget	ExceptionallCOMPATIBLE_SHELLSSHELL_FAMILYr   setattr)
shell_typerD   shell_filenameshells       r/   get_shell_pluginrP   I   s    
 *l3!#!1!1*!=!(,,^<E =!-!1!1!3 ")U-D-DD).););J!"
 \]]Z(EKjXYY|Z0L% ! ! E!s   C CCc                    t        t        j                  t           d| z        }|D ]  }|j	                  |d        y )Nz	%s_loaderT)with_subdir)getattrsysmodules__name__r;   )which_loaderpathsloaderr6   s       r/   add_dirs_to_loaderrZ   j   s>    S[[*K,,FGF 5Tt45rA   c                      e Zd Zd Zy)PluginPathContextc                     || _         || _        y r(   )r6   internal)selfr6   r^   s      r/   __init__zPluginPathContext.__init__r   s    	 rA   N)rV   
__module____qualname__r`    rA   r/   r\   r\   q   s    !rA   r\   c                  :    e Zd Zd Zed        Zd Zd Zd Zd Z	y)PluginLoadContextc                    d | _         g | _        g | _        g | _        g | _        d | _        d | _        d | _        d | _        d | _	        d| _
        d | _        d | _        g | _        d| _        d | _        d | _        y NF)original_nameredirect_list
error_listimport_error_listload_attemptspending_redirectexit_reasonplugin_resolved_pathplugin_resolved_nameplugin_resolved_collection
deprecatedremoval_dateremoval_versiondeprecation_warningsresolved_resolved_fqcnaction_pluginr_   s    r/   r`   zPluginLoadContext.__init__x   s    !!# $$(!$(!*.' #$&!"!rA   c                R   | j                   sy | j                  s| j                  d   }t        j                  |      r%|j                  d      r|j                  d      d   }| j                  r't        j                  |      s| j                  dz   |z   }|| _        | j                  S )Nansible.legacy..)rv   rw   ri   r   is_valid_fqcr
startswithsplitrq   )r_   final_plugins     r/   resolved_fqcnzPluginLoadContext.resolved_fqcn   s    }}""--b1L#11,?LD[D[\mDn+112CDRH..7K7Y7YZf7g#>>D|S".D"""rA   c                R   |s| S |j                  dd       xs d}|j                  dd       }|j                  dd       }|d }dj                  ||rdnd|      }t        j                  ||||       d| _        |r|| _        |r|| _        | j                  j                  |       | S )	Nwarning_text rs   rt   z{0} has been deprecated.{1}{2} )dateversioncollection_nameT)rG   formatr<   rr   rs   rt   ru   append)r_   r-   deprecationr   r   rs   rt   s          r/   record_deprecationz$PluginLoadContext.record_deprecation   s    K #~t<B"~t<%//*;TB#"O7>>tLS^`bno<lOetu ,D#2D !!((6rA   c                h    d | _         || _        || _        || _        || _        d| _        || _        | S )NT)rm   rp   ro   rq   rn   rv   rx   )r_   resolved_nameresolved_pathresolved_collectionrn   rx   s         r/   resolvezPluginLoadContext.resolve   s>     $$1!$1!*='&*rA   c                d    || _         dj                  | j                  |      | _        d| _        | S )Nz+pending redirect resolution from {0} to {1}F)rm   r   rh   rn   rv   )r_   redirect_names     r/   redirectzPluginLoadContext.redirect   s3     -HOOPTPbPbdqrrA   c                0    d | _         || _        d| _        | S rg   )rm   rn   rv   )r_   rn   s     r/   nopezPluginLoadContext.nope   s     $&rA   N)
rV   ra   rb   r`   propertyr   r   r   r   r   rc   rA   r/   re   re   w   s/    "& # #0rA   re   c                      e Zd ZdZd dZed        Zd Zd Zd Z	d Z
d	 Zd
 Zd Zd!dZd!dZd!dZd Zd"dZd#dZd"dZd$dZd$dZdddd e       fdZd%dZd#dZeZd Zd dZd Zd Zd dZ d Z!y)&r,   z
    PluginLoader loads plugins from the configured plugin directories.

    It searches for plugins by iterating through the combined list of play basedirs, configured
    paths, and the python path.  The first match is used.
    Nc                   |i n|}|| _         || _        || _        || _        || _        |rt        |t              s|g}n|sg }|| _        |t        vr	i t        |<   |t        vr	d t        |<   |t        vrt        t              t        |<   g | _        t        |   | _        t        |   | _        t        |   | _        | j                  dk(  ri nd | _        t%               | _        y Nvars_plugins)
class_name
base_classpackager9   aliasesr+   listconfigr   r   r   r   dict_extra_dirs_module_cache_paths_plugin_path_cache_plugin_instance_cacheset_searched_paths)r_   r   r   r   r9   r   required_base_classs          r/   r`   zPluginLoader.__init__   s    "W$- *VT2XFF\)')L$Z'%)Jz"..,7,=j)  **5 ,"3J"?,0KK>,Ibt#"urA   c                @    t        j                  | j                        S r(   )r    legacy_plugin_dir_to_plugin_typer9   ry   s    r/   typezPluginLoader.type   s    #DDT[[QQrA   c                8    dj                  | j                        S )NzPluginLoader(type={0}))r   r   ry   s    r/   __repr__zPluginLoader.__repr__   s    '..tyy99rA   c                   t         j                  rd | _        y i t        | j                  <   d t
        | j                  <   t        t              t        | j                  <   t        | j                     | _	        t
        | j                     | _        t        | j                     | _
        | j                  dk(  ri nd | _        t               | _        y r   )COLD_PLUGIN_CACHE_CLEARINGr   r   r   r   r   r   r   r   r   r9   r   r   r   ry   s    r/   _clear_cacheszPluginLoader._clear_caches   s    &&DK -/L)*.Jt'1<T1Bdoo. ".doo!>D$T__5DK&7&HD#04~0M"SWD'#&5D rA   c                   |j                  d      }|j                  d      }|j                  d      }|j                  d      }|j                  d      }|j                  d      }|j                  d      t        |<   |j                  d      t        |<   | j                  ||||||       |j                  d	g       | _        |j                  d
t                     | _        y)z
        Deserializer.
        r   r   r   r9   r   r   r   r   r   r   N)rG   r   r   r`   r   r   r   )r_   datar   r   r   r9   r   r   s           r/   __setstate__zPluginLoader.__setstate__  s    
 XXl+
((9%(#(#((9%XXl+
!%,!7
:(,1D(E*%j'667JO88M26#xx(935ArA   c                   t        | j                  | j                  | j                  | j                  | j
                  | j                  | j                  | j                  t        | j                     t        | j                     
      S )z
        Serializer.
        )
r   r   r   r   r9   r   r   r   r   r   )r   r   r   r   r   r9   r   r   r   r   r   ry   s    r/   __getstate__zPluginLoader.__getstate__   se    
 LL;;;;LL(( 00!$//2/@
 	
rA   c                ~    g }|D ]  }||vs|j                  |        t        j                  j                  |      S )z; Returns a string suitable for printing of the search path )r   r5   pathsepr:   )r_   rX   retis       r/   format_pathszPluginLoader.format_paths2  s?      	A|

1	 zzs##rA   c                D    | j                  | j                  d            S )NFsubdirs)r   
_get_pathsry   s    r/   print_pathszPluginLoader.print_paths<  s      !?@@rA   c                    g }|j                  |       t        j                  |d      D ]A  \  }}}d|v s|D ]1  }|j                  t        j                  j	                  ||             3 C |S )NT)followlinksz__init__.py)r   r5   walkr6   r:   )r_   dirresultsrootr   filesxs          r/   _all_directorieszPluginLoader._all_directories?  sm    s$&GGCT$B 	: D'5%  :ANN277<<a#89:	: rA   c                   | j                   sg S t        | d      st        | j                         }| j                   j                  d      dd }|D ]  }t	        ||      } t        t        j                  j                  |j                        d      | _
        |r| j                  | j                        S | j                  gS )z# Gets the path of a Python package package_pathr}   r   Nr2   r3   )r   hasattr
__import__r   rS   r   r5   r6   dirname__file__r   r   )r_   r   mparts
parent_mods        r/   _get_package_pathszPluginLoader._get_package_pathsH  s     ||It^,4<<(ALL&&s+AB/E# +
Az*+ '

(CLa bD(():):;;!!""rA   c           	     R   | j                   | j                   S | j                  D cg c]  }t        |d       }}| j                  | j                  D ]  }t        j
                  j                  t        j
                  j                  |            }|rt        j                  d|z        t        j                  d|z        z   }|D ]O  }t        |d      }t        j
                  j                  |      s0||vs5|j                  t        |d             Q t        |d      }||vs|j                  t        |d              |j                  | j                  |      D cg c]  }t        |d       c}       |j                  d 	       || _         |S c c}w c c}w )
zE Return a list of PluginPathContext objects to search for plugins in Fz%s/*z%s/*/*r2   r3   r   Tc                8    | j                   j                  d      S )Nz/windows)r6   endswith)ps    r/   <lambda>z6PluginLoader._get_paths_with_context.<locals>.<lambda>  s    qvvz: rA   key)r   r   r\   r   r5   r6   abspathr7   globr   r8   r   extendr   sort)r_   r   r   r   r6   contentscs          r/   _get_paths_with_contextz$PluginLoader._get_paths_with_contextW  sn    ;;";;484D4DEq E*EE ;;" ?wwrww'9'9$'?@#yy$7$))HtO:TTH% D#A.CD77==+JJ'8E'BCD
 t,ABs?JJ0u=>?  	

8O8OX_8O8`a1%a.ab$ 	:; 
U F( bs   F)F$c                d    | j                  |      }|D cg c]  }|j                   c}S c c}w )z1 Return a list of paths to search for plugins in r   )r   r6   )r_   r   paths_with_contextpath_with_contexts       r/   r   zPluginLoader._get_paths  s4     "99'9J@RS+<!&&SSSs   -c                   | j                   rt        | j                         }|t        j                  v rt        j                  j                  ||      st        t        |dd      |      j                         }|rpt        ||t        |dk(         d|v rUt        |d   t              rAt        j                  j                  |||d          t        j                  d|d|d	       y
y
y
y
y
y
y
)zf Reads plugin docs to find configuration setting definitions, to push to config manager for later use DOCUMENTATIONr   )	file_namemodule)fragment_loader	is_moduleoptionszLoaded config def from plugin (/)N)r   r   r   CONFIGURABLE_PLUGINSr   has_configuration_definitionr   rS   get_single_datar    r   r+   r   +initialize_plugin_configuration_definitionsr<   debug)r_   r-   r   r6   	type_namedstrings         r/   _load_config_defszPluginLoader._load_config_defs  s     ??(9I A222188;`;`ajlp;q'(LX\]mmo !'4]fjr]rt G+
79;Mt0TLLYX\^efo^pqQZ\`&ab 1U+  <r2	 rA   Fc                D   t         j                  j                  |      }||r*t         j                  j                  || j                        }|| j
                  vrD| j
                  j                  |       | j                          t        j                  d|z         yyy)z1 Adds an additional directory to the search path NzAdded %s to loader search path)
r5   r6   realpathr:   r9   r   r   r   r<   r   )r_   	directoryrR   s      r/   r;   zPluginLoader.add_directory  s     GG$$Y/	 GGLLDKK@	 0 00  ''	2""$>)LM	 1 !rA   c                   t        |j                        }|sy 	 t        |j                  dj                  |      z          t	        |dd       }|sy |j
                  r(dj                  |j
                  |j                  g      }n|j                  }|j                  di       j                  |i       j                  ||z   d       }|s2|j                  di       j                  |i       j                  |d       }|S # t        $ r Y w xY w)Nz.plugins.{0}_collection_metar}   plugin_routing)	r    n_python_collection_package_namer   ImportErrorrS   r   r:   resourcerG   )r_   acrplugin_type	extensioncollection_pkgcollection_metasubdir_qualified_resourceentrys           r/   _query_collection_routing_metaz+PluginLoader._query_collection_routing_meta  s   &s'K'KL	#>>AVAVWbAccd
 ".2DdK
 ;;(+#++s||1L(M%(+%##$4b9==k2NRRSloxSxz~#''(8"=AA+rRVVWprvwE)  		s   'C< <	DDc           	     	   d|_         t        j                  | j                        }t        j                  ||      }| j                  |||      }d}|r|j                  dd      }	|s|j                  ||	|j                         |j                  dd      }
|
r|
j                  d      }|
j                  d      }|
j                  d      xs d	}d
j                  ||rdnd	|      }t        j                  |||d|j                        }||_        ||_        d|_         ||_        t        ||      |j                  dd      }|rt        j                   |      st#        d|j                   d| d| d      t        j%                  dj                  |||             ||j&                  vr|j&                  j)                  |       |j+                  |      S | j,                  dk(  r|j                  d      }t/        |j0                  d      }dj                  |j2                  |      }|r||z  }t4        j6                  j                  |j2                        }|s	 t9        |j2                        }t>        j@                  jC                  |jD                        }t>        j@                  jG                  ||      }t>        j@                  jI                  |      rB|jK                  |tM        |      |j                  dj                  ||j                        |      S |r4|j=                  dj                  tM        |      |j                              S tO        jP                  t>        j@                  jG                  ||      dz         D cg c]B  }t>        j@                  jS                  |      r!|jU                  tV        jX                        s|D }}|s+|j=                  dj                  ||j                              S t[        |      }t]        |      dkD  r't        j_                  d d!jG                  |      z         |jK                  |tM        |d"         |j                  d#j                  ||j                        |      S # t:        $ r- |j=                  dj                  |j2                              cY S w xY wc c}w )$zSearch builtin paths to find a plugin. No external paths are searched,
        meaning plugins inside roles inside collections will be ignored.
        F)r  Nr   	tombstoners   rt   r   r   z{0} has been removed.{1}{2}r   T)msgr   r   removedr   r&   r   Collection  contains invalid redirect for : 6. Redirects must use fully qualified collection names.z"redirecting (type: {0}) {1} to {2}rU   rx   strictr3   {0}.{1}zPython package {0} not foundz found exact match for {0} in {1}zno match for {0} in {1}z.*z+failed fuzzy extension match for {0} in {1}r   zDFound several possible candidates for the plugin but using first: %s,r   z*found fuzzy extension match for {0} in {1})0rv   r   r   r9   	from_fqcrr	  rG   r   
collectionr   r<   get_deprecation_messagers   rt   rn   r   r~   r   vvri   r   r   r   r   r  n_python_package_namerT   rU   r   r   r   r5   r6   r   r   r:   existsr   r   r   iglobisfiler   r   MODULE_IGNORE_EXTSsortedlenr   )r_   fq_namer  r&   ignore_deprecatedr  r  routing_metadatarx   r   r  rs   rt   r   removed_msgr   
n_resource	full_namepkgpkg_pathn_resource_pathffound_filess                          r/   _find_fq_pluginzPluginLoader._find_fq_plugin  su   
 (-$*KKDKKX",,WkB  >>sK[d>e*..}dCK %#66wS^^\(,,[$?I (}}^<"+--0A"B(}}^<B<CCGT`Sfhjvw%==,XgCOY]NQnn > ^ 4@#06E#3/3#,2=#//Qdee'++J=H+99(C&%cnn%55TU\T]]_`h_i jO O  

?FF{T[]efg
 "5"C"CC'55<<WE*33H== yyI% 0 4 4_ Es||H=
$$S%>%>
K	)#Jkkooc778r#C$=$=> 77??3<<0'',,x< 77>>/*&..7?3S^^EgEnEnoxz}  {I  {I  FJ  LYZ Z &++,E,L,LWU_M`bebpbp,qrr !%

277<<*+MPT+T UV''..+AJJq?S?S4T  V V &++,Y,`,`ajlolzlz,{||[){aMM`cfckcklwcxxy"**w{1~.8??	3>>Z\ik 	k;  r*//0N0U0UVYVoVo0pqqr"Vs   $R AS3SSr   c                v    | j                  |||||      }|j                  r|j                  r|j                  S y)z Find a plugin named name N)find_plugin_with_contextrv   ro   )r_   r-   mod_typer"  check_aliasescollection_listresults          r/   find_pluginzPluginLoader.find_pluginC  s;    ..tX?PR_apq??v::...rA   c                   t               }||_        	 | j                  ||||||      }|j                  r]|j                  |j                  v r/t        dj                  |j                  |j                              |j                  }d|_        |}nn|j                  r/t        j                  dj                  ||j                               |S )zg Find a plugin named name, returning contextual info about the load, recursively resolving redirection r  z.plugin redirect loop resolving {0} (path: {1})Nz;errors were encountered during the plugin load for {0}:
{1})
re   rh   _resolve_plugin_steprm   ri   r   r   rj   r<   r=   )r_   r-   r/  r"  r0  r1  r&   r2  s           r/   r.  z%PluginLoader.find_plugin_with_contextK  s   /1,0)..tX?PR_ap  GZ.  [F&&**f.B.BB78h8o8opv  qE  qE  GM  G[  G[  9\  ]  ]..*.'&,#  ))OOZaabfh{  iG  iG  H  I #"rA   c                   |st        d      |j                  j                  |       d|_        |t        | j
                     v rdj                  |      |_        |S |r|}n| j                  rd}nd}t        j                  |      s|r]|j                  d      sKd|v s|s|g}n|D 	cg c]  }	dj                  |	|       }}	|D ]  }
	 |j                  j                  |
       |
j                  d	      r%| j                  |j                  d
      ||||      }nJ| j                  |
|||      }|j                  r)|
|j                  vr|j                  j                  |
       |j                  s|j                   r|c S  |j.                  r?t2        j5                  dj                  |dj7                  |j.                                     dj                  |      |_        |S | j                  |||||      S c c}	w # t"        t$        t&        f$ r  t(        $ r&}|j*                  j                  |       Y d }~xd }~wt,        $ r/}|j.                  j                  t1        |             Y d }~d }~ww xY w)NzA PluginLoadContext is requiredFz#{0} matched a defined plugin filterz.pyr   Ansibler}   r  zansible.legacyr|   )r&   r"  z)plugin lookup for {0} failed; errors: {1}z; )r  zno matches found for {0})
ValueErrorri   r   rv   _PLUGIN_FILTERSr   r   rn   r   r   r~   r   rl   _find_plugin_legacyremoveprefixr,  rm   r   r   r   r   rk   rH   rj   r   r<   r   r:   )r_   r-   r/  r"  r0  r1  r&   suffix
candidatesr   candidate_nameieexs                r/   r5  z!PluginLoader._resolve_plugin_stepi  s   ">??))006',$?4<<00.S.Z.Z[_.`+&&F__F F !..t4QUQ`Q`ajQkd{/"V
APQAi..q$7Q
Q", II'55<<^L%001AB /3.F.FtGXGXYjGkGZ\mo|  E/F+ /3.B.B>SY  pCUf /C /h+ /77NReRsRs<s/==DD^T*337J7[7[22 8\-IB #--"M"T"TUY[_[d[dex  fD  fD  \E  #F  G.H.O.OPT.U+&& ''.ACTVcekllY R4 23PRz{ " E'99@@DD  I'2299)B-HHIs+   +G=B4HI;I  I;$I66I;c                    d|_         |r j                  j                  ||      } j                  |   }	 ||   }|j                  |_        ||_        |j                  rdnd|_        |j                  rd|z   n||_	        d|_         |S # t        $ r Y nw xY w fd j                         D        D ]  }|j                  }t        |      t        j                  d|z         |j                  j!                  |       |j                  }		 fdt#        j$                        D        }
n7# t&        $ r+}t        j)                  d	t+        |      z         Y d
}~nd
}~ww xY wd 
D        D ]D  t"        j                  j-                        }t/        fdt0        j2                  D              rFt"        j                  j5                  |      }|d   }	 |d   }n# t6        $ r d}Y nw xY wt+        d      | j                  d   vrt9        |	       j                  d   |<   | j                  d   vrt9        |	       j                  d   |<   | j                  |   vrt9        |	       j                  |   |<   | j                  |   vs)t9        |	       j                  |   |<   G  j:                  j=                  |       	 ||   }|j                  |_        ||_        |j                  rdnd|_        |j                  rd|z   n||_	        d|_         |c S # t        $ r Y w xY w |j?                  d      sd|z   }||v r||   }|sPt"        j                  jA                  |j                        s't        jC                  d|jE                  d      z         |j                  |_        ||_        |j                  rdnd|_        |j                  rd|z   n||_	        d|_         |S djG                  |      }d|vr*tI        jJ                  |      r jM                  ||||      S |jO                  djG                  |            S )zSearch library and various *_plugins paths in order to find the file.
        This was behavior prior to the existence of collections.
        Fansible.builtinr   ansible.builtin.Tc              3     K   | ]R  }|j                   j                  vst        j                   j                  t	        |j                               sO| T y wr(   )r6   r   r5   r8   r   ).0r   r_   s     r/   	<genexpr>z3PluginLoader._find_plugin_legacy.<locals>.<genexpr>  sj       "Wqvv]a]q]qOqvxv}v}  wD  wD  EM  NO  NT  NT  EU  wV!  "Ws   A2AAz	trying %sc              3  ^   K   | ]$  }t         j                  j                  |       & y wr(   )r5   r6   r:   )rE  r*  r>   s     r/   rF  z3PluginLoader._find_plugin_legacy.<locals>.<genexpr>  s      R!bggll615Rs   *-z Error accessing plugin paths: %sNc              3     K   | ]A  }t         j                  j                  |      s#|j                  d       r5t	        |       C yw)s   __init__.pyN)r5   r6   r  r   r   )rE  r*  s     r/   rF  z3PluginLoader._find_plugin_legacy.<locals>.<genexpr>  s3     wq"''..QRBS\]\f\fgu\vilws   $A	A	A	c              3  @   K   | ]  }j                  |        y wr(   )r   )rE  r   	full_paths     r/   rF  z3PluginLoader._find_plugin_legacy.<locals>.<genexpr>  s     Ky))!,Ks   r   r   r2   r3   _z%s is kept for backwards compatibility but usage is discouraged. The module documentation details page may explain more about this rationale.zansible.builtin.{0}r}   )r!  r  r&   r"  z.{0} is not eligible for last-chance resolution)(rv   r   rG   r   r6   ro   rp   r^   rq   rw   KeyErrorr   r   r<   r   rl   r   r5   listdirOSErrorr=   r   rE   anyr   r  splitext
IndexErrorr\   r   addr   islinkrr   lstripr   r   r~   r,  r   )r_   r-   r&   r"  r0  r<  
pull_cacher   r6   r^   
full_pathser&  	splitname	base_namer  
alias_namecandidate_fqcrr>   rJ  s   `                 @@r/   r:  z PluginLoader._find_plugin_legacy  s    (-$<<##D$/D ,,V4

	 *4 07H7M7M47;4RcRlRl=Nrt:O`OiOi2Dt2Kos.+/(&& 		 "WT-I-I-K  "W 4	$))Dd^FMM+,---44T:(11HQRrzz&?QR
 Q BWQZ OPPQ xJw k	GG,,Y7	
 Ka6J6JKKGG,,Y7	%aL	# )!I! # "I# $I6KL	D$;$;B$??=NyZb=cD++B/	:D$;$;B$??=NyZb=cD++B/	:D$;$;I$FFDUV_aiDjD++I6yAD$;$;I$FFDUV_aiDjD++I6yA9k<   $$T*
$.t$4!;L;Q;Q#8;?#8VgVpVpARvx#>RcRlRl5G$5Nrv#2/3#,** e4	n s#tJZ'$.z$:!(@Q@V@V1W&& (vx|  yD  yD  EH  yI(I J;L;Q;Q#8;E#8VgVpVpARvx#>XiXrXr5G*5T  yC#2/3#,** /55d;d?3AA.Q''&fy  N_'  `  `"''(X(_(_`d(effsO   AB 	BBD..	E"7!EE"GG-,G-AL''	L43L4c                    	 | j                  ||      duS # t        $ rH}t        |t              r t        j                  dj                  t        |                   Y d}~yd}~ww xY w)z& Checks if a plugin named name exists r1  Nzhas_plugin error: {0})r3  rH   r+   r   r<   r   r   r   )r_   r-   r1  r@  s       r/   
has_pluginzPluginLoader.has_plugin  sb    	G##D/#JRVVV 	G"l+MM188EFF		Gs    	A(>A##A(c                z   |j                  d      r|}ndj                  | j                  |g      }|t        j                  v rt        j                  |   S t        j                         5  t        j                  dt               t        j                  j                  t        |      t        |            }t        j                  j                  |      }|t        j                  |<   	 |j                  j                  |       	 d d d        |S # t         $ r t        j                  |=  w xY w# 1 sw Y   S xY w)Nansible_collections.r}   ignore)r   r:   r   rT   rU   warningscatch_warningssimplefilterRuntimeWarning	importlibutilspec_from_file_locationr   module_from_specrY   exec_modulerH   )r_   r-   r6   r&  specr   s         r/   _load_module_sourcez PluginLoader._load_module_source*  s    ??12I$,,!56I#;;y))$$& 	 !!(N;>>99)I:NPYZ^P_`D^^44T:F &,CKK	"''/	" 	  KK	*	" s   +A?D0+DD--D00D:c                   t        |d|       t        |d|       t        |d|xs g        g }|r|j                  |       |r|j                  |d d d          |st        d|       t        |d|       t        |d|d          y )	N_original_path
_load_name_redirected_namesr{   zMissing FQCN for plugin source ansible_aliasesansible_namer   )rL   r   r   r   )r_   r.   r-   r6   redirected_namesrv   namess          r/   _update_objectzPluginLoader._update_objectI  s     	%t,\4((*:*@bALL"LL)$B$/0!@GHH&.^U1X.rA   c                B     | j                   |g|i |j                  S r(   )get_with_contextr%   )r_   r-   argskwargss       r/   rG   zPluginLoader.get\  s%    $t$$T;D;F;BBBrA   c           	        t        |      r|j                         }d}|j                  dd      }|j                  dd      }|| j                  v r| j                  |   }| j                  xs i j                  |      x}r|d   j                  rt        | S | j                  ||      }|j                  r|j                  st        d|      S |j                  }	d|	vr)|j                  rdj                  |j                  |	f      }	|j                  }
|j                  }| j                  xs i j                  |	      x}r|d   j                  rt        | S |j                  xs g }|| j                  vr!| j!                  |
|      | j                  |<   d}| j#                  |
| j                  |   |       t%        | j                  |   | j&                        }| j(                  rQt+        | j,                  | j(                  g	      }	 t%        || j(                        }t1        ||      st        d|      S | j3                  | j&                  |
| j4                  |||
       |sC	 t6        j9                  |      }| j;                  ||
|||	        |j<                  |g|i | |}| j;                  ||
|||	       | j                  t%        |dd      r||f| j                  |	<   n%| j                  dtI               f| j                  |	<   t        ||      S # t.        $ r t        d|      cY S w xY w# t>        $ rL}d|j@                  d   v r5tB        jE                  d|
dtG        |             t        d|      cY d}~S  d}~ww xY w)z9 instantiates a plugin of the given name using arguments T
class_onlyFr1  Nr   r]  r}   fromlistfound_in_cacher{  abstractr   zReturning not found on "z," as it has unimplemented abstract methods; is_stateless)%r!   _strip_unsafepopr   r   rG   rv   r$   r.  ro   r   rq   r:   rp   ri   r   rl  r   rS   r   r   r   r   AttributeError
issubclass_display_plugin_loadr   r%   __new__ru  r`   	TypeErrorrx  r<   vr   re   )r_   r-   rx  ry  r  r{  r1  cached_resultr&   r!  resolved_type_namer6   rs  r.   r   plugin_classinstancerW  s                     r/   rw  zPluginLoader.get_with_context_  s   d %%'DZZe4
 **%6=4<<<<%D"99?RDDTJJMJP]^_P`PiPi
 +M::";;DRa;b"++3F3[3[*41DEE%33g"5"P"Phh 3 N NPWXYG0EE"77"99?RDDWMMMMS`abScSlSl +M::.<<Bt)))'+'?'?@RTX'YDt$"N143E3Ed3KTRd((.@??  7HIFJ&vt? c<0.t5HII 	!!$//3EtG[G[]a  sA  NX!  	Y ">>#.##H.@$HXZabX777 	C!3T;KWU&&2wsNTY7Z479L3MD''0((448:K:M3ND''0&s,?@@; " J.t5HIIJ   *IIl~  AJ  KL  AM  N  O249LMMs8   L $AL2 L/.L/2	N;A N;NNNc                   t         j                  rrd|dt        j                  j	                  |      d|}t        |      dkD  r|d| j                  |      d}|s|r|d|d|d}t        j                  |       y	y	)
zd formats data to display debug info for plugin loading, also avoids processing unless really needed zLoading z 'z' from r   z (searched paths: r   z (found_in_cache=z, class_only=N)	r   DEFAULT_DEBUGr5   r6   rE   r   r   r<   r   )r_   r   r-   searched_pathsr6   r  r{  r  s           r/   r  z!PluginLoader._display_plugin_load  sj    ??1;RWW=M=Md=SUYZC>"Q&368I8I.8YZADnV`aMM# rA   c           
   /  	  K   |j                  dd      }|j                  dd      }|j                  dd      }|r|rt        d      g }d}t               }| j                         D ]  }	t	        j                  t        t        j                  j                  |	j                  d                  }
|	j                  s|j                  |
       |j                  t        |
t        j                  j                                t               }|D ]  }t        j                  j                  |      d	   }t        j                  j                  |      }t        | t               }|r|}n|}|s.|t"        | j$                     v rt&        j)                  d
|z         |dk(  s|dk(  r(| j$                  dk(  rt&        j)                  d|z         |r||v rt&        j)                  d|z         |j+                  |       |r| ||v r|}nd| }| j,                  xs i j/                  |      x}r|d   j0                  r	|d	    :|| j2                  vrZ| j4                  dv r%dj7                  t9        t;        |            |      }n|}	 | j=                  ||      }|| j2                  |<   d}n| j2                  |   }| jE                  |||       	 tG        || jH                        }| jL                  rGtO        | j$                  | jL                  g      }	 tG        || jL                        }tQ        ||      s.| jS                  | jH                  || jT                  |||       |s		  ||i |}| jY                  ||||       | j,                  0d}t[        |d      r|j\                  }|s| j_                  |      d	    |  y# t>        $ r/}t&        jA                  d|dtC        |             Y d}~d}~ww xY w# tJ        $ r/}t&        jA                  d|dtC        |             Y d}~+d}~ww xY w# tJ        $ r Y ?w xY w# tV        $ r/}t&        jA                  d|dtC        |             Y d}~d}~ww xY ww)a  
        Iterate through all plugins of this type, in configured paths (no collections)

        A plugin loader is initialized with a specific type.  This function is an iterator returning
        all of the plugins of that type to the caller.

        :kwarg path_only: If this is set to True, then we return the paths to where the plugins reside
            instead of an instance of the plugin.  This conflicts with class_only and both should
            not be set.
        :kwarg class_only: If this is set to True then we return the python class which implements
            a plugin rather than an instance of the plugin.  This conflicts with path_only and both
            should not be set.
        :kwarg _dedupe: By default, we only return one plugin per plugin name.  Deduplication happens
            in the same way as the :meth:`get` and :meth:`find_plugin` methods resolve which plugin
            should take precedence.  If this is set to False, then we return all of the plugins
            found, including those with duplicate names.  In the case of duplicates, the order in
            which they are returned is the one that would take precedence first, followed by the
            others  in decreasing precedence order.  This should only be used by subclasses which
            want to manage their own deduplication of the plugins.
        :*args: Any extra arguments are passed to each plugin when it is instantiated.
        :**kwargs: Any extra keyword arguments are passed to each plugin when it is instantiated.
        _dedupeT	path_onlyFr{  HDo not set both path_only and class_only when calling PluginLoader.all()z*.pyr   r   z+'%s' skipped due to a defined plugin filterr`   baseansible.plugins.cachez!'%s' skipped due to reserved namez'%s' skipped as duplicaterC  r   )filtertestz{0}_{1}zSkipping plugin (z), cannot load: Nz) as it seems to be invalid: r|  r~  z ) as it seems to be incomplete: rv   REQUIRES_ENABLED)0r  r   r   r   r   r   r5   r6   r:   r^   updater   r  rE   rP  r+   Jinja2Loaderr9  r   r<   r   rR  r   rG   rv   r   r   r   abshashrl  rH   r=   r   r   rS   r   r  r   r   r  r  r   r  ru  r   r  rw  )r_   rx  ry  deduper  r{  all_matchesr  legacy_excluding_builtinr   matchesloaded_modulesr6   r-   rE   is_j2ref_namefqcnr  r&  r   rW  r.   r  needs_enableds                            r/   rI   zPluginLoader.all  sD    D It,JJ{E2	ZZe4
ijj#&5 !%!=!=!? 	Fii	"'',,7H7M7Mv*V WXG$--(//8vg2773C3CDE	F  c	D77##D)!,Dww''-Ht\2E#X)FFKhVW:%(f*<QhAhADHI(n49HDEx(
//)(4"&"="="C!H!H!NNNTabcTdTmTm#A&&4---99 22 !* 0 0T$Z( KI (I!55iFF
 ,2""4(!&++D1""8VT:fdoo6
  $DLLDOO;LM#*64??#CL "#|4%%dooxAUAUW[lz  HR%  Srt.v.C XtdC**6 %3 23$'$8$8M$))$/2IGc	h ! OOtU\]^U_$`a " X\^efg^h ij &  ! rOO_celmneo$pqqrs   J	RO4RP).RQ.;R*Q2AR	P$O>8R>PR	P>$P93R9P>>R	Q
RQR	R	$R>RR		RNN)T)Fr(   r   FFN)FFN)"rV   ra   rb   __doc__r`   r   r   r   r   r   r   r   r   r   r   r   r   r   r;   r	  r,  r3  r.  re   r5  r:  r^  __contains__rl  ru  rG   rw  r  rI   rc   rA   r/   r,   r,      s    "%H R R:)"B&
$$A#3jTc.N>kkZ#< 35+0$\m\oGmRigV	G L>/&CWArXrA   r,   c                  f     e Zd ZdZd
 fd	Z fdZddZed        Zd Z	 fdZ
d Z fd	Z xZS )r  a
  
    PluginLoader optimized for Jinja2 plugins

    The filter and test plugins are Jinja2 plugins encapsulated inside of our plugin format.
    We need to do a few things differently in the base class because of file == plugin
    assumptions and dedupe logic.
    c                T    t         t        |   ||||||       || _        i | _        y )Nr   r   )superr  r`   _plugin_wrapper_type_cached_non_collection_wrappers)	r_   r   r   r   r9   plugin_wrapper_typer   r   	__class__s	           r/   r`   zJinja2Loader.__init__h  s8    lD*:wX_  vI*  	J$7!/1,rA   c                8    t         t        |           i | _        y r(   )r  r  r   r  )r_   r  s    r/   r   zJinja2Loader._clear_cachesm  s    lD/1/1,rA   c                    t        d      )Nz,find_plugin is not supported on Jinja2Loader)NotImplementedError)r_   r-   r/  r"  r0  r1  s         r/   r3  zJinja2Loader.find_pluginq  s    !"PQQrA   c                2    t        | j                        dz   S )Ns)r   r   ry   s    r/   method_map_namezJinja2Loader.method_map_namet  s    0366rA   c                B   g }dj                  d|d| j                  |g      }	 || j                  vr| j                  ||      | j                  |<   | j                  |   }t	        || j
                        } |       }	|	t        d|d|      	 t	        |	| j                        }
 |
       j                         }|D ]g  \  }}dj                  ||f      }dj                  ||f      }| j                  |      }||v rB| j                  ||||       |j!                  |       i |S # t        $ r"}t        d|d|dt        |            d }~ww xY w# t        $ r=}t        j                  d| j                  d	t        |      d
|       |cY d }~S d }~ww xY w)Nr}   ansible_collectionspluginszFailed to load z for r  zCould not find z	Ignoring  plugins in '' as it seems to be invalid: r  )r:   r   r   rl  rS   r   rH   rL  r   r  r*   r<   r=   r   r  ru  r   )r_   r  r?   r-   r  r&  r   r.   rW  plugin_impl
method_map
plugin_map	func_namefuncr!  fullplugins                    r/   get_contained_pluginsz"Jinja2Loader.get_contained_pluginsx  s   HH3ZDIIW[\]		e$"4"44262J2J9Va2b"";/''4F&$//2C eZFGG	 d.B.BCJ#++-J
  * 	#OIthh
I67G88Y	23D..t4F kGLNN6"	# /  	e[*V_`aVbcdd	e  	OO[_[d[dfmnyfz|}~N	s6   AD* +E *	E3EE	F!2FFFc                   |j                  dd       |j                  dd        t               }|j                  d      } | j                  |i | | j                  j                  |      x}r`d|_        ||_        |j                  |_	        |j                  j                  d      rdnd|_        |j                  |_        t        ||      S d }t        |      \  }}t!               }		 ||	v rt#        d	|z  d
      |	j%                  |       t'        j(                  || j*                        }
|
st-        dj/                  |            	 t1        |
j2                        }|j                  di       j                  | j*                  i       j                  |i       }|j                  d      }|r|j                  d      xs d}|j                  d      }|j                  d      }| j*                  j9                          d| d|rdnd | }t:        j=                  ||||
j2                         |j                  d      }|r|j                  d      xs d}|j                  d      }|j                  d      }| j*                  j9                          d| d|rdnd | }t:        j?                  ||||
j2                  d      }tA        |      |j                  dd       }|rt'        jB                  |      s6t#        d|
j2                   d|
j2                   d|
jD                   d| d	      t        ||
j2                        \  }}t:        jG                  d j/                  | j*                  |
j2                  |
jD                  |             |}nn	 tI        |
jJ                        }|
j2                  }|
jN                  rd!j/                  ||
jN                        }	 tQ        jR                  |jT                  |dz   "      D ]  \  }}}|r	 tW        tX        |   |g|i |}t]        |j^                  | j`                        } |       jc                         }|D ]  \  }}dji                  ||f      } d&|
j2                   d'| j*                   d|
jN                   d| }!||| fv sL| jk                  |      }|s`|jl                  }| jo                  ||!|j^                  j                  | (       |j                  |_           	 t        ||      S # t4        $ r)}t-        dj/                  |t7        |                  d }~ww xY w# tL        $ r}t-        t7        |            d }~ww xY w# td        $ r3}t:        jg                  d#| j*                   d$| d%|        Y d }~d }~ww xY w# t@        $ r}"t#        t7        |"      d
|")      d }"~"wt"        t,        f$ r  td        $ ru}#t:        jg                  d*j/                  t7        |#                   t:        jG                  d+j/                  tq                            t#        t7        |#      d
|#)      d }#~#ww xY w),Nr{  Fr1  r|   TrC  rB  r   z*recursive collection redirect found for %rr   zinvalid plugin name: {0}zInvalid plugin FQCN ({0}): {1}r   r   r   rs   rt   z "z" has been deprecated.r   )r   r   r   r  z" has been removed.)r   r   r   r  r   r  r  r}   r  r  )r  z&redirecting (type: {0}) {1}.{2} to {3}r  )prefix	Skipping z plugins in z$'; an error occurred while loading: r`  z	.plugins.r  )orig_excz>An unexpected error occurred during Jinja2 plugin loading: {0}z2Unexpected error during Jinja2 plugin loading: {0})9r  re   r;  _ensure_non_collection_wrappersr  rG   rv   rp   rn  ro   rr  r   rq   rw   r$   get_fqcr_and_namer   r   rR  r   try_parse_fqcrr   rL  r   r   r  r8  r   titler<   rr   r  r   r~   r  vvvr   r  r   r   pkgutiliter_modules__path__r  r  rw  rS   r%   r  r*   rH   r=   r:   r  r&   ru  r   )%r_   r-   rx  ry  contextknown_pluginr  r   leaf_keyseenr  tsrW  routing_entrydeprecation_entryr   rs   rt   tombstone_entryexc_msgr   next_keyr'  parent_prefixdummymodule_nameispkgr  r  r  r  r  r!  src_nameaprer@  r  s%                                       r/   rw  zJinja2Loader.get_with_context  sE   

<'

$d+#%   !23,,,d=f=  ??CCDII<I#G+/G(+7+F+FG(FRF_F_FjFjk}F~1B  EGG.%1%>%>G"*<AA)$/Xu d{"#ORV#VXYZZHHSM&55c499EC9@@EFF[-cnn= FF#3R8<<TYYKOOPXZ\]M !. 1 1- @ 044^DJ044^D"3"7"78I"J"&))//"3!4Bse;QYeRUkmQno{n|}""<|mpm{m{"| ,//<O.22>BHb.22>B"1"5"56G"H"&))//"3!4Bse;NVbshjNklxkyz!99,P_frJM..bf : h 088 %((T:H+99(C&%cnn%55TUXUcUcTddefifrfressuv~u @O O 
 &7xCNN%["(DKKDIIWZWeWegjgsgsu}~s v	) 9 9:C ;;%,,]CKKHM%	>-4-A-A#,,WdgjWj-k "){E #(d"L["j[_"jci"jK!(););T=Q=Q!RJ!+!3!3!5J
 (2 "OIt!hhy'ABG!5cnn5EYtyykYZ[^[f[fZgghirhstH y'22!%!:!:4!@!&1&E&EG //+BTBTBcBcnu/v5;5H5HG2!""L 'vw77  [?FFsIVWLYZZ[b  	)9Q<((	)$ ! OOi		{,{mSwxywz${|& ) 	ByDAAh' 	 	>OO\ccdmnpdqrsKKLSST^T`aby}a"==	>s   T U "/V3 AU4AV3 ,V3  AV3 	U#$UU	U1U,,U14	V0=(V+%V3 +V00V3 3	Y#<WY#.A0YY#c              /  l  K   |j                  dd        |j                  dd      }|j                  dd      }|r|rt        d       | j                  |i | |r*d | j                  j	                         D        E d {    y d | j                  j	                         D        E d {    y 7 /7 w)Nr  r  Fr{  r  c              3  4   K   | ]  }|j                     y wr(   )rn  rE  ws     r/   rF  z#Jinja2Loader.all.<locals>.<genexpr>0  s     `Q((`s   c              3      K   | ]  }|  y wr(   rc   r  s     r/   rF  z#Jinja2Loader.all.<locals>.<genexpr>2  s     QaQs   )r  r   r  r  values)r_   rx  ry  r  r{  s        r/   rI   zJinja2Loader.all%  s     

9d#JJ{E2	ZZe4
 ijj,,,d=f=`$2V2V2]2]2_```Q4#G#G#N#N#PQQQ aQs$   A>B4 B0)B4*B2+B42B4c                ~   | j                   ry t        t        |   |i |D ]  }|j                  j                  d      }t        || j                        }	  |       }|j                         D ]v  }d|v r&t        j                  | d|j                   d       .|t         | j"                     v rt        j                  d|z         \| j%                  ||         }	|}
|j                  j'                  d      d	k\  r-dj)                  |j                  j+                  d      d d	       nd
}|j                  |      s| d| }
| j-                  |	||j                  |
       ||
h}|r|j/                  d|        |D ]b  }| j                   j1                  |      x}r4t        j                  d| d|j                   d|j                   d       T|	| j                   |<   d y  y # t        $ rF}t        j                  d| j                  dt        |j                        d|       Y d }~d }~ww xY w)NrC  r  r  r  r}   z skipped in z.; Jinja plugin short names may not contain "."z)%s skipped due to a defined plugin filter   r   r  zJinja plugin z from z" skipped; shadowed by plugin from r   )r  r  r  rI   rr  r   rS   r  rH   r<   vvvvr   r   rn  keysr   r9  r   r  countr:   r   ru  rR  rG   )r_   rx  ry  p_map
is_builtinplugins_listr  rW  plugin_namewrapperr  r  target_namestarget_nameexisting_pluginr  s                  r/   r  z,Jinja2Loader._ensure_non_collection_wrappers4  sn   // <2DCFC (	PE++667IJJ #5$*>*>?L&.
  '||~ P+%MM[Me>R>R=S  TB  #C  D/$,,"??MM"MP["[\ 33GK4HI"LQL^L^LdLdehLimnLnSXXe&8&8&>&>s&CBQ&GHtv
"--j9(\;-8D##G[%:N:NY]#^ +T2 $$'7}%EF#/ PK*.*N*N*R*RS^*___k]&I]I]H^ _AAPA_A_@``a'c d HOD88EP/P(	P  \`\e\egnot  pD  pD  hE  GH  I  Js   G--	H<6;H77H<r  r  )rV   ra   rb   r  r`   r   r3  r   r  r  rw  rI   r  __classcell__)r  s   @r/   r  r  `  sK    2
2R 7 7"LE8NR-P -PrA   r  c                Z    d| vr| }|dz   | z   }||fS | j                  d      d   }| }||fS )Nr}   r{   )r   )r  r  r-   fqcrs       r/   r  r  d  sN    
(C(*
 : ~~c"2&:rA   c            
        t         } d}t        j                  d}nt        j                  }d}t        j                  j                  |      rt        |d      5 }	 t        |j                               }	 d d d        	 d   }t        |      }|j                         }|dk(  r	 t!        |d	         | d
<   | d
   | d<   nKt        j                  dj                  |             n&|r$t        j                  dj                  |             d| d
   v r#t%        dj                  t'        |                  | S # t        $ rC}t        j                  dj                  |t        |                   | cY d }~cd d d        S d }~ww xY w# 1 sw Y   xY w# t        $ r) t        j                  dj                  |             | cY S w xY w# t"        $ r) t        j                  dj                  |             | cY S w xY w)NFz/etc/ansible/plugin_filters.ymlTrbz;The plugin filter file, {0} was not parsable. Skipping: {1}filter_versionz2The plugin filter file, {0} was invalid. Skipping.z1.0module_rejectlistansible.moduleszXUnable to parse the plugin filter file {0} as module_rejectlist is not a list. Skipping.ansible.plugins.actionz^The plugin filter file, {0} was a version not recognized by this version of Ansible. Skipping.z5The plugin filter file, {0} does not exist. Skipping.statzThe stat module was specified in the module reject list file, {0}, but Ansible will not function without the stat module.  Please remove stat from the reject list.)r9  r   PLUGIN_FILTERS_CFGr5   r6   r  openr   readrH   r<   r=   r   r   rL  strip	frozensetr  r   r   )filtersuser_set
filter_cfgr*  filter_datarW  r   s          r/   _load_plugin_filterr	  o  s   GH#6
))
	ww~~j!*d# 	q'1		!"23G '"--/ f-6{CV7W-X)* 188I0JG,-OO >>DfZ>PR OO **0&*<> *++ 44:F9Z;P4QS 	S NQ   !228&WQZ2PR	 		 	  	OO **0&*<>N	   !..4fZ.@B 	sZ   FD5>F $G 5	F>/E<-F.F<FFF/GG/G87G8c                   t         j                  t        dj                  | |                   t	        |       }	 t        |j                  dd      t              sat        j                  j                  d      }dj                  | t              }|dk(  rt         j                  |       y |dk(  rt        |      y y # t        $ r  t        $ r/}t         j                  dj                  | |             Y d }~y d }~ww xY w)	NzLoading collection {0} from {1}requires_ansibler   'COLLECTIONS_ON_ANSIBLE_VERSION_MISMATCHz3Collection {0} does not support Ansible version {1}r=   errorzQError parsing collection metadata requires_ansible value from collection {0}: {1})r<   r  r   r   r   (_does_collection_support_ansible_versionrG   ansible_versionr   r   get_config_valuer=   r   r   rH   )r   collection_pathr  mismatch_behaviormessager@  s         r/   _on_collection_load_handlerr    s    LL:AA/Sbcde.?OI78K8KL^`b8cetu ! 9 9:c dKRRSbdstG I-("g->wGG . v   Ikrr  tC  EG  H  	I  	IIs   A/B= +B= =C>%C99C>c                    | syt         st        j                  d       yt        |       }t        |      j                  }|j                  |      S )NTz_packaging Python module unavailable; unable to validate collection Ansible version requirements)r"   r<   r=   r#   base_versioncontains)requirement_stringr  ssbase_ansible_versions       r/   r  r    sI    yz	(	)B #?3@@;;+,,rA   c                   t         j                  rt        j                  d       y | g } t	        |       t
        j                  z   }t        |t
        j                        }|j                          t         xj                  t        z  c_
        y )Nz3AnsibleCollectionFinder has already been configured)r   collection_finderrb  warnr   r   COLLECTIONS_PATHSr   COLLECTIONS_SCAN_SYS_PATH_installon_collection_loadr  )prefix_collections_pathrX   finders      r/   _configure_collection_loaderr$    sm    00KL&"$()A,?,??E%eQ-H-HIF
OO ..2MM.rA   c                .    t                t        |        y)a  Initialize the plugin filters and the collection loaders

    This method must be called to configure and insert the collection python loaders
    into ``sys.meta_path`` and ``sys.path_hooks``.

    This method is only called in ``CLI.run`` after CLI args have been parsed, so that
    instantiation of the collection finder can utilize parsed CLI args, and to not cause
    side effects.
    N)r	  r$  )r"  s    r/   init_plugin_loaderr&    s      !89rA   ModuleDocFragmentzansible.plugins.doc_fragmentsdoc_fragmentsActionModuler  action_plugins
ActionBase)r   CacheModuler  cache_pluginsCallbackModulezansible.plugins.callbackcallback_plugins
Connectionzansible.plugins.connectionconnection_pluginsparamikoparamiko_sshConnectionBaser  ShellModulezansible.plugins.shellshell_pluginsr   r  libraryzansible.module_utilsmodule_utilsLookupModulezansible.plugins.lookuplookup_plugins
LookupBaseFilterModulezansible.plugins.filterfilter_plugins
TestModulezansible.plugins.testtest_pluginsStrategyModulezansible.plugins.strategystrategy_pluginsStrategyBaseTerminalModulezansible.plugins.terminalterminal_pluginsTerminalBase
VarsModulezansible.plugins.varsr   Cliconfzansible.plugins.cliconfcliconf_pluginsCliconfBaseNetconfzansible.plugins.netconfnetconf_pluginsNetconfBaseInventoryModulezansible.plugins.inventoryinventory_pluginsHttpApizansible.plugins.httpapihttpapi_pluginsHttpApiBaseBecomeModulezansible.plugins.becomebecome_pluginsr  )rB  r(   )|
__future__r   r   r5   os.pathr  rT   rb  collectionsr   r   rf  r   	tracebackr   "ansible.module_utils.compat.typingr8  compattypingtr  r	   r  r
   ansibler   r  r   r   ansible.errorsr   r   r   r   +ansible.module_utils.common.text.convertersr   r   r   ansible.module_utils.sixr   ansible.parsing.utils.yamlr   ansible.parsing.yaml.loaderr   ansible.pluginsr   r   r   r   ansible.utils.collection_loaderr   r   2ansible.utils.collection_loader._collection_finderr   r   ansible.utils.displayr   ansible.utils.plugin_docsr    ansible.utils.unsafe_proxyr!   packaging.specifiersr"   packaging.versionr#   r   importlib.utilr  r9  r<   r$   r0   r@   rP   rZ   r%   r\   re   r,   r  r  r	  r  r  r$  r&  DOC_FRAGMENT_PLUGIN_PATHr   DEFAULT_ACTION_PLUGIN_PATHaction_loaderDEFAULT_CACHE_PLUGIN_PATHcache_loaderDEFAULT_CALLBACK_PLUGIN_PATHcallback_loaderDEFAULT_CONNECTION_PLUGIN_PATHconnection_loaderrF   DEFAULT_MODULE_PATHmodule_loaderDEFAULT_MODULE_UTILS_PATHmodule_utils_loaderps_module_utils_loaderDEFAULT_LOOKUP_PLUGIN_PATHlookup_loaderDEFAULT_FILTER_PLUGIN_PATHfilter_loaderDEFAULT_TEST_PLUGIN_PATHtest_loaderDEFAULT_STRATEGY_PLUGIN_PATHstrategy_loaderDEFAULT_TERMINAL_PLUGIN_PATHterminal_loaderDEFAULT_VARS_PLUGIN_PATHvars_loaderDEFAULT_CLICONF_PLUGIN_PATHcliconf_loaderDEFAULT_NETCONF_PLUGIN_PATHnetconf_loaderDEFAULT_INVENTORY_PLUGIN_PATHinventory_loaderDEFAULT_HTTPAPI_PLUGIN_PATHhttpapi_loaderBECOME_PLUGIN_PATHbecome_loaderrc   rA   r/   <module>r     s   #  	   
  / #   . . ' # 2 " L  L T T 1 0 5 Y Y Y q ) 3 11)
 i(
)$%>K`@ab _
rB5! !O OdT TnAP< APH5rI&- N":" #	   $ 	 ""	 ! $$((  	 	 #	  &	    $     ""& ""& 	 !!% !!%  ##	  !!% 	g2  LGs   .K 	K"!K"