コード例 #1
0
    def _take_action(self, parsed_args):
        self.rebuilder = AccountRebuilder(self.tool_conf, logger=self.logger)
        self.rebuilder.prepare_local_dispatcher()

        for item, _, error in self.rebuilder.run():
            if error is None:
                status = 'OK'
            else:
                status = 'error'
            yield (self.rebuilder.string_from_item(item), status, error)
コード例 #2
0
ファイル: item_repair.py プロジェクト: perrynzhou/oio-sds
    def _take_action(self, parsed_args):
        accounts = list()
        for account_name in parsed_args.accounts:
            account = dict()
            account['namespace'] = self.app.options.ns
            account['account'] = account_name
            accounts.append(account)

        self.repairer = AccountRebuilder(self.tool_conf,
                                         accounts=accounts,
                                         logger=self.logger)
        self.repairer.prepare_local_dispatcher()

        for item, _, error in self.repairer.run():
            if error is None:
                status = 'OK'
            else:
                status = 'error'
            yield (self.repairer.string_from_item(item), status, error)
コード例 #3
0
ファイル: item_repair.py プロジェクト: perrynzhou/oio-sds
class AccountRepair(AccountCommandMixin, ItemRepairCommand):
    """
    Repair a account.

    The steps of the repair:
    recompute the counter of this account ;
    refresh the counter of all containers in this account.
    """

    tool_class = AccountRebuilder
    columns = ('Entry', 'Status', 'Errors')

    def get_parser(self, prog_name):
        parser = super(AccountRepair, self).get_parser(prog_name)
        AccountCommandMixin.patch_parser(self, parser)
        return parser

    def _take_action(self, parsed_args):
        accounts = list()
        for account_name in parsed_args.accounts:
            account = dict()
            account['namespace'] = self.app.options.ns
            account['account'] = account_name
            accounts.append(account)

        self.repairer = AccountRebuilder(self.tool_conf,
                                         accounts=accounts,
                                         logger=self.logger)
        self.repairer.prepare_local_dispatcher()

        for item, _, error in self.repairer.run():
            if error is None:
                status = 'OK'
            else:
                status = 'error'
            yield (self.repairer.string_from_item(item), status, error)

    def take_action(self, parsed_args):
        AccountCommandMixin.check_and_load_parsed_args(self, self.app,
                                                       parsed_args)
        return super(AccountRepair, self).take_action(parsed_args)
コード例 #4
0
class AccountServiceRebuild(ServiceRebuildCommand):
    """
    Rebuild account services.
    The steps of the rebuilding:
    recompute the counter of all accounts ;
    refresh the counter of all containers.
    """

    tool_class = AccountRebuilder
    columns = ('Entry', 'Status', 'Errors')

    def _take_action(self, parsed_args):
        self.rebuilder = AccountRebuilder(self.tool_conf, logger=self.logger)
        self.rebuilder.prepare_local_dispatcher()

        for item, _, error in self.rebuilder.run():
            if error is None:
                status = 'OK'
            else:
                status = 'error'
            yield (self.rebuilder.string_from_item(item), status, error)