Skip to content

Commit

Permalink
Add args and kwargs to packagers __init__
Browse files Browse the repository at this point in the history
Fixes #51.
Avoid an error when an unexpected param is given, which can happen if a
definition is not correctly built.
  • Loading branch information
aruhier committed Feb 18, 2024
1 parent 2e3f339 commit 8a5690c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion virt_backup/backups/packagers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class _AbstractBackupPackager(ABC):
#: backups.
is_shareable = False

def __init__(self, name=None):
def __init__(self, name=None, *args, **kwargs):
#: Used for logging
self.name = name

Expand Down
2 changes: 1 addition & 1 deletion virt_backup/backups/packagers/directory.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class _AbstractBackupPackagerDir(_AbstractBackupPackager):
Images are just copied in a directory
"""

def __init__(self, name, path):
def __init__(self, name, path, *args, **kwargs):
super().__init__(name)
self.path = path

Expand Down
9 changes: 8 additions & 1 deletion virt_backup/backups/packagers/tar.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,14 @@ class _AbstractBackupPackagerTar(_AbstractBackupPackager):
_mode = ""

def __init__(
self, name, path, archive_name, compression=None, compression_lvl=None
self,
name,
path,
archive_name,
compression=None,
compression_lvl=None,
*args,
**kwargs
):
super().__init__(name)

Expand Down
4 changes: 3 additions & 1 deletion virt_backup/backups/packagers/zstd.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
class _AbstractBackupPackagerZSTD(_AbstractBackupPackager):
_mode = ""

def __init__(self, name, path, name_prefix, compression_lvl=0, threads=0):
def __init__(
self, name, path, name_prefix, compression_lvl=0, threads=0, *args, **kwargs
):
super().__init__(name)

#: Directory path to store the archives in.
Expand Down

0 comments on commit 8a5690c

Please sign in to comment.