mirror of
https://github.com/borgmatic-collective/borgmatic.git
synced 2026-07-26 03:23:00 +02:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
acb2ca79d9 | ||
|
|
c9211320e1 | ||
|
|
760286abe1 | ||
|
|
5890a1cb48 | ||
|
|
b3f5a9d18f | ||
|
|
80b33fbf8a | ||
|
|
5389ff6160 | ||
|
|
e8b8d86592 |
@@ -1,3 +1,11 @@
|
||||
1.5.18
|
||||
* #389: Fix "message too long" error when logging to rsyslog.
|
||||
* #440: Fix traceback that can occur when dumping a database.
|
||||
|
||||
1.5.17
|
||||
* #437: Fix error when configuration file contains "umask" option.
|
||||
* Remove test dependency on vim and /dev/urandom.
|
||||
|
||||
1.5.16
|
||||
* #379: Suppress console output in sample crontab and systemd service files.
|
||||
* #407: Fix syslog logging on FreeBSD.
|
||||
|
||||
@@ -292,7 +292,7 @@ properties:
|
||||
$borg_base_directory/.config/borg/keys
|
||||
example: /path/to/base/config/keys
|
||||
umask:
|
||||
type: string
|
||||
type: integer
|
||||
description: Umask to be used for borg create. Defaults to 0077.
|
||||
example: 0077
|
||||
lock_wait:
|
||||
@@ -787,7 +787,7 @@ properties:
|
||||
example:
|
||||
https://cronhub.io/start/1f5e3410-254c-11e8-b61d-55875966d01
|
||||
umask:
|
||||
type: scalar
|
||||
type: integer
|
||||
description: |
|
||||
Umask used when executing hooks. Defaults to the umask that
|
||||
borgmatic is run with.
|
||||
|
||||
@@ -81,6 +81,7 @@ def log_outputs(processes, exclude_stdouts, output_log_level, borg_local_path):
|
||||
for other_process in processes:
|
||||
if (
|
||||
other_process.poll() is None
|
||||
and other_process.stdout
|
||||
and other_process.stdout not in output_buffers
|
||||
):
|
||||
# Add the process's output to output_buffers to ensure it'll get read.
|
||||
@@ -138,9 +139,12 @@ def log_outputs(processes, exclude_stdouts, output_log_level, borg_local_path):
|
||||
if not output_buffer:
|
||||
continue
|
||||
|
||||
remaining_output = output_buffer.read().rstrip().decode()
|
||||
while True: # pragma: no cover
|
||||
remaining_output = output_buffer.readline().rstrip().decode()
|
||||
|
||||
if not remaining_output:
|
||||
break
|
||||
|
||||
if remaining_output: # pragma: no cover
|
||||
logger.log(output_log_level, remaining_output)
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from setuptools import find_packages, setup
|
||||
|
||||
VERSION = '1.5.16'
|
||||
VERSION = '1.5.18'
|
||||
|
||||
|
||||
setup(
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import logging
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
import pytest
|
||||
from flexmock import flexmock
|
||||
@@ -134,7 +135,13 @@ def test_log_outputs_vents_other_processes_when_one_exits():
|
||||
flexmock(module).should_receive('command_for_process').and_return('grep')
|
||||
|
||||
process = subprocess.Popen(
|
||||
['xxd', '-l', '40000', '-p', '/dev/urandom'], stdout=subprocess.PIPE, stderr=subprocess.PIPE
|
||||
[
|
||||
sys.executable,
|
||||
'-c',
|
||||
"import random, string; print(''.join(random.choice(string.ascii_letters) for _ in range(40000)))",
|
||||
],
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
)
|
||||
other_process = subprocess.Popen(
|
||||
['true'], stdin=process.stdout, stdout=subprocess.PIPE, stderr=subprocess.STDOUT
|
||||
@@ -155,6 +162,37 @@ def test_log_outputs_vents_other_processes_when_one_exits():
|
||||
)
|
||||
|
||||
|
||||
def test_log_outputs_does_not_error_when_one_process_exits():
|
||||
flexmock(module.logger).should_receive('log')
|
||||
flexmock(module).should_receive('command_for_process').and_return('grep')
|
||||
|
||||
process = subprocess.Popen(
|
||||
[
|
||||
sys.executable,
|
||||
'-c',
|
||||
"import random, string; print(''.join(random.choice(string.ascii_letters) for _ in range(40000)))",
|
||||
],
|
||||
stdout=None, # Specifically test the case of a process without stdout captured.
|
||||
stderr=None,
|
||||
)
|
||||
other_process = subprocess.Popen(
|
||||
['true'], stdin=process.stdout, stdout=subprocess.PIPE, stderr=subprocess.STDOUT
|
||||
)
|
||||
flexmock(module).should_receive('output_buffer_for_process').with_args(
|
||||
process, (process.stdout,)
|
||||
).and_return(process.stderr)
|
||||
flexmock(module).should_receive('output_buffer_for_process').with_args(
|
||||
other_process, (process.stdout,)
|
||||
).and_return(other_process.stdout)
|
||||
|
||||
module.log_outputs(
|
||||
(process, other_process),
|
||||
exclude_stdouts=(process.stdout,),
|
||||
output_log_level=logging.INFO,
|
||||
borg_local_path='borg',
|
||||
)
|
||||
|
||||
|
||||
def test_log_outputs_truncates_long_error_output():
|
||||
flexmock(module).ERROR_OUTPUT_MAX_LINE_COUNT = 0
|
||||
flexmock(module.logger).should_receive('log')
|
||||
|
||||
Reference in New Issue
Block a user