
    x[h                         S r SSKrSSKrSSKrSSKJr  SSKJrJr  SSK	J
r
  SSKJrJr  SrSS jrS	 rS
 r\S:X  a  \" 5         gg)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                     [        5       R                  S5      nU (       d  [        R                  " [        SS9n U R                  SSSSSS	9  U R                  S
SSSSS	9  U R                  SS[        USU 3S9  U $ )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                    [        5       nUR                  [        R                  :X  aC  [        R
                  R                  SR                  UR                  R                  5      5        gUR                  [        R                  :X  aC  [        R
                  R                  SR                  UR                  R                  5      5        g [        UR                  5       n[        R                  " U5      nSSS5        WR%                  S0 5      n['        UR%                  S	[(        5      UR%                  S
[(        5      UR%                  S[(        5      5      nUR                  (       a;  [        R*                  R                  S5        XvS'   [        R,                  " USSSS9nO1UR.                  (       a  U< SUR%                  S
[(        5      < 3nOUn[        R
                  R                  SU-  5        g! , (       d  f       GN
= f! [         a&    [        R                   " SUR                  -  5      s $ ["         a2  n[        R                   " SUR                  < SU< 35      s SnA$ SnAff = f)zHandle 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
$$$% IIdOM & 
		4	$B!
|-.
x)*
z+,H
 yy

AB!:::qD[
 
':J)KLJJVh&'9 &% 
~~%'+'9'9:
 	
  
~~151C1CQG
 	

sB   H #G=:H =
HH H -I9>	I9'I4.I94I9c                  |    [        5       n [        R                  " [        [        U R                  5       5      5        g)z,Tool to query specific instance-data values.N)r   r-   exitrC   r   
parse_args)r   s    r   mainrG   l   s%    \FHH[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   