Skip to content

Commit

Permalink
device-resource: add check for autodeflate algorithm
Browse files Browse the repository at this point in the history
If autodeflate is set, we need to ensure that an algorithm was
actually selected.
  • Loading branch information
sebsura authored and BareosBot committed Nov 10, 2023
1 parent fb4a57b commit 89c9138
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions core/src/stored/device_resource.cc
Original file line number Diff line number Diff line change
Expand Up @@ -276,12 +276,23 @@ static bool ValidateGenericDevice(const DeviceResource& resource)

bool DeviceResource::Validate()
{
if (IsMemberPresent("AutoDeflate")
&& !IsMemberPresent("AutoDeflateAlgorithm")) {
Jmsg(nullptr, M_ERROR, 0,
_("Device %s: If autodeflate is set, then 'AutoDeflateAlgorithm' "
"also has to be set.\n"),
resource_name_);

return false;
}

to_lower(device_type);
if (device_type == DeviceType::B_TAPE_DEV) {
return ValidateTapeDevice(*this);
} else {
return ValidateGenericDevice(*this);
}

return true;
}

Expand Down

0 comments on commit 89c9138

Please sign in to comment.