Revision e482b7f9 image_creator/image.py

b/image_creator/image.py
88 88

  
89 89
        self.out.output('Inspecting Operating System ...', False)
90 90
        roots = self.g.inspect_os()
91
        if len(roots) == 0:
92
            raise FatalError("No operating system found")
93
        if len(roots) > 1:
94
            raise FatalError("Multiple operating systems found."
95
                             "We only support images with one OS.")
91

  
92
        if len(roots) == 0 or len(roots) > 1:
93
            self.root = None
94
            self.ostype = "unsupported"
95
            self.distro = "unsupported"
96
            self.guestfs_device = '/dev/sda'
97
            self.size = self.g.blockdev_getsize64(self.guestfs_device)
98
            if len(roots) > 1:
99
                self.unsupported = "Multiple operating systems found on the " \
100
                    "media. We only support images with one OS."
101
            else:
102
                self.unsupported = \
103
                    "Unable to detect any operating system on the media"
104

  
105
            self.meta['UNSUPPORTED'] = "Reason: %s" % self.unsupported
106
            self.out.warn('Media is not supported. %s' %
107
                          self.meta['UNSUPPORTED'])
108
            return
109

  
96 110
        self.root = roots[0]
97 111
        self.guestfs_device = self.g.part_to_dev(self.root)
98 112
        self.size = self.g.blockdev_getsize64(self.guestfs_device)
......
264 278

  
265 279
        self.out.output("Shrinking image (this may take a while) ...", False)
266 280

  
281
        if hasattr(self, "unsupported"):
282
            self.out.warn("Unable to shrink unsupported image")
283
            return self.size
284

  
267 285
        sector_size = self.g.blockdev_getss(self.guestfs_device)
268 286

  
269 287
        last_part = None

Also available in: Unified diff