git://git.onelab.eu
/
sface.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
cleanup
[sface.git]
/
sface
/
sfiprocess.py
diff --git
a/sface/sfiprocess.py
b/sface/sfiprocess.py
index
829abab
..
34608de
100644
(file)
--- a/
sface/sfiprocess.py
+++ b/
sface/sfiprocess.py
@@
-5,7
+5,7
@@
import time
from PyQt4.QtCore import *
from sface.config import config
from PyQt4.QtCore import *
from sface.config import config
-from sface.xmlrpcwindow import XmlrpcTracker
+from sface.xmlrpcwindow import XmlrpcTracker
, XmlrpcReader
def find_executable(exec_name):
"""find the given executable in $PATH"""
def find_executable(exec_name):
"""find the given executable in $PATH"""
@@
-28,7
+28,8
@@
class SfiProcess(QObject):
self.connect(self.process, SIGNAL("finished(int, QProcess::ExitStatus)"),
self.processFinished)
self.connect(self.process, SIGNAL("finished(int, QProcess::ExitStatus)"),
self.processFinished)
- self.xmlrpctracker = XmlrpcTracker()
+ self.xmlrpcreader = XmlrpcReader() # this one is for parsing XMLRPC responses
+ self.xmlrpctracker = XmlrpcTracker() # this one is for the debug window
# holds aggregate output from processStandardOutput(); used by xmlrpc
# tracker.
# holds aggregate output from processStandardOutput(); used by xmlrpc
# tracker.
@@
-41,9
+42,14
@@
class SfiProcess(QObject):
def __init_command(self, args):
self.args = QStringList()
def __init_command(self, args):
self.args = QStringList()
- if config.debug:
- # this shows xmlrpc conversation, see sfi.py docs.
- self.args << QString('-D')
+ self.args << "-d"
+ self.args << config.get_dirname()
+
+ # this shows xmlrpc conversation, see sfi.py docs.
+ # always do this, so we can parse the XML result for faults and show
+ # then to the users.
+ self.args << QString('-D')
+
for arg in args:
self.args << QString(arg)
for arg in args:
self.args << QString(arg)
@@
-80,13
+86,27
@@
class SfiProcess(QObject):
print "ReadError"
elif err == QProcess.UnknownError:
print "UnknownError"
print "ReadError"
elif err == QProcess.UnknownError:
print "UnknownError"
+
+ # extract any faults from the XMLRPC response(s)
+ self.xmlrpcreader.responses = []
+ self.xmlrpcreader.store(self.output)
+ self.xmlrpcreader.extractXml()
+ self.responses = self.xmlrpcreader.responses
+ self.faults = [x for x in self.responses if (x["kind"]=="fault")]
+
self.trace_end()
self.emit(SIGNAL("finished()"))
self.trace_end()
self.emit(SIGNAL("finished()"))
+ def getFaultString(self):
+ if self.faults == []:
+ return None
+
+ return self.faults[0].get("faultString","") + " (" + self.faults[0].get("faultCode","") + ")"
+
def __getRSpec(self, mgr):
slice = config.getSlice()
# Write RSpec to file for testing.
def __getRSpec(self, mgr):
slice = config.getSlice()
# Write RSpec to file for testing.
- filename =
os.path.expanduser("~/.sfi/" + slice + ".rspec"
)
+ filename =
config.fullpath ("%s.rspec"%slice
)
try:
os.remove(filename)
except:
try:
os.remove(filename)
except:
@@
-157,6
+177,12
@@
class SfiProcess(QObject):
self.__init_command(args)
self.start()
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",
def renewSlivers(self, expiration):
args = ["-u", config.getUser(), "-a", config.getAuthority(),
"-r", config.getRegistry(), "-s", config.getSlicemgr(), "renew",
@@
-165,6
+191,8
@@
class SfiProcess(QObject):
self.start()
def start(self):
self.start()
def start(self):
+ self.respones = []
+ self.faults = []
self.output = ""
self.trace_command()
self.process.start(self.exe, self.args)
self.output = ""
self.trace_command()
self.process.start(self.exe, self.args)