3
# Copyright 2009 Canonical Ltd. This software is licensed under the
3
# Copyright 2009-2011 Canonical Ltd. This software is licensed under the
4
4
# GNU Affero General Public License version 3 (see the file LICENSE).
6
6
# pylint: disable-msg=C0103,W0403
23
from lp.registry.scripts.teamparticipation import check_teamparticipation
23
from lp.registry.scripts.teamparticipation import (
24
check_teamparticipation_circular,
25
check_teamparticipation_consistency,
26
check_teamparticipation_self,
27
fetch_team_participation_info,
24
29
from lp.services.scripts.base import LaunchpadScript
30
from lp.services.utils import (
27
36
class CheckTeamParticipationScript(LaunchpadScript):
28
37
description = "Check for invalid/missing TeamParticipation entries."
39
def add_my_options(self):
40
self.parser.add_option(
41
"--load-participation-info",
42
dest="load_info", metavar="FILE", help=(
43
"File from which to load participation information "
44
"instead of going to the database."))
45
self.parser.add_option(
46
"--save-participation-info",
47
dest="save_info", metavar="FILE", help=(
48
"File in which to save participation information, for "
49
"later processing with --load-participation-info."))
31
check_teamparticipation(self.logger)
52
"""Perform various checks on the `TeamParticipation` table."""
53
if self.options.load_info:
54
participation_info = load_bz2_pickle(self.options.load_info)
56
check_teamparticipation_self(self.logger)
57
check_teamparticipation_circular(self.logger)
58
participation_info = fetch_team_participation_info(self.logger)
59
if self.options.save_info:
60
save_bz2_pickle(participation_info, self.options.save_info)
62
check_teamparticipation_consistency(
63
self.logger, participation_info)
34
66
if __name__ == '__main__':