Skip to content

Commit

Permalink
libcloud-plugin: replace treat_download_errors_as_warnings
Browse files Browse the repository at this point in the history
- set fail_on_download_error to False by default because this is
  the default behaviour of bareos backups
- as a matter of fact by default download errors will be flagged
  as warnings and jobs will be marked "with warnings"
  • Loading branch information
franku committed Oct 8, 2020
1 parent ce87180 commit 4a687c3
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 19 deletions.
32 changes: 16 additions & 16 deletions core/src/plugins/filed/python/libcloud/BareosFdPluginLibcloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def __init__(self, plugindef):

super(BareosFdPluginLibcloud, self).__init__(plugindef)
super(BareosFdPluginLibcloud, self).parse_plugin_definition(plugindef)
self.options["treat_download_errors_as_warnings"] = False
self.options["fail_on_download_error"] = False
self.__parse_options()

self.last_run = datetime.datetime.fromtimestamp(self.since)
Expand Down Expand Up @@ -165,7 +165,7 @@ def __check_config(self, config_filename):
"temporary_download_directory",
]
optional_options = {}
optional_options["misc"] = ["treat_download_errors_as_warnings"]
optional_options["misc"] = ["fail_on_download_error"]

# this maps config file options to libcloud options
option_map = {
Expand Down Expand Up @@ -221,7 +221,7 @@ def __check_config(self, config_filename):
if self.config.has_option(section, option):
try:
value = self.config.get(section, option)
self.options["treat_download_errors_as_warnings"] = strtobool(value)
self.options["fail_on_download_error"] = strtobool(value)
except:
debugmessage(
100,
Expand Down Expand Up @@ -295,11 +295,11 @@ def start_backup_file(self, savepkt):
while self.active:
worker_result = self.api.check_worker_messages()
if worker_result == ERROR:
if self.options["treat_download_errors_as_warnings"]:
pass
else:
if self.options["fail_on_download_error"]:
self.active = False
error = True
else:
pass
elif worker_result == ABORT:
self.active = False
error = True
Expand Down Expand Up @@ -350,20 +350,20 @@ def start_backup_file(self, savepkt):
try:
self.FILE = IterStringIO(self.current_backup_task["data"].as_stream())
except ObjectDoesNotExistError:
if self.options["treat_download_errors_as_warnings"]:
if self.options["fail_on_download_error"]:
jobmessage(
M_WARNING,
"Skipped file %s because it does not exist anymore"
M_ERROR,
"File %s does not exist anymore"
% (self.current_backup_task["name"]),
)
return bRC_Skip
return bRC_Error
else:
jobmessage(
M_ERROR,
"File %s does not exist anymore"
M_WARNING,
"Skipped file %s because it does not exist anymore"
% (self.current_backup_task["name"]),
)
return bRC_Error
return bRC_Skip

else:
raise Exception(value='Wrong argument for current_backup_task["type"]')
Expand Down Expand Up @@ -418,10 +418,10 @@ def plugin_io(self, IOP):
),
)
IOP.status = 0
if self.options["treat_download_errors_as_warnings"]:
return bRC_Skip
else:
if self.options["fail_on_download_error"]:
return bRC_Error
else:
return bRC_Skip

elif IOP.func == IO_WRITE:
try:
Expand Down
7 changes: 4 additions & 3 deletions docs/manuals/source/TasksAndConcepts/Plugins.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1636,10 +1636,11 @@ Optional Plugin Options:

This option in the config file is optional:

treat_download_errors_as_warnings
This parameter can be set to True to keep a job running if for some reason a file cannot
fail_on_download_error
This parameter is by default False to keep a job running if for some reason a file cannot
be downloaded from a bucket because it is either deleted or moved to another space during
download. The default for this value is False.
download. In this case a Job will be marked with warnings as this is the default of Bareos.
It is recommended not to change this option.


.. _PerconaXtrabackupPlugin:
Expand Down

0 comments on commit 4a687c3

Please sign in to comment.