HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux ip-10-0-8-47 6.8.0-1021-aws #23~22.04.1-Ubuntu SMP Tue Dec 10 16:31:58 UTC 2024 aarch64
User: ubuntu (1000)
PHP: 8.1.2-1ubuntu2.22
Disabled: NONE
Upload Files
File: //usr/lib/python3/dist-packages/cloudinit/config/__pycache__/cc_bootcmd.cpython-310.pyc
o

�Ad|�@s�UdZddlZddlmZddlmZddlmZmZm	Z	ddl
mZddlm
Z
ddlmZmZdd	lmZeZd
gZddd
ed�eed�gedgd�Zeed<ee�Zdede
dedededdf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�all�
cc_bootcmd�Bootcmdz0Run 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�title�description�distros�examples�	frequency�activate_by_schema_keys�metar�cfg�cloud�log�args�returncCsd|vr|�d|�dStjdd��e}zt�|d�}|�t�|��|��Wnty>}z
t�	|dt
|���d}~wwz tj�
�}|��}	|	rQt
|	�|d<d|jg}
tj|
|dd	�Wntynt�	|d
|��wWd�dS1szwYdS)Nrz;Skipping module named %s, no 'bootcmd' key in configurationz.sh)�suffixzFailed to shellify bootcmd: %s�INSTANCE_IDz/bin/shF)�env�capturezFailed to run bootcmd module %s)�debugr�ExtendedTemporaryFiler�shellify�write�encode_text�flush�	Exception�logexc�str�os�environ�copy�get_instance_idrr)rrrrr�tmpf�content�er �iid�cmd�r4�=/usr/lib/python3/dist-packages/cloudinit/config/cc_bootcmd.py�handleBs8���

��"�r6)�__doc__r+�loggingr�textwrapr�	cloudinitrrr�cloudinit.cloudr�cloudinit.configr�cloudinit.config.schemar	r
�cloudinit.settingsrrrr�__annotations__r*�listr6r4r4r4r5�<module>sN	���	�%������