From: Daan De Meyer Date: Thu, 13 Jul 2023 07:25:09 +0000 (+0200) Subject: Use http_proxy and https_proxy from environment X-Git-Tag: v15~80^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b64cfe2da99804ebd102448df88a1b115be671ca;p=thirdparty%2Fmkosi.git Use http_proxy and https_proxy from environment We generally don't use environment variables passed to the process, but let's be a little more relaxed on this policy and make sure we use any configured proxy variables so mkosi works out of the box on servers behind a proxy. --- diff --git a/mkosi/state.py b/mkosi/state.py index 48f556b90..e29175e22 100644 --- a/mkosi/state.py +++ b/mkosi/state.py @@ -1,6 +1,7 @@ # SPDX-License-Identifier: LGPL-2.1+ import importlib +import os import tempfile from pathlib import Path @@ -23,9 +24,13 @@ class MkosiState: self.environment = self.config.environment.copy() if self.config.image_id is not None: - self.environment['IMAGE_ID'] = self.config.image_id + self.environment["IMAGE_ID"] = self.config.image_id if self.config.image_version is not None: - self.environment['IMAGE_VERSION'] = self.config.image_version + self.environment["IMAGE_VERSION"] = self.config.image_version + if (proxy := os.environ.get("http_proxy")): + self.environment["http_proxy"] = proxy + if (proxy := os.environ.get("https_proxy")): + self.environment["https_proxy"] = proxy try: distro = str(self.config.distribution)