diff options
author | Joerg Steffens <joerg.steffens@bareos.com> | 2018-01-19 18:35:10 +0300 |
---|---|---|
committer | Joerg Steffens <joerg.steffens@bareos.com> | 2018-01-19 19:52:15 +0300 |
commit | aea74c1c696abe60773d5390efd905a702f59229 (patch) | |
tree | 55ba70911011439f5473a0dbb9a372ac91602248 | |
parent | e44b09b0fe069e7dfde02fe7eabb331763ce75de (diff) |
cleanupRelease/17.2.5
-rw-r--r-- | README.rst | 3 | ||||
-rw-r--r-- | bareos/bsock/lowlevel.py | 7 |
2 files changed, 5 insertions, 5 deletions
@@ -3,7 +3,7 @@ python-bareos Python module to access a http://www.bareos.org backup system. -* prebuild packages available at http://download.bareos.org/bareos/contrib/ +`python-bareos` packages are included in the Bareos core distribution since bareos >= 17.2. calling bareos-director user agent commands @@ -42,4 +42,3 @@ Requires: bareos >= 15.2 directorconsole=bareos.bsock.DirectorConsoleJson(address="localhost", port=9101, password=password) directorconsole.call("list pools") ... - diff --git a/bareos/bsock/lowlevel.py b/bareos/bsock/lowlevel.py index 71c8a55..5087e5e 100644 --- a/bareos/bsock/lowlevel.py +++ b/bareos/bsock/lowlevel.py @@ -205,7 +205,7 @@ class LowLevel(object): # Bareos indicates end of command result by line starting with 4 digits if match: self.logger.debug("msg \"{0}\" matches regex \"{1}\"".format(self.receive_buffer.strip(), regex)) - result = self.receive_buffer[0:lastlineindex] + self.receive_buffer[lastlineindex:lastlineindex+match.end()] + result = self.receive_buffer[0:lastlineindex+match.end()] self.receive_buffer = self.receive_buffer[lastlineindex+match.end()+1:] return result #elif re.search("^\d\d\d\d .*$", msg, re.MULTILINE): @@ -260,8 +260,9 @@ class LowLevel(object): #print(msg.decode('utf-8')) sys.stdout.write(msg.decode('utf-8')) # add a linefeed, if there isn't one already - if msg[-2] != ord(b'\n'): - sys.stdout.write(b'\n') + if len(msg) >= 2: + if msg[-2] != ord(b'\n'): + sys.stdout.write(b'\n') def __get_header(self): |