Revision 8e3065a0 image_creator/main.py
b/image_creator/main.py | ||
---|---|---|
37 | 37 |
from image_creator import __version__ as version |
38 | 38 |
from image_creator import util |
39 | 39 |
from image_creator.disk import Disk |
40 |
from image_creator.util import get_command, error, success, output, FatalError |
|
40 |
from image_creator.util import get_command, error, success, output, \ |
|
41 |
FatalError, progress, md5 |
|
41 | 42 |
from image_creator.kamaki_wrapper import Kamaki |
42 | 43 |
import sys |
43 | 44 |
import os |
... | ... | |
153 | 154 |
% os.path.basename(sys.argv[0])) |
154 | 155 |
|
155 | 156 |
if not options.force and options.outfile is not None: |
156 |
for extension in ('', '.meta'): |
|
157 |
for extension in ('', '.meta', '.md5sum'):
|
|
157 | 158 |
filename = "%s%s" % (options.outfile, extension) |
158 | 159 |
if os.path.exists(filename): |
159 | 160 |
raise FatalError("Output file %s exists " |
... | ... | |
193 | 194 |
size = options.shrink and dev.shrink() or dev.size() |
194 | 195 |
metadata['SIZE'] = str(size // 2 ** 20) |
195 | 196 |
|
197 |
#Calculating MD5sum |
|
198 |
output("Calculating md5sum...", False) |
|
199 |
checksum = md5(snapshot, size) |
|
200 |
success(checksum) |
|
201 |
output() |
|
202 |
|
|
196 | 203 |
if options.outfile is not None: |
197 | 204 |
f = open('%s.%s' % (options.outfile, 'meta'), 'w') |
198 | 205 |
try: |
... | ... | |
207 | 214 |
disk.destroy_device(dev) |
208 | 215 |
|
209 | 216 |
if options.upload: |
210 |
output("Uploading image to pithos...", False)
|
|
217 |
output("Uploading image to pithos:")
|
|
211 | 218 |
kamaki = Kamaki(options.account, options.token) |
212 | 219 |
kamaki.upload(snapshot, size, options.upload) |
213 |
output("done") |
|
214 | 220 |
|
215 | 221 |
finally: |
216 | 222 |
output('cleaning up...') |
Also available in: Unified diff