Skip to content

Commit

Permalink
[PLAT-15582] Remove set -e from precheck templates
Browse files Browse the repository at this point in the history
Summary: [PLAT-15582] Remove set -e from precheck templates

Test Plan: tested locally

Reviewers: svarshney

Reviewed By: svarshney

Subscribers: yugaware

Differential Revision: https://phorge.dev.yugabyte.com/D38651
  • Loading branch information
amannijhawan committed Oct 14, 2024
1 parent 73eb957 commit 5ae8309
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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" ""
Expand Down

0 comments on commit 5ae8309

Please sign in to comment.