Dashboard
PHP:
8.2.30
OS:
Linux
User:
dh_nv8b2m
/
/
usr
/
local
/
lib
/
python3.10
/
dist-packages
/
ansible
/
cli
/
__pycache__
📤 Upload
📝 New File
📁 New Folder
Close
Editing: doc.cpython-310.pyc
o O�h � @ sB d dl mZ d dlmZ d dlZd dlZd dlZd dlZd dlZd dl Z d dl Z d dlm m Z d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d d lmZmZmZmZ d d lm Z m!Z! d dl"m#Z# d dl$m%Z% d d l&m'Z' d dl(m)Z) d dl*m+Z+ d dl,m-Z- d dl.m/Z/ d dl0m1Z1 d dlm2Z2m3Z3 d dl4m5Z5m6Z6 d dl7m8Z8 d dl9m:Z: d dl;m<Z< d dl=m>Z>m?Z?m@Z@ e<� ZAejBd ZCg d�ZDi ZEg d�ZFddddd d!d"d#�ZGd$d%d&d&d'�ZHd(d)d*d)d+d(d,�ZId-d.� ZJG d/d0� d0eK�ZLd1d2� ZMd3d4� ZNG d5d6� d6eeL�ZOd7d8� ZPd9d:� ZQd>d;d<�ZReSd=k�reR� dS dS )?� )�annotations)�CLIN)�Path)� constants)�context)�option_helpers)�list_collection_dirs)�AnsibleError�AnsibleOptionsError�AnsibleParserError�AnsiblePluginNotFound)� to_native�to_text)�is_sequence)� json_dump)� yaml_dump)�string_types)�read_docstub)� from_yaml)� AnsibleDumper)�list_plugins)� action_loader�fragment_loader)�AnsibleCollectionConfig�AnsibleCollectionRef)�_get_collection_name_from_path)�stringc)�Display)�get_plugin_docs� get_docstring�get_versioned_doclink)�role�keyword)�Play�Role�Block�Task�Handler)� inventory�lookup�modulez[5mz[1mz[8mz[0mz[0;0mz[7mz[4m)�BLINK�BOLD�HIDE�NORMAL�RESET�REVERSE� UNDERLINEz*%s*z`%s`z[%s])r, r1 �MODULE�PLUGIN�yellow�magenta�cyanz dark gray)r2 �REF�LINK�DEP�CONSTANTr3 c C sL z t � t| �� W d S ty% } zt �t�� � tdt|� ��d }~ww )NzXWe could not convert all the documentation into JSON as there was a conversion issue: %s)�displayr � TypeError�vvv� traceback� format_excr r )�text�e� rB �:/usr/local/lib/python3.10/dist-packages/ansible/cli/doc.py�jdumpN s ��rD c @ s� e Zd ZdZdd� ejD �Zdd� ejD �e Zdd� Zdd� Z d d � Z ddd �Zddd�Zdd� Z dd� Zddd�Zddd�ZdS )� 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. c C � g | ]}d | �qS )�mainrB ��.0rA rB rB rC � <listcomp>^ � zRoleMixin.<listcomp>c C rF )�argument_specsrB rH rB rB rC rJ _ rK c C s� |rt j�|d|d�}nt j�|d�}|D ]}t j�||�}t j�|�r(|} nq|du r/i S z1t|d��!} t| �� |d�} | du rMi } W d � W | S W d � W | S 1 sYw Y W | S ttfyx } z t d||f |d��d}~ww )a� Load and process the YAML for the first found of a set of role files :param str root: The root path to get the files from :param str files: List of candidate file names in order of precedence :param str role_name: The name of the role for which we want the argspec data. :param str collection: collection name or None in case of stand alone roles :returns: A dict that contains the data requested, empty if no data found �roles�metaN�r)� file_namez$Could not read the role '%s' (at %s)��orig_exc) �os�path�join�exists�openr �read�IOError�OSErrorr )�self�root�files� role_name� collection� meta_path�specfile� full_pathrT �f�datarA rB rB rC �_load_role_dataa s6 ��������zRoleMixin._load_role_datac C s | � || j||�}|d= |S )a~ Load the roles metadata from the source file. :param str role_name: The name of the role for which we want the argspec data. :param str role_path: Path to the role/collection root. :param str collection: collection name or None in case of stand alone roles :returns: A dict of all role meta data, except ``argument_specs`` or an empty dict rL )re �ROLE_METADATA_FILES)r[ r^ � role_pathr_ rd rB rB rC �_load_metadata� s zRoleMixin._load_metadatac C sb z| � || j||�}|�di �}W |S ty0 } zd|t|�f |d�}W Y d}~|S d}~ww )a� Load 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 role_path: Path to the role/collection root. :param str collection: collection name or None in case of stand alone 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. rL zFailed to process role (%s): %s)�error� exceptionN)re �ROLE_ARGSPEC_FILES�get� Exceptionr )r[ r^ rg r_ rd rA rB rB rC � _load_argspec� s � ��zRoleMixin._load_argspecNc C s� t � }t � }|D ]G}tj�|�sqt�|�D ]8}tj�||�}| jD ]+}tj�|d|�} tj�| �rM|du s:||v rK||vrK|�|� |�|d|f� nq"qq|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 rN N) �setrS rT �isdir�listdirrU rk rV �add) r[ � role_paths�name_filters�found�found_namesrT �entryrg ra rb rB rB rC �_find_all_normal_roles� s&