Welcome to mirror list, hosted at ThFree Co, Russian Federation.

joblog.py « node « fuse « bareos - github.com/bareos/python-bareos.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: e4249bb4541cfaaf1e468b6426bd616362a2208d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
"""
Bareos specific Fuse node.
"""

from   bareos.fuse.node.file import File

class JobLog(File):
    def __init__(self, root, name, job):
        super(JobLog, self).__init__(root, name)
        self.job = job
        if job['jobstatus'] == 'T' or job['jobstatus'] == 'E' or job['jobstatus'] == 'W':
            self.set_static()

    @classmethod
    def get_id(cls, name, job):
        return job['jobid']

    def do_update(self):
        jobid = self.job['jobid']
        data = self.bsock.call( "llist joblog jobid=%s" % (jobid) )
        self.content = ""
        for i in data['joblog']:
            self.content += str(i['time']) + " "
            try:
                self.content += str(i['logtext'])
            except UnicodeEncodeError as e:
                self.logger.error("failed to convert logtext to string: %s" % (str(e)))
                self.content += "BAREOFSFS SKIPPED: converting error\n"