
    Vhs                      d dl mZ 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Zd dlZd dlZd dlZd dl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 d dlmZmZ d d	l m!Z!m"Z" d d
l#m$Z$m%Z% d dl&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/ d dl0m1Z1 d dl2m3Z3 d dl4m5Z5 d dl6m7Z7 d dl8m9Z9m:Z:m;Z;m<Z< d dl=m>Z? d dl@mAZA d dlBmCZCmDZD d dlEmFZFmGZGmHZH d dlImJZJ d dlKmLZL d dlMmNZN d dlOmPZP d dlQmRZR d dlSmTZT d dlUmVZV d dlWmXZX  eT       ZYeJj                  j                  j                  j                  Z]d Z^d)dZ_d Z`d*d Zad! Zbd" Zce G d# d$             Zd G d% d&e      Zed+d'Zfegd(k(  r ef        yy),    )annotations)CLIN)	dataclass)	YAMLError)context)option_helpers)AnsibleErrorAnsibleOptionsError)Galaxy get_collections_galaxy_meta_info)	GalaxyAPIGalaxyError)	build_collectiondownload_collectionsfind_existing_collectionsinstall_collectionspublish_collectionvalidate_collection_namevalidate_collection_pathverify_collectionsSIGNATURE_COUNT_RE)ConcreteArtifactsManager)GPG_ERROR_MAP)Requirement)
GalaxyRole)BasicAuthTokenGalaxyTokenKeycloakTokenNoTokenSentinel)__version__)is_iterable)	yaml_dump	yaml_load)to_bytes	to_nativeto_text)six)
DataLoader)RoleRequirement)Templar)AnsibleCollectionConfig)Display)get_versioned_doclink)load_extra_varsc                B     t        j                          fd       }|S )zInject an artifacts manager if not passed explicitly.

    This decorator constructs a ConcreteArtifactsManager and maintains
    the related temporary directory auto-cleanup around the target
    method invocation.
    c                    d|v r | i |S dt         j                  j                  dd      i}t         j                  j                  dd       }|d|j                  t        j                  |      t         j                  j                  dd       t         j                  j                  dd       d       t        j                  t        j                  fi |5 }||d<    | i |cd d d        S # 1 sw Y   y xY w)	Nartifacts_managervalidate_certsresolved_validate_certsTkeyringrequired_valid_signature_countignore_gpg_errors)r4   required_signature_countignore_signature_errors)
r   CLIARGSgetupdate	GalaxyCLI_resolve_pathr   under_tmpdirCDEFAULT_LOCAL_TMP)argskwargsartifacts_manager_kwargsr4   concrete_artifact_cmwrapped_methods        B/home/dcms/DCMS/lib/python3.12/site-packages/ansible/cli/galaxy.pymethod_wrapperz9with_collection_artifacts_manager.<locals>.method_wrapperL   s    &(!42622 %5goo6I6IJcei6j#k //%%i6$++$227;,3OO,?,?@`bf,g+2??+>+>?RTX+Y-  &22##
*
 	3 "*>F&'!4262	3 	3 	3s   C11C:)	functoolswraps)rE   rG   s   ` rF   !with_collection_artifacts_managerrJ   E   s(     __^$3 %3,     c                    t         j                  dj                  | ||dt        t        |      |g      z  dt        t        |      |g      z  ||             y )Nz)
# {0}
{1:{cwidth}} {2:{vwidth}}
{3} {4}
-)cwidthvwidth)displayformatmaxlen)pathh1h2w1w2s        rF   _display_headerrY   f   s[    OOCJJ

c3r7B-  c3r7B-   K  rK   c                    | j                   }d }|r|j                  dd       }|sd}t        j                  d| j                  d|       y )Nversionz(unknown version)- , )install_infor:   rP   name)grr^   r[   s      rF   _display_rolera   r   sB    ??LG""9d3%OO"''734rK   c                    t         j                  dj                  t        | j                        | j                  t        ||      t        ||                   y )Nz"{fqcn:{cwidth}} {version:{vwidth}})fqcnr[   rN   rO   )rP   rQ   r&   rc   verrR   )
collectionrN   rO   
min_cwidth
min_vwidths        rF   _display_collectionrh   |   sI    OO8??Z__%6:&6:&	 @  rK   c                >   t        |       s| f} | D ch c]  }t        |j                         }}| D ch c]  }t        |j                         }}t	        t        |xs dgt                    }t	        t        |xs dgt                    }||fS c c}w c c}w )N key)r!   r&   rc   rd   rS   rR   )collectionscfqcn_setversion_setfqcn_lengthversion_lengths         rF   _get_collection_widthsrs      s    {#"o)45A5H5+67a7155>7K7c(*rd45K[0RDc:;N&& 67s
   BBc                Z    t        j                  t        |       }|t        |  d      | S )Nz% is not a valid signature count value)rematchr   
ValueError)valuerv   s     rF   validate_signature_country      s0    HH'/E}E7"GHIILrK   c                  2    e Zd ZU ded<   ded<   ed        Zy)RoleDistributionServerzt.Union[GalaxyAPI, None]_apizlist[GalaxyAPI]api_serversc                    | j                   r| j                   S | j                  D ]  }	 d|j                  v r	|| _          n | j                   s| j                  d   | _         | j                   S # t        $ r Y Tw xY w)Nv1r   )r|   r}   available_api_versions	Exception)selfservers     rF   apizRoleDistributionServer.api   s    9999&& 	FF999 &DI :	 yy((+DIyy  s   A..	A:9A:N)__name__
__module____qualname____annotations__propertyr    rK   rF   r{   r{      s     
""   rK   r{   c                      e Zd ZdZdZdZ fdZ fdZd1dZd1dZ	d1dZ
d1d	Zd1d
Zd1dZd1dZd1dZd1dZd1dZd1dZd1dZd1dZ fdZ fdZed        Zd Zd2dZd Zed3d       Zed        Zed        Zed        Z 	 	 d4dZ!d Z"d Z#d  Z$e%d1d!       Z&d" Z'd# Z(e%d1d$       Z)e%d1d%       Z*d& Z+d' Z,d( Z-d) Z.d* Z/e%d1d+       Z0d, Z1d- Z2d. Z3d/ Z4d0 Z5 xZ6S )5r<   zCommand to manage Ansible roles and collections.

       None of the CLI tools are designed to run concurrently with themselves.
       Use an external scheduler and/or locking to ensure there are no clashing operations.
    zansible-galaxy)r_   descriptionreadme_htmlrelatedsummary_fieldsaverage_aw_compositeaverage_aw_scoreurlc                   || _         d| _        t        |      dkD  r|d   dvr!d|vrd|vr|j                  dd       d| _        |dd ddgk(  rPt        j                  d	j                  t        t        j                                     t        j                  d       g | _        d | _        d | _        t        t         | G  |       y )
NF   )z-hz--helpz	--versionrolere   T   logina$  The login command was removed in late 2020. An API key is now required to publish roles or collections to Galaxy. The key can be found at https://galaxy.ansible.com/me/preferences, and passed to the ansible-galaxy CLI via a file at {0} or (insecurely) via the `--token` command-line argument.)	_raw_args_implicit_rolerS   insertrP   errorrQ   r&   r?   GALAXY_TOKEN_PATHsysexitr}   galaxylazy_role_apisuperr<   __init__)r   rA   	__class__s     rF   r   zGalaxyCLI.__init__   s    #t9q=Aw;;d@RWckoWoAv&&*#AayVW--- .4VGA<O<O4P-Q	S
 !i'-rK   c           
     T	   t         t        |   d       t        j                  d      }|j                  dddd	       |j                  d
t        ddgt        j                         |j                  dddd	       |j                  dddddd       |j                  ddt        d       t        j                  |       t        j                  d      }|j                  dddddd !       t        j                  d      }|j                  d"d#$       |j                  d%d&$       t        j                  d      }|j                  d'd(ddd)*       t        j                  j                  d+      j                  d,d-      }t        j                  d      }|j                  d.d/d0t        j                  d12      t        j                  t        j                   d3|z  4       t        j                  d      }|j                  d.d5d6t        j                  d12      t        j                   d7j#                  t$        j&                  j(                        8       t        j                  d      }|j                  d9d:ddd;!       |j                  d<d=ddd>!       | j*                  j-                  d?d@A      }	d1|	_        |	j1                  dBdC$      }
|
j3                  | j4                  D       |
j-                  dEdFA      }d1|_        | j7                  |||gG       | j9                  |||gG       | j;                  |||gG       | j=                  ||gG       | j?                  ||||gG       | jA                  |||gG       | jC                  |||gG       |	j1                  dHdI$      }|j3                  | jD                  D       |j-                  dJdFA      }d1|_        | j9                  ||||gG       | jG                  |||gG       | jI                  |||gG       | jA                  |||gG       | jK                  ||gG       | jM                  |||gG       | jO                  |||gG       | jQ                  ||||gG       | j?                  ||||gG       y)Kz* create an options parser for bin/ansible z7Perform various Role and Collection related operations.)descF)add_helpz-sz--server
api_serverzThe Galaxy API server URLdesthelpz--api-version   r   )typechoicesr   z--tokenz	--api-keyapi_keyz[The Ansible Galaxy API key which can be found at https://galaxy.ansible.com/me/preferences.z-cz--ignore-certs
store_trueignore_certsz)Ignore SSL certificate validation errors.N)actionr   r   defaultz	--timeouttimeoutzKThe time to wait for operations against the galaxy server, defaults to 60s.)r   r   r   z-fz--forceforcez0Force overwriting an existing role or collectionr   r   r   r   github_userGitHub usernamer   github_repoGitHub repository	--offlineofflinez.Don't query the galaxy API when creating roles)r   r   r   r   DEFAULT_ROLES_PATHr   rj   -p--roles-path
roles_pathT)pathsepz}The path to the directory containing your roles. The default is the first writable one configured via DEFAULT_ROLES_PATH: %s )r   r   r   r   r   --collections-pathcollections_pathzOne or more directories to search for collections in addition to the default COLLECTIONS_PATHS. Separate multiple paths with '{0}'.)r   r   r   r   z--clear-response-cacheclear_response_cachez)Clear the existing server response cache.z
--no-cacheno_cachez%Do not use the server response cache.TYPEr   )metavarr   re   z$Manage an Ansible Galaxy collection.funcCOLLECTION_ACTIONr   )parentsr   zManage an Ansible Galaxy role.ROLE_ACTION))r   r<   init_parseropt_helpArgumentParseradd_argumentintargparseSUPPRESSadd_verbosity_optionsr?   configget_configuration_definitionr:   unfrack_pathr   PrependListActionrQ   osrT   r   parseradd_subparsersrequired
add_parserset_defaultsexecute_collectionadd_download_optionsadd_init_optionsadd_build_optionsadd_publish_optionsadd_install_optionsadd_list_optionsadd_verify_optionsexecute_roleadd_remove_optionsadd_delete_optionsadd_search_optionsadd_import_optionsadd_setup_optionsadd_info_options)r   commonr   githubr   default_roles_pathr   r   cache_optionstype_parserre   collection_parserr   role_parserr   s                 rF   r   zGalaxyCLI.init_parser   s    	i*J 	+ 	

 ((%8D*<FabO#1vHL]L]^I{"N 	 	O 	D"2<n  dO  Y]  	^
 	Kic!n 	 	p 	&&v.''74W\ R 	 	T ((%8M0ABM0CD))59[y%P\"R 	 	T XXBBCWX\\]fhjk,,e<
n<hNcNclpNq()(<(<XE_E_&[]o&p 	  	q
 $22EB%%d,@GY`h`u`u  C  aD-5-G-G,44:F277??4K	 	& 	M !//?""#;BXam+07b 	# 	d""<j_d(O 	# 	Q kk00f0M# !++L?e+f
T%<%<=&55>QX`5a%)"!!"3fm=T!U/&%I065/J  !2VH E  !2VUM<Z [/&BR9ST 1FDT;UV %%f3S%Tt001))-h)O#kFE73KLfj5IJff5EFkFJ3GHfX>ff5EF{VZ4HIkFJ3PQ  vuj6Q RrK   c                <   |j                  d|d      }|j                  | j                         |j                  dddd	       |j                  d
ddddd       |j                  ddddd       |j                  dddd       |j                  dddd       y ) NdownloadPDownload collections and their dependencies as a tarball for an offline install.r   r   r   rA   zCollection(s)re   *r   r   nargs-n	--no-depsno_depsr   Fz4Don't download collection(s) listed as dependencies.r   r   z--download-pathdownload_pathz./collectionsz-The directory to download the collections to.r   r   r   -r--requirements-filerequirementsz9A file containing a list of collections to be downloaded.r   --preallow_pre_releaseUInclude pre-release versions. Semantic versioning pre-releases are ignored by defaultr   r   r   )r   r   execute_downloadr   )r   r   r   download_parsers       rF   r   zGalaxyCLI.add_download_options/  s     ++J2D , E 	$$$*?*?$@$$V/<_b$c$$T;Y|ej*` 	% 	b 	$$T+<?-<*Y 	% 	[ 	$$T+@~*e 	% 	g$$W3F| +B 	% 	CrK   c                   |j                   dk(  rdnd}|j                  d|dj                  |            }|j                  | j                         |j                  dd	d
dj                  |             |j                  dj                  |      dj                  |      |dk(  rt        j                  nt        j                  dj                  |             i }|dk(  r	t        |d<    |j
                  dj                  |      fddj                  |j                               i| |dk(  r|j                  ddddd       t        j                  |       y )Nr   re   r   initz4Initialize new {0} with the base structure of a {0}.r   r   z--init-path	init_path./zaThe path in which the skeleton {0} will be created. The default is the current working directory.r   z--{0}-skeleton{0}_skeletonzAThe path to a {0} skeleton that the new {0} should be based upon.r   {0}_namer   z{0} namez--type	role_typestorer   z_Initialize using an alternate role type. Valid types include: 'container', 'apb' and 'network'.r   )r   r   rQ   r   execute_initr   r?   GALAXY_COLLECTION_SKELETONGALAXY_ROLE_SKELETONr   
capitalizer   add_runtask_options)r   r   r   galaxy_typer   obj_name_kwargss         rF   r   zGalaxyCLI.add_init_optionsB  s|   &,nn8K&KlQW''.44:F;4G ( I 	  d&7&7 8  [$'CCI6+CV 	! 	X 	  !1!8!8!ENLaLabmLnITXdId)E)Ejk  kA  kA'..4f[.A 	! 	C
 ,&&>OF#   !2!2;!? 	4jFWFWXcXnXnXpFq 	4#2	4 & $$XKYb+A % B 	$$[1rK   c                    |j                  d|d      }|j                  | j                         |j                  dddd	       y )
NremovezDelete roles from roles_path.r   r   rA   zRole(s)r   +r   )r   r   execute_remover   )r   r   r   remove_parsers       rF   r   zGalaxyCLI.add_remove_options^  sI    ))(GJi)j""(;(;"<""6	6QT"UrK   c                d    |j                  d|d      }|j                  | j                         y )NdeletezWRemoves the role from Galaxy. It does not remove or alter the actual GitHub repository.r   r   )r   r   execute_delete)r   r   r   delete_parsers       rF   r   zGalaxyCLI.add_delete_optionsd  s;    ))(G0D * E 	""(;(;"<rK   c                &   d}|j                   dk(  rd}|j                  d|dj                  |            }|j                  | j                         |j                  ||j                         d|	       |dk(  r|j                  d
dddd       y y )Nr   r   re   listzAShow the name and version of each {0} installed in the {0}s_path.r   r   ?)r   r   r   z--formatoutput_format)humanyamljsonr&  z-Format to display the list of collections in.)r   r   r   r   )r   r   rQ   r   execute_listr   r  )r   r   r   r  list_parsers        rF   r   zGalaxyCLI.add_list_optionsj  s    >>00&K''-p-w-w  yD  .E ( F 	  d&7&7 8  ;3I3I3KSV`k l,&$$ZoOhry*Y % [ 'rK   c                   |j                  d|d      }|j                  | j                         |j                  ddd       |j                  d	d
d       |j                  ddd       |j                  dddd       y )NsearchzLSearch the Galaxy database by tags, platforms, author and multiple keywords.r   r   z--platforms	platformsz!list of OS platforms to filter byr   z--galaxy-tagsgalaxy_tagsz list of galaxy tags to filter byz--authorauthorr   rA   zSearch terms
searchtermr   r   )r   r   execute_searchr   )r   r   r   search_parsers       rF   r   zGalaxyCLI.add_search_optionsz  s    ))(G0; * < 	""(;(;"<""={Il"m""?Mo"p"":HCT"U""6\_"`rK   c                   |j                  d|d      }|j                  | j                         |j                  ddddd	
       |j                  ddd       |j                  ddd       |j                  ddddd
       y )Nimportz"Import a role into a galaxy serverr   r   	--no-waitwaitstore_falseTzDon't wait for import results.r   z--branch	referencez\The name of a branch to import. Defaults to the repository's default branch (usually master)r   z--role-name	role_namez>The name the role should have, if different than the repo namez--statuscheck_statusr   FzUCheck the status of the most recent import request for given github_user/github_repo.)r   r   execute_importr   )r   r   r   import_parsers       rF   r   zGalaxyCLI.add_import_options  s    ))(GJn)o""(;(;"<"";VM[_(H 	# 	J"":K); 	# 	< 	""={(h 	# 	j"":N<af)< 	# 	=rK   c                R   |j                  d|d      }|j                  | j                         |j                  ddd d       |j                  d	d
ddd       |j                  dd       |j                  dd       |j                  dd       |j                  dd       y )Nsetupz;Manage the integration between Galaxy and the given source.r   r   z--remove	remove_idzSRemove the integration matching the provided ID value. Use --list to see ID values.r   z--list
setup_listr   FzList all of your integrations.r   sourceSourcer   r   r   r   r   secretSecret)r   r   execute_setupr   )r   r   r   setup_parsers       rF   r   zGalaxyCLI.add_setup_options  s    (('.k ) m!!t'9'9!:!!*;(4 	" 	5 	!!(l\a'G 	" 	I!!(!:!!-6G!H!!-6I!J!!(!:rK   c                    |j                  d|d      }|j                  | j                         |j                  dddd	       y )
Ninfoz(View more details about a specific role.r   r   rA   r  r   zrole_name[,version])r   r   r   )r   r   execute_infor   )r   r   r   info_parsers       rF   r   zGalaxyCLI.add_info_options  sI    ''Fp'q  d&7&7 8  sI^ _rK   c                B   d}|j                  d|d      }|j                  | j                         |j                  ddj	                  |      dd	
       |j                  dddddd       |j                  ddddd       |j                  dddd       |j                  ddt
        j                  d       |j                  ddd d!"       d#}d$}|j                  d%d&t        |t
        j                  '       |j                  d(d)t        d t        j                  j                  t
        j                  t        t        j                                *       |j                  d+d)t        d,d-|t
        j                  t        t        j                                .       y )/Nre   verifywCompare checksums with the collection(s) found on the server and the installed copy. This does not verify dependencies.r   r   rA   r  r   zVThe installed collection(s) name. This is mutually exclusive with --requirements-file.)r   r   r   -i--ignore-errorsignore_errorsr   FzRIgnore errors during verification and continue with the next specified collection.r   r   r   z\Validate collection integrity locally without contacting server for canonical manifest hash.r  r  r  z7A file containing a list of collections to be verified.r   	--keyringr4   .The keyring used during signature verificationr   --signature
signaturesappenda  An additional signature source to verify the authenticity of the MANIFEST.json before using it to verify the rest of the contents of a collection from a Galaxy server. Use in conjunction with a positional collection name (mutually exclusive with --requirements-file).r  a  The number of signatures that must successfully verify the collection. This should be a positive integer or all to signify that all signatures must be used to verify the collection. Prepend the value with + to fail if no valid signatures are found for the collection (e.g. +all).4  A space separated list of status codes to ignore during signature verification (for example, NO_PUBKEY FAILURE). Descriptions for the choices can be seen at L(https://github.com/gpg/gnupg/blob/master/doc/DETAILS#general-status-codes).Note: specify these after positional arguments or use -- to separate them. --required-valid-signature-countr5   r   r   r   r   --ignore-signature-status-coder6   r   r   r   r   r   r   --ignore-signature-status-codesextendr  r   r   r   r   r   r   r   )r   r   execute_verifyr   rQ   r?   GALAXY_GPG_KEYRINGry   %GALAXY_REQUIRED_VALID_SIGNATURE_COUNTstrr   r   r   ,GALAXY_IGNORE_INVALID_SIGNATURE_STATUS_CODESr#  r   keys)r   r   r   r  verify_parservalid_signature_count_helpignore_gpg_status_helps          rF   r   zGalaxyCLI.add_verify_options  s   "))(G K{) |""(;(;"<""6:3D3D[3QY\ dZ" 	[""4):Yeot(| 	# 	~"";Y|]b)C 	# 	D 	""4)>^(a 	# 	c"";YH\H\(X 	# 	Z""=|H)G 	# 	H&I""n 	""#ELl  tL(BALsLs 	# 	u""#CJ]dgpx(0(9(9(B(BALzLz+/0B0B0D+E 	# 	G 	""#DK^ehqy  BE(>HvHv+/0B0B0D+E 	# 	GrK   c                	   |j                   dk(  rdnd}i }|dk(  rd|d<   d}nd|d<   d}| j                  rd	}d
}n&d| d}dj                  ||j                               }|j	                  d|dj                  |      ||      }|j                  | j                          |j                  dWdj                  |      dd| |j                  ddddd|       |j                         }	|	j                  ddddddj                  |             |	j                  dd ddd!j                  |             d"}
d#}|dk(  r|j                  d$d%d&| j                         d'(       |j                  d)d*d+d,-       |j                  d.d/dd01       |j                  d2d3d4ddd5       |j                  d6d7t        j                  d8(       |j                  d9d:dt        j                  d;       |j                  d<d=d>d?1       |j                  d@dAt        |
t        j                  B       |j                  dCdDt        d>t         j"                  j$                  t        j&                  t)        t+        j,                               E       |j                  dFdDt        dGdH|t        j&                  t)        t+        j,                               I       |j                  dJdKdddL       y | j                  r|j                  d)dMd+dN-       n|j                  d)dMd+dO-       t/        j0                  dP      }t3        | j4                  D cg c]  }|j7                  |      s| c}      }t/        j0                  dQ      }t3        | j4                  D cg c]  }|j7                  |      s| c}      }| j                  r|s|r|j                  d6d7t        j                  dR(       |j                  d9d:dt        j                  d;       |j                  d@dAt        |
t        j                  B       |j                  dCdDt        d>t         j"                  j$                  t        j&                  t)        t+        j,                               E       |j                  dFdDt        dGdH|t        j&                  t)        t+        j,                               I       |j                  dSdTdUdddV       y c c}w c c}w )XNr   re   r   zxThe collection(s) name or path/url to a tar.gz collection artifact. This is mutually exclusive with --requirements-file.r   zIgnore errors during installation and continue with the next specified collection. This will not ignore dependency conflict errors.z?Role name, URL or tar file. This is mutually exclusive with -r.z8Ignore errors and continue with the next specified role.a@  Install roles and collections from file(s), URL(s) or Ansible Galaxy to the first entry in the config COLLECTIONS_PATH for collections and first entry in the config ROLES_PATH for roles. The first entry in the config ROLES_PATH can be overridden by --roles-path or -p, but this will result in only roles being installed.zansible-galaxy installzansible-galaxy z installzInstall {0}(s) from file(s), URL(s) or Ansible Galaxy to the first entry in the config {1}S_PATH unless overridden by --{0}s-path.installz5Install {0}(s) from file(s), URL(s) or Ansible Galaxy)r   r   r   progr   r  r   )r   r   rN  rO  rP  r   Fr   r   r   r   z+Don't download {0}s listed as dependencies.z--force-with-depsforce_with_depsz7Force overwriting an existing {0} and its dependencies.a  The number of signatures that must successfully verify the collection. This should be a positive integer or -1 to signify that all signatures must be used to verify the collection. Prepend the value with + to fail if no valid signatures are found for the collection (e.g. +all).rV  r   r   r   z6The path to the directory containing your collections.r   r  r  r  z8A file containing a list of collections to be installed.r   r  r  r  r  z-Uz	--upgradeupgradezgUpgrade installed collection artifacts. This will also update dependencies unless --no-deps is providedrQ  r4   rR  z--disable-gpg-verifydisable_gpg_verifyzSDisable GPG signature verification when installing collections from a Galaxy serverrS  rT  rU  zAn additional signature source to verify the authenticity of the MANIFEST.json before installing the collection from a Galaxy server. Use in conjunction with a positional collection name (mutually exclusive with --requirements-file).rW  r5   rX  rY  r6   rZ  r[  r\  r  r]  r   r   zInstall collection artifacts (tarballs) without contacting any distribution servers. This does not apply to collections in remote Git repositories or URLs to remote tarballs.z--role-filezBA file containing a list of collections and roles to be installed.z2A file containing a list of roles to be installed.z^(?<!-)-[a-zA-Z]*r[a-zA-Z]*z--role-file($|=)z9The keyring used during collection signature verificationz-gz--keep-scm-metakeep_scm_metazBUse tar instead of the scm archive option when packaging the role.rA   )r   r   rQ   upperr   r   execute_installr   add_mutually_exclusive_group_get_default_collection_pathr?   r_  GALAXY_DISABLE_GPG_VERIFYry   r`  ra  r   r   r   rb  r#  r   rc  ru   compileboolr   rv   )r   r   r   r  args_kwargsignore_errors_helpdescription_textri  install_parserinstall_exclusivere  rf  r_rea
contains_rrole_file_recontains_role_files                    rF   r   zGalaxyCLI.add_install_options  s   &,nn8K&KlQW,&#QK"` #dK![M  ,D$[M:D44:F;HYHYH[4\ 
  **9g199?9L7G04	 + 7
 	##)=)=#>###mJ4E4Ek4RZ]malm##D*;/Zfpu); 	$ 	= +GGI&&t[yQ]gl,Y,`,`al,m 	' 	o&&':AR[gqv-<<BF;<O 	' 	Q&I""n ,&''.BI[040Q0Q0S-e ( g ''.C.-g ( i''6IR^ .E ( F''k	R^hm .W ( X'')QMaMa-] ( _''(>EYbn010K0K .C ( D ''LQY.n ( o ''(JQq  yQ-GQRQxQx ( z''(HObilu}-5->->-G-GQRQQ04]5G5G5I0J ( L ''(IPcjmv~  GJ-CQM{M{04]5G5G5I0J ( L '')Lbg.I ( *
 ""++D-n1u , w ++D-n1e , g ::<=D$..JQDJJqMqJKJ::&9:L!%$..&ZQLDVDVWXDYq&Z![""
6H++KiQRQeQe1l , n++,BI]fr454O4O 2G , H ++,NUu  }U1KUVU|U| , ~++,LSfmp  zB191B1B1K1KUV  VD  VD489K9K9M4N , P ++,MTgnq  {C  KN1GQRQQ489K9K9M4N , P ''.?o^j05-q ( s' K&Zs   S,S,S1%S1c                    |j                  d|d      }|j                  | j                         |j                  ddddd	
       |j                  dddd       y )NbuildzMBuild an Ansible collection artifact that can be published to Ansible Galaxy.r   r   rA   re   r   ).zPath to the collection(s) directory to build. This should be the directory that contains the galaxy.yml file. The default is the current working directory.)r   r   r   r   z--output-pathoutput_pathr  z[The path in which the collection is built to. The default is the current working directory.r   )r   r   execute_buildr   )r   r   r   build_parsers       rF   r   zGalaxyCLI.add_build_optionsC  sz    (('/8 ) 9 	!!t'9'9!:!!&,cSY(4 	" 	5 	!!/t(< 	" 	=rK   c                    |j                  d|d      }|j                  | j                         |j                  ddd       |j                  d	d
ddd       |j                  ddt        dd       y )Npublishz0Publish a collection artifact to Ansible Galaxy.r   r   rA   collection_pathz.The path to the collection tarball to publish.)r   r   r5  r6  r7  Tz)Don't wait for import validation results.r   z--import-timeoutimport_timeoutr   z=The time to wait for the collection import process to finish.)r   r   r   r   )r   r   execute_publishr   r   )r   r   r   publish_parsers       rF   r   zGalaxyCLI.add_publish_optionsQ  s    **9g0b + d##)=)=#>##F4E)Y 	$ 	[##Kf]\`)T 	$ 	V##$6=MTWab)h 	$ 	jrK   c                   t         t        |   |      }t        |d|j                  d n|j                          t        |d|j
                  |j
                  nt        j                          |j                  t        _        |S )Nr2   r3   )
r   r<   post_process_argssetattrr   r2   r?   GALAXY_IGNORE_CERTS	verbosityrP   )r   optionsr   s     rF   r  zGalaxyCLI.post_process_args]  s    	4:7C 	)G4H4H4PDZaZnZnVnp2wOeOeOqW5K5K{|  |Q  |Q  xQ  	S#--rK   c           
     t   t         t        |           t               | _        t
        j                  j                  t
        j                         i }dD ]+  }|t        j                  v st        j                  |   ||<   - g }t
        j                  xs g D cg c]  }|s|	 }}t        |d      D ]-  \  }}t
        j                  j                  d|      }|j                  d      }	|j                  d      }
|d   xs t        }|d	   }|j                  d
      }|d   t        j                  d   |d<   |d   }|r&t        j!                  d| d       d|z  d|z  i|d<   d |d<   |rt#        ||d         |d<   n&|r$|	rt%        ||	||
      |d<   nt'        |      |d<   |j)                  |       |j+                  t-        | j                  |fd|i|       0 t        j                  d   t        j                  d
   r5t        j                  d
   }t        j!                  d       d|z  d|z  i|d<   t'        t        j                  d         }t        j                  d   }t        j                  d   t        j                  d   nt
        j.                  }rvt1        fd|D        d       }|r| j2                  j+                  |       nJ| j2                  j+                  t-        | j                  df|t5        |      dz   ||d|       n|| _        t5        | j2                        dk(  rD| j2                  j+                  t-        | j                  dt
        j6                  f|d||d|       t9        d | j2                        | _        t        j                  d          S c c}w ) N)r   r   r   )startgalaxy_server)plugin_typer_   auth_url	client_idtokenusernameapi_versionr2   r3   zAThe specified "api_version" configuration for the galaxy server "zP" is not a public configuration, and may be removed at any time without warning.zv%sz/v%sr   password)access_tokenr  r2   r  )r  priorityr   z[The --api-version is not a public argument, and may be removed at any time without warning.r   r   c              3  B   K   | ]  }|j                   k(  s|  y wNr_   ).0s
cmd_servers     rF   	<genexpr>z GalaxyCLI.run.<locals>.<genexpr>  s     !Tqvv?S!!Ts   cmd_arg)r  r  r2   r   r   r   r   )r   r<   runr   r   r?   r   load_galaxy_server_defsGALAXY_SERVER_LISTr   r9   	enumerateget_plugin_optionspopr   rP   warningr   r   r   r;   rU  r   GALAXY_SERVER_TIMEOUTnextr}   rS   GALAXY_SERVERr{   r   )r   galaxy_optionsoptional_keyconfig_serversr  server_listserver_priority
server_keyserver_optionsr  r  	token_valr  r  r2   	cmd_tokendefault_server_timeoutconfig_serverr  r   s                     @rF   r  zGalaxyCLI.runh  s   i"$h 	
(()=)=>@ 	MLw./6|/L|,	M "#"6"6"<"BQqBB+4[+J 1	'OZ XX88_[e8fN &))*5H&**;7I&w/B?I%j1H(,,];K./73:??C\3]/0+,<=N WXbWc db b =BK<OQWZeQe;f78 '+N7#*8>R\C]*^w'2?YIQO]JS3Uw/ 3>I2Nw/!!.1!!)Z#(# !# [1	f __\2
??=)!//-8KOOm 9>8KVVaMa7bN34gooi&@A	 )BC?Fy?Y?e!;kl  lC  lC !!T^!TVZ[M  ''6  ''	KKJ)>G 014#12	)
 %)   .D t A%##IY%?H-.	%
 !%  4D$:J:JKv&(( Cs   N5#N5c                .    | j                   j                  S r  )r   r   r   s    rF   r   zGalaxyCLI.api  s    !!%%%rK   c                (    t         j                  d   S )Nr   )r?   COLLECTIONS_PATHSr  s    rF   rr  z&GalaxyCLI._get_default_collection_path  s    ""1%%rK   c           
     P    g g d}t        d      }t        j                  j                  |      st	        dt              z        t        j                  dz         t        |d      5 }	 t        |      }	 d	d	d	       t	        d
t              z         fd}
t        |t              r)|st	        d      |D ]  }|dxx    |
|      z  cc<    |S t        |t              rt        |j                               j!                  t        ddg            }|r&t	        dt        dj#                  |            z        |j%                  d      xs g D ]  }|dxx    |
|      z  cc<    |j%                  d      xs g D cg c](  }t'        j(                   j+                  |      ||      * c}|d<   |S t	        dt-        |      j.                         # t        $ r(}	t	        dt              dt        |	            d	}	~	ww xY w# 1 sw Y   xY wc c}w )a  
        Parses an Ansible requirement.yml file and returns all the roles and/or collections defined in it. There are 2
        requirements file format:

            # v1 (roles only)
            - src: The source of the role, required if include is not set. Can be Galaxy role name, URL to a SCM repo or tarball.
              name: Downloads the role to the specified name, defaults to Galaxy name from Galaxy or name of repo if src is a URL.
              scm: If src is a URL, specify the SCM. Only git or hd are supported and defaults ot git.
              version: The version of the role to download. Can also be tag, commit, or branch name and defaults to master.
              include: Path to additional requirements.yml files.

            # v2 (roles and collections)
            ---
            roles:
            # Same as v1 format just under the roles key

            collections:
            - namespace.collection
            - name: namespace.collection
              version: version identifier, multiple identifiers are separated by ','
              source: the URL or a predefined source name that relates to C.GALAXY_SERVER_LIST
              type: git|file|url|galaxy

        :param requirements_file: The path to the requirements file.
        :param allow_old_format: Will fail if a v1 requirements file is found and this is set to False.
        :param artifacts_manager: Artifacts manager.
        :return: a dict containing roles and collections to found in the requirements file.
        )rolesrm   surrogate_or_stricterrorsz*The requirements file '%s' does not exist.z Reading requirement file at '%s'rbz)Failed to parse the requirements yml at 'z' with the following error:
Nz"No requirements found in file '%s'c           
        d| vrkt        j                  |       }t        j                  dt	        |      z         d|vrd|vrt        d      t        j                  j                  fi |gS t        | d   d      }t        j                  j                  |      s$t        dt        |      d	t              d
      t        |d      5 }	 d t        |      D        D cg c]#  }t        j                  j                  fi |% c}cd d d        S c c}w # t         $ r(}t        dt              dt        |            d }~ww xY w# 1 sw Y   y xY w)Nincludezfound role %s in yaml filer_   srcz!Must specify name or src for roler  r  z*Failed to find include requirements file 'z' in ''r  c              3  F   K   | ]  }t        j                  |        y wr  )r)   role_yaml_parse)r  is     rF   r  zMGalaxyCLI._parse_requirements_file.<locals>.parse_role_req.<locals>.<genexpr>"  s      b!@!@!C bs   !z4Unable to load data from include requirements file:  )r)   r  rP   vvvr&   r	   r   r   r   r$   r   rT   isfiler%   openr#   r   )requirementr   b_include_path	f_includererequirements_filer   s         rF   parse_role_reqz:GalaxyCLI._parse_requirements_file.<locals>.parse_role_req  sX   +&66{C874=HI%%t*;&'JKK"4;;0B0BKdKLL!)+i*@I^!_ww~~n5&*3N*CYO`Ea(c d d .$/ [9[ bYW`Ma b dUV
4;;8J8J Pa P  d[ [ d$ [*.78I.JIVWL,Z [ [[	[ [s<   ED&(DDD	E(#EEEEzrExpecting requirements file to be a dict with the key 'collections' that contains a list of collections to installr  rm   z\Expecting only 'roles' and/or 'collections' as base keys in the requirements file. Found: %sr]   z?Expecting requirements yaml to be a list or dictionary but got )r$   r   rT   existsr	   r%   rP   r  r  r#   r   
isinstancer#  dictsetrc  
differencejoinr:   r   from_requirement_dict_init_coll_req_dictr   r   )r   r  allow_old_formatr1   validate_signature_optionsr  b_requirements_filereq_objfile_requirementserrr  role_req
extra_keyscollection_reqs   ``            rF   _parse_requirements_filez"GalaxyCLI._parse_requirements_file  sz   < 

 ''8AVWww~~12KiXiNjjkk69JJK%t, 	FF$-g$6!	F $CiPaFbbcc	[* '.#" $F G G . BW%)AA%B2 - )40.3356AA#wP]F^B_`J" $58A$))JBW8X$Z [ [ .11':@b BW%)AA%B '8&;&;M&J&Pb+ # 11,,^<%.+L'  !`aefwax  bB  bB  aC   D  E  Eu  F" !23Ys^EF FF	F 	Ff+s0   /H1G"-H#"	H+#HHHH c           
     Z   t        t              sdiS dvs&j                  d      rj                  dd      dk7  rS t        t	        fd| j
                  D              t        | j                  dj                  d         d   t        j                  d   	            d<   S )
Nr_   rA  r   r   c              3  \   K   | ]#  }d    |j                   |j                  hv r| % yw)rA  N)r_   r   )r  srvrcoll_reqs     rF   r  z0GalaxyCLI._init_coll_req_dict.<locals>.<genexpr>X  s3      H%$))T__)EE s   ),zexplicit_requirement_{name!s}r  r3   )r2   )r  r  r:   r  iterr}   r   r   rQ   r   r9   )r   r  s    `rF   r  zGalaxyCLI._init_coll_req_dictH  s    (D)H%% h&LL*VX.(:O
 " !%!1!1  /66!&) 7  "&/HI
 rK   c                @    t         j                  d   st        d      y)zn
        Exits with the specified return code unless the
        option --ignore-errors was specified
        rP  zR- you can use --ignore-errors to skip failed roles and finish processing the list.N)r   r9   r	   )rcs    rF   exit_without_ignorezGalaxyCLI.exit_without_ignoreh  s!     /stt 0rK   c           	        ddt        | d         z  g}| j                  di       }| j                  d|j                  dd            }|j                  d|z         t        | j	                               D ]  }|t
        j                  v rt        | |   t              rf|j                  d|z         t        | |   j	                               D ]2  }|t
        j                  v r|j                  d|d	| |   |          4 |j                  d
|d	| |           |j                  d       dj                  |      S )Nrj   zRole: %sr_   galaxy_infor   z	description: %sz	%s:z		: 	
)
r&   r:   rU  sortedrc  r<   SKIP_INFO_KEYSr  r  r  )	role_infotextr  r   krl   s         rF   _display_role_infozGalaxyCLI._display_role_infoq  s)    [79V+<#==>  mmM26mmM;??=RT3UV(;67	() 	=AI,,,)A,-HN+!)A,"3"3"56 JCi666 KKil36G HIJ
 1il;<	= 	Czz$rK   c                    t         j                  j                  t         j                  j                  t         j                  j	                  |                   S r  )r   rT   abspath
expanduser
expandvarsrT   s    rF   r=   zGalaxyCLI._resolve_path  s3    wwrww11"''2D2DT2JKLLrK   c                   t        t        | d      d      5 }t        |j                         d      }d d d        t	               }g }g }|D ]n  }|j                  dd      r|n|}|j                  |d   d       }	|	s)|j                  dd      }
|
dk(  rd	}	n|
d
k(  rg }	n|
dk(  ri }	|	|d<   |j                  |       p t        j                  d      t        j                  d      fd}t               }t        |||d      }||j                  j                  d<   |j                        }|S # 1 sw Y   xY w)Nr  r  r  r   Frl   r   ra  rj   r#  r  rx   zL\(([^)]+),\s+([^)]+)\)zC\(([^)]+)\)c                   t        | t              r.dj                  | D cg c]  }|j                  d       c}      } j	                  d|       } j	                  d|       } t        j                  | dddd      S c c}w )	Nz. r  z\1 <\2>z'\1'u   z# F)widthinitial_indentsubsequent_indentbreak_on_hyphens)r  r#  r  rstripsubtextwrapfill)vlconst_patternlink_patterns     rF   comment_ifyz7GalaxyCLI._get_skeleton_galaxy_yml.<locals>.comment_ify  sp    !T"IIa8qxx}89  Q/A!!'1-A==#dVZmrss 9s   A>)required_configoptional_config	variablesr  )r  r$   r&   readr   r:   rU  ru   rt  r(   r*   environmentfilterstemplate)template_pathinject_datatemplate_objmeta_templategalaxy_metar  r  
meta_entryconfig_listrx   	meta_typer  loadertemplar
meta_valuer  r  s                  @@rF   _get_skeleton_galaxy_ymlz"GalaxyCLI._get_skeleton_galaxy_yml  sS   (=1FGN 	WR^#L$5$5$7@UVM	W 78% 	+J-7^^J-N/TcKOOJu$5t<E&NN659	%E&(E&(E"'Jwz*	+" zz"<=

?3	t &ds,tu5@##M2%%m4
U	W 	Ws   D55D?c                   |r|rt        d      |s|st        d      |r8|t        d      t        j                  |      }| j                  |d|      }|S |D cg c]  }t	        j
                  |||       c}g d}|S c c}w )NzRThe positional collection_name arg and --requirements-file are mutually exclusive.z:You must specify a collection name or a requirements file.zThe --signatures option and --requirements-file are mutually exclusive. Use the --signatures with positional collection_name args or provide a 'signatures' key for requirements in the --requirements-file.F)r  r1   )rm   r  )r	   r<   r=   r  r   from_string)r   rm   r  rT  r1   r  
coll_inputs          rF   (_require_one_of_collections_requirementsz2GalaxyCLI._require_one_of_collections_requirements  s    
 ,stt%6[\\%"T 
 !* 7 78I J88!!&"3 9 L 	 '2 "  ++J8I:V  L  s   Bc                     y)z
        Perform the action on an Ansible Galaxy role. Must be combined with a further action like delete/install/init
        as listed below.
        Nr   r  s    rF   r   zGalaxyCLI.execute_role       	rK   c                     y)z
        Perform the action on an Ansible Galaxy collection. Must be combined with a further action like init/install as
        listed below.
        Nr   r  s    rF   r   zGalaxyCLI.execute_collection  r*  rK   c                   t         j                  d   }t        j                  t         j                  d         }t	        |d      }t
        j                  j                  |      st        j                  |       n6t
        j                  j                  |      rt        dt        |      z        t         j                  d   D ]:  }t        j                  |      }t        t        |d      t        |d      |       < y)a*  
        Build an Ansible Galaxy collection artifact that can be stored in a central repository like Ansible Galaxy.
        By default, this command builds from the current working directory. You can optionally pass in the
        collection input path (where the ``galaxy.yml`` file is).
        r   r  r  r  z9- the output collection directory %s is a file - abortingrA   N)r   r9   r<   r=   r$   r   rT   r  makedirsr  r	   r%   r   r&   )r   r   r  b_output_pathr  s        rF   r  zGalaxyCLI.execute_build  s     (--goom.LM 5JKww~~m,KK&WW^^M*Z]fgr]sstt&v6 	O'55oFO0EF,AB	rK   c                   t         j                  d   }t         j                  d   }t         j                  d   }t         j                  d   }|rt        j                  |      }| j	                  |||      d   }t        j                  |      }t        |d      }t        j                  j                  |      st        j                  |       t        ||| j                  |t         j                  d	   |       y
)r   rA   r   r   r  r1   rm   r  r  r  r   )r   r9   r<   r=   r(  r$   r   rT   r  r-  r   r}   )r   r1   rm   r   r   r  r  b_download_paths           rF   r  zGalaxyCLI.execute_download
  s     oof-//),8#OON; ) 7 78I JDD*/ E 
 
 "//>"=9NOww~~o.KK(-)9)97OO/0/	
 rK   c                  )* t         j                  d   }t         j                  d   }t         j                  d   }t         j                  dj                  |         }t         j                  dj                  |         }t        dj                  |      t	        d            }|d	k(  rn|j                  t        d
dd|t         j                  d   ddddt        dd g              t        j                  }t        j                  j                  ||      }nr|dk(  rm|j                  dd      \  }	}
|j                  t        |	|
dddgdgddddg              t        j                  }t        j                  j                  ||	|
      }t        d      }t        j                  j                  |      rt        j                  j!                  |      rt#        dt%        |      z        |st#        d t%        |      z        t        j&                  |d!"      D ]~  \  }}}|D ]7  }t        j                  j                  ||      }t)        j*                  |       9 |D ]7  }t        j                  j                  ||      }t        j,                  |       9  |d#}nd!}| j.                  j0                  }d$g}t        j                  j3                  |      }D cg c]  }t5        j6                  |       }}t        j                  j                  |      s$t#        d%j                  t%        |      |            t9               }|j                  t;        |             t=        ||&      }t        j                  j                  |      st        j>                  |       t        j&                  |d!"      D ]  \  }}}t        j                  jA                  ||      **j                  t        jB                        }|d'   }|dk(  r|d(v xr d)|v }n|d)k(  }|D cg c]  tE        fd*|D              r c}|dd |D ]B  )t        j                  jG                  )      \  }}tE        )*fd+|D              r<|dk(  r|r*dk(  r)d,k(  r|jI                         }|jK                  d-      |d.<   tL        jO                  t        j                  j                  |*)      |      }t        t        j                  j                  |*|      d      }tQ        |d/      5 } | jS                  t        |d             ddd       |d0k(  r|st        j                  j                  |)      }!t        j                  j                  |*|      }"tU        |jW                  |!      d'   d      }	 t        |jY                  |      d      }#tQ        |"d/      5 }%|%jS                  |#       ddd       t        j                  jA                  t        j                  j                  |)      |      }&t)        j\                  t        j                  j                  |)      t        j                  j                  ||&      d#5       E |D ]  t        t        j                  j                  |*      d      }'t        j                  j                  |'      rOt        t        j                  j                  |      d      }(t        j                  j_                  |(      rt)        j\                  |(|'d#5       t        j>                  |'         t`        ja                  d6|j[                         d2|d7       yc c}w c c}w # 1 sw Y   SxY w# t"        $ r@}$t)        j*                  |       t#        d1|j[                          d2| d3|! d4|$       |$d}$~$ww xY w# 1 sw Y   xY w)8z
        Creates the skeleton framework of a role or collection that complies with the Galaxy metadata format.
        Requires a role or collection name. The collection name must be in the format ``<namespace>.<collection>``.
        r   r  r   r  r  zyour {0} descriptionzplugins/plugins.html)r   ansible_plugin_list_dirr   z	your namezyour company (optional)z$license (GPL-2.0-or-later, MIT, etc)r  z http://example.com/issue/trackerzhttp://example.com/repositoryzhttp://docs.example.comzhttp://example.comNr   )r/  companylicenser9  r  issue_tracker_urlrepository_urldocumentation_urlhomepage_urlmin_ansible_versiondependenciesre   r  r   z1.0.0z	README.mdzyour name <example@domain.com>zGPL-2.0-or-later)	namespacecollection_namer[   readmeauthorsr5  
repositorydocumentationhomepageissuesbuild_ignorer  r  z6- the path %s already exists, but is a file - abortingz- the directory %s already exists. You can use --force to re-initialize this directory,
however it will reset any main.yml files that may have
been modified there already.T)topdownFz^.*/.git_keep$z9- the skeleton path '{0}' does not exist, cannot init {1}r  r   )	playbooksr  	templatesc              3  @   K   | ]  }|j                          y wr  )rv   )r  r  ds     rF   r  z)GalaxyCLI.execute_init.<locals>.<genexpr>  s     1Y!''!*1Y   c              3  |   K   | ]3  }|j                  t        j                  j                               5 y wr  )rv   r   rT   r  )r  r  frel_roots     rF   r  z)GalaxyCLI.execute_init.<locals>.<genexpr>  s)     Vaqwwrww||Ha89Vs   9<zgalaxy.yml.j2r=  r_   wbz.j2zFailed to create r  z. Templating z failed with the error: )follow_symlinksr\   z was created successfully)1r   r9   rQ   r  r-   r;   ansible_versionr?   GALAXY_ROLE_SKELETON_IGNOREr   rT   r  split!GALAXY_COLLECTION_SKELETON_IGNOREr$   r  r  r	   r%   walkshutilrmtreeunlinkr   default_role_skeleton_pathr  ru   rt  r(   r.   r*   r-  relpathsepanysplitextcopyr  r<   r$  r  writer&   _get_file_contentsr  titlecopyfileislinkrP   )+r   r  r  r   obj_skeletonobj_namer  skeleton_ignore_expressionsobj_pathr<  r=  
b_obj_pathrootdirsfilesold_dirrT   old_fileown_skeletonxskeleton_ignore_rer!  r"  rel_dirsrel_root_dirin_templates_dirrI  filenameexttemplate_datar#  b_dest_file
galaxy_objsrc_template	dest_file
b_renderedr  df
f_rel_path
b_dir_path	b_src_dirrL  rM  s+                             `              @@rF   r  zGalaxyCLI.execute_init'  s    oof-OOK0	(~'<'<['IJ??:#4#4[#AB.55kB$9:P$Q
 & t"1>"!//+6"D>";1$3BQ$7   +,*G*G'ww||Ix8HL()1Q)?&It# /"9:+,:7-9   +,*M*M'ww||Iy/JHh/DE
77>>*%ww~~h'"#[^ghp^q#qrr" $B ENhDW$X Y Y &(WWZ%F $!dE# (G77<<g6DMM$'( !& $H77<<h7DIIdO$	$ # LL;;AAL+;*<'ww)),75PQbjjmQQww~~l+Zaa,' 6   ?623&K8 ww~~j)KK
#!#t!D 8	,D$wwt\:H~~bff-H#A;Ll*#/3I#I#ek]eNe #/;#>  #'ZQc1YFX1Y.YqZDG  v " 0 0 3#VCUVV,.<HPSOXY]lXl %0$4$4$6M,9,=,=>O,PM&)!*!C!CBGGLLQUW_abDcer!sJ"*277<<(H+U^s"tKk40 ]J"((*EZ)[\] ]E\*:#%77<<a#8L "Xx JI$+F,E,El,STU,V_t$uM^%-g.>.>}.MVk%l
 i. -",- - "$dA1F!UJOOBGGLLq$9277<<R\;]otuA vD  ,%bggll8Xq&IRgh
77>>*-$RWW\\$%:CXY	77>>),OOIz5QKK
+,a8	,t 	k>O>O>QS[\]S R6 [&] ] ( ^j1*->{?P?P?R>SSTU]T^^klxky  zR  ST  RU  ,V  W  ]^  ^^- -sB   !^	$^>^(^7^ _,^ 	_));_$$_),_6c                z   t         j                  d   }d}t         j                  d   D ]4  }d|i}t        | j                  | j                  |      }|j
                  }|r d|v r|d   |d<   |d= |j                  |       t         j                  d   s:d}	 | j                  j                  |d	      }|r|j                  |       n-d|z  } nt         j                  d   r|j                  sd|z  } nn|j                  r|j                  |j                         t               }	|	j!                  d|i      }
|
r|j                  |
       || j#                  |      z  }7 | j%                  |       y# t        $ r>}|j                  d
k(  rd|j                  v rd|z  }Y d}~ Ct        d|d|      d}~ww xY w)zx
        prints out detailed information about an installed role as well as info available from the galaxy API.
        r   rj   rA   rT   r[   installed_versionr   NFi  zBad Request- the role %s was not foundzUnable to find info about 'z': r   )r   r9   r   r   r   r^   r;   r   lookup_role_by_namer   	http_codemessager	   _existsmetadatar)   r  r  pager)r   r   datar   r  r`   r^   remote_datar  req	role_specs              rF   rI  zGalaxyCLI.execute_info  s   
 __\2
OOF+ *	7D,IDKK););TBB??L,8DY8OL!45$Y/  .??9-"Y"&((">">tU"KK $$[19D@D+BJJ5<{{  -!#C++VTN;I  +D++I66DU*	7X 	

49 # Y{{c)mqyy.H=D&tUV'WXXYs   E33	F:<"F5$F55F:c                   t         j                  d   }t        j                  }t         j                  d   }t         j                  d   }t         j                  d   }t         j                  d   }|t	        |      }| j                  ||||      d   }|D 	cg c]   }	t        t        j                  |	            " }
}	t        ||
| j                  |||      }t        d	 |D              ry
yc c}	w )rM  rA   rP  r   r  rT  rT  r1   rm   )local_verify_onlyr1   c              3  :   K   | ]  }|j                   r|  y wr  )success)r  results     rF   r  z+GalaxyCLI.execute_verify.<locals>.<genexpr>  s     B&6>>vBs   r   r   )r   r9   r+   collection_pathsr#  r(  r   r<   r=   r   r}   r[  )r   r1   rm   search_pathsrP  r  r  rT  r  rT   resolved_pathsresultss               rF   r^  zGalaxyCLI.execute_verify  s     oof-.??8#OOI6#OON;__\2
!j)JDD*!/ E 
 	 _kkVZ293J3J43PQkk$.m//	
 BGBB ls   %C/c                   t         j                  d   }t         j                  d   }d}t         j                  j                  d      }|t        |      }|rt        j                  |      }dt        |      z  }g }g }t         j                  d   dk(  rlt        j                  t         j                  d         }| j                  ||||	      }	|	d
   }|	d   rt        j                  |j                  d             nY|s|t        d      |r|j                  d      s|j                  d      st        d      | j                  }
| j                  xr
 d|
vxr d|
v}| j!                  |||      }	|	d   }|	d
   rX| j                  rd|
v sd|
v rD| j                  rt        j"                  nt        j                  } ||j                  d             n| j%                         }|	d
   }nkt         j                  d   D ]U  }t'        j(                  |j+                               }|j-                  t/        | j0                  | j2                  fi |       W |s|st        j                  d       y|r&t        j                  d       | j5                  |       |r*t        j                  d       | j7                  |||       yy)a  
        Install one or more roles(``ansible-galaxy role install``), or one or more collections(``ansible-galaxy collection install``).
        You can pass in a list (roles or collections) or use the file
        option listed below (these are mutually exclusive). If you pass in a list, it
        can be a name (which will be downloaded via the galaxy API and github), or it can be a local tar archive file.
        rA   r  NrT  zThe requirements file '%s' contains {0}s which will be ignored. To install these {0}s run 'ansible-galaxy {0} install -r' or to install both at the same time run 'ansible-galaxy install -r' without a custom install path.r   re   r   r  rm   r  r   z3- you must specify a user/role name or a roles filez.yamlz.ymlzJInvalid role requirements file, it must end with a .yml or .yaml extensionr   r   )r1   r  z'Skipping install, no requirements foundz$Starting galaxy role install processz*Starting galaxy collection install processr0  )r   r9   r:   r#  r<   r=   r&   r(  rP   r  rQ   r
   endswithr	   r   r   r  r  rr  r)   r  striprU  r   r   r   _execute_install_role_execute_install_collection)r   r1   install_itemsr  r  rT  two_type_warningcollection_requirementsrole_requirementsr  galaxy_argswill_install_collectionsdisplay_funcrnamer   s                  rF   rp  zGalaxyCLI.execute_install  s     /#OON;__((6
!j)J ) 7 78I JXZabsZtu
 #%??6"l2'55gooFX6YZOHH0%"3 I L '3=&A#G$,33F;< %6%>)*_`` )227;?P?Y?YZ`?a&'stt"nn+/+>+>  ,A4{CZ  ,A_m  vA  `A(#<<%&7/G  =  
 %1$9!  .8K8KtWbOb4Bk4Q 7;6I6I7??w{{L !1!8!8!FG&*&G&G&IO.:=.I+ %__V4 bE*::5;;=ID%,,ZTEWEW-`[_-`ab !)@OOEFOOBC&&'89"OOHI ,,'"3 - 	 #rK   c                t   t         j                  d   }t         j                  d   }t         j                  d   }t         j                  d   }	 t         j                  d   }t         j                  j                  dd      }	t         j                  j                  d	d      }
t        j                  }t        d
 t        j                  D              }t        d t        j                  D              }t        j                  xr t        fd|D               }|r.t        fd|D              rt        j                  d d       n?|r=t        j                  dt              dt        dj!                  |            d       t#              }t%        |d      }t&        j(                  j+                  |      st'        j,                  |       t/        ||| j0                  |||||
|	||t         j                  j                  dd      |       y# t        $ r | j                  rt	        d       w xY w)Nr   rP  r   rj  rl  zUnable to properly parse command line arguments. Please use "ansible-galaxy collection install" instead of "ansible-galaxy install".r  Frk  c              3  2   K   | ]  }t        |        y wr  r   r  ps     rF   r  z8GalaxyCLI._execute_install_collection.<locals>.<genexpr>  s     UA4Q7U   c              3  2   K   | ]  }t        |        y wr  r  r  s     rF   r  z8GalaxyCLI._execute_install_collection.<locals>.<genexpr>  s     kQ5a8kr  c              3  @   K   | ]  }|j                          y wr  
startswithr  r  rT   s     rF   r  z8GalaxyCLI._execute_install_collection.<locals>.<genexpr>  s     Gr_`UYHZGrrJ  c              3  @   K   | ]  }|j                          y wr  r  r  s     rF   r  z8GalaxyCLI._execute_install_collection.<locals>.<genexpr>  s     "N!1<<#5"NrJ  z The specified collections path 'z' appears to be part of the pip Ansible package. Managing these directly with ansible-galaxy could break the Ansible package. Install collections to a configured collections path, which will take precedence over collections found in the PYTHONPATH.z;' is not part of the configured Ansible collections paths ':z}'. The installed collection will not be picked up in an Ansible run, unless within a playbook-adjacent collections directory.r  r  r   )r  r1   rl  r   read_requirement_pathsr   )r   r9   KeyErrorr   r	   r:   r?   r  r  r+   r  GALAXY_COLLECTIONS_PATH_WARNINGr[  rP   r  r&   r  r   r$   r   rT   r  r-  r   r}   )r   r  rT   r1   r   rP  r   rj  rl  r  rk  r   managed_pathsread_req_pathsunexpected_pathr  r.  s     `              rF   r  z%GalaxyCLI._execute_install_collectionu  s    (8//),!//*;<	!(1E!F $OO//0CUK//%%i7..UATATUUkBYBjBjkk;;rCGrdqGrDr@rs"N~"NNOO24& 97 7 OO_fgk_lnuvyv~v~  @P  wQ  oRS T /t4 5JKww~~m,KK&+t'7'7UOW//1OO''	59#1	
 [  	""";  	s   H "H7c                >	   t         j                  d   }t         j                  d   }t         j                  d   }t         j                  d   xs |}|D ]  }|rUt         j                  d   rB|j                  t         j                  d   vr#t        j	                  d|j                  z         [t        j	                  d|j                  z         |j
                  |j
                  d   |j                  k7  s|r|rTt        j                  d	|j                  d
|j
                  d   d|j                  xs d       |j                          njt        j                  d|j                  d|j
                  d   d|j                  xs d       B|s#t        j                  dt        |      z         g	 |j                         }|sA|r>|j                  s$t        j                  d|j                  z         n|j                   |j"                  z   }	|	D ]  }
t        j%                  d|
z         t'               }|j)                  |
      }t+        | j,                  | j.                  fi |}d|j                  vrd|j0                  vr|j2                  |j
                  Z||vr3t        j                  dt        |      z         |j5                  |       t        j                  d|j                  z         |j
                  d   |j                  k7  r|rft        j                  d|j                  d
|j
                  d   d|j                  xs d       |j                          |j5                  |       kt        j                  dt        |      d|j                  d|j                  d|j
                  d   d	       |r|j5                  |       t        j                  d|j                  z          |rt        j                  d|j                  z         | j                           y# t        $ rJ}t        j                  d|j                  dt        |      d       | j                          Y d }~Dd }~ww xY w) Nr  r   rj  r   rA   zSkipping role %szProcessing role %s r[   z- changing role z from z to unspecifiedr\   z (z:) is already installed - use --force to change version to z$- %s is already installed, skipping.z! was NOT installed successfully: r  z-Meta file %s is empty. Skipping dependencies.zInstalling dep %sr  z- adding dependency: %sz-- dependency %s already pending installation.z- changing dependent role z- dependency z) from role z) differs from already installed version (z), skippingz/- dependency %s is already installed, skipping.z$- %s was NOT installed successfully.r   )r   r9   r_   rP   r  r^   r[   r  r  ra  rh  r	   r&   r  r  rT   metadata_dependenciesr  debugr)   r  r   r   r   r  scmrU  )r   r  	role_filer   
force_depsr   r   	installedr  role_dependenciesdepdep_reqdep_infodep_roles                 rF   r  zGalaxyCLI._execute_install_role  s   OON3	//),__%67
(6J  H	+DW__V4'//Z`Ja9a.:;KK-		9:   ,$$Y/4<<?5)-D4E4Ei4PRVR^R^RoboRo)q r)-D4E4Ei4PRVR^R^RoboRo)q r  (NQTUYQZ(Z[  LLN	 y}}OO$SVZV_V_$_`(,(B(BTEVEV(V%0 w&9C&?@"1"3#*#:#:3#?#-dkk4;M;M#ZQY#Zhmm38<<8OT\T`T`Th %#008'|; '0IGT\L]0] ^ , 3 3H = '0_bjbobo0o p'44Y?8CSCSS#-$+OO5=]]HDYDYZcDdfnfvfv  gH  {H  gH5I %J$,OO$5$0$7$7$A$+OO5<X5FHXHXZ^ZcZcemezez  |E  fF5G %H $.$0$7$7$A$+OO4ehphuhu4u$v;w>  F RS((*QH	+T _   tyyZabcZd ef((*s   ;Q			R?RRc           
        t         j                  d   st        d      t         j                  d   D ]e  }t        | j                  | j
                  |      }	 |j                         rt        j                  d|z         nt        j                  d|z         g y# t        $ r}t        d|dt        |            d}~ww xY w)	zV
        removes the list of roles passed as arguments from the local system.
        rA   z/- you must specify at least one role to remove.z- successfully removed %sz - %s is not installed, skipping.zFailed to remove role r  Nr   )r   r9   r
   r   r   r   r  rP   r   r	   r%   )r   r9  r   r  s       rF   r  zGalaxyCLI.execute_remove  s    
 v&%&WXX 0 	_Idkk488Y?D_;;=OO$?)$KLOO$F$RS	_   _"YPYZ[P\#]^^_s   AB	C$B>>Cc                    t         j                  d   dk(  r| j                          yt         j                  d   dk(  r| j                          yy)z5
        List installed collections or roles
        r   r   re   N)r   r9   execute_list_roleexecute_list_collectionr  s    rF   r)  zGalaxyCLI.execute_list  sC    
 ??6"f,""$__V$4((* 5rK   c           
        d}d}g }t         j                  d   }t         j                  d   }|D ]  }t        j                  |      }t        j
                  j                  |      rd}n!|j                  dj                  |             \|rt        | j                  | j                  |t        j
                  j                  ||            }t        j
                  j                  |j
                        rNd}t        j                  dt        j
                  j                  |j
                        z         t        |        n|j                  d|z         ,t        j
                  j!                  |      s|j                  d	|z         at        j
                  j                  |      s|j                  d
|z         t        j                  d|z         t	        j"                  |      }	|	D ]=  }
t        | j                  | j                  |
|      }|j$                  s3t        |       ?  |r|rg }|D ]  }t        j'                  |        |s+t)        dj                  t         j                  d               y)zQ
        List all roles installed on the local system or a specific role
        Fr   r   T)- the configured path {0} does not exist.r   z# %sr  z(- the configured path %s does not exist.z<- the configured path %s, exists, but it is not a directory.V- None of the provided paths were usable. Please specify a valid path with --{0}s-pathr   r   )r   r9   r<   r=   r   rT   isdirrU  rQ   r   r   r   r  rP   dirnamera   r  listdirr  r  r
   )r   
path_found
role_foundwarningsroles_search_pathsr9  rT   	role_pathr`   
path_files	path_filews               rF   r  zGalaxyCLI.execute_list_role  s   
 

$__\:OOF+	& 	*D!//5Iww}}T"!
 K R RSW XYT-?-?QSQXQXQ]Q]^girQst77==)!%JOOFRWW__RWW-E$EF!"% =	 IJww~~i0OO$NQZ$Z[ww}}Y/OO$ben$no 23ZZ	2
!+ *I#DKK1C1CYUYZB{{%b)*9	*D )H 	AOOA	 %hoopwpp  AG  qH  I  rK   c           	        |d|_         t        j                  d   }t        j                  d   }t        t        j
                        }t        t        j                  d   xs g       |z  t        t        j                        z  }i }g }d}d}	d}
d}|rt        |       |j                  d      \  }
}t        t        t        |      ||
|d            }t               }t        |      \  }}t        |d 	      D ]  }d
}	t        j                  t!        |j"                              j$                  j$                  j'                         }|dv r1|j)                  |i        d|j*                  i||   |j,                  <   ||vr t/        |dd||       |j1                  |       t3        |||        d}|D ]  }t4        j6                  j9                  |      s&||v r'|j;                  dj=                  |             Ht4        j6                  j9                  |      r@t4        j6                  j?                  |      s!|j;                  dj=                  |             d
} |	r|rg }|D ]  }t@        jC                  |        |s-|s+tE        dj=                  t        j                  d               |dk(  r)t@        jA                  tG        jH                  |             y|dk(  rt@        jA                  tK        |             y)zz
        List all collections installed on the local system

        :param artifacts_manager: Artifacts manager.
        NFr%  re   r   r  )namespace_filtercollection_filterdedupec                    | j                   S r  )r  )rn   s    rF   <lambda>z3GalaxyCLI.execute_list_collection.<locals>.<lambda>  s
    AEE rK   rk   T>   r(  r'  r[   
CollectionVersionr  z=- the configured path {0}, exists, but it is not a directory.r  r   r(  r'  r   )&require_build_metadatar   r9   r  r?   r  r+   r  r   rR  r#  r   rs   r  pathlibPathr&   r  parentas_posix
setdefaultrd   rc   rY   addrh   r   rT   r  rU  rQ   r  rP   r  r
   r(  dumpsr"   )r   r1   r%  r=  default_collections_pathcollections_search_pathscollections_in_pathsr  r  collection_foundr  r  rm   seen
fqcn_widthversion_widthre   r  rT   r  s                       rF   r  z!GalaxyCLI.execute_list_collectionW  s    (7<48!//,7#&q':':#;  239r:=UUX[\s  ]E  ]E  YF  F 	!  "
   %_52A2G2G2L//4)*-/
  u$:;$G!
M /B 	KJ#%ll7:>>+BCJJQQZZ\O 00$//DJSU_UcUcId$_5jooF"$.#'$!"% HH_-#J
MJ#	K& 
, 		"D77>>$'33 K R RSW XY%bggmmD.A _ f fgk lm!
		" H 	AOOA	 :%hoopwpp  AG  qH  I  F"OODJJ';<=  f$OOI&:;<rK   c                    t         j                  t        j                  d         }t        j                  d   }t        j                  d   }t	        || j
                  ||       y)zs
        Publish a collection into Ansible Galaxy. Requires the path to the collection tarball to publish.
        rA   r6  r  N)r<   r=   r   r9   r   r   )r   r  r6  r   s       rF   r  zGalaxyCLI.execute_publish  sL     $11'//&2IJv&//"23?DHHdGDrK   c                   d}d}t         j                  d   r"dj                  t         j                  d         }|sDt         j                  d   s1t         j                  d   st         j                  d   st        d      | j                  j                  |t         j                  d   t         j                  d   t         j                  d   |	      }|d
   dk(  rt        j                  d       ydg}|d
   |kD  r|j                  d|d
   |fz         n|j                  d|d
   z         g }|d   D ](  }|j                  t        |d   dz   |d   z                * t        |      }d|z  }|j                  d       |j                  |dz         |j                  |dz         |d   D ]&  }|j                  ||d   d|d   |d   fz         ( dj                  |      }| j                  |       y)z0 searches for roles on the Ansible Galaxy serveri  NrA   r  r-  r.  r/  zYInvalid query. At least one search term, platform, galaxy tag or author must be provided.)r-  tagsr/  	page_sizecountr   zNo roles match your search.rj   z6Found %d roles matching your search. Showing first %s.z$Found %d roles matching your search:r  r  r  r_   z %%-%ds %%s)NameDescription)z----z-----------r   r  )r   r9   r  r	   r   search_rolesrP   r  rU  rS   rR   r  )	r   r  r,  responser  max_lenr   name_len
format_strs	            rF   r1  zGalaxyCLI.execute_search  s    	??6"XXgoof56Fgook:7??S`Cajqjyjy  {C  kDz{{88((7??;;W.5oom.LU\UdUdemUn  {D ) E G!OO9:uGy(KKQU]^eUfhqTrrsKK?(7BSSTY' 	GDNN3tJ/#5VDEF	Gw<#h.
CJ!::;J!::;Y' 	iDKK
$z2BDL&QSWXeSf%ggh	i zz$

4rK   c                   dt         j                  t         j                  t         j                  t         j                  d}t	        t
        j                  d   d      }t	        t
        j                  d   d      }d}t
        j                  d   r| j                  j                  ||	      }n| j                  j                  ||t
        j                  d
   t
        j                  d         }t        |      dkD  rt        j                  d|d|dd       t        j                  dt         j                         |D ]>  }t        j                  |d   d   d   d|d   d   d   t         j                         @ t        j                  d|d|dt         j                         |S t        j                  d|d   d   z         t
        j                  d   sKt        j                  d|d   d   d   d   z         t        j                  d|d   d   d|d   d          t
        j                  d   st
        j                  d   rg }d}|s| j                  j                  |d   d          }|d   d   d!   D ]>  }	|	d   |vst        j                  |	d"   ||	d#             |j                  |	d          @ |d   d$   x}
d%v rd&d'gj                  |
      }d(}nt        j                   d)       |s|S )*z+ used to import a role into Ansible Galaxy normal)INFOWARNINGERRORSUCCESSFAILEDr   r  r  r   r   r:  )r   r   r8  r9  )r8  r9  r   z?WARNING: More than one Galaxy role associated with Github repo /r  yellowcolorz.The following Galaxy roles are being updated:
r   r   r<  r_   zI
To properly namespace this role, remove each of the above and re-import z from scratchz(Successfully submitted import request %didr6  zRole name: %szRepo: F)task_idtask_messagesmessage_textmessage_typestate)r  r  r  r  T
   )r?   
COLOR_WARNCOLOR_ERRORCOLOR_OKr&   r   r9   r   get_import_taskcreate_import_taskrS   rP   COLOR_CHANGEDrU  indextimesleep)r   colorsr   r   r  tasktmsg_listfinishedmsgr  s              rF   r;  zGalaxyCLI.execute_import  s    ||]]zzmm
 goom<EZ[goom<EZ[??>*88++Q\+]D 88..{K9@9U9@9U / WD 4y1}kv  yD  !E&.   0 W_`_n_no VAOOq1A/B6/J;/WYZ[kYlmsYtu{Y|$}  FG  FU  FUO  VV  DO  Q\  !]&'oo   7	OOFaQUVW??6*$q':J2KF2STZ2[ [\a1GaQ^I_ `a??>*goof.EHHxx//Q/F7#34_E 3C4y0N(;6#nJ]C^_ D	23 "!WW--E2GG#X.44U;B#HJJrN  	rK   c                   t         j                  d   r| j                  j                         }t	        |      dk(  rt
        j                  d       yt
        j                  dt        j                         t
        j                  dt        j                         |D ]@  }t
        j                  |d   dd	|d
   dd	|d   d|d   t        j                         B yt         j                  d   rR| j                  j                  t         j                  d          t
        j                  dt        j                         yt         j                  d
   }t         j                  d   }t         j                  d   }t         j                  d   }| j                  j                  ||||      }t
        j                  d|d
   d	|d   d|d          y)zD Setup an integration from Github or Travis for Ansible Galaxy rolesr@  r   zNo integrations found.z
ID         Source     Repor  z ---------- ---------- ----------r  10r  rA  r   r  r   r?  zDSecret removed. Integrations using this secret will not longer work.rC  zAdded integration for )
r   r9   r   list_secretsrS   rP   r?   r  remove_secret
add_secret)r   secretsrC  rA  r   r   resps          rF   rE  zGalaxyCLI.execute_setup  sx    ??<(hh++-G7|q  89OO@

OSOO>ajjOQ! avd|VHEUW]^kWl7=m7L!NUVU_U_   aa ??;'HH""7??;#?@OObjkjtjtOu*oom4oom4*xx""6;VLDNDQ^L_aefsatuvrK   c                   t         j                  d   }t         j                  d   }| j                  j                  ||      }t	        |d         dkD  rt
        j                  d       t
        j                  d       t
        j                  d       |d   D ]?  }t
        j                  |j                  dd	|j                  d
d	|j                         A t
        j                  |d          y)z$ Delete a role from Ansible Galaxy. r   r   deleted_rolesr   zDeleted the following roles:zID     User            Namez!------ --------------- ----------8r  15statusr   )	r   r9   r   delete_rolerS   rP   r  r<  r_   )r   r   r   r  r   s        rF   r   zGalaxyCLI.execute_delete>  s     oom4oom4xx##K=tO$%)OO:;OO9:OO?@_- X477DNNDII VWX 	X'rK   r  )TNT)r   )NN)7r   r   r   __doc__r_   r  r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r   r   rr  r  r  staticmethodr  r  r=   r$  r(  r   r   r  rJ   r  r  rI  r^  rp  r  r  r  r)  r  r  r  r1  r;  rE  r   __classcell__)r   s   @rF   r<   r<      s    D LN.0WSrC&28V=[ 	a=;`"GHtsl=
j	o)b & &&fP@ u u    6 M M + +^ "H. ' '8[^z4l ' '@ 'W 'Wr6pPd(+8t 'W 'WrE'R7rBrK   r<   c                .    t         j                  |        y r  )r<   cli_executorrn  s    rF   mainr+  Q  s    4 rK   __main__)r	     )r	  r-  r	  r-  r  )h
__future__r   ansible.clir   r   rH   r(  os.pathr   r  ru   rU  r   r
  r  typingr  dataclassesr   
yaml.errorr   ansible.constants	constantsr?   ansibler   ansible.cli.argumentsr   r   ansible.errorsr	   r
   ansible.galaxyr   r   ansible.galaxy.apir   r   ansible.galaxy.collectionr   r   r   r   r   r   r   r   r   3ansible.galaxy.collection.concrete_artifact_managerr   ansible.galaxy.collection.gpgr   0ansible.galaxy.dependency_resolution.dataclassesr   ansible.galaxy.roler   ansible.galaxy.tokenr   r   r   r   $ansible.module_utils.ansible_releaser    rP  'ansible.module_utils.common.collectionsr!    ansible.module_utils.common.yamlr"   r#   +ansible.module_utils.common.text.convertersr$   r%   r&   ansible.module_utilsr'   ansible.parsing.dataloaderr(   !ansible.playbook.role.requirementr)   ansible.templater*   ansible.utils.collection_loaderr+   ansible.utils.displayr,   ansible.utils.plugin_docsr-   ansible.utils.varsr.   rP   movesurllibparseurlparserJ   rY   ra   rh   rs   ry   r{   r<   r+  r   r   rK   rF   <module>rQ     s   #       	  
    !     < < C 5
 
 
 8 H * \ \ O ? A T T $ 1 = $ C ) ; .
)99!!**B	5
'   .[ [|4! zF rK   