def take_action(self, parsed_args): image_uuid, path = bs_image.make_bootstrap(vars(parsed_args)) self.app.stdout.write("Bootstrap image {0} has been built: {1}\n".format(image_uuid, path)) if parsed_args.activate: bs_image.import_image(path) bs_image.activate(image_uuid) self.app.stdout.write("Bootstrap image {0} has been activated.\n".format(image_uuid))
def take_action(self, parsed_args): image_uuid, path = bs_image.make_bootstrap(vars(parsed_args)) self.app.stdout.write("Bootstrap image {0} has been built: {1}\n" .format(image_uuid, path)) if parsed_args.activate: bs_image.import_image(path) bs_image.activate(image_uuid) self.app.stdout.write("Bootstrap image {0} has been activated.\n" .format(image_uuid))
def take_action(self, parsed_args): super(BuildCommand, self).take_action(parsed_args) #构造一个bootstrap image_uuid, path = bs_image.make_bootstrap(vars(parsed_args)) self.app.stdout.write( "Bootstrap image {0} has been built: {1}\n".format( image_uuid, path)) #导入bootstrap if parsed_args.activate: bs_image.import_image(path) bs_image.activate(image_uuid) self.app.stdout.write( "Bootstrap image {0} has been activated.\n".format(image_uuid))
def take_action(self, parsed_args): # Cliff handles errors by itself image_uuid = bs_image.import_image(parsed_args.filename) self.app.stdout.write("Bootstrap image {0} has been imported.\n" .format(image_uuid)) if parsed_args.activate: image_uuid = bs_image.activate(image_uuid) self.app.stdout.write("Bootstrap image {0} has been activated\n" .format(image_uuid))
def take_action(self, parsed_args): # Cliff handles errors by itself image_uuid = bs_image.import_image(parsed_args.filename) self.app.stdout.write( "Bootstrap image {0} has been imported.\n".format(image_uuid)) if parsed_args.activate: image_uuid = bs_image.activate(image_uuid) self.app.stdout.write( "Bootstrap image {0} has been activated\n".format(image_uuid))
def test_activate(self, activate_mock, parse_mock): image_uuid = '/test/test_image_uuid' activate_mock.return_value = image_uuid self.assertEqual(image_uuid, bs_image.activate(image_uuid)) parse_mock.assert_called_once_with(image_uuid) activate_mock.assert_called_once_with(image_uuid)
def take_action(self, parsed_args): super(ActivateCommand, self).take_action(parsed_args) # cliff handles errors by itself image_uuid = bs_image.activate(parsed_args.id) self.app.stdout.write("Bootstrap image {0} has been activated.\n" .format(image_uuid))