�
܍~c�
� � � d Z ddlZddlZddlZddlmZ ddlmZmZ ddl m
Z
mZ ddlm
Z
dZdd�Zd � Zd
� Zedk r e� � dS dS )
zCCommandline utility to list the canonical cloud-id for an instance.� N)�read_cfg_paths)�UXAppStatus�get_status_details)�METADATA_UNKNOWN�canonical_cloud_id)�errorzcloud-idc �. � t � � � d� � }| st j t d�� � } | � ddddd� � � | � d
dddd� � � | � d
dt |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 �get_runpath�argparse�ArgumentParser�NAME�add_argument�str)�parser�default_instance_jsons �8/usr/lib/python3/dist-packages/cloudinit/cmd/cloud_id.py�
get_parserr s� � � +�,�,�8�8��I�I���
��(��I�
�
�
�� �������
D� � � � � �������
L� � � � � �����
�%�
2�/�
2�
2�
� � � � �M� c � � t � � }|j t j k r>t j � d� |j j � � � � dS |j t j k r>t j � d� |j j � � � � dS t |j � � 5 }t j
|� � }ddd� � n# 1 swxY w Y nS# t $ r t d|j z � � cY S t $ r$}t d|j �d|��� � cY d}~S d}~ww xY w|� di � � }t% |� d t& |