Example #1
0
    def __init__ (self, parser):
        # assume you have a .conf input file, first...
        # see : https://docs.python.org/2/library/configparser.html
        self.configparser=ConfigParser.SafeConfigParser()

        try:
            options,args = parser.parse_args()
        except SystemExit:
            print "Error in parsing options"
            sys.stderr.write("[wmcontrol exception] Error in parsing options")
            sys.exit(-1)

        global test_mode
        test_mode = test_mode or options.test

        if options.wmtest:
            print "Setting to injection in cmswebtest : ", options.wmtesturl
            wma.testbed(options.wmtesturl)
            
        if options.req_file != '' and options.req_file !=None:
            cfg_filename=options.req_file
            print "We have a configfile: %s." %cfg_filename
            self.configparser.read(cfg_filename)
        else: # ... otherwise, we have to convert the command line option parser to a .conf, and populate self.configparser
            print "We have a commandline."
            self.__fill_configparser(options)
Example #2
0
def main():
    parser = prepare_parser()
    options, args = parser.parse_args()
    if options.wmtest:
        print "Setting to injection in cmswebtest : ", options.wmtesturl
        wma.testbed(options.wmtesturl)
    for cfg_name in args:
        wma.upload_to_couch(cfg_name, options.label, options.user, options.group)
Example #3
0
def main():
    parser = prepare_parser()
    options, args = parser.parse_args()
    if options.wmtest:
        print("Setting to injection in cmswebtest : ", options.wmtesturl)
        wma.testbed(options.wmtesturl)
    for cfg_name in args:
        wma.upload_to_couch(cfg_name, options.label, options.user, options.group)
Example #4
0
def approveRequest(options):
    if options.workflows == '':
        print 'No workflows found'
        sys.exit(-1)
    workflows = set(options.workflows.split(','))
    print 'Approving requests: %s' % workflows
    if options.wmtest:
        wma.testbed(options.wmtesturl)
    for workflow in workflows:
        tries = 1
        while tries < 3:
            try:
                if(wma.getWorkflowStatus(wma.WMAGENT_URL, workflow) == 'new'):
                    wma.approveRequest(wma.WMAGENT_URL, workflow)
                break
            except Exception, e:
                time.sleep(1)
                print 'Something went wrong: %s Try number: %s' % (str(e), tries)
                tries += 1