Revision f5174d2c image_creator/dialog_main.py

b/image_creator/dialog_main.py
48 48
from image_creator.output.dialog import GaugeOutput
49 49
from image_creator.output.composite import CompositeOutput
50 50
from image_creator.disk import Disk
51
from image_creator.os_type import os_cls
52 51
from image_creator.dialog_wizard import wizard
53 52
from image_creator.dialog_menu import main_menu
54 53
from image_creator.dialog_util import SMALL_WIDTH, WIDTH, confirm_exit, \
55 54
    Reset, update_background_title
56 55

  
57 56

  
58
def image_creator(d, media, out, tmp):
57
def create_image(d, media, out, tmp):
59 58

  
60 59
    d.setBackgroundTitle('snf-image-creator')
61 60

  
......
71 70
    signal.signal(signal.SIGTERM, signal_handler)
72 71
    try:
73 72
        snapshot = disk.snapshot()
74
        dev = disk.get_device(snapshot)
73
        image = disk.get_image(snapshot)
75 74

  
75
        out.output("Collecting image metadata...")
76 76
        metadata = {}
77
        for (key, value) in dev.meta.items():
77
        for (key, value) in image.meta.items():
78 78
            metadata[str(key)] = str(value)
79 79

  
80
        dev.mount(readonly=True)
81
        out.output("Collecting image metadata...")
82
        cls = os_cls(dev.distro, dev.ostype)
83
        image_os = cls(dev.root, dev.g, out)
84
        dev.umount()
85

  
86
        for (key, value) in image_os.meta.items():
80
        for (key, value) in image.os.meta.items():
87 81
            metadata[str(key)] = str(value)
88 82

  
89 83
        out.success("done")
......
97 91

  
98 92
        session = {"dialog": d,
99 93
                   "disk": disk,
100
                   "snapshot": snapshot,
101
                   "device": dev,
102
                   "image_os": image_os,
94
                   "image": image,
103 95
                   "metadata": metadata}
104 96

  
105 97
        msg = "snf-image-creator detected a %s system on the input media. " \
......
107 99
              "image creation process?\n\nChoose <Wizard> to run the wizard," \
108 100
              " <Expert> to run the snf-image-creator in expert mode or " \
109 101
              "press ESC to quit the program." \
110
              % (dev.ostype if dev.ostype == dev.distro else "%s (%s)" %
111
                 (dev.ostype, dev.distro))
102
              % (image.ostype if image.ostype == image.distro else "%s (%s)" %
103
                 (image.ostype, image.distro))
112 104

  
113 105
        update_background_title(session)
114 106

  
......
226 218
                    out = CompositeOutput([log])
227 219
                    out.output("Starting %s v%s..." %
228 220
                               (parser.get_prog_name(), version))
229
                    ret = image_creator(d, media, out, options.tmp)
221
                    ret = create_image(d, media, out, options.tmp)
230 222
                    sys.exit(ret)
231 223
                except Reset:
232 224
                    log.output("Resetting everything...")

Also available in: Unified diff