관리-도구
편집 파일: cloud_id.cpython-39.opt-1.pyc
a ����'�Dg� ����������������������@���s����d�Z�ddlZddlZddlZddlmZ�ddlmZmZ�ddl m Z �ddlmZm Z �dZddd �Zd d��Zdd ��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-idc�����������������C���sd���t����d�}|�stjtdd�}�|�jdddddd ��|�jd ddddd ��|�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)�prog�descriptionz-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���)r���Zget_runpath�argparse�ArgumentParser�NAME�add_argument�str)�parserZdefault_instance_json��r����:/usr/lib/python3.9/site-packages/cloudinit/cmd/cloud_id.py� get_parser���s<���� ����� r���c����������� ��� ���C���sz��t���}|jtjkr,tj�d�|jj���dS�|jtj krRtj�d�|jj���dS�z8t |j��}t� |�}W�d����n1�s~0����Y��W�nX�ty����t�d|j���Y�S��ty��}�z t�d|j|f��W��Y�d}~S�d}~0�0�|�di��}t|�dt�|�d t�|�d t��}|j�rDtj�d��||d<�tj|d ddd�}n"|j�rbd||�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} ��������NzTFile not found '%s'. Provide a path to instance data json file using --instance-datazFile '%s' is not valid json. %s�v1Z cloud_nameZregion�platformz%DEPRECATED: Use: cloud-init query v1 �cloud_id����T)�,z: )�indentZ sort_keysZ separatorsz%s %sz%s r���)r���Zrunning_statusr���ZDISABLED�sys�stdout�write�format�valueZNOT_STARTED�openr����json�load�IOErrorr����error� ValueError�getr���r����stderr�dumpsZlong) �name�argsZstatus_details�filer����er���r���Zresponser���r���r����handle_args=���sJ����,��� ��r3���c������������������C���s���t���}�t�tt|�������dS�)z,Tool to query specific instance-data values.N)r���r!����exitr3���r���� parse_args)r���r���r���r����mainl���s����r6����__main__)N)�__doc__r���r'���r!���Zcloudinit.cmd.develr���Zcloudinit.cmd.statusr���r���Z cloudinit.logr���Zcloudinit.sourcesr���r���r���r���r3���r6����__name__r���r���r���r����<module>���s��� */