Current File : //lib/python2.7/site-packages/cloudinit/subp.pyc |
�
oB�]c @ s. d Z d d l Z e j e � Z d � Z d S( s9 Common utility functions for interacting with subprocess.i����Nc C s) g } g } g } x� | D]� } t | t � rq | d d k rK | d } q� | d | k r� | j d | � q� nK t | t � r� | j d | � s� | j | � q� n | j t | � � q | j | � q W| r� t j d | | d j | � � n | r%t
d j d | d d j | � � � � n | S(
s� 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.
i i s %s s Non-%s commands in %s config:
%ss
sH Invalid {name} config. These commands are not a string or list:
{errors}t namet errorsN( t
isinstancet listt Nonet insertt strt
startswitht appendt LOGt warningt joint TypeErrort format( t base_commandt commandst warningsR t fixed_commandst command( ( s2 /usr/lib/python2.7/site-packages/cloudinit/subp.pyt prepend_base_command s0
( t __doc__t loggingt getLoggert __name__R R ( ( ( s2 /usr/lib/python2.7/site-packages/cloudinit/subp.pyt <module> s