Current File : //usr/lib/python2.7/site-packages/cloudinit/cmd/cloud_id.pyo |
�
oB�]c @ s� d Z d d l Z d d l Z d d l Z d d l m Z m Z m Z d e Z d Z d d � Z d � Z d � Z
d � Z e d
k r� e � n d S( sC Commandline utility to list the canonical cloud-id for an instance.i����N( t INSTANCE_JSON_FILEt METADATA_UNKNOWNt canonical_cloud_ids /run/cloud-init/%ss cloud-idc
C s� | s! t j d t d d � } n | j d d d d d t d d
�| j d d d d d t d d
�| j d d d t d t d d t �| 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.
t progt descriptions/ Report the canonical cloud-id for this instances -js --jsont actiont
store_truet defaultt helps5 Report all standardized cloud-id information as json.s -ls --longs= Report extended cloud-id information as tab-delimited string.s -is --instance-datat types. Path to instance-data.json file. Default is %s( t argparset ArgumentParsert NAMEt add_argumentt Falset strt DEFAULT_INSTANCE_JSON( t parser( ( s: /usr/lib/python2.7/site-packages/cloudinit/cmd/cloud_id.pyt
get_parser s c C s t j j d | � d S( Ns
ERROR: %s
i ( t syst stderrt write( t msg( ( s: /usr/lib/python2.7/site-packages/cloudinit/cmd/cloud_id.pyt error+ s c C s) y t j t | j � � } WnE t k
r= t d | j � St k
rc } t d | j | f � SX| j d i � } t | j d t � | j d t � | j d t � � } | j r� | | d <t j
| d d d
t d d �} n. | j rd | | j d t � f } n | } t
j j d | � d S( s� Handle calls to 'cloud-id' cli.
Print the canonical cloud-id on which the instance is running.
@return: 0 on success, 1 otherwise.
sT File not found '%s'. Provide a path to instance data json file using --instance-datas File '%s' is not valid json. %st v1t
cloud_namet regiont platformt cloud_idt indenti t sort_keyst
separatorst ,s : s %s %ss %s
i ( R s : ( t jsont loadt opent
instance_datat IOErrorR t
ValueErrort getR R t dumpst Truet longR t stdoutR ( t namet argsR$ t eR R t response( ( s: /usr/lib/python2.7/site-packages/cloudinit/cmd/cloud_id.pyt handle_args0 s.
c C s) t � } t j t t | j � � � d S( s, Tool to query specific instance-data values.N( R R t exitR0 R t
parse_args( R ( ( s: /usr/lib/python2.7/site-packages/cloudinit/cmd/cloud_id.pyt mainQ s t __main__( t __doc__R
R! R t cloudinit.sourcesR R R R R t NoneR R R0 R3 t __name__( ( ( s: /usr/lib/python2.7/site-packages/cloudinit/cmd/cloud_id.pyt <module> s
!