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

github.com/bareos/python-bareos.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'bareos/bsock/filedaemon.py')
-rw-r--r--bareos/bsock/filedaemon.py30
1 files changed, 24 insertions, 6 deletions
diff --git a/bareos/bsock/filedaemon.py b/bareos/bsock/filedaemon.py
index a5845d7..93a06e1 100644
--- a/bareos/bsock/filedaemon.py
+++ b/bareos/bsock/filedaemon.py
@@ -2,10 +2,12 @@
Communicates with the bareos-fd
"""
-from bareos.bsock.connectiontype import ConnectionType
-from bareos.bsock import BSock
+from bareos.bsock.connectiontype import ConnectionType
+from bareos.bsock.lowlevel import LowLevel
+import shlex
-class FileDaemon(BSock):
+
+class FileDaemon(LowLevel):
'''use to send and receive the response to Bareos File Daemon'''
def __init__(self,
@@ -13,6 +15,22 @@ class FileDaemon(BSock):
port=9102,
dirname=None,
name=None,
- password=None,
- type=ConnectionType.FILEDAEMON):
- super(FileDaemon, self).__init__(address, port, dirname, name, password, type)
+ password=None):
+ super(FileDaemon, self).__init__()
+ self.connect(address, port, dirname, ConnectionType.FILEDAEMON)
+ self.auth(name=name, password=password, auth_success_regex=b'^2000 OK Hello.*$')
+ self._init_connection()
+
+ def call(self, command):
+ '''
+ Replace spaces by char(1) in quoted arguments
+ and then call the original function.
+ '''
+ if isinstance(command, list):
+ cmdlist=command
+ else:
+ cmdlist=shlex.split(command)
+ command0 = []
+ for arg in cmdlist:
+ command0.append(arg.replace(" ", "\x01"))
+ return super(FileDaemon, self).call(command0)