Пример #1
0
class ManageLogs():
    def __init__(self, parent=None):
        self.logmgr = LogManager(SERVICE, '/org/ganesha/nfsd/admin',
                                 'org.freedesktop.DBus.Properties')

    def set(self, property, value):
        print "Set log %s to %s" % (property, value)
        status, msg = self.logmgr.Set(property, value)
        self.status_message(status, msg)

    def get(self, property):
        print "Get property %s" % (property)
        status, msg, level = self.logmgr.Get(property)
        if status == True:
            self.show_loglevel(level)
        else:
            self.status_message(status, msg)

    def getall(self):
        print "Get all"
        status, msg, properties = self.logmgr.GetAll()
        if status == True:
            self.print_components(properties)
        else:
            self.status_message(status, msg)

    def show_loglevel(self, level):
        print "Log level: %s" % (str(level))

    def status_message(self, status, errormsg):
        print "Returns: status = %s, %s" % (str(status), errormsg)

    def print_components(self, properties):
        for prop in properties:
            print str(prop)
Пример #2
0
 def __init__(self, parent=None):
     self.logmgr = LogManager(SERVICE, '/org/ganesha/nfsd/admin',
                              'org.freedesktop.DBus.Properties')