From 6cfc75e3212aa059d2cd78919a16502ed0acafbe Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Wed, 30 Aug 2023 09:47:45 -0400 Subject: [PATCH] Simplify stdout/stderr handling --- bootstrap-daemon/pvcbootstrapd/lib/tftp.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bootstrap-daemon/pvcbootstrapd/lib/tftp.py b/bootstrap-daemon/pvcbootstrapd/lib/tftp.py index 66d7358..d297913 100755 --- a/bootstrap-daemon/pvcbootstrapd/lib/tftp.py +++ b/bootstrap-daemon/pvcbootstrapd/lib/tftp.py @@ -22,18 +22,16 @@ import os.path import shutil from subprocess import run -from sys import stdout, stderr import pvcbootstrapd.lib.notifications as notifications def build_tftp_repository(config): # Generate an installer config - build_cmd = f"{config['ansible_path']}/pvc-installer/buildpxe.sh -o {config['tftp_root_path']} -u {config['deploy_username']}" build_cmd = [ f"{config['ansible_path']}/pvc-installer/buildpxe.sh", "-o", config['tftp_root_path'], "-u", config['deploy_username'] ] - print(f"Building TFTP contents via pvc-installer command: {build_cmd}") + print(f"Building TFTP contents via pvc-installer command: {' '.join(build_cmd)}") notifications.send_webhook(config, "begin", f"Building TFTP contents via pvc-installer command: {' '.join(build_cmd)}") - retcode = run(build_cmd, stdout=stdout, stderr=stderr) + retcode = run(build_cmd) return True if retcode == 0 else False @@ -52,6 +50,8 @@ def init_tftp(config): result = build_tftp_repository(config) if result: + print("First run: successfully initialized TFTP root and contents") notifications.send_webhook(config, "success", "First run: successfully initialized TFTP root and contents") else: + print("First run: failed initialized TFTP root and contents; see logs above") notifications.send_webhook(config, "failure", "First run: failed initialized TFTP root and contents; check pvcbootstrapd logs")