From ae73eb4c53a4a72099750f3432fdc57764daddb5 Mon Sep 17 00:00:00 2001 From: chnyda Date: Mon, 29 Jan 2018 15:12:51 +0100 Subject: [PATCH] Fix publish dump/restore Add publish storage if the publish is not local in the dump file's name Add timestamp to snapshot when recreating publish during restore --- aptly/publisher/__init__.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/aptly/publisher/__init__.py b/aptly/publisher/__init__.py index 55ed238..7987363 100644 --- a/aptly/publisher/__init__.py +++ b/aptly/publisher/__init__.py @@ -80,7 +80,8 @@ def dump_publishes(self, publishes_to_save, dump_dir, prefix): raise Exception('Publish(es) required not found') for publish in save_list: - save_path = ''.join([dump_dir, '/', prefix, publish.name.replace('/', '-'), '.yml']) + storage = '' if not publish.storage else '-{}-'.format(publish.storage) + save_path = ''.join([dump_dir, '/', prefix, storage, publish.name.replace('/', '-'), '.yml']) publish.save_publish(save_path) def _publish_match(self, publish, names=False, name_only=False): @@ -481,7 +482,8 @@ def restore_publish(self, config, components, recreate=False): to_publish.append(component_name) - snapshot_name = '{}-{}'.format("restored", saved_component.get('snapshot')) + timestamp = time.strftime("%Y%m%d%H%M%S") + snapshot_name = '{}-{}-{}'.format("restored", timestamp, saved_component.get('snapshot')) lg.debug("Creating snapshot %s for component %s of packages: %s" % (snapshot_name, component_name, saved_packages))