156 lines
6.6 KiB
Diff
156 lines
6.6 KiB
Diff
diff -up sectool-0.9.4/org.fedoraproject.sectool.mechanism.conf.old sectool-0.9.4/org.fedoraproject.sectool.mechanism.conf
|
|
--- sectool-0.9.4/org.fedoraproject.sectool.mechanism.conf.old 2009-09-01 10:20:23.000000000 +0200
|
|
+++ sectool-0.9.4/org.fedoraproject.sectool.mechanism.conf 2010-03-10 14:51:48.564326918 +0100
|
|
@@ -9,7 +9,7 @@
|
|
<allow own="org.fedoraproject.sectool.mechanism"/>
|
|
</policy>
|
|
<policy context="default">
|
|
- <allow send_destination="org.fedoraproject.sectool"/>
|
|
+ <allow send_destination="org.fedoraproject.sectool.mechanism"/>
|
|
<allow send_type="method_call"/>
|
|
</policy>
|
|
</busconfig>
|
|
diff -up sectool-0.9.4/org.fedoraproject.sectool.policy.old sectool-0.9.4/org.fedoraproject.sectool.policy
|
|
--- sectool-0.9.4/org.fedoraproject.sectool.policy.old 2009-08-24 16:43:10.000000000 +0200
|
|
+++ sectool-0.9.4/org.fedoraproject.sectool.policy 2010-03-10 14:51:51.858326825 +0100
|
|
@@ -20,8 +20,9 @@
|
|
<description>Run level</description>
|
|
<message>System policy prevents run level</message>
|
|
<defaults>
|
|
- <allow_inactive>no</allow_inactive>
|
|
- <allow_active>auth_admin</allow_active>
|
|
+ <allow_any>no</allow_any>
|
|
+ <allow_inactive>auth_admin_keep</allow_inactive>
|
|
+ <allow_active>auth_admin_keep</allow_active>
|
|
</defaults>
|
|
</action>
|
|
|
|
@@ -29,9 +30,9 @@
|
|
<description>Run tests</description>
|
|
<message>System policy prevents run tests</message>
|
|
<defaults>
|
|
- <allow_any>no</allow_any>
|
|
- <allow_inactive>no</allow_inactive>
|
|
- <allow_active>auth_admin</allow_active>
|
|
+ <allow_any>auth_admin_keep</allow_any>
|
|
+ <allow_inactive>auth_admin_keep</allow_inactive>
|
|
+ <allow_active>auth_admin_keep</allow_active>
|
|
</defaults>
|
|
</action>
|
|
|
|
diff -up sectool-0.9.4/src/sectool-gui.py.old sectool-0.9.4/src/sectool-gui.py
|
|
--- sectool-0.9.4/src/sectool-gui.py.old 2010-03-10 14:50:07.111201828 +0100
|
|
+++ sectool-0.9.4/src/sectool-gui.py 2010-03-10 14:52:01.219201762 +0100
|
|
@@ -712,10 +712,14 @@ class DBusCaller(object):
|
|
|
|
def __init__(self):
|
|
|
|
+ #print "DBusCaller::init::start"
|
|
self.timeout = -1
|
|
+ self.auth = 0
|
|
+ #print "DBusCaller::init::SystemBus()"
|
|
self.bus = dbus.SystemBus ()
|
|
#self.bus_name = dbus.service.BusName('org.fedoraproject.sectool.mechanism', self.bus)
|
|
- self.dbus_action_object = self.bus.get_object ("org.fedoraproject.sectool.mechanism", "/org/fedoraproject/sectool/object")
|
|
+ #self.dbus_action_object = self.bus.get_object ("org.fedoraproject.sectool.mechanism", "/org/fedoraproject/sectool/object")
|
|
+ #print "DBusCaller::init::end"
|
|
|
|
def get_action(self, action):
|
|
""" Get action from dbus sectool mechanism """
|
|
@@ -723,7 +727,7 @@ class DBusCaller(object):
|
|
|
|
@staticmethod
|
|
def error_handler(error):
|
|
- #print "ERROR: ", error
|
|
+ print "[ASYNC ERROR]: ", error
|
|
pass # We will recieve an error that timeout has expired
|
|
|
|
@staticmethod
|
|
@@ -736,12 +740,16 @@ class DBusCaller(object):
|
|
|
|
def close(self):
|
|
self.bus.flush()
|
|
- self.bus.close()
|
|
+ #self.bus.close() # can't close this, cause it will close main loop
|
|
|
|
def run( self, args, file ):
|
|
|
|
- auth = slip.dbus.polkit.IsSystemBusNameAuthorized( self.bus.get_unique_name(), "org.fedoraproject.sectool.runtests" )
|
|
+ #print "DBusCaller::run::start"
|
|
+ #if (self.auth != 1):
|
|
+ self.auth = slip.dbus.polkit.IsSystemBusNameAuthorized( self.bus.get_unique_name(), "org.fedoraproject.sectool.runtests" )
|
|
+ #print "DBusCaller::run::auth: \"",self.auth,"\" end"
|
|
self.runtests(args, file)
|
|
+ #print "DBusCaller::run::end"
|
|
|
|
@slip.dbus.polkit.enable_proxy
|
|
def runtests( self, args, file ):
|
|
@@ -754,7 +762,7 @@ class DBusCaller(object):
|
|
[args, file],
|
|
reply_handler=self.reply_handler,
|
|
error_handler=self.error_handler,
|
|
- timeout=0.00)
|
|
+ timeout=10)
|
|
|
|
|
|
class ThreadHandler(threading.Thread, Handler):
|
|
@@ -845,6 +853,9 @@ class ThreadHandler(threading.Thread, Ha
|
|
"""
|
|
|
|
self.readers = []
|
|
+ # get action from dbus
|
|
+ #print "start dbus"
|
|
+ self.bus = DBusCaller()
|
|
for test in self.__suite:
|
|
|
|
self.test = test
|
|
@@ -869,12 +880,10 @@ class ThreadHandler(threading.Thread, Ha
|
|
|
|
# Block for dbus exceptions handling, here should be all code that manipulate with dBus
|
|
try:
|
|
- # get action from dbus
|
|
- bus = DBusCaller()
|
|
-
|
|
# Start new thread - reader to listen on socket and update GUI if something from dBus comes up
|
|
# We need to call reader here, because of passing bus to close connection and save processes
|
|
- reader = Reader( file, test.dsc['HEADER']['NAME'], self.fill_form, self.test_done, iter, bus )
|
|
+ #print "start reader"
|
|
+ reader = Reader( file, test.dsc['HEADER']['NAME'], self.fill_form, self.test_done, iter, self.bus )
|
|
reader.start()
|
|
# Add reader to readers pool
|
|
self.readers.append( reader )
|
|
@@ -886,12 +895,15 @@ class ThreadHandler(threading.Thread, Ha
|
|
TODO: Look for async call, this is workaround using 0-timeout
|
|
If you use timeout=-1, it will be sequencial, all positives numbers are seconds in float
|
|
"""
|
|
-
|
|
- bus.run( self.__make_dbus_call( test.dsc["HEADER"]["NAME"] ), file )
|
|
+ #print "run start"
|
|
+ self.bus.run( self.__make_dbus_call( test.dsc["HEADER"]["NAME"] ), file )
|
|
+ #print "run end"
|
|
#bus.call( test.dsc["HEADER"]["NAME"], file )
|
|
except dbus.DBusException, e:
|
|
# This should always happend. We need to be stopped by dBus to start new test in separate thread
|
|
+ raise e
|
|
if 'org.freedesktop.DBus.Error.NoReply' in e.get_dbus_name():
|
|
+ print >>sys.stderr, "Not reply from DBus"
|
|
pass # maybe continue ?
|
|
# catch Authorization exception
|
|
elif 'NotAuthorizedException' in e.get_dbus_name():
|
|
@@ -939,6 +951,7 @@ class ThreadHandler(threading.Thread, Ha
|
|
The testing process is going to die .. we have a little time to stop all tests correctly
|
|
"""
|
|
self.__stopthread.set( )
|
|
+ self.bus.close()
|
|
for reader in self.readers:
|
|
reader.stop_thread()
|
|
|
|
@@ -1056,7 +1069,7 @@ class Reader(threading.Thread):
|
|
def stop_thread(self):
|
|
|
|
self.stop = True
|
|
- self.bus.close()
|
|
+ #self.bus.close()
|
|
|
|
|
|
|