File: //lib/python3.9/site-packages/ansible/plugins/become/__pycache__/su.cpython-39.pyc
a
�)g� � @ sX d dl mZmZmZ eZdZd dlZd dlZd dl m
Z
d dlmZ G dd� de�Z
dS )� )�absolute_import�division�print_functionaV
name: su
short_description: Substitute User
description:
- This become plugin allows your remote/login user to execute commands as another user via the su utility.
author: ansible (@core)
version_added: "2.8"
options:
become_user:
description: User you 'become' to execute the task
default: root
ini:
- section: privilege_escalation
key: become_user
- section: su_become_plugin
key: user
vars:
- name: ansible_become_user
- name: ansible_su_user
env:
- name: ANSIBLE_BECOME_USER
- name: ANSIBLE_SU_USER
keyword:
- name: become_user
become_exe:
description: Su executable
default: su
ini:
- section: privilege_escalation
key: become_exe
- section: su_become_plugin
key: executable
vars:
- name: ansible_become_exe
- name: ansible_su_exe
env:
- name: ANSIBLE_BECOME_EXE
- name: ANSIBLE_SU_EXE
keyword:
- name: become_exe
become_flags:
description: Options to pass to su
default: ''
ini:
- section: privilege_escalation
key: become_flags
- section: su_become_plugin
key: flags
vars:
- name: ansible_become_flags
- name: ansible_su_flags
env:
- name: ANSIBLE_BECOME_FLAGS
- name: ANSIBLE_SU_FLAGS
keyword:
- name: become_flags
become_pass:
description: Password to pass to su
required: False
vars:
- name: ansible_become_password
- name: ansible_become_pass
- name: ansible_su_pass
env:
- name: ANSIBLE_BECOME_PASS
- name: ANSIBLE_SU_PASS
ini:
- section: su_become_plugin
key: password
prompt_l10n:
description:
- List of localized strings to match for prompt detection
- If empty we'll use the built in one
- Do NOT add a colon (:) to your custom entries. Ansible adds a colon at the end of each prompt;
if you add another one in your string, your prompt will fail with a "Timeout" error.
default: []
type: list
elements: string
ini:
- section: su_become_plugin
key: localized_prompts
vars:
- name: ansible_su_prompt_l10n
env:
- name: ANSIBLE_SU_PROMPT_L10N
N��to_bytes)�
BecomeBasec s4 e Zd ZdZdZg d�Zdd� Z� fdd�Z� ZS )�BecomeModuleZsu)zAuthentication failure) ZPasswordu 암호u パスワードZAdgangskodeu ContraseñaZContrasenyau HasłoZHeslou Jelszóu Lösenordu Mật khẩuzMot de passeZParolaZParoolZ PasahitzaZPassordZPasswortZSalasanaZSandiZSenhaZ
Wachtwoordu ססמהu Лозинкаu Паролаu Парольu गुप्तशब्दu शब्दकूटu సంకేతపదముu හස්පදයu 密码u 密碼u 口令c C sN | � d�p| j}d�dd� |D ��}|td� }tj|tjd�}t|�|��S )z; checks if the expected password prompt exists in b_output Zprompt_l10n� |c s s | ]}d t |� V qdS )s
(\w+\'s )?Nr )�.0�p� r �=/usr/lib/python3.9/site-packages/ansible/plugins/become/su.py� <genexpr>� � z5BecomeModule.check_password_prompt.<locals>.<genexpr>u ?(:|:) ?)�flags) �
get_option�SU_PROMPT_LOCALIZATIONS�joinr �re�compile�
IGNORECASE�bool�match)�selfZb_outputZpromptsZb_password_stringZb_su_prompt_localizations_rer r r
�check_password_prompt� s
z"BecomeModule.check_password_promptc sn t t| ��||� d| _|s |S | �d�p.| j}| �d�p<d}| �d�pJd}| �||�}d|||t�|�f S )NTZ
become_exeZbecome_flags� Zbecome_userz%s %s %s -c %s) �superr �build_become_command�promptr �nameZ_build_success_command�shlex�quote)r �cmd�shellZexer �userZsuccess_cmd�� __class__r r
r � s z!BecomeModule.build_become_command) �__name__�
__module__�__qualname__r Zfailr r r �
__classcell__r r r% r
r e s
#
r )Z
__future__r r r �typeZ
__metaclass__Z
DOCUMENTATIONr r Zansible.module_utils._textr Zansible.plugins.becomer r r r r r
�<module> s W