[Qa-jenkins-scm] [jenkins.debian.net] 01/03: reproducible: scheduler: add a --null flag to read arguments from stdin and consider them null-terminated. Thanks Lunar for the suggestion

Holger Levsen holger at moszumanska.debian.org
Tue Aug 18 22:30:37 UTC 2015


This is an automated email from the git hooks/post-receive script.

holger pushed a commit to branch master
in repository jenkins.debian.net.

commit 16955949fd64ef9adf251a106cb7dfcbf99f35c0
Author: Mattia Rizzolo <mattia at mapreri.org>
Date:   Tue Aug 18 21:40:59 2015 +0000

    reproducible: scheduler: add a --null flag to read arguments from stdin and consider them null-terminated. Thanks Lunar for the suggestion
---
 bin/reproducible_remote_scheduler.py | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/bin/reproducible_remote_scheduler.py b/bin/reproducible_remote_scheduler.py
index 435dedd..50957b7 100755
--- a/bin/reproducible_remote_scheduler.py
+++ b/bin/reproducible_remote_scheduler.py
@@ -8,6 +8,7 @@
 #
 # A secure script to be called from remote hosts
 
+import sys
 import time
 import argparse
 
@@ -20,6 +21,16 @@ parser = argparse.ArgumentParser(
            ' issue AND that status AND that date". Blacklisted package '
            "can't be selected by a filter, but needs to be explitely listed"
            ' in the package list.')
+parser.add_argument('--null', action='store_true', help='The arguments are '
+                    'considered null-separated and coming from stding')
+
+null_args = parser.parse_known_args()[0]
+if null_args.null:
+    input_args = sys.stdin.read().split('\0')
+else:
+    input_args = sys.argv
+
+
 parser.add_argument('--dry-run', action='store_true')
 parser.add_argument('-k', '--keep-artifacts',  action='store_true',
                    help='Save artifacts (for further offline study)')
@@ -45,7 +56,7 @@ parser.add_argument('-s', '--suite', required=True,
                     help='Specify the suite to schedule in')
 parser.add_argument('packages', metavar='package', nargs='*',
                     help='list of packages to reschedule')
-scheduling_args = parser.parse_known_args()[0]
+scheduling_args = parser.parse_known_args(args=input_args)[0]
 
 # these are here as an hack to be able to parse the command line
 from reproducible_common import *

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/qa/jenkins.debian.net.git



More information about the Qa-jenkins-scm mailing list