Bug#1033424: image-factory: FTBFS in testing: AssertionError: pylint found issues:
Hello, I have attached a debdiff where I replace the broad exception types with appropriate error types. This patch satisfies the pylint test and allows the package to build without issues. I can upload this RC bug fix as a NMU if you want. Thanks! -- Josef Schneider GPG Fingerprint 3267 0331 DB61 A817 7D25 4D05 5A44 BC12 F2A8 E58F diff -Nru image-factory-1.0.2/debian/changelog image-factory-1.0.2/debian/changelog --- image-factory-1.0.2/debian/changelog2021-11-12 16:52:40.0 +0100 +++ image-factory-1.0.2/debian/changelog2023-04-12 15:50:18.0 +0200 @@ -1,3 +1,11 @@ +image-factory (1.0.2-1.1) unstable; urgency=medium + + * Non-maintainer upload. + * debian/patches: Add 0001-replace-broad-exceptions.patch. ++ Pass pylint test and fix FTBFS (Closes: #1033424). + + -- Josef Schneider Wed, 12 Apr 2023 15:50:18 +0200 + image-factory (1.0.2-1) unstable; urgency=medium * New upstream release diff -Nru image-factory-1.0.2/debian/patches/0001-replace-broad-exceptions.patch image-factory-1.0.2/debian/patches/0001-replace-broad-exceptions.patch --- image-factory-1.0.2/debian/patches/0001-replace-broad-exceptions.patch 1970-01-01 01:00:00.0 +0100 +++ image-factory-1.0.2/debian/patches/0001-replace-broad-exceptions.patch 2023-04-12 15:50:18.0 +0200 @@ -0,0 +1,43 @@ +From a32952d31c02d2ce2425032e1960c0c292a29855 Mon Sep 17 00:00:00 2001 +From: Josef Schneider +Date: Wed, 12 Apr 2023 15:49:41 +0200 +Subject: [PATCH] replace broad exceptions + +--- + image-factory | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/image-factory b/image-factory +index f8dffe0..5130fd7 100755 +--- a/image-factory b/image-factory +@@ -61,7 +61,7 @@ def get_config(): + if env_name in os.environ: + config_files = [os.environ[env_name]] + if not os.path.isfile(config_files[0]): +-raise Exception( ++raise FileNotFoundError( + "'" + config_files[0] + "' (set in " + env_name + ") is not a valid file." + ) + else: +@@ -135,7 +135,7 @@ def cache_file(cache_dir, source): + elif source.startswith("rsync:"): + call_command(["rsync", "--no-motd", source, destination]) + else: +-raise Exception(f"No download handler for file '{source}' found.") ++raise ValueError(f"No download handler for file '{source}' found.") + return relative_destination + + +@@ -163,7 +163,7 @@ def download_and_publish(config, image, source, filename): + elif source.startswith("rsync:"): + call_command(["rsync", "--no-motd", source, destination]) + else: +-raise Exception(f"No download handler for file '{source}' found.") ++raise ValueError(f"No download handler for file '{source}' found.") + return destination + + +-- +2.38.1 + diff -Nru image-factory-1.0.2/debian/patches/series image-factory-1.0.2/debian/patches/series --- image-factory-1.0.2/debian/patches/series 1970-01-01 01:00:00.0 +0100 +++ image-factory-1.0.2/debian/patches/series 2023-04-12 15:50:18.0 +0200 @@ -0,0 +1 @@ +0001-replace-broad-exceptions.patch OpenPGP_0x5A44BC12F2A8E58F.asc Description: OpenPGP public key OpenPGP_signature Description: OpenPGP digital signature
Bug#1033424: image-factory: FTBFS in testing: AssertionError: pylint found issues:
Source: image-factory Version: 1.0.2-1 Severity: serious Justification: FTBFS Tags: bookworm sid ftbfs User: lu...@debian.org Usertags: ftbfs-20230323 ftbfs-bookworm Hi, During a rebuild of all packages in testing (bookworm), your package failed to build on amd64. Relevant part (hopefully): > make[1]: Entering directory '/<>' > python3 -m unittest discover -v > test_black (tests.test_black.BlackTestCase.test_black) > Test: Run black code formatter on Python source code. ... Running following > command: > black --check --diff -l 99 image-factory tests > ok > test_empty_config (tests.test_cli.TestCLI.test_empty_config) > Test empty configuration file. ... ok > test_example_config (tests.test_cli.TestCLI.test_example_config) > Test exapmle image-factory.conf file. ... ok > test_override_cache_dir (tests.test_cli.TestCLI.test_override_cache_dir) > Test overriding the cache directory. ... ok > test_flake8 (tests.test_flake8.Flake8TestCase.test_flake8) > Test: Run flake8 on Python source code. ... Running following command: > /usr/bin/python3 -m flake8 --max-line-length=99 image-factory tests > ok > test_invalid (tests.test_helper.TestParseBytes.test_invalid) > Test parse_bytes("invalid") ... ok > test_parse_1_g (tests.test_helper.TestParseBytes.test_parse_1_g) > Test parse_bytes("1G") ... ok > test_parse_2_tb (tests.test_helper.TestParseBytes.test_parse_2_tb) > Test parse_bytes("2 TB") ... ok > test_parse_512_mib (tests.test_helper.TestParseBytes.test_parse_512_mib) > Test parse_bytes("512 MiB") ... ok > test_isort (tests.test_isort.IsortTestCase.test_isort) > Test: Run isort on Python source code. ... Running following command: > isort --check-only --diff -l 99 image-factory tests > ok > test_pylint (tests.test_pylint.PylintTestCase.test_pylint) > Test: Run pylint on Python source code. ... Running following command: > /usr/bin/python3 -m pylint --rcfile=/<>/tests/pylint.conf -- > image-factory tests > FAIL > test_chmod_dnf_log (tests.test_sudo_helper.TestSudoHelper.test_chmod_dnf_log) > Test read access for dnf log file. ... ok > test_chmod_log_file > (tests.test_sudo_helper.TestSudoHelper.test_chmod_log_file) > Test read access for mounted /var/log/... ... ok > test_chmod_recursive > (tests.test_sudo_helper.TestSudoHelper.test_chmod_recursive) > Test chmod recursively ... ok > test_chmod_remove_root > (tests.test_sudo_helper.TestSudoHelper.test_chmod_remove_root) > Test chmod remove mounted /root permission ... ok > test_chmod_root (tests.test_sudo_helper.TestSudoHelper.test_chmod_root) > Test chmod mounted /root ... ok > test_chmod_var_log (tests.test_sudo_helper.TestSudoHelper.test_chmod_var_log) > Test write access for mounted /var/log/... ... ok > test_mount (tests.test_sudo_helper.TestSudoHelper.test_mount) > Test mounting. ... ok > test_reject_escaping > (tests.test_sudo_helper.TestSudoHelper.test_reject_escaping) > Test rejecting ../../etc/shadow. ... ok > test_umount (tests.test_sudo_helper.TestSudoHelper.test_umount) > Test unmounting. ... ok > > == > FAIL: test_pylint (tests.test_pylint.PylintTestCase.test_pylint) > Test: Run pylint on Python source code. > -- > Traceback (most recent call last): > File "/<>/tests/test_pylint.py", line 74, in test_pylint > self.fail("\n".join(msgs)) > AssertionError: pylint found issues: > * Module image-factory > image-factory:64:12: W0719: Raising too general exception: Exception > (broad-exception-raised) > image-factory:138:8: W0719: Raising too general exception: Exception > (broad-exception-raised) > image-factory:166:8: W0719: Raising too general exception: Exception > (broad-exception-raised) > > -- > Ran 20 tests in 8.079s > > FAILED (failures=1) > make[1]: *** [Makefile:13: check] Error 1 > make[1]: Leaving directory '/<>' > dh_auto_test: error: make -j8 check returned exit code 2 The full build log is available from: http://qa-logs.debian.net/2023/03/23/image-factory_1.0.2-1_testing.log All bugs filed during this archive rebuild are listed at: https://bugs.debian.org/cgi-bin/pkgreport.cgi?tag=ftbfs-20230323;users=lu...@debian.org or: https://udd.debian.org/bugs/?release=na=ign=7=7=only=ftbfs-20230323=lu...@debian.org=1=1=1=1#results A list of current common problems and possible solutions is available at http://wiki.debian.org/qa.debian.org/FTBFS . You're welcome to contribute! If you reassign this bug to another package, please mark it as 'affects'-ing this package. See https://www.debian.org/Bugs/server-control#affects If you fail to reproduce this, please provide a build log and diff it with mine so that we can identify if something relevant changed in the meantime.