From 3314fefaec8d754e039c73fba5710bedc0c63313 Mon Sep 17 00:00:00 2001 From: Alex Vandiver Date: Mon, 8 Mar 2021 22:57:26 -0800 Subject: [PATCH] puppet: Do not require a venv for zulip-puppet-apply. 0663b23d54dafe4911ef1b67fa64b2e18a82846d changed zulip-puppet-apply to use the venv, because it began using `yaml` to parse the output of puppet to determine if changes would happen. However, not every install ends with a venv; notably, non-frontend servers do not have one. Attempting to run zulip-puppet-apply on them hence now fails. Remove this dependency on the venv, by installing a system python3-yaml package -- though in reality, this package is already an indirect dependency of the system. Especially since pyyaml is quite stable, we're not using it in any interesting way, and it does not actually add to the dependencies, it is preferable to parsing the YAML by hand in this instance. --- puppet/zulip/manifests/profile/base.pp | 2 ++ scripts/lib/install | 4 ++-- scripts/zulip-puppet-apply | 9 ++------- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/puppet/zulip/manifests/profile/base.pp b/puppet/zulip/manifests/profile/base.pp index e3c9ee2054..1d86b33cde 100644 --- a/puppet/zulip/manifests/profile/base.pp +++ b/puppet/zulip/manifests/profile/base.pp @@ -35,6 +35,7 @@ class zulip::profile::base { $base_packages = [ # Basics 'python3', + 'python3-yaml', 'puppet', 'git', # Used in scripts including install-yarn.sh @@ -59,6 +60,7 @@ class zulip::profile::base { $release_name = "${::operatingsystem}${::operatingsystemmajrelease}" $base_packages = [ 'python3', + 'python3-pyyaml', 'puppet', 'git', 'curl', diff --git a/scripts/lib/install b/scripts/lib/install index e3e77e7054..0d2ffbe387 100755 --- a/scripts/lib/install +++ b/scripts/lib/install @@ -327,7 +327,7 @@ if [ "$package_system" = apt ]; then # `zulip::profile::base` such that the new dependency is seen by # upgrades, as well as new installs. if ! apt-get install -y \ - python3 puppet git curl wget jq crudini \ + python3 python3-yaml puppet git curl wget jq crudini \ "${ADDITIONAL_PACKAGES[@]}"; then set +x echo -e '\033[0;31m' >&2 @@ -338,7 +338,7 @@ if [ "$package_system" = apt ]; then fi elif [ "$package_system" = yum ]; then if ! yum install -y \ - python3 puppet git curl wget jq crudini \ + python3 python3-pyyaml puppet git curl wget jq crudini \ "${ADDITIONAL_PACKAGES[@]}"; then set +x echo -e '\033[0;31m' >&2 diff --git a/scripts/zulip-puppet-apply b/scripts/zulip-puppet-apply index 2d527df643..7fe4f0c09f 100755 --- a/scripts/zulip-puppet-apply +++ b/scripts/zulip-puppet-apply @@ -7,15 +7,10 @@ import subprocess import sys import tempfile -BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) -sys.path.append(BASE_DIR) -from scripts.lib.setup_path import setup_path -from scripts.lib.zulip_tools import assert_running_as_root, parse_os_release - -setup_path() - import yaml +from lib.zulip_tools import assert_running_as_root, parse_os_release + assert_running_as_root() BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))