From 944a77c9c60ab2ef938fae609e68c9c67bac8872 Mon Sep 17 00:00:00 2001 From: "John L. Villalovos" Date: Tue, 6 Feb 2018 23:01:53 -0800 Subject: [PATCH] When ouputting to /dev/null should open in write mode Even though it was working opening the file in 'read' mode, it really should be opened in 'write' mode, since we are redirecting the output to the file. Interestingly it does fail in 'read' mode if the command is: echo something But passes in 'write' mode. Change-Id: Ic67091881e0be377e527b78d270ab48962881ae0 --- ironic_python_agent/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ironic_python_agent/utils.py b/ironic_python_agent/utils.py index f09512707..2bc2bfa11 100644 --- a/ironic_python_agent/utils.py +++ b/ironic_python_agent/utils.py @@ -313,7 +313,7 @@ def is_journalctl_present(): :returns: True if journalctl is present, False if not. """ try: - devnull = open(os.devnull) + devnull = open(os.devnull, 'w') subprocess.check_call(['journalctl', '--version'], stdout=devnull, stderr=devnull) except OSError as e: