Ë
    x[há  ã                   óŠ   — d Z ddlZddlZddlZddlmZ ddlmZmZ ddl	m
Z
 ddlmZmZ dZdd„Zd	„ Zd
„ Zedk(  r e«        yy)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_idzcloud-idc                 ó  — t        «       j                  d«      }| st        j                  t        d¬«      } | j                  ddddd¬	«       | j                  d
dddd¬	«       | j                  ddt        |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ô
ˆð ×ÑØØØØØDð ô ð ×ÑØØØØØLð ô ð ×ÑØØÜØ%ðØ/Ð0ð2ð ô 	ð €Mó    c                 óÈ  — t        «       }|j                  t        j                  k(  rCt        j
                  j                  dj                  |j                  j                  «      «       y|j                  t        j                  k(  rCt        j
                  j                  dj                  |j                  j                  «      «       y	 t        |j                  «      5 }t        j                  |«      }ddd«       j%                  di «      }t'        |j%                  d	t(        «      |j%                  d
t(        «      |j%                  dt(        «      «      }|j                  r>t        j*                  j                  d«       ||d<   t        j,                  |ddd¬«      }n*|j.                  r|›d|j%                  d
t(        «      ›�}n|}t        j
                  j                  d|z  «       y# 1 sw Y   ŒûxY w# t        $ r% t        j                   d|j                  z  «      cY S t"        $ r/}t        j                   d|j                  ›d|›�«      cY d}~S d}~ww xY w)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-datazFile 'z' is not valid json. Úv1Ú
cloud_nameÚregionÚplatformz%DEPRECATED: Use: cloud-init query v1
Úcloud_idé   T)ú,z: )ÚindentÚ	sort_keysÚ
separatorsú	z%s
r   )r   Úrunning_statusr   ÚDISABLEDÚsysÚstdoutÚwriteÚformatÚvalueÚNOT_STARTEDÚopenr
   ÚjsonÚloadÚIOErrorr   ÚerrorÚ
ValueErrorÚgetr   r   ÚstderrÚdumpsÚlong)	ÚnameÚargsÚstatus_detailsÚfiler
   Úer    r$   Úresponses	            r   Úhandle_argsrC   =   sà  € ô (Ó)€NØ×$Ñ$¬×(>Ñ(>Ò>Ü�
‰
×Ñ˜Ÿ™¨×(EÑ(E×(KÑ(KÓLÔMØØ	×	&Ñ	&¬-×*CÑ*CÒ	CÜ�
‰
×Ñ˜Ÿ™¨×(EÑ(E×(KÑ(KÓLÔMØð
Ü�$×$Ñ$Ó%ð 	,¨Ü ŸI™I d›OˆM÷	,ð 
×	Ñ	˜4 Ó	$€BÜ!Ø
�‰ˆ|Ô-Ó.Ø
�‰ˆxÔ)Ó*Ø
�‰ˆzÔ+Ó,ó€Hð
 ‡y‚yÜ�
‰
×ÑÐAÔBØ!ˆˆ:‰Ü—:‘:Ø�q D°[ô
‰ð 
�ŠÚ'¨¯©°Ô:JÔ)KÐL‰àˆÜ‡J�J×Ñ�V˜hÑ&Ô'Ø÷9	,ð 	,ûäò 
Ü�~‰~ð%Ø'+×'9Ñ'9ñ:ó
ò 	
ô ò 
Ü�~Š~Ø15×1CÓ1CÁQÐGó
õ 	
ûð
ús<   ÃG= Ã!G1Ã7G= Ç1G:Ç6G= Ç=+I!È*I!È2$IÉI!ÉI!c                  óz   — t        «       } t        j                  t        t        | j                  «       «      «       y)z,Tool to query specific instance-data values.N)r   r-   ÚexitrC   r   Ú
parse_args)r   s    r   ÚmainrG   l   s%   € ä‹\€FÜ‡H�HŒ[œ˜v×0Ñ0Ó2Ó3Õ4r   Ú__main__)N)Ú__doc__r   r4   r-   Úcloudinit.cmd.develr   Úcloudinit.cmd.statusr   r   Úcloudinit.logr   Úcloudinit.sourcesr   r   r   r   rC   rG   Ú__name__© r   r   ú<module>rP      sJ   ðñ
 Jã Û Û 
å .ß BÝ "ß Bà€ó'òT,ò^5ð ˆzÒÙ…Fð r   