Current File : //lib/python2.7/site-packages/cloudinit/cmd/cloud_id.pyo
�
oB�]c@s�dZddlZddlZddlZddlmZmZmZdeZdZ	dd�Zd�Zd�Z
d	�Zed
kr�e�ndS(sCCommandline utility to list the canonical cloud-id for an instance.i����N(tINSTANCE_JSON_FILEtMETADATA_UNKNOWNtcanonical_cloud_ids/run/cloud-init/%sscloud-idc
Cs�|s!tjdtdd�}n|jdddddtd	d
�|jdddddtd	d
�|jdddtdtd	dt�|S(s*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.
    tprogtdescriptions/Report the canonical cloud-id for this instances-js--jsontactiont
store_truetdefaultthelps5Report all standardized cloud-id information as json.s-ls--longs=Report extended cloud-id information as tab-delimited string.s-is--instance-datattypes.Path to instance-data.json file. Default is %s(targparsetArgumentParsertNAMEtadd_argumenttFalsetstrtDEFAULT_INSTANCE_JSON(tparser((s:/usr/lib/python2.7/site-packages/cloudinit/cmd/cloud_id.pyt
get_parsers		cCstjjd|�dS(Ns
ERROR: %s
i(tsyststderrtwrite(tmsg((s:/usr/lib/python2.7/site-packages/cloudinit/cmd/cloud_id.pyterror+sc	Cs)ytjt|j��}WnEtk
r=td|j�Stk
rc}td|j|f�SX|jdi�}t|jdt	�|jdt	�|jdt	��}|jr�||d<tj
|dd	d
tdd�}n.|jrd||jdt	�f}n|}t
jjd|�dS(s�Handle calls to 'cloud-id' cli.

    Print the canonical cloud-id on which the instance is running.

    @return: 0 on success, 1 otherwise.
    sTFile not found '%s'. Provide a path to instance data json file using --instance-datasFile '%s' is not valid json. %stv1t
cloud_nametregiontplatformtcloud_idtindentit	sort_keyst
separatorst,s: s%s	%ss%s
i(R s: (tjsontloadtopent
instance_datatIOErrorRt
ValueErrortgetRRtdumpstTruetlongRtstdoutR(tnametargsR$teRRtresponse((s:/usr/lib/python2.7/site-packages/cloudinit/cmd/cloud_id.pythandle_args0s.
	
	cCs)t�}tjtt|j���dS(s,Tool to query specific instance-data values.N(RRtexitR0Rt
parse_args(R((s:/usr/lib/python2.7/site-packages/cloudinit/cmd/cloud_id.pytmainQs	t__main__(t__doc__R
R!Rtcloudinit.sourcesRRRRRtNoneRRR0R3t__name__(((s:/usr/lib/python2.7/site-packages/cloudinit/cmd/cloud_id.pyt<module>s
		!