예제 #1
0
파일: cli.py 프로젝트: Axam/nsx-web
def run_upgrade(args):
    """Run upgrade on master node

    :param args: argparse object
    """
    # Initialize config
    config = build_config(args.src)
    logger.debug('Configuration data: {0}'.format(config))

    # Initialize upgrade engines
    upgraders_to_use = [
        SUPPORTED_SYSTEMS[system](config)
        for system in args.systems]

    # Initialize checkers
    if not args.no_checker:
        checker_manager = CheckerManager(upgraders_to_use, config)
        checker_manager.check()

    # Initialize pre upgrade hook manager
    hook_manager = PreUpgradeHookManager(upgraders_to_use, config)
    hook_manager.run()

    # Initialize upgrade manager with engines and checkers
    upgrade_manager = UpgradeManager(upgraders_to_use, args.no_rollback)
    upgrade_manager.run()
예제 #2
0
class TestPreUpgradeHookManager(TestPreUpgradeHooksBase):

    def setUp(self):
        super(TestPreUpgradeHookManager, self).setUp()

        self.required_hooks = [mock.MagicMock(), mock.MagicMock()]
        for hook in self.required_hooks:
            type(hook).is_required = mock.PropertyMock(return_value=True)

        self.not_required_hooks = [mock.MagicMock()]
        for hook in self.not_required_hooks:
            type(hook).is_required = mock.PropertyMock(return_value=False)

        self.hooks = []
        self.hooks.extend(self.required_hooks)
        self.hooks.extend(self.not_required_hooks)

        self.hook_manager = PreUpgradeHookManager(
            self.upgraders, self.fake_config)

    def test_run(self):
        self.hook_manager.pre_upgrade_hooks = self.hooks
        self.hook_manager.run()

        for hook in self.required_hooks:
            self.called_once(hook.run)

        for hook in self.not_required_hooks:
            self.method_was_not_called(hook.run)
예제 #3
0
파일: cli.py 프로젝트: romcheg/fuel-web
def run_upgrade(args):
    """Run upgrade on master node

    :param args: argparse object
    """
    # Initialize config
    config = build_config(args.src)
    logger.debug('Configuration data: {0}'.format(config))

    # Initialize upgrade engines
    upgraders_to_use = [
        SUPPORTED_SYSTEMS[system](config) for system in args.systems
    ]

    # Initialize checkers
    if not args.no_checker:
        checker_manager = CheckerManager(upgraders_to_use, config)
        checker_manager.check()

    # Initialize pre upgrade hook manager
    hook_manager = PreUpgradeHookManager(upgraders_to_use, config)
    hook_manager.run()

    # Initialize upgrade manager with engines and checkers
    upgrade_manager = UpgradeManager(upgraders_to_use, args.no_rollback)
    upgrade_manager.run()
예제 #4
0
def run_upgrade(args):
    """Run upgrade on master node

    :param args: argparse object
    """
    # Get admin password
    if not args.password:
        args.password = getpass.getpass('Admin Password: '******'Configuration data: %s', config)

    # Initialize upgrade engines
    upgraders_to_use = [
        SUPPORTED_SYSTEMS[system](config)
        for system in args.systems]

    # Initialize checkers
    if not args.no_checker:
        checker_manager = CheckerManager(upgraders_to_use, config)
        checker_manager.check()

    # Initialize pre upgrade hook manager
    hook_manager = PreUpgradeHookManager(upgraders_to_use, config)
    hook_manager.run()

    # Initialize upgrade manager with engines and checkers
    upgrade_manager = UpgradeManager(
        upgraders_to_use, config, args.no_rollback)
    upgrade_manager.run()
예제 #5
0
def run_upgrade(args):
    """Run upgrade on master node

    :param args: argparse object
    """
    # Get admin password
    if not args.password:
        args.password = getpass.getpass('Admin Password: '******'Configuration data: %s', config)

    # Initialize upgrade engines
    upgraders_to_use = [
        SUPPORTED_SYSTEMS[system](config) for system in args.systems
    ]

    # Initialize checkers
    if not args.no_checker:
        checker_manager = CheckerManager(upgraders_to_use, config)
        checker_manager.check()

    # Initialize pre upgrade hook manager
    hook_manager = PreUpgradeHookManager(upgraders_to_use, config)
    hook_manager.run()

    # Initialize upgrade manager with engines and checkers
    upgrade_manager = UpgradeManager(upgraders_to_use, args.no_rollback)
    upgrade_manager.run()
예제 #6
0
class TestPreUpgradeHookManager(TestPreUpgradeHooksBase):

    def setUp(self):
        super(TestPreUpgradeHookManager, self).setUp()

        self.required_hooks = [mock.MagicMock(), mock.MagicMock()]
        for hook in self.required_hooks:
            type(hook).is_required = mock.PropertyMock(return_value=True)

        self.not_required_hooks = [mock.MagicMock()]
        for hook in self.not_required_hooks:
            type(hook).is_required = mock.PropertyMock(return_value=False)

        self.hooks = []
        self.hooks.extend(self.required_hooks)
        self.hooks.extend(self.not_required_hooks)

        self.hook_manager = PreUpgradeHookManager(
            self.upgraders, self.fake_config)

    def test_run(self):
        self.hook_manager.pre_upgrade_hooks = self.hooks
        self.hook_manager.run()

        for hook in self.required_hooks:
            self.called_once(hook.run)

        for hook in self.not_required_hooks:
            self.method_was_not_called(hook.run)
예제 #7
0
    def setUp(self):
        super(TestPreUpgradeHookManager, self).setUp()

        self.required_hooks = [mock.MagicMock(), mock.MagicMock()]
        for hook in self.required_hooks:
            type(hook).is_required = mock.PropertyMock(return_value=True)

        self.not_required_hooks = [mock.MagicMock()]
        for hook in self.not_required_hooks:
            type(hook).is_required = mock.PropertyMock(return_value=False)

        self.hooks = []
        self.hooks.extend(self.required_hooks)
        self.hooks.extend(self.not_required_hooks)

        self.hook_manager = PreUpgradeHookManager(
            self.upgraders, self.fake_config)
예제 #8
0
    def setUp(self):
        super(TestPreUpgradeHookManager, self).setUp()

        self.required_hooks = [mock.MagicMock(), mock.MagicMock()]
        for hook in self.required_hooks:
            type(hook).is_required = mock.PropertyMock(return_value=True)

        self.not_required_hooks = [mock.MagicMock()]
        for hook in self.not_required_hooks:
            type(hook).is_required = mock.PropertyMock(return_value=False)

        self.hooks = []
        self.hooks.extend(self.required_hooks)
        self.hooks.extend(self.not_required_hooks)

        self.hook_manager = PreUpgradeHookManager(
            self.upgraders, self.fake_config)