Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
Size: Mime:
ó
·EYc@s°ddlZddlmZddlmZddlZddlmZddlZddl	m
Z
ddlmZddl
mZdZdZdZdefd„ƒYZdS(iÿÿÿÿN(tencodeutils(tcodes(tparse(tutils(texc(tschemasitasctdesctnametstatustcontainer_formattdisk_formattsizetidt
created_att
updated_att
ControllercBsReZd„Zejd„ƒZejd„ƒZed„ƒZed„ƒZ	ej
ƒd„ƒZejƒdd„ƒZd„Zejƒed„ƒZejƒdd	„ƒZejƒd
„ƒZejƒd„ƒZejƒd„ƒZejƒd
„ƒZdd„Zd„Zejƒd„ƒZd„Zd„Zd„ZRS(cCs||_||_dS(N(thttp_clientt
schema_client(tselfRR((sK/home/tvault/.virtenv/lib/python2.7/site-packages/glanceclient/v2/images.pyt__init__#s	cCs4|jjdƒ}tj|jƒdtjƒ}|S(Ntimaget
base_class(Rtgettwarlockt
model_factorytrawRtSchemaBasedModel(Rtschemat
warlock_model((sK/home/tvault/.virtenv/lib/python2.7/site-packages/glanceclient/v2/images.pytmodel'scCs@|jjdƒ}tj|jƒdtjƒ}d„|_|S(s@A model which does not validate the image against the v2 schema.RRc_sdS(N(tNone(targstkwargs((sK/home/tvault/.virtenv/lib/python2.7/site-packages/glanceclient/v2/images.pyt<lambda>4s(RRRRRRRtvalidate(RRR((sK/home/tvault/.virtenv/lib/python2.7/site-packages/glanceclient/v2/images.pytunvalidated_model.s
cCst|tjƒr|gS|S(N(t
isinstancetsixtstring_types(tvalue((sK/home/tvault/.virtenv/lib/python2.7/site-packages/glanceclient/v2/images.pyt_wrap7scCsÀx¹|jƒjdƒD]¢}|jdƒ\}}}|ry|tkrydi|d6djtƒd6}tj|ƒ‚n|tkrdi|d6djtƒd6}tj|ƒ‚qqW|S(	s¯Validates sorting argument for invalid keys and directions values.

        :param sort: comma-separated list of sort keys with optional <:dir>
        after each key
        t,t:sUInvalid sort direction: %(sort_dir)s. It must be one of the following: %(available)s.tsort_dirs, t	availablesOInvalid sort key: %(sort_key)s. It must be one of the following: %(available)s.tsort_key(tstriptsplitt	partitiontSORT_DIR_VALUEStjoinRtHTTPBadRequesttSORT_KEY_VALUES(tsortt
sort_paramtkeyt_septdirtmsg((sK/home/tvault/.virtenv/lib/python2.7/site-packages/glanceclient/v2/images.pyt_validate_sort_param=s

c+s³|jdƒ}|jdƒp!t}d‡fd†}|jdiƒ}||d<|jdgƒ}g}xS|D]K}t|tjƒsŸtjd|ƒ‚n|j	it
j|ƒd6ƒqqWxEtj|ƒD]4\}	}
t|
tjƒrÐt
j|
ƒ||	<qÐqÐWdt
j|ƒ}x'|D]}	d|t
j|	ƒf}q"Wd	|kr›d
|ksid|kr{tjdƒ‚nd
|ˆj|d	ƒf}n´ˆj|jdgƒƒ}ˆj|jd
gƒƒ}
t|
ƒt|ƒkr
t|ƒdkr
tjdƒ‚nx|
D]}d||f}qWx|D]}d||f}q5Wt|jdƒtjƒrd||df}nx+||||ƒD]\}}||fVq”WdS(sÊRetrieve a listing of Image objects.

        :param page_size: Number of images to request in each
                          paginated request.
        :returns: generator over list of Images.
        tlimitt	page_sizec3s|}i}xîtrü|rD||krD|jd|d|ƒ}nˆjj|d|ƒ\}}tj|ƒ|d<x^|dD]R}|jddƒˆj||fV|r€|d8}|dkrÒt	‚qÒq€q€Wy|d}Wqt
k
rødSXqWdS(	Nslimit=%stheaderssx-openstack-request-idtimagesRiitnext(tTruetreplaceRRRt_extract_request_idtpopRR$t
StopIterationtKeyError(turlR>R=tnext_urlt
req_id_hdrtresptbodyR(R(sK/home/tvault/.virtenv/lib/python2.7/site-packages/glanceclient/v2/images.pytpaginatecs&	


tfiltersttagsInvalid tag value %ss
/v2/images?%ss%s&%sR6R.R,sCThe 'sort' argument is not supported with 'sort_key' or 'sort_dir'.s
%s&sort=%sisUnexpected number of sort directions: either provide a single sort direction or an equal number of sort keys and sort directions.s%s&sort_key=%ss%s&sort_dir=%stmarkers%s&marker=%sN(RtDEFAULT_PAGE_SIZERRER%R&R'RR4tappendRtsafe_encodet	iteritemsRt	urlencodeR<R)tlen(RR!R=R>RMRNttagsttags_url_paramsROtparamR(RHR,R.R8R:RRK((RsK/home/tvault/.virtenv/lib/python2.7/site-packages/glanceclient/v2/images.pytlistTsH	$

!
*

cCsWd|}|pi}|jj|d|ƒ\}}|jddƒ|j||fS(Ns
/v2/images/%sR?R(RRRERR$(Rtimage_idtheaderRHRKRL((sK/home/tvault/.virtenv/lib/python2.7/site-packages/glanceclient/v2/images.pyt_getºs

cCs
|j|ƒS(N(R](RR[((sK/home/tvault/.virtenv/lib/python2.7/site-packages/glanceclient/v2/images.pyRÄscCs«d|}|jj|ƒ\}}|jtjkr>d|fS|jjddƒ}t|jjddƒƒ}|r•|dk	r•tj	||ƒ}ntj
||ƒ|fS(sÈRetrieve data of an image.

        :param image_id:    ID of the image to download.
        :param do_checksum: Enable/disable checksum validation.
        :returns: An iterable body or None
        s/v2/images/%s/filescontent-md5scontent-lengthiN(RRtstatus_codeRt
no_contentRR?tintRtintegrity_itertIterableWithLength(RR[tdo_checksumRHRKRLtchecksumtcontent_length((sK/home/tvault/.virtenv/lib/python2.7/site-packages/glanceclient/v2/images.pytdataÇs

cCsQd|}idd6}|}|jj|d|d|ƒ\}}||f|fS(söUpload the data for an image.

        :param image_id: ID of the image to upload data for.
        :param image_data: File-like object supplying the data to upload.
        :param image_size: Unused - present for backwards compatibility
        s/v2/images/%s/filesapplication/octet-streamsContent-TypeR?Rf(Rtput(RR[t
image_datat
image_sizeRHthdrsRLRK((sK/home/tvault/.virtenv/lib/python2.7/site-packages/glanceclient/v2/images.pytuploadÜs


$cCs2d|}|jj|ƒ\}}||f|fS(sDelete an image.s
/v2/images/%s(Rtdelete(RR[RHRKRL((sK/home/tvault/.virtenv/lib/python2.7/site-packages/glanceclient/v2/images.pyRlês
c	Ks²d}|jƒ}x\|jƒD]N\}}yt|||ƒWqtjk
rl}ttj|ƒƒ‚qXqW|jj	|d|ƒ\}}|j
ddƒ|j||fS(sCreate an image.s
/v2/imagesRfRN(RtitemstsetattrRtInvalidOperationt	TypeErrorRtexception_to_unicodeRtpostRER(	RR!RHRR8R(teRKRL((sK/home/tvault/.virtenv/lib/python2.7/site-packages/glanceclient/v2/images.pytcreateñscCs2d|}|jj|ƒ\}}||f|fS(sDeactivate an image.s /v2/images/%s/actions/deactivate(RRr(RR[RHRKRL((sK/home/tvault/.virtenv/lib/python2.7/site-packages/glanceclient/v2/images.pyt
deactivates
cCs2d|}|jj|ƒ\}}||f|fS(sReactivate an image.s /v2/images/%s/actions/reactivate(RRr(RR[RHRKRL((sK/home/tvault/.virtenv/lib/python2.7/site-packages/glanceclient/v2/images.pyt
reactivate
s
cKsD|j|ƒ}|j|}x\|jƒD]N\}}yt|||ƒWq+tjk
rx}ttj|ƒƒ‚q+Xq+W|rà|j	ƒ}	|j	ƒ}
t
|	ƒjt
|ƒj|
ƒƒ}x|D]}t
||ƒqÆWnd|}idd6}
|jj|d|
d|jƒ\}}itj|ƒd6}|j||ƒS(sÝUpdate attributes of an image.

        :param image_id: ID of the image to modify.
        :param remove_props: List of property names to remove
        :param kwargs: Image attribute names and their new values.
        s
/v2/images/%ss,application/openstack-images-v2.1-json-patchsContent-TypeR?Rfsx-openstack-request-id(RRRmRnRRoRpRRqtkeystsettintersectiont
differencetdelattrRtpatchRRDR](RR[tremove_propsR!tunvalidated_imageRR8R(Rst	cur_propst	new_propstprops_to_removeRHRjRKt_RJ((sK/home/tvault/.virtenv/lib/python2.7/site-packages/glanceclient/v2/images.pytupdates(


'cCs=|j|ƒ}t|ddƒdkr9tjdƒ‚n|S(Nt	locationss<The administrator has disabled API access to image locations(RtgetattrRRR4(RR[R((sK/home/tvault/.virtenv/lib/python2.7/site-packages/glanceclient/v2/images.pyt!_get_image_with_locations_or_fail8scCsTd|}idd6}|jj|d|dtj|ƒƒ\}}||f|fS(Ns
/v2/images/%ss,application/openstack-images-v2.1-json-patchsContent-TypeR?Rf(RR|tjsontdumps(RR[t
patch_bodyRHRjRKRL((sK/home/tvault/.virtenv/lib/python2.7/site-packages/glanceclient/v2/images.pyt_send_image_update_request?s


cCsbidd6dd6i|d6|d6d6g}|j||ƒ}i|jdd	6}|j||ƒS(
sAdd a new location entry to an image's list of locations.

        It is an error to add a URL that is already present in the list of
        locations.

        :param image_id: ID of image to which the location is to be added.
        :param url: URL of the location to add.
        :param metadata: Metadata associated with the location.
        :returns: The updated image
        taddtops/locations/-tpathRHtmetadataR(isx-openstack-request-id(RŠtrequest_idsR](RR[RHRŽt	add_patchtresponseRJ((sK/home/tvault/.virtenv/lib/python2.7/site-packages/glanceclient/v2/images.pytadd_locationGs
cCsÓ|j|ƒ}g|jD]}|d^q}|jt|ƒƒ}|rftjdt|ƒƒ‚ng|D]}|j|ƒ^qm}|jdt	ƒg|D]}	idd6d|	d6^qŸ}
|j
||
ƒS(sáRemove one or more location entries of an image.

        :param image_id: ID of image from which locations are to be removed.
        :param url_set: set of URLs of location entries to remove.
        :returns: None
        RHsUnknown URL(s): %streversetremoveRŒs
/locations/%sR(R†R„RzRxRtHTTPNotFoundRZtindexR6RBRŠ(RR[turl_setRtltcurrent_urlstmissing_locsRHturl_indicesturl_idxtpatches((sK/home/tvault/.virtenv/lib/python2.7/site-packages/glanceclient/v2/images.pytdelete_locationsZs "(c
Csã|j|ƒ}tg|jD]}|d|f^qƒ}||kr]tjd|ƒ‚n||d|kru|S|||d<idd6dd6t|jƒƒd6g}|j||ƒ}i|jd	d
6}	|j	||	ƒS(s†Update an existing location entry in an image's list of locations.

        The URL specified must be already present in the image's list of
        locations.

        :param image_id: ID of image whose location is to be updated.
        :param url: URL of the location to update.
        :param metadata: Metadata associated with the location.
        :returns: The updated image
        RHsKUnknown URL: %s, the URL must be one of existing locations of current imageRŽRCRŒs
/locationsRR(isx-openstack-request-id(
R†tdictR„RR•RZtvaluesRŠRR](
RR[RHRŽRR˜turl_mapRR‘RJ((sK/home/tvault/.virtenv/lib/python2.7/site-packages/glanceclient/v2/images.pytupdate_locationqs,	

N(t__name__t
__module__RRtmemoized_propertyRR$tstaticmethodR)R<tadd_req_id_to_generatorRZtadd_req_id_to_objectRR]RRBRfRkRlRtRuRvRƒR†RŠR’RžR¢(((sK/home/tvault/.virtenv/lib/python2.7/site-packages/glanceclient/v2/images.pyR"s.		f					
'			(sascsdesc(snamesstatusscontainer_formatsdisk_formatssizesids
created_ats
updated_at(R‡t
oslo_utilsRtrequestsRR&tsix.moves.urllibRRtglanceclient.commonRtglanceclientRtglanceclient.v2RRQR2R5tobjectR(((sK/home/tvault/.virtenv/lib/python2.7/site-packages/glanceclient/v2/images.pyt<module>s