print server_filter.expression
    server_refs=server_service.findServerRefs(server_filter)


    server_array=[]
    for srv in server_refs:
        server_array.append(srv)
    filtered_refs=auth_service.filterSingleTypeResourceList(OperationConstants.EXECUTE_SERVER_SCRIPT, server_array)
    ssja=ServerScriptJobArgs()
    ssja.targets=filtered_refs
    ssja.timeOut=3600
    if opts.args:
        ssja.parameters=opts.args
    if opts.runas_user and opts.runas_pwd and opts.runas_domain:
        ssja.username=opts.runas_user
        ssja.password=opts.runas_pwd
        ssja.loginDomain=opts.runas_domain
    if int(opts.debug)!=1:
        job_ref=server_script_service.startServerScript(script_ref,ssja,'Script from pytwist',default_notify(opts.email),None)
        print job_ref
    else:
        print filtered_refs

    if int(opts.debug)!=1:
        wait_count=0
        while(True and wait_count<9000):
            wait_count=wait_count+1
            job_progress=job_service.getProgress(job_ref)
            if(job_progress):
                sys.stdout.write('.')
                time.sleep(4)
Esempio n. 2
0
    print server_filter.expression
    server_refs = server_service.findServerRefs(server_filter)

    server_array = []
    for srv in server_refs:
        server_array.append(srv)
    filtered_refs = auth_service.filterSingleTypeResourceList(
        OperationConstants.EXECUTE_SERVER_SCRIPT, server_array)
    ssja = ServerScriptJobArgs()
    ssja.targets = filtered_refs
    ssja.timeOut = 3600
    if opts.args:
        ssja.parameters = opts.args
    if opts.runas_user and opts.runas_pwd and opts.runas_domain:
        ssja.username = opts.runas_user
        ssja.password = opts.runas_pwd
        ssja.loginDomain = opts.runas_domain
    if int(opts.debug) != 1:
        job_ref = server_script_service.startServerScript(
            script_ref, ssja, 'Script from pytwist',
            default_notify(opts.email), None)
        print job_ref
    else:
        print filtered_refs

    if int(opts.debug) != 1:
        wait_count = 0
        while (True and wait_count < 9000):
            wait_count = wait_count + 1
            job_progress = job_service.getProgress(job_ref)
            if (job_progress):