관리-도구
편집 파일: __init__.cpython-39.pyc
a �)gu% � @ s� d dl mZmZmZ eZd dlZd dlZd dlZd dl Z d dl Z d dlZd dlm Z d dlmZ d dlmZmZ d dlmZmZ d dlmZ e �d�ZG d d � d e�ZdS )� )�absolute_import�division�print_functionN)�AnsibleError)� to_native)� text_type�string_types)�Mapping�Sequence)� AnsiblePluginz^~[_.A-Za-z0-9][-_.A-Za-z0-9]*$c s� e Zd Z� fdd�Zdd� Zd/� fdd� Zedd � �Zd d� Zdd � Z dd� Z dd� Zdd� Zdd� Z dd� Zdd� Zd0dd�Zdd� Zd1d d!�Zd2d#d$�Zd%d&� Zd3d'd(�Zd)d*� Zd+d,� Zd-d.� Z� ZS )4� ShellBasec s$ t t| ��� i | _d | _d | _d S �N)�superr �__init__�env�tmpdir� executable��self�� __class__� �B/usr/lib/python3.9/site-packages/ansible/plugins/shell/__init__.pyr % s zShellBase.__init__c C sH dd� | � d�D �}tdd� |D ��s8td�t|����| �d|� d S )Nc S s g | ]}|� d ��qS )�/)�rstrip��.0�dr r r � <listcomp>1 � z7ShellBase._normalize_system_tmpdirs.<locals>.<listcomp>�system_tmpdirsc s s | ]}t j�|�V qd S r )�os�path�isabsr r r r � <genexpr>5 r z6ShellBase._normalize_system_tmpdirs.<locals>.<genexpr>z`The configured system_tmpdirs contains a relative path: {0}. All system_tmpdirs must be absolute)� get_option�allr �formatr Z set_option)r Znormalized_pathsr r r �_normalize_system_tmpdirs- s �z#ShellBase._normalize_system_tmpdirsNc s� t t| �j|||d� | �d�}t|t�r2td��t|t�sB|g}|D ]*}t|t�sdtdt |� ��| j �|� qFz| �� W n t y� Y n0 d S )N)� task_keys�var_options�directZenvironmentzUThe "envirionment" keyword takes a list of dictionaries or a dictionary, not a stringzfThe "envirionment" keyword takes a list of dictionaries (or single dictionary), but got a "%s" instead)r r �set_optionsr% � isinstancer r r r �typer �updater( �KeyError)r r) r* r+ r Zenv_dictr r r r, ; s zShellBase.set_optionsc C s dt � � t�� t�dd�f S )Nzansible-tmp-%s-%s-%sr l )�timer! �getpid�randomZrandintr r r r �_generate_temp_dir_nameS s z!ShellBase._generate_temp_dir_namec K s d� dd� |�� D ��S )N� c S s&