From 1554a54a0adfb8a0b34c9534e402b23baa19da5d Mon Sep 17 00:00:00 2001 From: Alvaro Lopez Garcia Date: Thu, 26 Sep 2024 18:16:00 +0200 Subject: [PATCH] feat: improve logging --- imgsync/distros/base.py | 2 ++ imgsync/distros/debian.py | 2 +- imgsync/distros/ubuntu.py | 4 +++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/imgsync/distros/base.py b/imgsync/distros/base.py index 37ad301..d55ccdd 100644 --- a/imgsync/distros/base.py +++ b/imgsync/distros/base.py @@ -66,6 +66,8 @@ def _download_one(self, url, checksum): :param checksum: tuple in the form (checksum_name, checksum_value) :returns: temporary file object """ + LOG.info("Downloading %s", url) + with tempfile.NamedTemporaryFile(suffix=".imgsync", delete=False) as location: try: response = requests.get(url, stream=True, timeout=10) diff --git a/imgsync/distros/debian.py b/imgsync/distros/debian.py index dade204..566e574 100644 --- a/imgsync/distros/debian.py +++ b/imgsync/distros/debian.py @@ -78,7 +78,7 @@ def _sync_latest(self): LOG.error("Could not find checksum for %s" % filename) return - LOG.info("Downloading %s", filename) + LOG.info("Syncing %s", filename) url = base_url + filename architecture = "x86_64" diff --git a/imgsync/distros/ubuntu.py b/imgsync/distros/ubuntu.py index 428c35d..35080f5 100644 --- a/imgsync/distros/ubuntu.py +++ b/imgsync/distros/ubuntu.py @@ -56,7 +56,9 @@ def url(self): def _sync_latest(self): """Sync the latest image.""" filename = self.filename - LOG.info("Downloading %s", filename) + + LOG.info("Syncing %s", filename) + base_url = self.url + "current/" checksum_file = base_url + "SHA256SUMS" checksum_file = requests.get(checksum_file, timeout=10)