#NEWLINE# def avail_images( call = None ) : #NEWLINE# #INDENT# '\n    Get list of available images\n\n    CLI Example:\n\n    .. code-block:: bash\n\n        salt-cloud --list-images\n\n    Can use a custom URL for images. Default is:\n\n    .. code-block:: yaml\n\n        image_url: images.joyent.com/image\n    ' #NEWLINE# if ( call == 'action' ) : #NEWLINE# #INDENT# raise SaltCloudSystemExit ( 'The avail_images function must be called with -f or --function, or with the --list-images option' ) #NEWLINE# #UNINDENT# user = config . get_cloud_config_value ( 'user' , get_configured_provider ( ) , __opts__ , search_global = False ) #NEWLINE# img_url = config . get_cloud_config_value ( 'image_url' , get_configured_provider ( ) , __opts__ , search_global = False , default = '{0}{1}/{2}/images' . format ( DEFAULT_LOCATION , JOYENT_API_HOST_SUFFIX , user ) ) #NEWLINE# if ( ( not img_url . startswith ( 'http://' ) ) and ( not img_url . startswith ( 'https://' ) ) ) : #NEWLINE# #INDENT# img_url = '{0}://{1}' . format ( _get_proto ( ) , img_url ) #NEWLINE# #UNINDENT# ( rcode , data ) = query ( command = 'my/images' , method = 'GET' ) #NEWLINE# log . debug ( data ) #NEWLINE# ret = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for image in data : #NEWLINE# #INDENT# ret [ image [ 'name' ] ] = image #NEWLINE# #UNINDENT# return ret