%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3.9/site-packages/ansible/cli/arguments/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3.9/site-packages/ansible/cli/arguments/__pycache__/option_helpers.cpython-39.opt-1.pyc

a

�)g�F�@s�ddlmZmZmZeZddlZddlZddlZddl	Z	ddl
Z	ddlZddlZddl
mZddlZddlmZddlmZddlmZmZddlmZddlmZGdd	�d	ej�ZGd
d�dej�ZGdd
�d
ej�ZGdd�dej�Z dd�Z!dAdd�Z"dd�Z#dd�Z$dd�Z%dBdd�Z&dCdd �Z'd!d"�Z(d#d$�Z)d%d&�Z*d'd(�Z+d)d*�Z,d+d,�Z-d-d.�Z.d/d0�Z/d1d2�Z0d3d4�Z1d5d6�Z2dDd7d8�Z3d9d:�Z4d;d<�Z5d=d>�Z6d?d@�Z7dS)E�)�absolute_import�division�print_functionN)�__version__)�	constants)�	to_native)�HAS_LIBYAML�	yaml_load��unfrackpathcseZdZ�fdd�Z�ZS)�SortingHelpFormattercs&t|t�d�d�}tt|��|�dS)N�option_strings)�key)�sorted�operator�
attrgetter�superr�
add_arguments)�self�actions��	__class__��H/usr/lib/python3.9/site-packages/ansible/cli/arguments/option_helpers.pyrsz"SortingHelpFormatter.add_arguments)�__name__�
__module__�__qualname__r�
__classcell__rrrrrsrc@seZdZddd�ZdS)�AnsibleVersionNcCs&ttt|d���}t|�|��dS)N�prog)r�version�getattr�print�exit)r�parser�	namespace�values�
option_stringZansible_versionrrr�__call__#szAnsibleVersion.__call__)N)rrrr(rrrrr"srcs(eZdZd	�fdd�	Zd
dd�Z�ZS)�UnrecognizedArgumentTNFrc			s"tt|�j|||||||d�dS)N)r
�dest�nargs�const�default�required�help)rr)�__init__)	rr
r*r,r-r.r/�metavarr+rrrr0*s�zUnrecognizedArgument.__init__cCs|�d|�dS)Nzunrecognized arguments: %s)�error)rr$r%r&r'rrrr(.szUnrecognizedArgument.__call__)TNFNNr)N)rrrr0r(rrrrrr))sr)cs,eZdZdZd�fdd�	Zd	dd�Z�ZS)
�PrependListActionznA near clone of ``argparse._AppendAction``, but designed to prepend list values
    instead of appending.
    NFcsX|dkrtd��|dur0|tjkr0tdtj��tt|�j|||||||||	|
d�
dS)Nrz�nargs for append actions must be > 0; if arg strings are not supplying the value to append, the append const action may be more appropriatez nargs must be %r to supply const)
r
r*r+r,r-�type�choicesr.r/r1)�
ValueError�argparse�OPTIONALrr3r0)rr
r*r+r,r-r4r5r.r/r1rrrr06s 
�zPrependListAction.__init__cCs2t�t||jg��}||dd�<t||j|�dS)Nr)�copy�ensure_valuer*�setattr)rr$r%r&r'�itemsrrrr(KszPrependListAction.__call__)NNNNNFNN)N)rrr�__doc__r0r(rrrrrr32s
�r3cCs&t||d�durt|||�t||�S)N)r!r;)r%�name�valuerrrr:Qsr:FTcs��fdd�}|S)z=Turn an Option's data into a single path in Ansible locationscs6�r�fdd�|�tj�D�S|dkr*|St|�d�S)Ncsg|]}|rt|�d��qS)��followr
)�.0�xr@rr�
<listcomp>^�z/unfrack_path.<locals>.inner.<locals>.<listcomp>�-r@)�split�os�pathsepr�r?�rArIrr�inner\s
zunfrack_path.<locals>.innerr)rIrArLrrKr�unfrack_pathZsrMcs�fdd�}|S)Ncs"|���r�t|dd��S|S)N�)�
startswithrrJ��beaconrrrLis
z!maybe_unfrack_path.<locals>.innerr)rQrLrrPr�maybe_unfrack_pathgsrRc
	Cs�d}tj�|��r�tj�|�r�zbt|��}t|��d�}Wd�n1sL0Ytj�|�rh|}ntj�|dd�|�}Wnt	t
fy�YdS0ttj�|d���D}|���d�}|�
d�r�tj�||dd��}nd}Wd�n1s�0Y|�rhtj�|��rhd	�|�d	�d
d��}t|�� }|��dd�}Wd�n1�s\0Yn|dd�}d}tj�|d�}t�t�|�j�}tjd
k�r�tj}	ntj}	d�||t�d|�t|	d��}nd}|S)zC returns a string containing git branch, commit id and commit date N�gitdir����ZHEAD�
zref:��/��
z
detached HEADrz)({0} {1}) last updated {2} (GMT {3:+04d})z%Y/%m/%d %H:%M:%Si���)rH�path�exists�isfile�openr	�get�isabs�join�IOError�AttributeError�readline�rstriprOrG�time�	localtime�stat�st_mtime�daylight�timezone�altzone�format�strftime�int)
�	repo_path�result�frS�lineZbranch_path�branchZcommit�date�offsetrrr�_git_repo_infops<
,
"
2"rwc	Cs:tj�tj�tj�t�dddd��}tj�|d�}t|�S)Nz..z.git)rHr[�normpathra�dirname�__file__rw)�basedirrprrr�_gitinfo�s$r|cCs�|rd�|t�g}ntg}t�}|r8d�|d|�|d<|�dtj�tjdurXd}ntj}|�d|�|�dd	�tj	��|�d
d	�tj
��|�dtjd�|�dd
�tj
���ttj�f�|�dt�|�dt�d�|�S)z return ansible version z{0} [core {1}]z{0} {1}rz  config file = %sNzDefault w/o overridesz$  configured module search path = %sz%  ansible python module location = %s�:z"  ansible collection location = %sz  executable location = %sz  python version = %s (%s)rUz  jinja version = %sz  libyaml = %srV)rmrr|�append�CZCONFIG_FILE�DEFAULT_MODULE_PATHra�ansible�__path__ZCOLLECTIONS_PATHS�sys�argvr �
splitlinesr�
executable�
j2_versionr)rrqZgitinfoZcpathrrrr �s$
$r rUcCs6tj|t||dd�}d}|jdtd|d�t|�|S)z:
    Create an options parser for all ansible scripts
    �resolve)r�formatter_class�epilog�description�conflict_handlerz�show program's version number, config file location, configured module search path, module location, executable location and exitz	--versionr)�actionr+r/)r7�ArgumentParserr�add_argumentr�add_verbosity_options)r�usageZdescr�r$Zversion_helprrr�create_base_parser�s�r�cCs|jdddtjddd�dS)zAdd options for verbosityz-vz	--verbose�	verbosity�countz�Causes Ansible to print more debug messages. Adding multiple -v will increase the verbosity, the builtin plugins currently evaluate up to -vvvvvv. A reasonable level to start is -vvv, connection debugging might require -vvvv.�r*r-r�r/N)r�rZDEFAULT_VERBOSITY�r$rrrr��s�r�cCs8|jddtjtddtjd�|jdddtd	d
d�dS)
z5Add options for commands which can launch async tasksz-Pz--pollZ
poll_intervalz.set the poll interval if using -B (default=%s)�r-r4r*r/z-Bz--backgroundZsecondsrz9run asynchronously, failing after X seconds (default=N/A))r*r4r-r/N)r�rZDEFAULT_POLL_INTERVALror�rrr�add_async_options�s��r�cCs|jdtjdddt�d�dS)z9Add options for commands which can set a playbook basedirz--playbook-dirr{�storez�Since this tool does not use playbooks, use this as a substitute playbook directory. This sets the relative path for many features including roles/ group_vars/ etc.)r-r*r�r/r4N)r�rZPLAYBOOK_DIRrMr�rrr�add_basedir_options�s�r�cCs2|jddddddd�|jdd	tjd
ddd�dS)
zKAdd options for commands which can run with diagnostic information of tasksz-Cz--checkF�check�
store_truezRdon't make any changes; instead, try to predict some of the changes that may occur�r-r*r�r/z-Dz--diff�diffzhwhen changing (small) files and templates, show the differences in those files; works great with --checkN)r�rZDIFF_ALWAYSr�rrr�add_check_options�s��r�c	Cs|�dd�}|jddtjddt�d�|jdd	tjd
dtjd�|jd
ddtjdtjd�|jddtjtddtjd�|jddddd�|jddddd�|jdddd d�|jd!dd"d#d�|�|�|�	�}|jd$d%tj
d&d'd(d)�|jd*d+tjd,d-t�d.d/�|�|�dS)0z@Add options for commands which need to connection to other hostszConnection Optionsz+control as whom and how to connect to hostsz
--private-keyz
--key-fileZprivate_key_filez,use this file to authenticate the connection)r-r*r/r4z-uz--userZremote_userz!connect as this user (default=%s)�r-r*r/z-cz--connectionZ
connectionz#connection type to use (default=%s)�r*r-r/z-Tz	--timeout�timeoutz7override the connection timeout in seconds (default=%s)r�z--ssh-common-argsNZssh_common_argszDspecify common arguments to pass to sftp/scp/ssh (e.g. ProxyCommand)z--sftp-extra-argsZsftp_extra_argsz:specify extra arguments to pass to sftp only (e.g. -f, -l)z--scp-extra-argsZscp_extra_argsz5specify extra arguments to pass to scp only (e.g. -l)z--ssh-extra-argsZssh_extra_argsz5specify extra arguments to pass to ssh only (e.g. -R)z-kz
--ask-passZask_passr�zask for connection passwordr�z--connection-password-filez--conn-pass-fileZconnection_password_filezConnection password filer��r-r*r/r4r�)�add_argument_groupr�rZDEFAULT_PRIVATE_KEY_FILErMZDEFAULT_REMOTE_USERZDEFAULT_TRANSPORTZDEFAULT_TIMEOUTro�add_mutually_exclusive_groupZDEFAULT_ASK_PASSZCONNECTION_PASSWORD_FILE)r$Z
connect_groupZconnect_password_grouprrr�add_connect_options�sD����
�
�
�
�
��r�cCs"|jdddtjtdtjd�dS)z7Add options for commands that can fork worker processesz-fz--forksZforksz8specify number of parallel processes to use (default=%s))r*r-r4r/N)r�rZ
DEFAULT_FORKSror�rrr�add_fork_optionss�r�cCsB|jddddddd�|jdd	d
dd�|jdd
tjddd�dS)z/Add options for commands that utilize inventoryz-iz--inventoryz--inventory-fileZ	inventoryr~zXspecify inventory host path or comma separated host list. --inventory-file is deprecated�r*r�r/z--list-hostsZ	listhostsr�z@outputs a list of matching hosts; does not execute anything elsez-lz--limitZsubsetz5further limit selected hosts to an additional patternr�N)r�rZDEFAULT_SUBSETr�rrr�add_inventory_optionss�
��r�cCs,|jdtjdddd�|jddddd	�d
S)zJAdd options for commands which can launch meta tasks from the command linez--force-handlersZforce_handlersr�z!run handlers even if a task failsr�z
--flush-cacheZflush_cachez0clear the fact cache for every host in inventoryr�N)r�rZDEFAULT_FORCE_HANDLERSr�rrr�add_meta_options%s�
�r�c	Cs:tj�d��dd�}|jddddd|td	d
�td�dS)z*Add options for commands that load modulesr�r-rUz-Mz
--module-path�module_pathNz>prepend colon-separated path(s) to module library (default=%s)T)rI)r*r-r/r4r�)rZconfigZget_configuration_definitionr_r�rMr3)r$r�rrr�add_module_options-s

�r�cCs,|jdddddd�|jddd	d
dd�d
S)
z6Add options for commands which can change their outputz-oz
--one-lineZone_liner�zcondense outputr��-tz--treeZtreeNzlog output to this directoryr�)r�r�rrr�add_output_options5s��r�cCsr|�dd�}|jddtjdddd�|jd	d
tjdtjdd
�|jdddtdtjd�|�|�t|�dS)z�
    Add options for commands which can run tasks as another user

    Note that this includes the options from add_runas_prompt_options().  Only one of these
    functions should be used.
    zPrivilege Escalation Optionsz8control how and which user you become as on target hostsz-bz--becomer�Zbecomez>run operations with become (does not imply password prompting))r-r�r*r/z--become-methodZ
become_methodz/privilege escalation method to use (default=%s)z7, use `ansible-doc -t become -l` to list valid choices.r�z
--become-userNZbecome_userz(run operations as this user (default=%s))r-r*r4r/)r�r�rZDEFAULT_BECOMEZDEFAULT_BECOME_METHOD�strZDEFAULT_BECOME_USER�add_runas_prompt_options)r$�runas_grouprrr�add_runas_options=s����
r�c	Cs\|dur|�|�|��}|jddddtjdd�|jdd	tjd
dt�dd
�|�|�dS)z�
    Add options for commands which need to prompt for privilege escalation credentials

    Note that add_runas_options() includes these options already.  Only one of the two functions
    should be used.
    Nz-Kz--ask-become-passZbecome_ask_passr�z%ask for privilege escalation password)r*r�r-r/z--become-password-filez--become-pass-fileZbecome_password_filezBecome password filer�r�)r�r�r�rZDEFAULT_BECOME_ASK_PASSZBECOME_PASSWORD_FILErM)r$r�Zrunas_pass_grouprrrr�Ts
��r�c	Cs |jddddtd�dgd�dS)	z(Add options for commands that run a taskz-ez--extra-varsZ
extra_varsr~�@zNset additional variables as key=value or YAML/JSON, if filename prepend with @)r*r�r4r/r-N)r�rRr�rrr�add_runtask_optionsis�r�cCs|jdtddtjdd�dS)z;Add options for commands that run a task w/o a defined playz--task-timeoutZtask_timeoutr�z<set task timeout limit in seconds, must be positive integer.)r4r*r�r-r/N)r�rorZTASK_TIMEOUTr�rrr�add_tasknoplay_optionsos�r�cCs2|jdddtjddd�|jddtjdd	d�d
S)z8Add options for commands which can run a subset of tasksr�z--tags�tagsr~z1only run plays and tasks tagged with these valuesr�z--skip-tagsZ	skip_tagsz=only run plays and tasks whose tags do not match these valuesN)r�rZTAGS_RUNZ	TAGS_SKIPr�rrr�add_subset_optionsus��r�c	CsX|jdgddtdd�|��}|jddtjdd	d
d�|jdd
gddtdd�dd�dS)z#Add options for loading vault filesz
--vault-idZ	vault_idsr~zthe vault identity to use)r-r*r�r4r/z--ask-vault-passwordz--ask-vault-passZask_vault_passr�zask for vault passwordr�z--vault-password-filez--vault-pass-fileZvault_password_fileszvault password fileFr@r�N)r�r�r�rZDEFAULT_ASK_VAULT_PASSrM)r$Z
base_grouprrr�add_vault_options}s���r�)FT)N)rUNN)N)8Z
__future__rrrr4Z
__metaclass__r9rr7rHZos.pathr�rfZjinja2rr�r�rrZansible.module_utils._textrZ ansible.module_utils.common.yamlrr	Zansible.releaseZansible.utils.pathr�
HelpFormatterr�Actionrr)r3r:rMrRrwr|r r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrr�<module>sT		

	+

	"



Zerion Mini Shell 1.0