X-Git-Url: http://git.onelab.eu/?p=sface.git;a=blobdiff_plain;f=sface%2Fsfiprocess.py;h=8eb0408a091ae8d8764848d7504096939e8423ec;hp=cd98a314f8f1a94634977129610dd6afc58a0713;hb=7deacd09712ea9d96f3dcef6195f3e207efb55f4;hpb=5d9d4374df91f919e5c744906186b2769b6d09ae diff --git a/sface/sfiprocess.py b/sface/sfiprocess.py index cd98a31..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,23 +105,73 @@ class SfiProcess(QObject): # def getRSpecFromAM(self): # return self.__getRSpec(config.getAggmgr()) - def getRecord(self, hrn): - args = ["-u", config.getUser(), "-a", config.getAuthority(), + 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] + if filename: + args.append("-o") + args.append(filename) 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) - args = ["-u", config.getUser(), "-a", config.getAuthority(), - "-r", config.getRegistry(), "-s", config.getSlicemgr(), "create", + args = ["-u", config.getUser(), "-a", config.getAuthority(), + "-r", config.getRegistry(), "-s", config.getSlicemgr(), "create", config.getSlice(), filename] self.__init_command(args) self.start() return filename + def updateRecord(self, filename): + args = ["-u", config.getUser(), "-a", config.getAuthority(), + "-r", config.getRegistry(), "-s", config.getSlicemgr(), "update", filename] + 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", + config.getSlice(), expiration] + self.__init_command(args) + self.start() + def start(self): + self.output = "" self.trace_command() self.process.start(self.exe, self.args)