Tushar Gupta has proposed merging ~tushar5526/launchpad-buildd:no-fail-hello-snap-install-for-livefs into launchpad-buildd:master.
Requested reviews: Launchpad code reviewers (launchpad-reviewers) For more details, see: https://code.launchpad.net/~tushar5526/launchpad-buildd/+git/launchpad-buildd/+merge/481588 -- Your team Launchpad code reviewers is requested to review the proposed merge of ~tushar5526/launchpad-buildd:no-fail-hello-snap-install-for-livefs into launchpad-buildd:master.
diff --git a/debian/changelog b/debian/changelog index ea8c5d7..712a90f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +launchpad-buildd (251) UNRELEASED; urgency=medium + + * Ignore failures while trying to install the hello snap for the snapd + udev issue workaround for Noble. + + + -- Tushar Gupta <tushar.gu...@canonical.com> Thu, 20 Feb 2025 11:03:22 +0530 + launchpad-buildd (250) noble; urgency=medium [ Colin Watson ] diff --git a/lpbuildd/target/build_livefs.py b/lpbuildd/target/build_livefs.py index 13b382e..78cc1cb 100644 --- a/lpbuildd/target/build_livefs.py +++ b/lpbuildd/target/build_livefs.py @@ -3,6 +3,7 @@ import logging import os +import subprocess from collections import OrderedDict from lpbuildd.target.operation import Operation @@ -145,13 +146,20 @@ class BuildLiveFS(SnapStoreOperationMixin, Operation): # on the first attempt fails due to udev issues. This # fix should be REMOVED after the new release of snapd # in early march. - self.backend.run( - [ - "snap", - "install", - "hello", - ] - ) + try: + self.backend.run( + [ + "snap", + "install", + "hello", + ] + ) + except subprocess.CalledProcessError as e: + logger.info( + 'Unable to install the "hello" snap with error: %s' + " Ignoring the failure and proceeding with the next" + " steps!" % e + ) def build(self): if self.args.locale is not None: diff --git a/lpbuildd/target/tests/test_build_livefs.py b/lpbuildd/target/tests/test_build_livefs.py index df59255..8555f8e 100644 --- a/lpbuildd/target/tests/test_build_livefs.py +++ b/lpbuildd/target/tests/test_build_livefs.py @@ -486,6 +486,29 @@ class TestBuildLiveFS(TestCase): build_livefs.backend.run = FailInstall() self.assertEqual(RETCODE_FAILURE_INSTALL, build_livefs.run()) + def test_hello_snap_install_failures_are_ignored(self): + class FailInstall(FakeMethod): + def __call__(self, run_args, *args, **kwargs): + super().__call__(run_args, *args, **kwargs) + if run_args == ["snap", "install", "hello"]: + raise subprocess.CalledProcessError(1, run_args) + + logger = self.useFixture(FakeLogger()) + args = [ + "buildlivefs", + "--backend=fake", + "--series=xenial", + "--arch=amd64", + "1", + "--project=ubuntu", + ] + build_livefs = parse_args(args=args).operation + build_livefs.backend.run = FailInstall() + self.assertEqual(0, build_livefs.run()) + self.assertTrue( + 'Unable to install the "hello" snap with error:' in logger.output + ) + def test_run_build_fails(self): class FailBuild(FakeMethod): def __call__(self, run_args, *args, **kwargs):
_______________________________________________ Mailing list: https://launchpad.net/~launchpad-reviewers Post to : launchpad-reviewers@lists.launchpad.net Unsubscribe : https://launchpad.net/~launchpad-reviewers More help : https://help.launchpad.net/ListHelp