| Server IP : 159.223.102.202 / Your IP : 216.73.216.195 Web Server : nginx/1.26.0 System : Linux Gen1-cloudpanel2ubuntu2404-1vcpu-1gb-nyc1-01 6.8.0-31-generic #31-Ubuntu SMP PREEMPT_DYNAMIC Sat Apr 20 00:40:06 UTC 2024 x86_64 User : albasshbotta ( 1021) PHP Version : 8.2.19 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /usr/lib/python3/dist-packages/cloudinit/__pycache__/ |
Upload File : |
�
�f2 �
�B � d Z ddlZddlZddlZddlZddlZddlmZ ddlm Z ddl
mZmZ ej e� Z ej dddg� Zd � Z G d
� de� Zdeee ee f fd
�Zdddddddddd� deeeee ee f defd�Zdd�Zdd�Zd� Zdd�Zy)z9Common utility functions for interacting with subprocess.� N)�ENOEXEC)�
TextIOWrapper)�List�Union�
SubpResult�stdout�stderrc � � g }g }g }|D ]� }t |t � r&|d �|dd }nl|d | k7 rd|j d| � nQt |t � r&|j | � d�� s-|j |� n|j t |� � ��|j |� �� |r't j d| | dj |� � |r+t dj | dj |� �� � �|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 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�LOG�warning�join� TypeError�format)�base_command�commands�warningsr �fixed_commands�commands �0/usr/lib/python3/dist-packages/cloudinit/subp.py�prepend_base_commandr! s
� �"