diff --git a/managed/node-agent/resources/ynp/commands/provision_command.py b/managed/node-agent/resources/ynp/commands/provision_command.py index cbed45a48700..2e2a3bc26326 100644 --- a/managed/node-agent/resources/ynp/commands/provision_command.py +++ b/managed/node-agent/resources/ynp/commands/provision_command.py @@ -59,7 +59,6 @@ def _load_modules(self): def _build_script(self, all_templates, phase): with tempfile.NamedTemporaryFile(mode="w+", delete=False) as temp_file: temp_file.write("#!/bin/bash\n\n") - temp_file.write("set -e\n") key = next(iter(self.config), None) if key is not None: context = self.config[key] @@ -133,13 +132,11 @@ def print_results_helper(self, file): def populate_sudo_check(self, file): file.write("\n######## Check the SUDO Access #########\n") file.write("SUDO_ACCESS=\"false\"\n") - file.write("set +e\n") file.write("if [ $(id -u) = 0 ]; then\n") file.write(" SUDO_ACCESS=\"true\"\n") file.write("elif sudo -n pwd >/dev/null 2>&1; then\n") file.write(" SUDO_ACCESS=\"true\"\n") file.write("fi\n") - file.write("set -e\n") def _generate_template(self): os_distribution, os_family, os_version = self._get_os_info() @@ -311,7 +308,7 @@ def _compare_ynp_version(self): ) sys.exit(1) - def run_preflight_checks(self, extra_vars): + def run_preflight_checks(self): _, precheck_combined_script = self._generate_template() self._compare_ynp_version() self._run_script(precheck_combined_script) diff --git a/managed/node-agent/resources/ynp/modules/provision/configure_os/templates/precheck.j2 b/managed/node-agent/resources/ynp/modules/provision/configure_os/templates/precheck.j2 index 77f2cb3bf6a8..dfcd0fbc5a88 100644 --- a/managed/node-agent/resources/ynp/modules/provision/configure_os/templates/precheck.j2 +++ b/managed/node-agent/resources/ynp/modules/provision/configure_os/templates/precheck.j2 @@ -152,7 +152,7 @@ done platform_id=$(grep -oP '(?<=^PLATFORM_ID=).+' /etc/os-release | tr -d '"') if [[ "$platform_id" == "platform:el8" ]]; then # Check if selinux module can be imported - python3 -c "import selinux" 2>/dev/null + /usr/bin/python3 -c "import selinux" 2>/dev/null if [ $? -eq 0 ]; then echo "libselinux bindings are correctly working for the system's default Python." add_result "python libselinux check" "PASS" ""