Viewing File: /usr/lib/python2.7/site-packages/euca2ools/commands/euimage/pack/metadata.pyo

ó
¡ôXc@s\ddlZddlmZddlmZdefd„ƒYZdefd„ƒYZdS(iÿÿÿÿN(tbuild_image_profile(tcheck_dict_whitelisttImagePackMetadatacBsJeZd„Zed„ƒZed„ƒZd„Zd„Zd„ZRS(cCs(d|_d|_d|_d|_dS(Ni(tNonetimage_sha256sumt
image_sizetimage_md_sha256sumtversion(tself((sL/usr/lib/python2.7/site-packages/euca2ools/commands/euimage/pack/metadata.pyt__init__!s			cCs*|ƒ}tj|ƒ}t|ddddgƒ|jdƒrut|dƒdkrutdj|dƒƒ‚qun|jdƒp‡i}|jdƒs¨tdƒ‚n|d|_|jd	ƒsÓtd
ƒ‚nt|d	ƒ|_|jdƒpøi}|jdƒstdƒ‚n|d|_	|S(Ntpacktimagetimage_metadataRis)pack has metadata version {0}; expected 1t	sha256sums)pack: image.sha256sum is missing or emptytsizes#pack: image.size is missing or zeros2pack: image_metadata.sha256sum is missing or empty(
tyamlt	safe_loadRtgettintt
ValueErrortformatRRR(tclstfileobjtnew_mdtmetadatat
image_infot
image_md_info((sL/usr/lib/python2.7/site-packages/euca2ools/commands/euimage/pack/metadata.pytfrom_fileobj's*	
	

cCs&t|ƒ}|j|ƒSWdQXdS(N(topenR(RtfilenameR((sL/usr/lib/python2.7/site-packages/euca2ools/commands/euimage/pack/metadata.pyt	from_fileFscCs tj|jƒ|dtƒdS(Ntdefault_flow_style(Rt	safe_dumpt%_ImagePackMetadata__serialize_as_dicttFalse(RR((sL/usr/lib/python2.7/site-packages/euca2ools/commands/euimage/pack/metadata.pytdump_to_fileobjKscCs)t|dƒ}|j|ƒWdQXdS(Ntw(RR#(RRR((sL/usr/lib/python2.7/site-packages/euca2ools/commands/euimage/pack/metadata.pytdump_to_fileOscCs:ii|jd6|jd6d6i|jd6d6|jd6S(NR
RRRR(RRRR(R((sL/usr/lib/python2.7/site-packages/euca2ools/commands/euimage/pack/metadata.pyt__serialize_as_dictSs(	t__name__t
__module__R	tclassmethodRRR#R%R!(((sL/usr/lib/python2.7/site-packages/euca2ools/commands/euimage/pack/metadata.pyR s			t
ImageMetadatacBsAeZd„Zed„ƒZed„ƒZd„Zd„ZRS(cCsCd|_d|_d|_d|_d|_d|_i|_dS(Ni(RtnameRtreleasetepochtarchtdescriptiontprofiles(R((sL/usr/lib/python2.7/site-packages/euca2ools/commands/euimage/pack/metadata.pyR	[s						c	CsZ|ƒ}tj|ƒ}t|dddddddgƒ|jdƒsXtdƒ‚n|d|_|jdƒstd	j|jƒƒ‚n|d|_|jdƒsÆtd
j|jƒƒ‚n|d|_|jdƒrRyt	|dƒ|_
Wn)tk
r$tdj|jƒƒ‚nX|j
d
krRtdj|jƒƒ‚qRn|jdƒs|tdj|jƒƒ‚n|d|_|jdƒs³tdj|jƒƒ‚n|djƒ|_
|jdƒ}|sötdj|jƒƒ‚nt|tƒs tdj|jƒƒ‚nx3|jƒD]%\}}t||jƒ|j|<q-W|S(NRR+RR,R.R/R0sname is missing or emptys(image "{0}": version is missing or emptys(image "{0}": release is missing or emptyR-s%image "{0}": epoch must be an integeris'image "{0}": epoch must not be negatives%image "{0}": arch is missing or emptys,image "{0}": description is missing or emptysUimage "{0}" must have at least one profile (use "default" for a single-profile image)s2image "{0}": profiles must be an associative array(RRRRRR+RRR,RR-R.trstripR/t
isinstancetdicttitemsRR0(RRRRR0tprofile_nametprofile_info((sL/usr/lib/python2.7/site-packages/euca2ools/commands/euimage/pack/metadata.pyRdsX		

	
	

			
			cCs&t|ƒ}|j|ƒSWdQXdS(N(RR(RRR((sL/usr/lib/python2.7/site-packages/euca2ools/commands/euimage/pack/metadata.pyR”scCs‘i|jd6|jd6|jd6|d6}|jrD|j|d<n||jkrktdj|ƒƒ‚n|j|j|||||d|ƒS(Nseuimage:nameseuimage:versionseuimage:releaseseuimage:profiles
euimage:epochsno such profile: "{0}"ttags(R+RR,R-R0RRtinstall(RR5tservicest
image_fileobjRtargsteuimage_tags((sL/usr/lib/python2.7/site-packages/euca2ools/commands/euimage/pack/metadata.pytinstall_profile™s



	
cCs"dj|j|j|j|jƒS(Ns{0}-{1}-{2}.{3}(RR+RR,R.(R((sL/usr/lib/python2.7/site-packages/euca2ools/commands/euimage/pack/metadata.pytget_nvra¬s(R'R(R	R)RRR=R>(((sL/usr/lib/python2.7/site-packages/euca2ools/commands/euimage/pack/metadata.pyR*Zs
		0	(Rt(euca2ools.commands.euimage.pack.profilesRteuca2ools.utilRtobjectRR*(((sL/usr/lib/python2.7/site-packages/euca2ools/commands/euimage/pack/metadata.pyt<module>s:
Back to Directory File Manager