ó ¡ô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 RR R R(RRRR(R((sL/usr/lib/python2.7/site-packages/euca2ools/commands/euimage/pack/metadata.pyt__serialize_as_dictSs( t__name__t __module__R t classmethodRRR#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(RtnameRtreleasetepochtarcht descriptiontprofiles(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|(((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.pyts :