HEX
Server: Apache
System: Linux scp1.abinfocom.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: confeduphaar (1010)
PHP: 8.1.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //proc/self/root/lib/python3/dist-packages/cloudinit/cmd/__pycache__/cloud_id.cpython-38.pyc
U

Ӈg�
�@s�dZddlZddlZddlZddlmZddlmZmZddl	m
Z
ddlmZm
Z
dZddd	�Zd
d�Zdd
�Zedkr�e�dS)zCCommandline utility to list the canonical cloud-id for an instance.�N)�read_cfg_paths)�
RunningStatus�get_status_details)�log_util)�METADATA_UNKNOWN�canonical_cloud_idzcloud-idcCsdt��d�}|stjtdd�}|jdddddd	�|jd
ddddd	�|jd
dt|d|��d�|S)a*Build or extend an arg parser for the cloud-id utility.

    @param parser: Optional existing ArgumentParser instance representing the
        query subcommand which will be extended to support the args of
        this utility.

    @returns: ArgumentParser with proper argument configuration.
    �
instance_dataz/Report the canonical cloud-id for this instance)�progZdescriptionz-jz--json�
store_trueFz5Report all standardized cloud-id information as json.)�action�default�helpz-lz--longz=Report extended cloud-id information as tab-delimited string.z-iz--instance-dataz,Path to instance-data.json file. Default is )�typerr
)rZget_runpath�argparse�ArgumentParser�NAME�add_argument�str)�parserZdefault_instance_json�r�8/usr/lib/python3/dist-packages/cloudinit/cmd/cloud_id.py�
get_parsers8	����
rc	
Csjt�}|jtjkr,tj�d�|jj��dS|jtj	krRtj�d�|jj��dSz$t
|j��}t�
|�}W5QRXWn\tk
r�t�d|j�YStk
r�}zt�d|j|f�WY�Sd}~XYnX|�di�}t|�dt�|�d	t�|�d
t��}|j�r4tj�d�||d<tj|d
ddd�}n"|j�rRd||�d	t�f}n|}tj�d|�dS)z�Handle calls to 'cloud-id' cli.

    Print the canonical cloud-id on which the instance is running.

    @return: 0 on success, 1 on error, 2 on disabled, 3 on cloud-init not run.
    z{0}
��zTFile not found '%s'. Provide a path to instance data json file using --instance-datazFile '%s' is not valid json. %sN�v1Z
cloud_nameZregion�platformz%DEPRECATED: Use: cloud-init query v1
�cloud_id�T)�,z: )�indentZ	sort_keysZ
separatorsz%s	%sz%s
r)rZrunning_statusrZDISABLED�sys�stdout�write�format�valueZNOT_STARTED�openr�json�load�IOErrorr�error�
ValueError�getrr�stderr�dumpsZlong)	�name�argsZstatus_details�filer�errZresponserrr�handle_args=sP���


��r2cCst�}t�tt|����dS)z,Tool to query specific instance-data values.N)rr �exitr2r�
parse_args)rrrr�mainlsr5�__main__)N)�__doc__rr&r Zcloudinit.cmd.develrZcloudinit.cmd.statusrrZ
cloudinit.logrZcloudinit.sourcesrrrrr2r5�__name__rrrr�<module>s
*/