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

directorconsole.py « bsock « bareos - github.com/bareos/python-bareos.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 81e4f6c008fe6d66f7731b3107a279f9eb62c833 (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
29
"""
Communicates with the bareos-dir console
"""

from   bareos.bsock.connectiontype  import ConnectionType
from   bareos.bsock.lowlevel import LowLevel

class DirectorConsole(LowLevel):
    '''use to send and receive the response to Bareos File Daemon'''

    def __init__(self,
                 address="localhost",
                 port=9101,
                 dirname=None,
                 name="*UserAgent*",
                 password=None):
        super(DirectorConsole, self).__init__()
        self.connect(address, port, dirname, ConnectionType.DIRECTOR)
        self.auth(name=name, password=password, auth_success_regex=b'^1000 OK.*$')
        self._init_connection()


    def _init_connection(self):
        self.call("autodisplay off")


    def get_to_prompt(self):
        self.send(b".")
        return super(DirectorConsole, self).get_to_prompt()