Code style changes
This commit is contained in:
parent
cbc2db2a93
commit
47d2d20043
|
@ -10,14 +10,15 @@ DEFAULT_WEEKLY = 4
|
||||||
DEFAULT_MONTHLY = 3
|
DEFAULT_MONTHLY = 3
|
||||||
DEFAULT_TIMESTAMP_FORMAT = "%Y%m%d"
|
DEFAULT_TIMESTAMP_FORMAT = "%Y%m%d"
|
||||||
|
|
||||||
class BackupFile():
|
|
||||||
|
class BackupFile:
|
||||||
"""
|
"""
|
||||||
Manipulations with backup files
|
Manipulations with backup files
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
* retention_daily - daily renention period
|
* retention_daily - daily retention period
|
||||||
* retention_weekly - weekly retention period
|
* retention_weekly - weekly retention period
|
||||||
* retention_monthly - monthly retention perod
|
* retention_monthly - monthly retention period
|
||||||
* file_path (optional) - file path
|
* file_path (optional) - file path
|
||||||
* dateformat (optional) - format of timestamps (default is '%Y%m%d')
|
* dateformat (optional) - format of timestamps (default is '%Y%m%d')
|
||||||
"""
|
"""
|
||||||
|
@ -27,8 +28,8 @@ class BackupFile():
|
||||||
retention_weekly,
|
retention_weekly,
|
||||||
retention_monthly,
|
retention_monthly,
|
||||||
file_path=None,
|
file_path=None,
|
||||||
dateformat = "%Y%m%d") -> None:
|
dateformat="%Y%m%d"
|
||||||
|
) -> None:
|
||||||
self.file_path = file_path
|
self.file_path = file_path
|
||||||
self.daily = retention_daily
|
self.daily = retention_daily
|
||||||
self.weekly = retention_weekly
|
self.weekly = retention_weekly
|
||||||
|
@ -64,11 +65,11 @@ class BackupFile():
|
||||||
retention_daily=None,
|
retention_daily=None,
|
||||||
retention_weekly=None,
|
retention_weekly=None,
|
||||||
retention_monthly=None,
|
retention_monthly=None,
|
||||||
dateformat = None):
|
dateformat=None
|
||||||
|
):
|
||||||
"""
|
"""
|
||||||
Create new instance of BackupFile, can be used for retention settings inheritance.
|
Create new instance of BackupFile, can be used for retention settings inheritance.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if retention_daily is None:
|
if retention_daily is None:
|
||||||
retention_daily = self.daily
|
retention_daily = self.daily
|
||||||
if retention_weekly is None:
|
if retention_weekly is None:
|
||||||
|
@ -129,6 +130,7 @@ class BackupFile():
|
||||||
if self.need_remove():
|
if self.need_remove():
|
||||||
self.remove(force_remove=force_remove)
|
self.remove(force_remove=force_remove)
|
||||||
|
|
||||||
|
|
||||||
# Argument parser
|
# Argument parser
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
description="Cleanup old backups",
|
description="Cleanup old backups",
|
||||||
|
|
Loading…
Reference in New Issue