%PDF- %PDF-
Direktori : /snap/core20/current/lib/python3/dist-packages/cloudinit/__pycache__/ |
Current File : //snap/core20/current/lib/python3/dist-packages/cloudinit/__pycache__/subp.cpython-38.pyc |
U �f2 � @ s d Z ddlZddlZddlZddlZddlZddlmZ ddlm Z ddl mZmZ e� e�Ze�dddg�Zd d � ZG dd� de�Zeee ee f d �dd�Zdddddddddd� eeeee ee f ed�dd�Zddd�Zd dd�Zdd� Zd!dd�ZdS )"z9Common utility functions for interacting with subprocess.� N)�ENOEXEC)� TextIOWrapper)�List�Union� SubpResult�stdout�stderrc C s� g }g }g }|D ]�}t |t�rR|d dkr8|dd� }q�|d | kr�|�d| � n6t |t�rx|�| � d��s�|�|� n|�t|�� q|�|� q|r�t�d| | d�|�� |r�t dj | d�|�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 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)Zbase_commandZcommands�warningsr Zfixed_commandsZcommand� r �0/usr/lib/python3/dist-packages/cloudinit/subp.py�prepend_base_command s<