| Server IP : 23.254.227.96 / Your IP : 216.73.216.21 Web Server : Apache/2.4.62 (Unix) OpenSSL/1.1.1k System : Linux hwsrv-1277026.hostwindsdns.com 4.18.0-477.13.1.el8_8.x86_64 #1 SMP Tue May 30 14:53:41 EDT 2023 x86_64 User : viralblo ( 1001) PHP Version : 8.1.31 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /usr/lib/python3.6/site-packages/cloudinit/__pycache__/ |
Upload File : |
3
��b�4 � @ s~ d Z ddlZddlZddlZddlmZ eje�Zdd� Z G dd� de
�Zddd�Zdd
d�Z
ddd�Zdd� Zddd�ZdS )z9Common utility functions for interacting with subprocess.� N)�ENOEXECc C s� g }g }g }x�|D ]�}t |t�rT|d dkr:|dd� }q�|d | kr�|jd| � n4t |t�rx|jd| �s�|j|� n|jt|�� q|j|� qW |r�tjd| | dj|�� |r�t dj
| dj|�d���|S ) a� Ensure user-provided commands start with base_command; warn otherwise.
Each command is either a list or string. Perform the following:
- If the command is a list, pop the first element if it is None
- If the command is a list, insert base_command as the first element if
not present.
- When the command is a string not starting with 'base-command', warn.
Allow flexibility to provide non-base-command environment/config setup if
needed.
@commands: List of commands. Each command element is a list or string.
@return: List of 'fixed up' commands.
@raise: TypeError on invalid config item type.
r N� z%s z Non-%s commands in %s config:
%s�
zHInvalid {name} config. These commands are not a string or list:
{errors})�name�errors)�
isinstance�list�insert�str�
startswith�append�LOGZwarning�join� TypeError�format)Zbase_commandZcommands�warningsr Zfixed_commands�command� r �/usr/lib/python3.6/subp.py�prepend_base_command s4
r c @ s0 e Zd ZdZdZddd�Zdd� Zdd d
�ZdS )
�ProcessExecutionErrorzr%(description)s
Command: %(cmd)s
Exit code: %(exit_code)s
Reason: %(reason)s
Stdout: %(stdout)s
Stderr: %(stderr)s�-Nc C s |s| j | _n|| _|s6| r.|tkr.d| _q<d| _n|| _t|t�sP| j | _n|| _|st|d krl| j | _q�|| _n| j|�| _|s�|d kr�| j | _ q�|| _ n| j|�| _ |r�|| _
n| j | _
|| _| j| j
| j�| j
| j�| j
| j�| j
| j �| j
| j�| j
| j
�d� }tj| |� d S )Nz(Exec format error. Missing #! in script?z'Unexpected error while running command.)�description�cmd� exit_code�stdout�stderr�reason)�
empty_attrr r r r �intr r �_indent_textr r �errno�MESSAGE_TMPL�_ensure_string�IOError�__init__) �selfr r r r r r r! �messager r r r% K sB
zProcessExecutionError.__init__c C s t |t�r|j� S |S )z1
if data is bytes object, decode
)r �bytes�decode)r&