aboutsummaryrefslogtreecommitdiffstats
path: root/rrs/tools/rrs_upstream_email.py
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2018-04-10 09:28:14 +1200
committerPaul Eggleton <paul.eggleton@linux.intel.com>2018-05-04 23:57:53 +1200
commit201c74ca0f202171d6a4a92ec14b1b781298aaf6 (patch)
tree8d2fc0d652d37569f070d4db4e8600f5dbbe0d66 /rrs/tools/rrs_upstream_email.py
parentbaa3f78498a07ca38ba1f31448292901a819e3c8 (diff)
downloadopenembedded-core-contrib-201c74ca0f202171d6a4a92ec14b1b781298aaf6.tar.gz
rrs/tools: add -p/--plan option
Add an option to specify which maintenance plan to operate on (largely for debugging purposes). Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Diffstat (limited to 'rrs/tools/rrs_upstream_email.py')
-rwxr-xr-xrrs/tools/rrs_upstream_email.py18
1 files changed, 14 insertions, 4 deletions
diff --git a/rrs/tools/rrs_upstream_email.py b/rrs/tools/rrs_upstream_email.py
index c4657b09d0..7d2aa419b0 100755
--- a/rrs/tools/rrs_upstream_email.py
+++ b/rrs/tools/rrs_upstream_email.py
@@ -123,6 +123,10 @@ def main():
usage = """
%prog [options]""")
+ parser.add_option("-p", "--plan",
+ help="Specify maintenance plan to operate on (default is all plans that have updates enabled)",
+ action="store", dest="plan", default=None)
+
parser.add_option("-s", "--subject",
action="store", dest="subject", help='Override email subject')
parser.add_option("-f", "--from",
@@ -139,10 +143,16 @@ def main():
options, args = parser.parse_args(sys.argv)
# get recipes for send email
- maintplans = MaintenancePlan.objects.filter(email_enabled=True)
- if not maintplans.exists():
- logger.error('No maintenance plans with email enabled were found')
- sys.exit(1)
+ if options.plan:
+ maintplans = MaintenancePlan.objects.filter(id=int(options.plan))
+ if not maintplans.exists():
+ logger.error('No maintenance plan with ID %s found' % options.plan)
+ sys.exit(1)
+ else:
+ maintplans = MaintenancePlan.objects.filter(email_enabled=True)
+ if not maintplans.exists():
+ logger.error('No maintenance plans with email enabled were found')
+ sys.exit(1)
for maintplan in maintplans:
recipes = {}