summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMina Galić <me+git@igalic.co>2022-10-06 04:49:07 +0100
committerGitHub <noreply@github.com>2022-10-05 21:49:07 -0600
commit0f005bf4973c093aab6fe8728bd50702126d511e (patch)
tree9591c1cd5c618da07dde36c0e5a543cfa88aed7f
parent219a0be476596a0ea76129d6ca63603574026407 (diff)
downloadcloud-init-git-0f005bf4973c093aab6fe8728bd50702126d511e.tar.gz
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
-rw-r--r--cloudinit/distros/freebsd.py3
-rw-r--r--cloudinit/distros/openbsd.py7
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