Simone Pelosi has proposed merging ~pelpsi/launchpad-buildd:handle-base64-certificate into launchpad-buildd:master.
Commit message: Handle Base64 certificate Requested reviews: Launchpad code reviewers (launchpad-reviewers) For more details, see: https://code.launchpad.net/~pelpsi/launchpad-buildd/+git/launchpad-buildd/+merge/465049 -- Your team Launchpad code reviewers is requested to review the proposed merge of ~pelpsi/launchpad-buildd:handle-base64-certificate into launchpad-buildd:master.
diff --git a/lpbuildd/target/build_snap.py b/lpbuildd/target/build_snap.py index 5adbb76..94b1ea0 100644 --- a/lpbuildd/target/build_snap.py +++ b/lpbuildd/target/build_snap.py @@ -2,6 +2,7 @@ # GNU Affero General Public License version 3 (see the file LICENSE). import argparse +import base64 import json import logging import os.path @@ -122,9 +123,13 @@ class BuildSnap( requests when fetching dependencies. """ with self.backend.open( - "/usr/local/share/ca-certificates/local-ca.crt", mode="w" + "/usr/local/share/ca-certificates/local-ca.crt", + mode="wb" ) as local_ca_cert: - local_ca_cert.write(self.args.fetch_service_mitm_certificate) + decoded_certificate = base64.b64decode( + self.args.fetch_service_mitm_certificate.encode("ASCII") + ) + local_ca_cert.write(decoded_certificate) os.fchmod(local_ca_cert.fileno(), 0o644) self.backend.run(["update-ca-certificates"]) # XXX jugmac00 2024-04-17: We might need to restart snapd diff --git a/lpbuildd/target/tests/test_build_snap.py b/lpbuildd/target/tests/test_build_snap.py index 4788029..33b1e0d 100644 --- a/lpbuildd/target/tests/test_build_snap.py +++ b/lpbuildd/target/tests/test_build_snap.py @@ -208,7 +208,8 @@ class TestBuildSnap(TestCase): "test-snap", "--use_fetch_service", "--fetch-service-mitm-certificate", - "content_of_cert", + # Base64 content_of_cert + "Y29udGVudF9vZl9jZXJ0", ] build_snap = parse_args(args=args).operation build_snap.bin = "/builderbin"
_______________________________________________ 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