܍~c dZddlZddlZddlZddlmZddlmZmZddl m Z m Z ddl m Z dZd dZd Zd Zed kr edSdS) zCCommandline utility to list the canonical cloud-id for an instance.N)read_cfg_paths) UXAppStatusget_status_details)METADATA_UNKNOWNcanonical_cloud_id)errorzcloud-idc.td}|stjtd}|ddddd |d d ddd |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.)actiondefaulthelpz-lz--longz=Report extended cloud-id information as tab-delimited string.z-iz--instance-dataz,Path to instance-data.json file. Default is )typerr)r get_runpathargparseArgumentParserNAME add_argumentstr)parserdefault_instance_jsons 8/usr/lib/python3/dist-packages/cloudinit/cmd/cloud_id.py get_parserrs+,,88II  (I      D    L    % 2/ 2 2     Mct}|jtjkr>tjd|jjdS|jtj kr>tjd|jjdS t|j 5}tj |}dddn #1swxYwYnS#t$rtd|j zcYSt $r$}td|j d|cYd}~Sd}~wwxYw|di}t%|d t&|d t&|d t&}|j r=tjd ||d <tj|ddd}n*|jr!|d|d t&}n|}tjd|zdS)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-datazFile 'z' is not valid json. v1 cloud_nameregionplatformz%DEPRECATED: Use: cloud-init query v1 cloud_idT),z: )indent sort_keys separators z%s r)rstatusrDISABLEDsysstdoutwriteformatvalueNOT_RUNopenr jsonloadIOErrorr ValueErrorgetrrstderrdumpslong) nameargsstatus_detailsfiler er r$responses r handle_argsrB=s())N 444 (=(CDDEEEq  +"5 5 5 (=(CDDEEEq  $$ % % , IdOOM , , , , , , , , , , , , , , ,     %'+'9 :         u151C1C1CQQ G            4 $ $B! |-.. x)** z+,,H  y  ABBB!:: qD[    'xx:J)K)K)KLJVh&''' 1sH6C7 C+ C7+C//C72C/3C77!E E#E<EEct}tjtt|dS)z,Tool to query specific instance-data values.N)rr-exitrBr parse_args)rs rmainrFls7 \\FH[v0022 3 344444r__main__)N)__doc__rr4r-cloudinit.cmd.develrcloudinit.cmd.statusrrcloudinit.sourcesrrcloudinit.utilrrrrBrF__name__rrrOs JI ......@@@@@@@@BBBBBBBB ''''T, , , ^555  zDFFFFFr