Blob Blame History Raw
From d351a328ec7d785b1ab3a39c34cb29f870164733 Mon Sep 17 00:00:00 2001
From: Ken Gaillot <kgaillot@redhat.com>
Date: Fri, 21 Sep 2018 16:07:37 -0500
Subject: [PATCH] Low: tools: ensure crm_resource --force-* commands get stderr
 messages

---
 tools/crm_resource_runtime.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tools/crm_resource_runtime.c b/tools/crm_resource_runtime.c
index 1b6a3f3..1a360a0 100644
--- a/tools/crm_resource_runtime.c
+++ b/tools/crm_resource_runtime.c
@@ -1757,6 +1757,12 @@ cli_resource_execute(resource_t *rsc, const char *requested_name,
         setenv("OCF_TRACE_RA", "1", 1);
     }
 
+    /* A resource agent using the standard ocf-shellfuncs library will not print
+     * messages to stderr if it doesn't have a controlling terminal (e.g. if
+     * crm_resource is called via script or ssh). This forces it to do so.
+     */
+    setenv("OCF_TRACE_FILE", "/dev/stderr", 0);
+
     if (override_hash) {
         GHashTableIter iter;
         char *name = NULL;
-- 
1.8.3.1