summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormbligh <mbligh@592f7852-d20e-0410-864c-8624ca9c26a4>2008-03-11 22:40:55 +0000
committermbligh <mbligh@592f7852-d20e-0410-864c-8624ca9c26a4>2008-03-11 22:40:55 +0000
commit6d866bcf1a5405f3be0b032bab7292e59563767e (patch)
tree30ee8e7b58bf22a206781401dff49a570244ce63
parent30669ccbdacfd36b843a403d5b97d85201f243d1 (diff)
Add options to specify db host, username, pass, and db_name
Add usage message if no options are passed to parse Signed-off-by: Scott Zawalski <scottz@google.com> git-svn-id: svn://test.kernel.org/autotest/trunk@1334 592f7852-d20e-0410-864c-8624ca9c26a4
-rwxr-xr-xtko/parse19
1 files changed, 17 insertions, 2 deletions
diff --git a/tko/parse b/tko/parse
index 19a4cf8b..4dd7850c 100755
--- a/tko/parse
+++ b/tko/parse
@@ -21,8 +21,21 @@ parser.add_option('-o', help='one: parse a single results directory',
dest='singledir', action='store_true')
parser.add_option('-l', help='levels of subdirectories to include in job name',
type='int', dest='level', default=1)
+parser.add_option('-s', help='Database server hostname',
+ dest='db_host', action='store')
+parser.add_option('-u', help='Database username',
+ dest='db_user', action='store')
+parser.add_option('-p', help='Database password',
+ dest='db_pass', action='store')
+parser.add_option('-d', help='Database name',
+ dest='db_name', action='store')
(options, args) = parser.parse_args()
+if len(args) == 0:
+ print "ERROR: You need to at least provide a directory to parse\n"
+ parser.print_help()
+ sys.exit(1)
+
dir = os.path.abspath(args[0])
assert os.path.exists(dir)
@@ -36,8 +49,10 @@ debug = True
failcc = ""
# The user to notify on job failures - TOOD, pull into the config file
notify_user = None
-
-db = db.db(autocommit=False) # do commits transactionally
+# do commits transactionally
+db = db.db(autocommit=False, host=options.db_host,
+ user=options.db_user, password=options.db_pass,
+ database=options.db_name)
def mailfailure(jobname, job, mesgtxt):