From 0f005bf4973c093aab6fe8728bd50702126d511e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mina=20Gali=C4=87?= Date: Thu, 6 Oct 2022 04:49:07 +0100 Subject: OpenBSD: remove pkg_cmd_environ function (#1773) This environment variable is being set to the main mirror, which is heavily under load. It also sets it to a deprecated and highly insecure protocol. OpenBSD's default behaviour is to read a list of mirrors from installurl(5): https://man.openbsd.org/installurl.5 We can restore this behaviour by removing the contents of this function. Note that the Equivalent NetBSD function makes vastly more sense. LP: 1991567 Sponsored by: FreeBSD Foundation --- cloudinit/distros/freebsd.py | 3 ++- cloudinit/distros/openbsd.py | 7 ------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/cloudinit/distros/freebsd.py b/cloudinit/distros/freebsd.py index fe6ea04c..68a9f300 100644 --- a/cloudinit/distros/freebsd.py +++ b/cloudinit/distros/freebsd.py @@ -176,7 +176,8 @@ class Distro(cloudinit.distros.bsd.BSD): ) def _get_pkg_cmd_environ(self): - """Return environment vars used in *BSD package_command operations""" + """Return environment vars used in FreeBSD package_command + operations""" e = os.environ.copy() e["ASSUME_ALWAYS_YES"] = "YES" return e diff --git a/cloudinit/distros/openbsd.py b/cloudinit/distros/openbsd.py index c398335c..9ef33bf2 100644 --- a/cloudinit/distros/openbsd.py +++ b/cloudinit/distros/openbsd.py @@ -3,7 +3,6 @@ # This file is part of cloud-init. See LICENSE file for license information. import os -import platform import cloudinit.distros.netbsd from cloudinit import log as logging @@ -57,13 +56,7 @@ class Distro(cloudinit.distros.netbsd.NetBSD): def _get_pkg_cmd_environ(self): """Return env vars used in OpenBSD package_command operations""" - os_release = platform.release() - os_arch = platform.machine() e = os.environ.copy() - e["PKG_PATH"] = ( - "ftp://ftp.openbsd.org/pub/OpenBSD/{os_release}/" - "packages/{os_arch}/" - ).format(os_arch=os_arch, os_release=os_release) return e -- cgit v1.2.1