Your IP : 216.73.217.13


Current Path : /lib/python3/dist-packages/cloudinit/config/__pycache__/
Upload File :
Current File : //lib/python3/dist-packages/cloudinit/config/__pycache__/cc_bootcmd.cpython-38.pyc

U

�Ad|�	@s�UdZddlZddlmZddlmZddlmZmZm	Z	ddl
mZddlm
Z
ddlmZmZdd	lmZeZd
gZddd
ed�eed�gedgd�Zeed<ee�Zee
eeedd�dd�ZdS)z:Bootcmd: run arbitrary commands early in the boot process.�N)�Logger)�dedent)�subp�
temp_utils�util)�Cloud)�Config)�
MetaSchema�get_meta_doc)�
PER_ALWAYS�allZ
cc_bootcmdZBootcmdz0Run arbitrary commands early in the boot processa�        This module runs arbitrary commands very early in the boot process,
        only slightly after a boothook would run. This is very similar to a
        boothook, but more user friendly. The environment variable
        ``INSTANCE_ID`` will be set to the current instance id for all run
        commands. Commands can be specified either as lists or strings. For
        invocation details, see ``runcmd``.

        .. note::
            bootcmd should only be used for things that could not be done later
            in the boot process.

        .. note::

          when writing files, do not use /tmp dir as it races with
          systemd-tmpfiles-clean LP: #1707222. Use /run/somedir instead.
    z�        bootcmd:
            - echo 192.168.1.130 us.archive.ubuntu.com > /etc/hosts
            - [ cloud-init-per, once, mymkfs, mkfs, /dev/vdb ]
    �bootcmd)�id�name�titleZdescription�distrosZexamples�	frequencyZactivate_by_schema_keys�meta)r�cfg�cloud�log�args�returncCs�d|kr|�d|�dStjdd���}z*t�|d�}|�t�|��|��Wn6tk
r�}zt�	|dt
|���W5d}~XYnXz@tj�
�}|��}	|	r�t
|	�|d<d|jg}
tj|
|dd	�Wn$tk
r�t�	|d
|��YnXW5QRXdS)Nr
z;Skipping module named %s, no 'bootcmd' key in configurationz.sh)�suffixzFailed to shellify bootcmd: %sZINSTANCE_IDz/bin/shF)�envZcapturezFailed to run bootcmd module %s)�debugrZExtendedTemporaryFilerZshellify�writeZencode_text�flush�	ExceptionZlogexc�str�os�environ�copyZget_instance_idrr)rrrrrZtmpfZcontent�erZiid�cmd�r%�=/usr/lib/python3/dist-packages/cloudinit/config/cc_bootcmd.py�handleBs0�

r')�__doc__r Zloggingr�textwraprZ	cloudinitrrrZcloudinit.cloudrZcloudinit.configrZcloudinit.config.schemar	r
Zcloudinit.settingsrrrr�__annotations__r�listr'r%r%r%r&�<module>
s@���	�%�