Skip to content
This repository was archived by the owner on Mar 19, 2021. It is now read-only.

Commit aea74c1

Browse files
committed
cleanup
1 parent e44b09b commit aea74c1

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

README.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ python-bareos
33

44
Python module to access a http://www.bareos.org backup system.
55

6-
* prebuild packages available at http://download.bareos.org/bareos/contrib/
6+
`python-bareos` packages are included in the Bareos core distribution since bareos >= 17.2.
77

88

99
calling bareos-director user agent commands
@@ -42,4 +42,3 @@ Requires: bareos >= 15.2
4242
directorconsole=bareos.bsock.DirectorConsoleJson(address="localhost", port=9101, password=password)
4343
directorconsole.call("list pools")
4444
...
45-

bareos/bsock/lowlevel.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ def recv_msg(self, regex = b'^\d\d\d\d OK.*$', timeout = None):
205205
# Bareos indicates end of command result by line starting with 4 digits
206206
if match:
207207
self.logger.debug("msg \"{0}\" matches regex \"{1}\"".format(self.receive_buffer.strip(), regex))
208-
result = self.receive_buffer[0:lastlineindex] + self.receive_buffer[lastlineindex:lastlineindex+match.end()]
208+
result = self.receive_buffer[0:lastlineindex+match.end()]
209209
self.receive_buffer = self.receive_buffer[lastlineindex+match.end()+1:]
210210
return result
211211
#elif re.search("^\d\d\d\d .*$", msg, re.MULTILINE):
@@ -260,8 +260,9 @@ def _show_result(self, msg):
260260
#print(msg.decode('utf-8'))
261261
sys.stdout.write(msg.decode('utf-8'))
262262
# add a linefeed, if there isn't one already
263-
if msg[-2] != ord(b'\n'):
264-
sys.stdout.write(b'\n')
263+
if len(msg) >= 2:
264+
if msg[-2] != ord(b'\n'):
265+
sys.stdout.write(b'\n')
265266

266267

267268
def __get_header(self):

0 commit comments

Comments
 (0)