launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #20140
[Merge] lp:~paulgear/python-oops-datedir-repo/variable-retention-period into lp:python-oops-datedir-repo
Paul Gear has proposed merging lp:~paulgear/python-oops-datedir-repo/variable-retention-period into lp:python-oops-datedir-repo.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~paulgear/python-oops-datedir-repo/variable-retention-period/+merge/289863
Landscape have requested long retention for OOPSes; this is a presently-untested change to allow that. cRT#89955
--
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~paulgear/python-oops-datedir-repo/variable-retention-period into lp:python-oops-datedir-repo.
=== modified file 'oops_datedir_repo/prune.py'
--- oops_datedir_repo/prune.py 2012-09-26 06:57:23 +0000
+++ oops_datedir_repo/prune.py 2016-03-23 06:29:43 +0000
@@ -28,7 +28,6 @@
import sys
from launchpadlib.launchpad import Launchpad
-from launchpadlib.uris import lookup_service_root
from pytz import utc
import oops_datedir_repo
@@ -106,8 +105,8 @@
--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 repository for all oopses created during
+ the last date it pruned up to, using the upper limit specified with
+ --retention. It then looks in the repository for all oopses created during
that date range, and if they are not in the set returned by Launchpad,
deletes them. If the repository has never been pruned before, it will
pick the earliest datedir present in the repository as the start date.
@@ -122,6 +121,8 @@
help="Launchpad project group to find references in.")
parser.add_option('--repo', help="Path to the repository to read from.")
parser.add_option(
+ '--retention', help="Number of days to keep OOPSes", default=7)
+ parser.add_option(
'--lpinstance', help="Launchpad instance to use", default="production")
options, args = parser.parse_args(argv[1:])
def needed(*optnames):
@@ -140,10 +141,9 @@
logging.basicConfig(
filename='prune.log', filemode='w', level=logging.DEBUG)
repo = oops_datedir_repo.DateDirRepo(options.repo)
- one_week = datetime.timedelta(weeks=1)
- one_day = datetime.timedelta(days=1)
- # Only prune OOPS reports more than one week old.
- prune_until = datetime.datetime.now(utc) - one_week
+ retention = datetime.timedelta(days=options.retention)
+ # 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