Check for valid compress mode before proceeding

This commit is contained in:
Eric Torres 2019-03-31 22:00:48 -07:00
parent 43ccda7ae9
commit 4361ad703a

View File

@ -88,11 +88,11 @@ class PackageManager:
:rtype: path-like object
:raises: ValueError if compress is not in packagemanager.VALID_DB_COMPRESS_MODES
"""
syslog.info("Creating a database archive")
if compress is not None and compress not in VALID_DB_COMPRESS_MODES:
raise ValueError(f"{compress} is not a valid compress mode")
syslog.info("Creating a database archive")
archivemode = "w" if compress is None else f"w:{compress}"
archivesuffix = ".tar" if compress is None else f".tar.{compress}"