mirror of
https://github.com/netinvent/npbackup.git
synced 2025-11-08 13:11:50 +08:00
Reformat file with black
This commit is contained in:
parent
efd468b5ab
commit
27050e8dc9
3 changed files with 15 additions and 20 deletions
|
|
@ -177,7 +177,7 @@ empty_config_dict = {
|
||||||
"repo_opts": {
|
"repo_opts": {
|
||||||
"repo_password": None,
|
"repo_password": None,
|
||||||
"repo_password_command": None,
|
"repo_password_command": None,
|
||||||
"compression": "auto", # Can be auto, max, off
|
"compression": "auto", # Can be auto, max, off
|
||||||
# Minimum time between two backups, in minutes
|
# Minimum time between two backups, in minutes
|
||||||
# Set to zero in order to disable time checks
|
# Set to zero in order to disable time checks
|
||||||
"minimum_backup_age": 1435,
|
"minimum_backup_age": 1435,
|
||||||
|
|
@ -848,28 +848,26 @@ def _migrate_config_dict(full_config: dict, old_version: str, new_version: str)
|
||||||
f"{object_type} {object_name} has no retention policy, skipping migration"
|
f"{object_type} {object_name} has no retention policy, skipping migration"
|
||||||
)
|
)
|
||||||
return full_config
|
return full_config
|
||||||
|
|
||||||
def _migrate_compression_3_0_0_to_3_0_4(
|
def _migrate_compression_3_0_0_to_3_0_4(
|
||||||
full_config: dict,
|
full_config: dict,
|
||||||
object_name: str,
|
object_name: str,
|
||||||
object_type: str,
|
object_type: str,
|
||||||
) -> dict:
|
) -> dict:
|
||||||
try:
|
try:
|
||||||
if full_config.g(
|
if (
|
||||||
f"{object_type}.{object_name}.repo_opts.compression"
|
full_config.g(f"{object_type}.{object_name}.repo_opts.compression")
|
||||||
) is None and f"{object_type}.{object_name}.backup_opts.compression" is not None:
|
is None
|
||||||
|
and f"{object_type}.{object_name}.backup_opts.compression" is not None
|
||||||
|
):
|
||||||
full_config.s(
|
full_config.s(
|
||||||
f"{object_type}.{object_name}.repo_opts.compression",
|
f"{object_type}.{object_name}.repo_opts.compression",
|
||||||
full_config.g(
|
full_config.g(
|
||||||
f"{object_type}.{object_name}.backup_opts.compression"
|
f"{object_type}.{object_name}.backup_opts.compression"
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
full_config.d(
|
full_config.d(f"{object_type}.{object_name}.backup_opts.compression")
|
||||||
f"{object_type}.{object_name}.backup_opts.compression"
|
logger.info(f"Migrated {object_name} compression to repo_opts")
|
||||||
)
|
|
||||||
logger.info(
|
|
||||||
f"Migrated {object_name} compression to repo_opts"
|
|
||||||
)
|
|
||||||
except KeyError:
|
except KeyError:
|
||||||
logger.info(
|
logger.info(
|
||||||
f"{object_type} {object_name} has no compression, skipping migration"
|
f"{object_type} {object_name} has no compression, skipping migration"
|
||||||
|
|
|
||||||
|
|
@ -1222,18 +1222,14 @@ def config_gui(full_config: dict, config_file: str):
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
sg.Text(
|
sg.Text(_t("config_gui.pack_size"), size=(20, 1)),
|
||||||
_t("config_gui.pack_size"), size=(20, 1)
|
|
||||||
),
|
|
||||||
sg.Image(
|
sg.Image(
|
||||||
NON_INHERITED_ICON,
|
NON_INHERITED_ICON,
|
||||||
key="inherited.backup_opts.pack_size",
|
key="inherited.backup_opts.pack_size",
|
||||||
tooltip=_t("config_gui.group_inherited"),
|
tooltip=_t("config_gui.group_inherited"),
|
||||||
pad=1,
|
pad=1,
|
||||||
),
|
),
|
||||||
sg.Input(
|
sg.Input(key="backup_opts.pack_size", size=(8, 1)),
|
||||||
key="backup_opts.pack_size", size=(8, 1)
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
]
|
]
|
||||||
),
|
),
|
||||||
|
|
@ -1603,7 +1599,8 @@ def config_gui(full_config: dict, config_file: str):
|
||||||
NON_INHERITED_ICON,
|
NON_INHERITED_ICON,
|
||||||
key="inherited_repo_group",
|
key="inherited_repo_group",
|
||||||
tooltip=_t("config_gui.group_inherited"),
|
tooltip=_t("config_gui.group_inherited"),
|
||||||
pad=1),
|
pad=1,
|
||||||
|
),
|
||||||
sg.Combo(
|
sg.Combo(
|
||||||
values=configuration.get_group_list(full_config),
|
values=configuration.get_group_list(full_config),
|
||||||
key="repo_group",
|
key="repo_group",
|
||||||
|
|
|
||||||
|
|
@ -275,7 +275,7 @@ class ResticRunner:
|
||||||
self._no_lock = value
|
self._no_lock = value
|
||||||
else:
|
else:
|
||||||
raise ValueError("Bogus no_lock value given")
|
raise ValueError("Bogus no_lock value given")
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def compression(self) -> str:
|
def compression(self) -> str:
|
||||||
return self._compression
|
return self._compression
|
||||||
|
|
@ -297,7 +297,7 @@ class ResticRunner:
|
||||||
self._pack_size = value
|
self._pack_size = value
|
||||||
else:
|
else:
|
||||||
raise ValueError("Bogus pack_size value given")
|
raise ValueError("Bogus pack_size value given")
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def json_output(self) -> bool:
|
def json_output(self) -> bool:
|
||||||
return self._json_output
|
return self._json_output
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue