a ì)gìã@sddlmZmZmZeZddlmZddlZddl Z ddl Z ddl Z ddl Z ddl Z ddlmmZddlmZddlmZddlmZddlmZddlmZdd lmZmZm Z m!Z!dd l"m#Z#m$Z$dd l%m&Z&dd l'm(Z(dd l)m*Z*ddl+m,Z,ddl-m.Z.ddl/m0Z0ddl1m2Z2ddl3m4Z4ddl5m6Z6ddlm7Z7m8Z8ddl9m:Z:m;Z;ddlm?Z?ddl@mAZAmBZBmCZCe?ƒZDejEdZFgd¢ZGiZHgd¢ZId+dd„ZJdd„ZKGd d!„d!eLƒZMGd"d#„d#eeMƒZNd$d%„ZOd&d'„ZPd,d(d)„ZQeRd*kreQƒdS)-é)Úabsolute_importÚdivisionÚprint_function)ÚCLIN)ÚPath)Ú constants)Úcontext)Úoption_helpers)Úlist_collection_dirs)Ú AnsibleErrorÚAnsibleOptionsErrorÚAnsibleParserErrorÚAnsiblePluginNotFound)Ú to_nativeÚto_text)Ú is_sequence)Ú json_dump)Ú yaml_dump)Ú importlib)Ú string_types)Ú read_docstub)Ú from_yaml)Ú AnsibleDumper)Ú list_plugins)Ú action_loaderÚfragment_loader)ÚAnsibleCollectionConfigÚAnsibleCollectionRef)Ú_get_collection_name_from_path)ÚDisplay)Úget_plugin_docsÚ get_docstringÚget_versioned_doclink)ÚroleÚkeyword)ZPlayZRoleZBlockZTask)Ú inventoryÚlookupÚmodulecCs"tjddd| t||ƒ¡dS)NzJadd_collection_plugins method, use ansible.plugins.list functions instead.ú2.17©Úversion)ÚdisplayÚ deprecatedÚupdater)Ú plugin_listÚ plugin_typeÚ coll_filter©r1ú3/usr/lib/python3.9/site-packages/ansible/cli/doc.pyÚadd_collection_plugins6sr3c CsZzt t|ƒ¡WnBtyT}z*t t ¡¡tdt|ƒƒ‚WYd}~n d}~00dS)NzXWe could not convert all the documentation into JSON as there was a conversion issue: %s)r+rÚ TypeErrorÚvvvÚ tracebackÚ format_excr r)ÚtextÚer1r1r2Újdump;s r:c@sreZdZdZdd„ejDƒdd„ejDƒZddd„Zddd „Zdd d „Z d d „Z dd„Z ddd„Z ddd„Z dS)Ú RoleMixinz§A mixin containing all methods relevant to role argument specification functionality. Note: The methods for actual display of role data are not present here. cCsg|] }d|‘qS)Úargument_specsr1©Ú.0r9r1r1r2Ú KózRoleMixin.cCsg|] }d|‘qS)Úmainr1r=r1r1r2r?Kr@Nc Cs|rtj |d|d¡}n |r,tj |d¡}n td|ƒ‚d}|jD]&}tj ||¡}tj |¡rB|}qjqB|durviSzXt|dƒ:}t| ¡|d} | dur i} |   di¡WdƒWS1sÂ0YWnBt t fy} z$t d|t | ƒf| d ‚WYd} ~ n d} ~ 00dS) aCLoad the role argument spec data from the source file. :param str role_name: The name of the role for which we want the argspec data. :param str collection_path: Path to the collection containing the role. This will be None for standard roles. :param str role_path: Path to the standard role. This will be None for collection roles. We support two files containing the role arg spec data: either meta/main.yml or meta/argument_spec.yml. The argument_spec.yml file will take precedence over the meta/main.yml file, if it exists. Data is NOT combined between the two files. :returns: A dict of all data underneath the ``argument_specs`` top-level YAML key in the argspec data file. Empty dict is returned if there is no data. ÚrolesÚmetaz7A path is required to load argument specs for role '%s'NÚr)Ú file_namer<z8An error occurred while trying to read the file '%s': %s©Zorig_exc)ÚosÚpathÚjoinr ÚROLE_ARGSPEC_FILESÚexistsÚopenrÚreadÚgetÚIOErrorÚOSErrorr r) ÚselfZ role_nameÚcollection_pathÚ role_pathÚ meta_pathrHÚspecfileÚ full_pathÚfÚdatar9r1r1r2Ú _load_argspecMs*    0zRoleMixin._load_argspecc Cs¢tƒ}tƒ}|D]Œ}tj |¡s"qt |¡D]n}tj ||¡}|jD]T}tj |d|¡} tj | ¡rD|dust||vr”||vrŠ| ||f¡| |¡q,qDq,q|S)añFind all non-collection roles that have an argument spec file. Note that argument specs do not actually need to exist within the spec file. :param role_paths: A tuple of one or more role paths. When a role with the same name is found in multiple paths, only the first-found role is returned. :param name_filters: A tuple of one or more role names used to filter the results. :returns: A set of tuples consisting of: role name, full role path rCN) ÚsetrGrHÚisdirÚlistdirrIrJrKÚadd) rQZ role_pathsÚ name_filtersÚfoundZ found_namesrHÚentryrSrUrVr1r1r2Ú_find_all_normal_roles{s      z RoleMixin._find_all_normal_rolesc Cstƒ}t|d}|D]ú}t|dd}t|ƒ}tj |d¡}tj |¡rt |¡D]¼} |j D]°} tj || d| ¡} tj | ¡r\|dur˜|  | ||f¡np|D]j} t |   d¡ƒdkrî|   d¡\} }}d | |g¡|krì| |krì|  | ||f¡qœ| | krœ|  | ||f¡qœqRq\qRq|S) aFind all collection roles with an argument spec file. Note that argument specs do not actually need to exist within the spec file. :param name_filters: A tuple of one or more role names used to filter the results. These might be fully qualified with the collection name (e.g., community.general.roleA) or not (e.g., roleA). :param collection_filter: A string containing the FQCN of a collection which will be used to limit results. This filter will take precedence over the name_filters. :returns: A set of tuples consisting of: role name, collection name, collection path )r0Úsurrogate_or_strict©ÚerrorsrBrCNÚ.é) rZr rrrGrHrIrKr\rJr]ÚlenÚsplit)rQr^Úcollection_filterr_Z b_colldirsÚb_pathrHZcollnameZ roles_dirr`rUrVÚfqcnÚnsÚcolr#r1r1r2Ú_find_all_collection_roless,       z$RoleMixin._find_all_collection_rolescCsb|rd ||g¡}n|}i}||d<i|d<| ¡D]$}||pBi}| dd¡|d|<q4||fS)aÜBuild a summary dict for a role. Returns a simplified role arg spec containing only the role entry points and their short descriptions, and the role collection name (if applicable). :param role: The simple role name. :param collection: The collection containing the role (None or empty string if N/A). :param argspec: The complete role argspec data dict. :returns: A tuple with the FQCN role name and a summary dict. reÚ collectionÚ entry_pointsÚshort_descriptionÚ)rIÚkeysrN)rQr#roÚargspecrkÚsummaryÚepÚ entry_specr1r1r2Ú_build_summaryÇs   zRoleMixin._build_summaryc CsŠ|rd ||g¡}n|}i}||d<||d<i|d<| ¡D],}|dusP||kr<||pZi} | |d|<q„ƒZ+d?d@„Z,edAdB„ƒZ-edRdCdD„ƒZ.edEdF„ƒZ/edSdGdH„ƒZ0edTdJdK„ƒZ1dLdM„Z2edUdNdO„ƒZ3‡Z4S)VÚDocCLIa displays information on modules installed in Ansible libraries. It displays a terse listing of plugins and their short descriptions, provides a printout of their DOCUMENTATION strings, and it can create a short "snippet" which can be pasted into a playbook. z ansible-doc) r'ZdocuriÚ version_addedÚversion_added_collectionrqZnow_dateÚ plainexamplesÚ returndocsroz\bI\(([^)]+)\)z\bB\(([^)]+)\)z\bM\(([^)]+)\)z\bL\(([^)]+), *([^)]+)\)z\bU\(([^)]+)\)z\bR\(([^)]+), *([^)]+)\)z\bC\(([^)]+)\)z\bHORIZONTALLINE\bz .. note::z .. seealso::z:\w+?:`z .. \w+?::cstt|ƒ |¡tƒ|_dS©N)ÚsuperrŽÚ__init__rZr.)rQÚargs©Ú __class__r1r2r•yszDocCLI.__init__NcCs tjdddt|||gƒ ¡S)Nz^find_plugins method as it is incomplete/incorrect. use ansible.plugins.list functions instead.r(r))r+r,rrs)ÚclsrHZinternalr/r0r1r1r2Ú find_plugins~szDocCLI.find_pluginscCs²|j d|¡}|j d|¡}|j d|¡}|j d|¡}|j d|¡}|j d|¡}|j d|¡}|j d  d¡|¡}|j  d|¡}|j  d |¡}|j  d |¡}|j  d |¡}|S) Nz`\1'z*\1*z[\1]z\1z\1 <\2>z {0} z -------------z See also:zNote:ú`rr)Ú_ITALICÚsubÚ_BOLDÚ_MODULEÚ_URLÚ_LINKÚ_REFÚ_CONSTÚ_RULERÚformatÚ _RST_SEEALSOÚ _RST_NOTEÚ _RST_ROLESÚ_RST_DIRECTIVES)r™r8Útr1r1r2Útty_ifyƒszDocCLI.tty_ifyc s@d}tt|ƒjdddt |j¡t |j¡|jjddddd |jjd d d d dd t ¡t d|jjddddddd|jjdddt j tj ddtj dd|j ¡}|jdd d!d"d#|jd$d%ddd&d'd( t¡d|jd)d*ddd+d,|d|jd-d.ddd/d0|d|jd1ddd2d3d|jjd4ddd5d6ddS)7Nz[A supplied argument will be used for filtering, can be a namespace or full collection name.zplugin documentation toolzWSee man pages for Ansible CLI options or website for tutorials https://docs.ansible.com)ÚdescÚepilogr–Ú*ZPluginÚplugin)ÚnargsÚhelpÚmetavarz-tz--typeÚstorer'ÚtypezQChoose which plugin type (defaults to "module"). Available plugin types are : {0})ÚactionÚdefaultÚdestr±Úchoicesz-jz--jsonÚ store_trueFÚ json_formatzChange output into json format.)rµr¶r·r±z-rz --roles-pathr„T)Úpathsepz0The path to the directory containing your roles.)r·r¶r´rµr±z-ez --entry-pointryz#Select the entry point for role(s).)r·r±z-sz --snippetÚ show_snippetz0Show playbook snippet for these plugin types: %sú, z-Fz --list_filesÚ list_fileszOShow plugin names and their source files without summaries (implies --list). %sz-lz--listÚlist_dirzList available plugins. %sz--metadata-dumpÚdumpzT**For internal use only** Dump json metadata for all entries, ignores other options.z--no-fail-on-errorsÚno_fail_on_errorsz}**For internal use only** Only used for --metadata-dump. Do not fail on errors. Report the error message in the JSON instead.)r”rŽÚ init_parserÚopt_helpZadd_module_optionsÚparserZadd_basedir_optionsÚ add_argumentr¥ÚTARGET_OPTIONSrZDEFAULT_ROLES_PATHZ unfrack_pathZPrependListActionÚadd_mutually_exclusive_grouprIÚSNIPPETS)rQr0Z exclusiver—r1r2r˜sR þ  ÿýÿ ý  ÿ ÿÿÿ ÿÿzDocCLI.init_parsercstt|ƒ |¡}|jt_|Sr“)r”rŽÚpost_process_argsÚ verbosityr+)rQÚoptionsr—r1r2rÉÌszDocCLI.post_process_argsc CsÄtdd„| ¡Dƒƒ}tj|d}g}g}tjdrÞt| ¡ƒD]˜}t||ƒ}| d¡}|d  d¡r¾|dd kr¾|d d vr¾|dd d…|d<d  |¡}|  d |||t |ƒ|f¡qB|  d |||t |ƒ|f¡qBn°t| ¡ƒD]¢}t  ||¡} t | ƒ|kr| d|…d } | d¡}|d  d¡rp|dd d…|d<d  |¡}|  d |||t | ƒ| f¡qê|  d |||t | ƒ| f¡qêt |ƒdkr°|  d¡| |¡t  d  |¡¡dS)Ncss|]}t|ƒVqdSr“©rg©r>Úxr1r1r2Ú Ör@z-DocCLI.display_plugin_list..ér¾reéÿÿÿÿÚ_rÚansibleé)ZbuiltinÚlegacyz %-*s %-*.*sú...z DEPRECATED:Ú )Úmaxrsr+ÚcolumnsrÚCLIARGSÚsortedrrhÚ startswithrIÚappendrgrŽr«ÚextendÚpager) rQÚresultsZdisplaceÚ linelimitr8r,r¯ÚfilenameZpbreakr¬r1r1r2Údisplay_plugin_listÓs6   &      zDocCLI.display_plugin_listc Csöt| ¡ƒ}tƒ}|D]$}||d ¡D]}| |¡q*qd}d}|rZtdd„|Dƒƒ}|rptdd„|Dƒƒ}tj||d}g} t|ƒD]R}||d ¡D]<\}} t | ƒ|krÆ| d|…d} |   d ||||| f¡q¢qŽt   d   | ¡¡dS) zŽDisplay all roles we can find with a valid argument specification. Output is: fqcn role name, entry point, short description rprcss|]}t|ƒVqdSr“rÌrÍr1r1r2rÏr@z2DocCLI._display_available_roles..css|]}t|ƒVqdSr“rÌrÍr1r1r2rÏr@rÐNrÖz %-*s %-*s %sr×)ÚlistrsrZr]rØr+rÙrÛÚitemsrgrÝrŽrßrI) rQZ list_jsonrBZentry_point_namesr#ryZ max_role_lenZ max_ep_lenrár8r¬r1r1r2Ú_display_available_roless,    þ zDocCLI._display_available_rolescCsBt| ¡ƒ}g}|D]}|| |||¡7}qt d |¡¡dS)Nr×)rärsÚget_role_man_textrŽrßrI)rQÚ role_jsonrBr8r#r1r1r2Ú_display_role_doc!s  zDocCLI._display_role_doccCstt dd¡ƒS)NrÓzkeyword_desc.yml)rÚpkgutilÚget_datar1r1r1r2Ú_list_keywords*szDocCLI._list_keywordsc CsÆi}t ¡}|D]®}| d¡r&d}n|dkr4d}n|}z*d||i}g|d<tD]Ü}|tvr†d| ¡}t |¡}t||dƒt|<|t|j vrT|d  |¡d|vrTt|j   |¡} t| d ƒrÌi}t ‚t| d d ƒ|d<|  d ¡sî|d vrød|d<nt| dƒrd|d<nd|d<dD]} t| | ƒ|| <qqTt| ¡ƒD]} || dur>|| =q>|||<Wqtt fy¾} ztd |¡ƒ‚nttjdƒdkrXtdƒ‚|S)Nr–rÔrzGInvalid collection name (must be of the form namespace.collection): {0}z-Only a single collection filter is supported.)rgrrÚrZis_valid_collection_namer r¥r )rQr0r1r1r2rrs zDocCLI._get_collection_filtercs„i}iˆ_t |¡}ˆ ¡}ˆj t||ƒ¡|dkrBˆ |¡}n>|dkrd‡fdd„ˆj ¡Dƒ}ndd„ˆj ¡Dƒ}tƒˆ_ |S)NÚdirÚfilescsi|]}|ˆj|d“qS)r)Úplugins©r>r©rQr1r2Ú ‹r@z(DocCLI._list_plugins..cSsi|] }|i“qSr1r1rr1r1r2rr@) rrŽÚ _prep_loaderrr-rÚ_get_plugin_list_descriptionsrsrZr.)rQr/ÚcontentràÚloaderr0r1rr2Ú _list_plugins~s  zDocCLI._list_pluginsFTc Cs”t |¡}i}|D]z}i}z&t|||ttjddkƒ\}} } } Wn¼ty€} z&t t | ƒ¡WYd} ~ qWYd} ~ nˆd} ~ 0t yþ} zh|s²ddt | ƒi||<WYd} ~ qt  t   ¡¡d||t | ƒf} |rât | ¡nt| ƒ‚WYd} ~ n d} ~ 00|s|sddi||<qt |||| | | ¡}|s†z t|ƒWnFt y„} z,ddt | ƒi||<WYd} ~ qWYd} ~ n d} ~ 00|||<q|S)NrÊrr}z:Missing documentation or could not parse documentation: %szC%s %s missing documentation (or could not parse documentation): %s zNo valid documentation foundz*Cannot serialize documentation as JSON: %s)rŽrr rrrÚrr+rûrr‚r5r6r7r Ú_combine_plugin_docr)rQr/ÚnamesÚfail_okrƒr Z plugin_docsr¯rzr‘r’Úmetadatar9ÚmsgÚdocsr1r1r2Ú_get_plugins_docs’s>  &     " zDocCLI._get_plugins_docscCsVtjd}tjddurRtj tjdd¡}tj |¡rB|f|}|tjdf}|S)ao Add any 'roles' subdir in playbook dir to the roles search path. And as a last resort, add the playbook dir itself. Order being: - 'roles' subdir of playbook dir - DEFAULT_ROLES_PATH (default in cliargs) - playbook dir (basedir) NOTE: This matches logic in RoleDefinition._load_role_path() method. r„ÚbasedirNrB)rrÚrGrHrIr[)rQr„Zsubdirr1r1r2r€½s   zDocCLI._get_roles_pathcCsbttd|ƒ}tjddur0|jtjdddtjdrXtjdD]}|rD| |¡qDd|_|S)z' return a plugint type specific loader ú %s_loaderrNT)Z with_subdirZ module_path)r÷Ú plugin_loaderrrÚZ add_directoryZ_paths)r/r rHr1r1r2rÎs  zDocCLI._prep_loaderc s˜tt|ƒ ¡tjd}tjd ¡}tjdp8tjd}tjdpLtjd}tjdr^d}ntjdrnd}nd}i}|r€|t_|tvr”t d |ƒ‚tjdrTt}i|d <|D] }t tjd  ƒ} |d krü|j | d } |j |   ¡tjd| d |d |<q°|dkr&t ¡} t |   ¡¡|d |<q°| |d¡} |j|| |dv| d|d |<q°nª|r|dkrnt ¡}n |d kr‚|  ¡}n | ||¡}nnttjdƒdkr¬t dƒ‚|dkrÈt tjd¡}n6|d krì|  tjdtjd¡}n| |tjd¡}|rt|ƒn„g} |tjvr.|r8|r8| |¡nôtjdrÔ|tvr`tdd t¡ƒ‚| ¡D]h\}}zt |||d¡}Wn<tyÂ}z"t d |t |ƒ¡¡WYd}~nd}~00|  !|¡qhnX| ¡D]N\}}t "|||d|d|d|d¡}|r|  !|¡nt d|¡qÜnP|d krhtjdrV|rV| #|¡n|r~| $|¡n|r~t %t &|¡¡} | r”t 'd | ¡¡dS)Nrr´rºrÀr¾r¿rrz)Unknown or undocumentable plugin type: %sÚallrÁr#)rƒryr$)ÚtestÚfilter)rrƒr–rzEMissing name(s), incorrect options passed for detailed documentation.r¼z>Snippets are only available for the following plugin types: %sr½rzz,Unable to construct a snippet for '{0}': {1}ÚexamplesÚreturnrz.No valid documentation was retrieved from '%s'rr)(r”rŽÚrunrrÚrõrZplaybook_pathsrÆr Úboolr‡rˆrsrìrr rrgr:rÚDOCUMENTABLE_PLUGINSrãrÈr rIråÚformat_snippetÚ ValueErrorr+rûr¥rrÝÚformat_plugin_docrærér«Ú _dump_yamlrß)rQrr/Zdo_jsonZlistingr rZptypesZptypeZno_failrBrZ plugin_namesr8r¯Zdoc_dataZtextretr9r—r1r2rásœ      $  "            ÿÿ  þ    z DocCLI.runcCs>ttd|ƒ}| ¡}i}|D]}| t|ƒ¡qt| ¡ƒS)Nr)r÷rZ_get_paths_with_contextr-rrÛrs)r/r ÚpathsrZ path_contextr1r1r2Úget_all_plugins_of_typeMs zDocCLI.get_all_plugins_of_typecCsÖttd|ƒ}|j|dddd}|js6td ||¡ƒ‚|j}|j}z(t|t t j ddk||d\}}}}Wn2t yœt  t ¡¡td |||fƒ‚Yn0|durªdSt|t |||j¡| d d ¡| d d ¡d S)Nrz.pyT)Úmod_typeZignore_deprecatedZ check_aliasesz$unable to load {0} plugin named {1} rÊr)rüÚcollection_namer/zM%s %s at %s has a documentation formatting error or is missing documentation.rqZUNKNOWNr)ÚnameÚ namespacerîr)r÷rZfind_plugin_with_contextZresolvedr r¥Zplugin_resolved_pathZplugin_resolved_collectionr!rrrÚr‚r+r5r6r7ÚdictrŽÚnamespace_from_plugin_filepathÚ package_pathrN)r/Ú plugin_namer r†râr&rzÚ__r1r1r2Úget_plugin_metadataVs*ÿ   üzDocCLI.get_plugin_metadatacCs`| d¡s|d7}| |d¡}tj |¡d}| |d¡d d¡}| dd¡}|dkr\d}|S)Nú/rrrrÔz/_re)rùÚreplacerGrHÚsplitextÚrsplitÚstrip)Úfilepathr,rZrel_pathZextension_freeZnamespace_onlyZclean_nsr1r1r2r*rs   z%DocCLI.namespace_from_plugin_filepathcCs0|dkr"|tvrd|d<nd|d<||||dœS)Nr'TÚ has_actionF)rzrrr)r)r¯r/rzr‘r’rr1r1r2r s  zDocCLI._combine_plugin_doccCsb|dkr(| di¡ d¡r(td |¡ƒ‚g}|dkr>t|ƒ}nd|vrNt|ƒ}| d¡d |¡S)z9 return heavily commented plugin use to insert into play r%rËr¯z†The {0} inventory plugin does not take YAML type config source that can be used with the "auto" plugin so a snippet cannot be created.r&rrr×)rNr r¥Ú_do_lookup_snippetÚ_do_yaml_snippetrÝrI)r¯r/rzr8r1r1r2rŒsþ  zDocCLI.format_snippetc Cs‚|d}||d<||d<||d<zt |||¡}WnJty|}z2t t ¡¡td|t|ƒf|d‚WYd}~n d}~00|S)Nror‘r’rz5Unable to retrieve documentation from '%s' due to: %srF) rŽÚ get_man_textr‚r+r5r6r7r r) r¯r/rzr‘r’rr&r8r9r1r1r2r! s .zDocCLI.format_plugin_docc Cs0i}|j ¡D]}d}tt|j|dƒƒ}d}z t|ƒ}Wn(tyf}z|}WYd}~n d}~00|durâ| d¡d}| ||j¡} t j D]L} |   | ¡} z|   ¡r´t| ƒ}Wq”tyÞ}z|}WYd}~q”d}~00q”|rút  d||f¡q|r t|tƒsd} n| dd¡ ¡} | ||<q|S)NrrerÑz+%s has a documentation formatting error: %sZ UNDOCUMENTEDrqzINVALID SHORT DESCRIPTION)rrsrrrr‚rhÚ with_nameÚsuffixrZDOC_EXTENSIONSÚ with_suffixrKr+rûÚ isinstancer)rNr3) rQr rýr¯rzrâZdocerrorr9ÚbaseZbasefileÚ extensionZdocfiler¬r1r1r2r ·s6     z$DocCLI._get_plugin_list_descriptionscCs@g}|jddD]"}t|dd}||vr| |¡qtj |¡S)z; Returns a string suitable for printing of the search path F)Úsubdirsrbrc)Z _get_pathsrrÝrGr»rI)ÚfinderÚretÚir1r1r2Ú print_pathsÞs   zDocCLI.print_pathscCst||dtd d¡S)Nz'')Údefault_flow_styleZ default_styleZDumperr×)rrÚrstrip)ÚstructÚ flow_styler1r1r2r"êszDocCLI._dump_yamlcs$t d ‡fdd„| d¡Dƒ¡¡S)Nr×csg|] }ˆ|‘qSr1r1)r>Úline©Úindentr1r2r?ðr@z(DocCLI._indent_lines..)rŽr«rIrh)r8rJr1rIr2Ú _indent_linesîszDocCLI._indent_linescCs2|dkrd}|dkrdS|r(d||f}d|fS)Nzansible.builtinz ansible-coreZ historicalz%s of %sz version %sr1)rrr1r1r2Ú_format_version_addedòs zDocCLI._format_version_addedrrc Csxt|ƒD]h}t||ƒ}| dd¡}t|tƒsÚitemr1r1r2r?*r@z%DocCLI.add_fields..ÚcliÚoptionr'z--%srÒ)r'rZZset_viarrú%s: %sT)rGz%sadded in: %s rrz%s%s: z )rÛr)Úpopr<rr rÝrÚ enumeraterr´ÚtextwrapÚfillrŽr«ÚIGNOREr0rKr"rÜrLÚupperÚ add_fields)r8ÚfieldsÚlimitÚ opt_indentÚ return_valuesZ base_indentÚoÚoptrMZ opt_leadinZ entry_idxr`rSZsubkeyZconfZconfigÚignorerXrYrrrZsubdatar1r1r2rbýsv      ""      *    *$  zDocCLI.add_fieldsc Cs"g}d}tjd}ttjt|ƒdƒ}| d| ¡| d¡f¡|dD]Ð}|d|}| d¡r€| d|| d¡f¡n| d |¡| d ¡ràt|d tƒr¶d   |d ¡} n|d } | d t j t   | ¡|||d ¡| d¡r| d¡t  || d¡||¡| d¡| d¡rT| d¡| t  t  | d¡¡|¡¡| d¡dD]Â} | |vrjqXt|| tƒr´| d|  ¡t j t   || ¡|t| ƒd|df¡nZt|| ttfƒrê| d|  ¡d  || ¡f¡n$| t  t  |  ¡|| i¡d¡¡| d¡qXqJ|S)a˜Generate text for the supplied role suitable for display. This is similar to get_man_text(), but roles are different enough that we have a separate method for formatting their display. :param role: The role name. :param role_json: The JSON for the given role as returned from _create_role_doc(). :returns: A array of text suitable for displaying to screen. ú çš™™™™™É?éFú > %s (%s) rHrprqzENTRY POINT: %s - %s zENTRY POINT: %s rîú ú%s rPrËúOPTIONS (= is mandatory): rrÚ attributesú ATTRIBUTES: )Zauthorr[é©rRr½)r+rÙrØÚintrÝrarNr<rärIr^r_rŽr«rbr\rKr"rrgÚtuple) rQr#rèr8reÚpadrdryrzr¬rr1r1r2rçVsL     þ        ÿ"$zDocCLI.get_role_man_textc Csnt|ƒ}tjtjdft_d}g}tjd}ttjt|ƒdƒ}|  tjd|  d¡¡pf|  d¡pf|}|rxd||f}|  d|  ¡|  d ¡f¡t |d tƒr´d  |  d ¡¡}n |  d ¡}|  d tjt |¡|||d ¡d|vr|  d¡} |  dd¡} |  dt | | ¡¡|  dd¡rÆ|  d¡t |dtƒr¨d|dvrb|  d|  d¡¡nDd|dvr’d|dvr’|dd|dd<|  d|  d¡¡n|  d|  d¡¡|  d¡|  dd¡râ|  dd¡|  dd¡r|  d¡t ||  d¡||¡|  d ¡|  d!d¡rZ|  d"¡|  t t |  d!¡¡|¡¡|  d ¡|  d#d¡rÊ|  d$¡|d#D]4} |  tjt | ¡|d%|dd&…d'|d ¡qz|  d ¡|  d ¡|d#=|  d(d¡rb|  d)¡|d(D]Z} d*| vrè|  tjt d+| d*¡|d%|dd&…d'|d ¡|   d ¡} | dur`| d* d,¡r`d-| d*} | dur”|  tjt | ¡|d%|d.|d.d ¡| d* d,¡rDd/| d* d0d1d2¡}|  tjt t|ƒ¡|d%|d.|d ¡qêd| vr–d3| vr–d | vr–|  tjt | d¡|d%|dd&…d'|d ¡|  tjt | d ¡|d%|d.|d.d ¡|  tjt | d3¡|d%|d.|d.d ¡n®d4| vrêd | vrê|  tjt d5| d4¡|d%|dd&…d'|d ¡|  tjt | d ¡|d%|d.|d.d ¡|  tjt td6| d4ƒ¡|d%|d.|d.d ¡qê|  d ¡|  d ¡|d(=|  d7d¡r¦d8 |  d7¡¡}|  d9tjt |¡|d:d;|d ¡t|ƒD]Ô}|tjvs®||sÌq®t ||tƒr|  d<|  ¡tjt ||¡|t|ƒd2|d=f¡nZt ||ttfƒrL|  d<|  ¡d8 ||¡f¡n$|  t t |  ¡||i¡d ¡¡||=|  d ¡q®|  d>d¡r2|  d?¡|  d ¡t |d>tƒrÌ|  |  d>¡ ¡¡nRz|  t|  d>¡d2dd@¡Wn2t y}zt!dA|dB‚WYd}~n d}~00|  d ¡|  d ¡|  dCd¡rd|  dD¡tj||  dC¡||dEdFd |¡S)GNr´rjrkrlr'r/rrmrârîrnrorPrrz ADDED IN: %s r,Fz DEPRECATED: Zremoved_at_datezg Reason: %(why)s Will be removed in a release after %(removed_at_date)s Alternatives: %(alternative)sr*Z removed_inz[ Reason: %(why)s Will be removed in: Ansible %(removed_in)s Alternatives: %(alternative)sz%sr×r5z * note: %s z.This module has a corresponding action plugin.rËrprrrqrrZnoteszNOTES:ééþÿÿÿz* Zseealsoz SEE ALSO:r'z Module %szansible.builtin.z,The official documentation on the %s module.z zcollections/%s_module.htmlrer/rsÚlinkÚrefzAnsible documentation [%s]z/#stq=%s&stp=1Z requirementsr½zREQUIREMENTS:%s éz r[rtr‘z EXAMPLES:)rJrDz Unable to parse examples sectionrFr’zRETURN VALUES:T)rf)"r)rŽr`rrÚr+rÙrØrurNrÝrar\r<rärIr^r_r«rLrbrKr"rÜr0r"rÛrrgrvr3rr‚r )rzr&r/rer8rwrdr,r¬rrZnoterXrîZ relative_urlZreqrr9r1r1r2r8“sò &  ÿ      ÿ       ÿ     ÿ   ÿÿ ÿÿÿ ÿÿÿ   & :"$  "   zDocCLI.get_man_text)N)FT)F)N)Frr)rrrr)5r‰rŠr‹rŒr'r`ÚreÚcompilerœržrŸr¡r r¢r£r¤r§r¦r¨r©r•Ú classmethodršr«rÂrÉrãræréÚ staticmethodrìrrr rr€rrr$r.r*r rr!r rCr"rKrLrbrçr8Ú __classcell__r1r1r—r2rŽ]s|                4 -!   C  +  l      '     X=rŽc Csfg}t |d¡}| d¡}|r>| d|¡| d|¡n| d| d| d¡¡¡d}d  |d ¡}tj|}t|d  ¡ƒD]Ú}|d |}t |d t ƒr´t |d ¡} nt d   |d ¡¡} | dd¡} t | t ƒsêt d| ƒ‚d|}|r&| rd| } | d|tj| ||df¡q†| r2d} n | dd¡} | d|| tj| ||ddf¡q†|S)Nrqr'z - name: %sz %s:z# %s:r¯r'éz# rsrËrîrnrMFú7Incorrect value for 'Required', a boolean is needed: %sz%s:z (required) %sz %-20s # %srtz (required)r¶ÚNonez %s %-9s # %srf)rRZ max_lines)rŽr«rNrÝÚrjustr+rÙrÛrsr<rrIrr r^r_) rzr8Zmdescr'rwZsubdentrdrgrhr¬rMr¶r1r1r2r7s8        $r7c Csg}d| d| d¡¡}g}t|d ¡ƒD]²}|d|}| d|| dd¡| dd ¡f¡|d vrx|d |7}q.| d d ¡}t|tƒsštd|ƒ‚|r¤d}n | dd¡}| d¡dvrÐ|d||f7}q.|d||f7}q.|d7}|r| |¡| d ¡| |¡|S)Nz lookup('%s', r¯r'rËz # %s(%s): %sr´rïrîrr)Z_termsZ_rawZ_listz< %s >rMFrƒz r¶r„)rïÚstrz , %s='%s'z, %s=%sú))rNrÛrsrÝr<rr rÞ)rzr8ZsnippetZcommentrgrhrMr¶r1r1r2r6Ls0 $        r6cCst |¡dSr“)rŽZ cli_executor)r–r1r1r2rArsrAÚ__main__)N)N)SZ __future__rrrr´Z __metaclass__Z ansible.clirrêrGZos.pathr}r^r6Zansible.plugins.loaderrr rÚpathlibrrÓrrrZansible.cli.argumentsr rÃZansible.collections.listr Zansible.errorsr r r rZansible.module_utils._textrrZ'ansible.module_utils.common.collectionsrZ ansible.module_utils.common.jsonrZ ansible.module_utils.common.yamlrZansible.module_utils.compatrZansible.module_utils.sixrZansible.parsing.plugin_docsrZansible.parsing.utils.yamlrZansible.parsing.yaml.dumperrZansible.plugins.listrrrZansible.utils.collection_loaderrrZ2ansible.utils.collection_loader._collection_finderrZansible.utils.displayrZansible.utils.plugin_docsr r!r"r+rrÆrórôrÈr3r:Úobjectr;rŽr7r6rAr‰r1r1r1r2Úsj                   I-&