Revision f5174d2c image_creator/dialog_wizard.py
b/image_creator/dialog_wizard.py | ||
---|---|---|
180 | 180 |
|
181 | 181 |
name = WizardInputPage( |
182 | 182 |
"ImageName", "Image Name", "Please provide a name for the image:", |
183 |
title="Image Name", init=session['device'].distro)
|
|
183 |
title="Image Name", init=session['image'].distro)
|
|
184 | 184 |
|
185 | 185 |
descr = WizardInputPage( |
186 | 186 |
"ImageDescription", "Image Description", |
... | ... | |
232 | 232 |
|
233 | 233 |
def create_image(session): |
234 | 234 |
d = session['dialog'] |
235 |
disk = session['disk'] |
|
236 |
device = session['device'] |
|
237 |
snapshot = session['snapshot'] |
|
238 |
image_os = session['image_os'] |
|
235 |
image = session['image'] |
|
239 | 236 |
wizard = session['wizard'] |
240 | 237 |
|
241 | 238 |
# Save Kamaki credentials |
242 | 239 |
Kamaki.save_token(wizard['Account']['auth_token']) |
243 | 240 |
|
244 | 241 |
with_progress = OutputWthProgress(True) |
245 |
out = disk.out
|
|
242 |
out = image.out
|
|
246 | 243 |
out.add(with_progress) |
247 | 244 |
try: |
248 | 245 |
out.clear() |
249 | 246 |
|
250 | 247 |
#Sysprep |
251 |
device.mount(False)
|
|
252 |
image_os.do_sysprep()
|
|
253 |
metadata = image_os.meta
|
|
254 |
device.umount()
|
|
248 |
image.mount(False)
|
|
249 |
image.os.do_sysprep()
|
|
250 |
metadata = image.os.meta
|
|
251 |
image.umount()
|
|
255 | 252 |
|
256 | 253 |
#Shrink |
257 |
size = device.shrink()
|
|
254 |
size = image.shrink()
|
|
258 | 255 |
session['shrinked'] = True |
259 | 256 |
update_background_title(session) |
260 | 257 |
|
261 |
metadata.update(device.meta)
|
|
258 |
metadata.update(image.meta)
|
|
262 | 259 |
metadata['DESCRIPTION'] = wizard['ImageDescription'] |
263 | 260 |
|
264 | 261 |
#MD5 |
265 | 262 |
md5 = MD5(out) |
266 |
session['checksum'] = md5.compute(snapshot, size)
|
|
263 |
session['checksum'] = md5.compute(image.device, size)
|
|
267 | 264 |
|
268 | 265 |
#Metadata |
269 | 266 |
metastring = '\n'.join( |
... | ... | |
278 | 275 |
name = "%s-%s.diskdump" % (wizard['ImageName'], |
279 | 276 |
time.strftime("%Y%m%d%H%M")) |
280 | 277 |
pithos_file = "" |
281 |
with open(snapshot, 'rb') as f:
|
|
278 |
with open(image.device, 'rb') as f:
|
|
282 | 279 |
pithos_file = kamaki.upload(f, size, name, |
283 | 280 |
"(1/4) Calculating block hashes", |
284 | 281 |
"(2/4) Uploading missing blocks") |
Also available in: Unified diff