X-Git-Url: http://git.onelab.eu/?p=sface.git;a=blobdiff_plain;f=sface%2Fsfiprocess.py;h=8eb0408a091ae8d8764848d7504096939e8423ec;hp=bef0902c93b3432bf149ed1077df8a21a0b335ad;hb=7deacd09712ea9d96f3dcef6195f3e207efb55f4;hpb=a30b55dc5d556c92155aada00a46c91450887f71 diff --git a/sface/sfiprocess.py b/sface/sfiprocess.py index bef0902..8eb0408 100644 --- a/sface/sfiprocess.py +++ b/sface/sfiprocess.py @@ -27,11 +27,12 @@ class SfiProcess(QObject): self.process.setEnvironment(env) self.connect(self.process, SIGNAL("finished(int, QProcess::ExitStatus)"), self.processFinished) - + self.xmlrpctracker = XmlrpcTracker() - # in case self.output is read by the XmlrpcTracker before any - # readyReadStandardOutput signal - self.output = '' + + # holds aggregate output from processStandardOutput(); used by xmlrpc + # tracker. + self.output = "" self.connect(self.process, SIGNAL("readyReadStandardOutput()"), self.processStandardOutput) @@ -55,6 +56,7 @@ class SfiProcess(QObject): def processStandardOutput(self): output = self.process.readAllStandardOutput() + self.output = self.output + output if config.debug: print output @@ -103,6 +105,27 @@ class SfiProcess(QObject): # def getRSpecFromAM(self): # return self.__getRSpec(config.getAggmgr()) + def listRecords(self, hrn, rectype=None, filename=None): + args = ["-u", config.getUser(), "-a", config.getAuthority(), + "-r", config.getRegistry(), "-s", config.getSlicemgr(), "list", hrn] + + if filename: + # we can't tell whether SFI will create one file or many, so delete + # leftovers from last time, then we'll know what we got, after we get it. + if os.path.exists(filename): + os.remove(filename) + if os.path.exists(filename + ".1"): + os.remove(filename + ".1") + args.append("-o") + args.append(filename) + + if rectype: + args.append("-t") + args.append(rectype) + + self.__init_command(args) + self.start() + def getRecord(self, hrn, filename=None): args = ["-u", config.getUser(), "-a", config.getAuthority(), "-r", config.getRegistry(), "-s", config.getSlicemgr(), "show", hrn] @@ -112,6 +135,12 @@ class SfiProcess(QObject): self.__init_command(args) self.start() + def getSliceRecord(self): + self.getRecord(config.getSlice(), config.getSliceRecordFile()) + + def getAuthorityRecord(self): + self.getRecord(config.getAuthority(), config.getAuthorityRecordFile()) + def applyRSpec(self, rspec): filename = config.getSliceRSpecFile() + "_new" rspec.save(filename) @@ -128,6 +157,12 @@ class SfiProcess(QObject): self.__init_command(args) self.start() + def addRecord(self, filename): + args = ["-u", config.getUser(), "-a", config.getAuthority(), + "-r", config.getRegistry(), "-s", config.getSlicemgr(), "add", filename] + self.__init_command(args) + self.start() + def renewSlivers(self, expiration): args = ["-u", config.getUser(), "-a", config.getAuthority(), "-r", config.getRegistry(), "-s", config.getSlicemgr(), "renew", @@ -136,6 +171,7 @@ class SfiProcess(QObject): self.start() def start(self): + self.output = "" self.trace_command() self.process.start(self.exe, self.args)