feat: store configs used to create an archive in the archive
This commit is contained in:
parent
e66e449c3b
commit
1bc7bb4971
2 changed files with 7 additions and 5 deletions
|
@ -351,7 +351,7 @@ def create_archive(
|
||||||
sources = deduplicate_directories(
|
sources = deduplicate_directories(
|
||||||
map_directories_to_devices(
|
map_directories_to_devices(
|
||||||
expand_directories(
|
expand_directories(
|
||||||
tuple(location_config.get('source_directories', ())) + borgmatic_source_directories
|
tuple(location_config.get('source_directories', ())) + borgmatic_source_directories + tuple(global_arguments.config_paths)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
additional_directory_devices=map_directories_to_devices(
|
additional_directory_devices=map_directories_to_devices(
|
||||||
|
|
|
@ -45,10 +45,10 @@ logger = logging.getLogger(__name__)
|
||||||
LEGACY_CONFIG_PATH = '/etc/borgmatic/config'
|
LEGACY_CONFIG_PATH = '/etc/borgmatic/config'
|
||||||
|
|
||||||
|
|
||||||
def run_configuration(config_filename, config, arguments):
|
def run_configuration(config_filename, config, arguments, used_config_paths):
|
||||||
'''
|
'''
|
||||||
Given a config filename, the corresponding parsed config dict, and command-line arguments as a
|
Given a config filename, the corresponding parsed config dict, command-line arguments as a
|
||||||
dict from subparser name to a namespace of parsed arguments, execute the defined create, prune,
|
dict from subparser name to a namespace of parsed arguments, and a list of paths of all configs used, execute the defined create, prune,
|
||||||
compact, check, and/or other actions.
|
compact, check, and/or other actions.
|
||||||
|
|
||||||
Yield a combination of:
|
Yield a combination of:
|
||||||
|
@ -61,6 +61,7 @@ def run_configuration(config_filename, config, arguments):
|
||||||
for section_name in ('location', 'storage', 'retention', 'consistency', 'hooks')
|
for section_name in ('location', 'storage', 'retention', 'consistency', 'hooks')
|
||||||
)
|
)
|
||||||
global_arguments = arguments['global']
|
global_arguments = arguments['global']
|
||||||
|
global_arguments.config_paths = used_config_paths
|
||||||
|
|
||||||
local_path = location.get('local_path', 'borg')
|
local_path = location.get('local_path', 'borg')
|
||||||
remote_path = location.get('remote_path')
|
remote_path = location.get('remote_path')
|
||||||
|
@ -644,8 +645,9 @@ def collect_configuration_run_summary_logs(configs, arguments):
|
||||||
|
|
||||||
# Execute the actions corresponding to each configuration file.
|
# Execute the actions corresponding to each configuration file.
|
||||||
json_results = []
|
json_results = []
|
||||||
|
used_config_paths = list(configs.keys())
|
||||||
for config_filename, config in configs.items():
|
for config_filename, config in configs.items():
|
||||||
results = list(run_configuration(config_filename, config, arguments))
|
results = list(run_configuration(config_filename, config, arguments, used_config_paths))
|
||||||
error_logs = tuple(result for result in results if isinstance(result, logging.LogRecord))
|
error_logs = tuple(result for result in results if isinstance(result, logging.LogRecord))
|
||||||
|
|
||||||
if error_logs:
|
if error_logs:
|
||||||
|
|
Loading…
Reference in a new issue