File: //usr/lib/python3/dist-packages/cloudinit/config/__pycache__/cc_runcmd.cpython-39.pyc
a
��`q � @ s� d Z ddlmZmZ ddlmZ ddlmZ ddlm Z ddl
Z
ddlmZ egZ
dd d
ed�e
ed�ged
ddddddid�ddigidddg d�id� Zee�Z dd� ZdS )zERuncmd: run arbitrary commands at rc.local with output to the console� )�get_schema_doc�validate_cloudconfig_schema)�ALL_DISTROS)�PER_INSTANCE)�utilN)�dedentZ cc_runcmdZRuncmdzRun arbitrary commandsa� Run arbitrary commands at a rc.local like level with output to the
console. Each item can be either a list or a string. If the item is a
list, it will be properly executed as if passed to ``execve()`` (with
the first arg as the command). If the item is a string, it will be
written to a file and interpreted
using ``sh``.
.. note::
all commands must be proper yaml, so you have to quote any characters
yaml would eat (':' can be problematic)
.. note::
when writing files, do not use /tmp dir as it races with
systemd-tmpfiles-clean LP: #1707222. Use /run/somedir instead.
a runcmd:
- [ ls, -l, / ]
- [ sh, -xc, "echo $(date) ': hello world!'" ]
- [ sh, -c, echo "=========hello world'=========" ]
- ls -l /root
- [ wget, "http://example.org", -O, /tmp/index.html ]
�object�runcmd�array�oneOf�type�string)r �itemsF� )r r ZadditionalItems�additionalProperties�minItems�required) �id�name�title�description�distros�examples� frequencyr �
propertiesc C s� d|vr|� d| � d S t|t� tj�|�d�d�}|d }zt�|�}t� ||d� W n" t
y| t�|d||� Y n0 d S )Nr z:Skipping module named %s, no 'runcmd' key in configuration�scriptsi� z"Failed to shellify %s into file %s)�debugr �schema�os�path�join� get_ipathr �shellify�
write_file� Exception�logexc)r �cfg�cloud�log�_args�out_fn�cmd�content� r- �</usr/lib/python3/dist-packages/cloudinit/config/cc_runcmd.py�handleQ s �
r/ )�__doc__�cloudinit.config.schemar r Zcloudinit.distrosr �cloudinit.settingsr � cloudinitr r �textwrapr r r r/ r- r- r- r. �<module> s>