관리-도구
편집 파일: option_helpers.cpython-39.opt-1.pyc
a �����)g�F����������������������@���s���d�dl�mZmZmZ�eZd�dlZd�dlZd�dlZd�dl Z d�dl Z d�dlZd�dlZd�dl mZ�d�dlZd�dlmZ�d�dlmZ�d�dlmZmZ�d�dlmZ�d�dlmZ�G�dd ��d ej�ZG�d d��dej�ZG�dd ��d ej�ZG�dd��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��unfrackpathc�����������������������s���e�Zd�Z��fdd�Z���ZS�)�SortingHelpFormatterc��������������������s&���t�|t�d�d�}tt|���|��d�S�)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.pyr������s����z"SortingHelpFormatter.add_arguments)�__name__� __module__�__qualname__r���� __classcell__r���r���r���r���r������s���r���c�������������������@���s���e�Zd�Zddd�ZdS�)�AnsibleVersionNc�����������������C���s&���t�tt|d���}t|��|����d�S�)N�prog)r����version�getattr�print�exit)r����parser� namespace�values� option_stringZansible_versionr���r���r����__call__#���s����zAnsibleVersion.__call__)N)r���r���r���r(���r���r���r���r���r���"���s���r���c�����������������������s(���e�Zd�Zd ��fdd� Zd dd�Z���ZS�)�UnrecognizedArgumentTNFr���c ����������� ��� ������s"���t�t|��j|||||||d��d�S�)N)r ����dest�nargs�const�default�required�help)r���r)����__init__) r���r ���r*���r,���r-���r.���r/����metavarr+���r���r���r���r0���*���s�����zUnrecognizedArgument.__init__c�����������������C���s���|��d|���d�S�)Nzunrecognized arguments: %s)�error)r���r$���r%���r&���r'���r���r���r���r(���.���s����zUnrecognizedArgument.__call__)TNFNNr���)N)r���r���r���r0���r(���r���r���r���r���r���r)���)���s���r)���c�����������������������s,���e�Zd�ZdZd��fdd� Zd dd�Z���ZS�) �PrependListActionznA near clone of ``argparse._AppendAction``, but designed to prepend list values instead of appending. NFc��������������������sX���|dkrt�d��|d�ur0|tjkr0t�dtj���tt|��j||||||||| | d� �d�S�)Nr���z�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�OPTIONALr���r3���r0���)r���r ���r*���r+���r,���r-���r4���r5���r.���r/���r1���r���r���r���r0���6���s ���� �zPrependListAction.__init__c�����������������C���s2���t���t||�jg���}||dd�<�t||�j|��d�S�)Nr���)�copy�ensure_valuer*����setattr)r���r$���r%���r&���r'����itemsr���r���r���r(���K���s����zPrependListAction.__call__)NNNNNFNN)N)r���r���r����__doc__r0���r(���r���r���r���r���r���r3���2���s ������r3���c�����������������C���s&���t�|�|d��d�u�rt|�||��t�|�|�S�)N)r!���r;���)r%����name�valuer���r���r���r:���Q���s����r:���FTc��������������������s������fdd�}|S�)z=Turn an Option's data into a single path in Ansible locationsc��������������������s6����r��fdd�|���tj�D��S�|�dkr*|�S�t|���d�S�)Nc��������������������s���g�|�]}|rt�|��d���qS�)��followr ���)�.0�xr@���r���r���� <listcomp>^��������z/unfrack_path.<locals>.inner.<locals>.<listcomp>�-r@���)�split�os�pathsepr����r?����rA���rI���r���r����inner\���s ����zunfrack_path.<locals>.innerr���)rI���rA���rL���r���rK���r����unfrack_pathZ���s����rM���c��������������������s�����fdd�}|S�)Nc��������������������s"���|������r��t|�dd�����S�|�S�)N����)� startswithr���rJ�����beaconr���r���rL���i���s���� z!maybe_unfrack_path.<locals>.innerr���)rQ���rL���r���rP���r����maybe_unfrack_pathg���s����rR���c����������� ��� ���C���s���d}t�j�|���r�t�j�|��r�zbt|���}t|��d�}W�d����n1�sL0����Y��t�j�|�rh|}�nt�j�|�dd��|�}�W�n�t t fy����Y�dS�0�tt�j�|�d���D}|����d�}|� d�r�t�j�|�|dd���}nd}W�d����n1�s�0����Y��|�rht�j�|��rhd �|�d �d d���}t|�� }|���dd��}W�d����n1��s\0����Y��n|dd��}d}t�j�|�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 HEADr���z)({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�rstriprO���rG����time� localtime�stat�st_mtime�daylight�timezone�altzone�format�strftime�int) � repo_path�result�frS����lineZbranch_path�branchZcommit�date�offsetr���r���r����_git_repo_infop���s<���� , " 2"rw���c��������������� ���C���s:���t�j�t�j�t�j�t�dddd��}�t�j�|�d�}t|�S�)Nz..z.git)rH���r[����normpathra����dirname�__file__rw���)�basedirrp���r���r���r����_gitinfo����s����$r|���c�����������������C���s����|�rd��|�t�g}ntg}t��}|r8d��|d�|�|d<�|�dtj���tjdu�rXd}ntj}|�d|���|�dd �tj ����|�d d �tj ����|�dtjd����|�dd �tj ����ttj�f���|�dt���|�dt���d�|�S�)z return ansible version z{0} [core {1}]z{0} {1}r���z 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)rU���z jinja version = %sz libyaml = %srV���)rm���r���r|����append�CZCONFIG_FILE�DEFAULT_MODULE_PATHra����ansible�__path__ZCOLLECTIONS_PATHS�sys�argvr ���� splitlinesr���� executable� j2_versionr���)r���rq���ZgitinfoZcpathr���r���r���r �������s$���� $r ���rU���c�����������������C���s6���t�j|�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$���Zversion_helpr���r���r����create_base_parser����s�����r����c�����������������C���s���|�j�dddtjddd��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����r���ZDEFAULT_VERBOSITY�r$���r���r���r���r��������s�����r����c�����������������C���s8���|�j�ddtjtddtj�d��|�j�dddtd d d��dS�) z5Add options for commands which can launch async tasksz-Pz--pollZ poll_intervalz.set the poll interval if using -B (default=%s)�r-���r4���r*���r/���z-Bz--backgroundZsecondsr���z9run asynchronously, failing after X seconds (default=N/A))r*���r4���r-���r/���N)r����r���ZDEFAULT_POLL_INTERVALro���r����r���r���r����add_async_options����s������r����c�����������������C���s���|�j�dtjdddt��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/���r4���N)r����r���ZPLAYBOOK_DIRrM���r����r���r���r����add_basedir_options����s�����r����c�����������������C���s2���|�j�ddddddd��|�j�dd tjd ddd��dS�) 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����r���ZDIFF_ALWAYSr����r���r���r����add_check_options����s������r����c�������������� ���C���s��|���dd�}|jddtjddt��d��|jdd tjd dtj�d��|jd ddtjdtj�d��|jddtjtddtj�d��|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/���r4���z-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/���r4���r����)�add_argument_groupr����r���ZDEFAULT_PRIVATE_KEY_FILErM���ZDEFAULT_REMOTE_USERZDEFAULT_TRANSPORTZDEFAULT_TIMEOUTro����add_mutually_exclusive_groupZDEFAULT_ASK_PASSZCONNECTION_PASSWORD_FILE)r$���Z connect_groupZconnect_password_groupr���r���r����add_connect_options����sD�������� � � � � ��r����c�����������������C���s"���|�j�dddtjtdtj�d��dS�)z7Add options for commands that can fork worker processesz-fz--forksZforksz8specify number of parallel processes to use (default=%s))r*���r-���r4���r/���N)r����r���Z DEFAULT_FORKSro���r����r���r���r����add_fork_options��s�����r����c�����������������C���sB���|�j�ddddddd��|�j�dd d dd��|�j�dd 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����r���ZDEFAULT_SUBSETr����r���r���r����add_inventory_options��s����� ��r����c�����������������C���s,���|�j�dtjdddd��|�j�ddddd ��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����r���ZDEFAULT_FORCE_HANDLERSr����r���r���r����add_meta_options%��s����� �r����c�������������� ���C���s:���t�j�d��dd�}|�jddddd|�td d �td��dS�)z*Add options for commands that load modulesr����r-���rU���z-Mz --module-path�module_pathNz>prepend colon-separated path(s) to module library (default=%s)T)rI���)r*���r-���r/���r4���r����)r���ZconfigZget_configuration_definitionr_���r����rM���r3���)r$���r����r���r���r����add_module_options-��s ���� �r����c�����������������C���s,���|�j�dddddd��|�j�ddd 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����r���r���r����add_output_options5��s������r����c�����������������C���sr���|���dd�}|jddtjdddd��|jd d tjdtj�d�d ��|jdddtdtj�d��|���|��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*���r4���r/���)r����r����r���ZDEFAULT_BECOMEZDEFAULT_BECOME_METHOD�strZDEFAULT_BECOME_USER�add_runas_prompt_options)r$����runas_groupr���r���r����add_runas_options=��s�������� r����c�������������� ���C���s\���|dur|���|��|����}|jddddtjdd��|jdd tjd dt��dd ��|���|��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����r���ZDEFAULT_BECOME_ASK_PASSZBECOME_PASSWORD_FILErM���)r$���r����Zrunas_pass_groupr���r���r���r����T��s���� ��r����c�������������� ���C���s ���|�j�ddddtd�dg�d��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����r4���r/���r-���N)r����rR���r����r���r���r����add_runtask_optionsi��s�����r����c�����������������C���s���|�j�dtddtjdd��dS�)z;Add options for commands that run a task w/o a defined playz--task-timeoutZtask_timeoutr����z<set task timeout limit in seconds, must be positive integer.)r4���r*���r����r-���r/���N)r����ro���r���ZTASK_TIMEOUTr����r���r���r����add_tasknoplay_optionso��s�����r����c�����������������C���s2���|�j�dddtjddd��|�j�ddtjdd 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����r���ZTAGS_RUNZ TAGS_SKIPr����r���r���r����add_subset_optionsu��s������r����c�������������� ���C���sX���|�j�dg�ddtdd��|����}|j�ddtjdd d d��|j�dd g�ddtdd�dd��dS�)z#Add options for loading vault filesz --vault-idZ vault_idsr~���zthe vault identity to use)r-���r*���r����r4���r/���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����r���ZDEFAULT_ASK_VAULT_PASSrM���)r$���Z base_groupr���r���r����add_vault_options}��s�������r����)FT)N)rU���NN)N)8Z __future__r���r���r���r4���Z __metaclass__r9���r���r7���rH���Zos.pathr����rf���Zjinja2r���r����r����r���r���Zansible.module_utils._textr���Z ansible.module_utils.common.yamlr���r ���Zansible.releaseZansible.utils.pathr���� HelpFormatterr����Actionr���r)���r3���r:���rM���rR���rw���r|���r ���r����r����r����r����r����r����r����r����r����r����r����r����r����r����r����r����r����r���r���r���r����<module>���sT��� + "