~james-w/python-oops-tools/prod-deploy

« back to all changes in this revision

Viewing changes to src/oopstools/scripts/prune.py

  • Committer: Tarmac
  • Author(s): Robert Collins
  • Date: 2012-09-26 07:40:54 UTC
  • mfrom: (47.1.1 bug-1003627)
  • Revision ID: launchpad@pqm.canonical.com-20120926074054-nmzdilwoern0yogs
0.6.7: make it possible to supply a complete list of projects or project groups to prune.

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
        %prog [options]
41
41
 
42
42
        The following options must be supplied:
43
 
        Either
 
43
        At least one of
44
44
         --project
45
45
        or
46
46
         --projectgroup
50
50
 
51
51
        Will process every member project of launchpad-project.
52
52
 
 
53
        Project and projectgroup can be supplied multiple times.
 
54
 
53
55
        When run this program will ask Launchpad for OOPS references made since
54
56
        the last date it pruned up to, with an upper limit of one week from
55
57
        today. It then looks in the database for all oopses created during that
65
67
        "Delete OOPS reports that are not referenced in a bug tracker."
66
68
    parser = optparse.OptionParser(
67
69
        description=description, usage=usage)
68
 
    parser.add_option('--project',
 
70
    parser.add_option('--project', action="append",
69
71
        help="Launchpad project to find references in.")
70
 
    parser.add_option('--projectgroup',
 
72
    parser.add_option('--projectgroup', action="append",
71
73
        help="Launchpad project group to find references in.")
72
74
    parser.add_option(
73
75
        '--lpinstance', help="Launchpad instance to use", default="production")
83
85
            else:
84
86
                raise ValueError(
85
87
                    'One of options %s must be supplied' % (optnames,))
86
 
        elif len(present) != 1:
87
 
            raise ValueError(
88
 
                    'Only one of options %s can be supplied' % (optnames,))
89
88
    needed('project', 'projectgroup')
90
89
    logging.basicConfig(
91
90
        filename='prune.log', filemode='w', level=logging.DEBUG)