launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #20139
[Merge] lp:~paulgear/python-oops-tools/variable-retention-period into lp:python-oops-tools
Paul Gear has proposed merging lp:~paulgear/python-oops-tools/variable-retention-period into lp:python-oops-tools.
Requested reviews:
python-oops-tools reviewers (oops-tools-reviewers)
For more details, see:
https://code.launchpad.net/~paulgear/python-oops-tools/variable-retention-period/+merge/289862
Landscape have requested long retention for OOPSes; this is a (presently-untested) change to allow that. cRT#89955
--
Your team python-oops-tools reviewers is requested to review the proposed merge of lp:~paulgear/python-oops-tools/variable-retention-period into lp:python-oops-tools.
=== modified file 'src/oopstools/scripts/prune.py'
--- src/oopstools/scripts/prune.py 2012-12-05 17:30:35 +0000
+++ src/oopstools/scripts/prune.py 2016-03-23 06:29:26 +0000
@@ -53,9 +53,9 @@
Project and projectgroup can be supplied multiple times.
When run this program will ask Launchpad for OOPS references made since
- the last date it pruned up to, with an upper limit of one week from
- today. It then looks in the database for all oopses created during that
- date range, and if they are not in the set returned by Launchpad,
+ the last date it pruned up to, using the upper limit specified with
+ --retention. It then looks in the database for all oopses created during
+ that date range, and if they are not in the set returned by Launchpad,
deletes them. If the database has never been pruned before, it will
pick the earliest date present in the repository as the start date.
@@ -73,6 +73,8 @@
help="Launchpad project group to find references in.")
parser.add_option(
'--lpinstance', help="Launchpad instance to use", default="production")
+ parser.add_option(
+ '--retention', help="Number of days to keep OOPSes", default=7)
options, args = parser.parse_args(argv[1:])
def needed(*optnames):
present = set()
@@ -88,10 +90,10 @@
needed('project', 'projectgroup')
logging.basicConfig(
filename='logs/prune.log', filemode='w', level=logging.DEBUG)
- one_week = datetime.timedelta(weeks=1)
+ retention = datetime.timedelta(days=options.retention)
one_day = datetime.timedelta(days=1)
- # Only prune OOPS reports more than one week old.
- prune_until = datetime.datetime.now(utc) - one_week
+ # Only prune OOPS reports older than the retention period
+ prune_until = datetime.datetime.now(utc) - retention
# Ignore OOPS reports we already found references for - older than the last
# prune date.
try:
Follow ups