Ejemplo n.º 1
0
    def doWork(self):
        configHolder = ConfigHolder(self.options.__dict__, self.config)

        if self.options.saveDisk:
            creator = Creator(self.image, configHolder)
            creator.createRunner()
            runner = creator.runner
        else:
            runner = VmManagerFactory.create(self.image, configHolder)

        if self.options.listType:
            print runner.listInstanceTypes()
        else:
            vmInfo = runner.runInstance(details=True)

            # TODO: This is anti-intuitive and should be reviewed.
            #
            # To keep compatibility with the previous output, this will
            # only print something when quiet is set.  The 'normal' output
            # will be printed via INFO logging statements in the code.
            if self.options.quiet > 0:
                self._printShortResults(vmInfo)