#!/usr/local/bin/python # -*- coding: UTF-8 -*- """Organising testruns """ # Copyright 2008-2010 eGovMon # This program is distributed under the terms of the GNU General # Public License. # # This file is part of the eGovernment Monitoring # (eGovMon) # # eGovMon is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # eGovMon is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with eGovMon; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, # MA 02110-1301 USA import SOAPpy import sys import egovmondb import socket import urllib from logit import * import sc sc = sc.SystemConfiguration() def usage(): print 'Usage: startegovmon urllistid testrundid responsible contenttype' try: contenttype = sys.argv[-1] responsible = sys.argv[-2] testrunid = sys.argv[-3] urllistid = sys.argv[-4] except IndexError: usage() sys.exit(1) if len(sys.argv)<4: usage() sys.exit(1) def checkonline(typeofserver): try: return SOAPpy.SOAPProxy(typeofserver).ping() except socket.error: return False if not checkonline(sc.samplingserver): print 'Warning: Sampling server',sc.samplingserver,'not online.' print responsible,'has started testrun',testrunid,'with urllist',urllistid egovmondb = egovmondb.eGovMonDB() revision = egovmondb.getRevision() egovmondb.initiateTestrun(urllistid,testrunid,responsible,revision,contenttype) server = SOAPpy.SOAPProxy(urllib.unquote(sc.siteurlserver)) server.startTestrun(testrunid,contenttype) logit('Started testrun '+testrunid,stdout=True)