예제 #1
0
def beginCatalog(d=None, u=None, h=None, c=None, f=None, **notes):
    return partial(_ctlgThisLine,
                   merge(notes, catalogId=newCatalogId(), 
                         testCase=c or notes.get('testCase', 'ad_hoc_%s'%(time.time())), 
                         targetHost=h or notes.get('targetHost', h),
                         targetUser=u or notes.get('targetUser', u)),
                   _detDB(d), u, h)
예제 #2
0
def genRunner(username=None, hostname=None, **notes): #(!:2)
    if username or hostname:
        return _runner(**merge(notes,
                             targetUser=username or environ.get("USER"),
                             targetHost=hostname or gethostname(),
                             preprocessor=makeRemoteCommand))
    return _runner(**notes)
예제 #3
0
def _runner(preprocessor=lambda x,**y: split(x), **iNotes):
    return lambda cmd,**notes: _evoke(preprocessor(cmd,**iNotes),
                                      merge(iNotes, notes, command=cmd))
예제 #4
0
def _evoke(cmdLst, notes): #(!:2)
    return _execute(merge(notes, started=time()), _popen(cmdLst))
예제 #5
0
def _finalizeReport(obs, retGet, stdout, stderr, finishTime):
    return merge(obs, artificeBreed='observation',
                 finished=finishTime, stdout=stdout,
                 stderr=stderr, retCode=retGet(),
                 duration=finishTime-obs.get('started',0))
예제 #6
0
def showAndRecord(reporter, artifice): #rig:3
    if artifice:
        if "-q" not in argv:
            print "%s"%(artifice)
        return merge(artifice, _id=reporter(artifice))
    return artifice
예제 #7
0
 def _hf(fn):
     return map(beginCatalog(**merge(args, testCase=path.split(fn)[1])),
                readLines(fn))
예제 #8
0
def _ctlgThisLine(notes, rptf, user, host, lineTxt):
    global interruptSignalReceived
    if not interruptSignalReceived:
        return showAndRecord(rptf, _ctlgy(notes,user, host, 
                                          *sliceTxt(subst(lineTxt, **notes))))
    return merge(notes, artificeBreed="interrupted")
예제 #9
0
 def dostep(**params):
     return merge(params, f(**params))