File 0037-Low-VirtualDomain-fix-warning-messages-in-log.patch of Package resource-agents.8843

From 1127265b94c2b73f2b9dedc2c1420ae569210d60 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michal=20Koutn=C3=BD?= <mkoutny@suse.com>
Date: Tue, 6 Mar 2018 12:39:16 +0100
Subject: [PATCH 33/33] Low: VirtualDomain: fix warning messages in log

Changes introduced in dd9f8d47ec0dbec067442db4e4461a72aab0585e leave
behind warning messages in logs.
Pacemaker/lrmd sets umask(0026) we override that for file creation in
RA and make new directories more carefully.
---
 heartbeat/ocf-shellfuncs.in | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/heartbeat/ocf-shellfuncs.in b/heartbeat/ocf-shellfuncs.in
index 670bdda4..955aaaf2 100644
--- a/heartbeat/ocf-shellfuncs.in
+++ b/heartbeat/ocf-shellfuncs.in
@@ -618,16 +618,21 @@ systemd_is_running()
 # usage: systemd_drop_in <name> <After|Before> <dependency.service>
 systemd_drop_in()
 {
+	local conf_file
 	if [ $# -ne 3 ]; then
           ocf_log err "Incorrect number of arguments [$#] for systemd_drop_in."
         fi
 
 	systemdrundir="/run/systemd/system/resource-agents-deps.target.d"
-	mkdir "$systemdrundir"
-	cat > "$systemdrundir/$1.conf" <<EOF
+	mkdir -p "$systemdrundir"
+	conf_file="$systemdrundir/$1.conf"
+	cat >"$conf_file" <<EOF
 [Unit]
 $2=$3
 EOF
+	# The information is accessible through systemd API and systemd would
+	# complain about improper permissions.
+	chmod o+r "$conf_file"
 	systemctl daemon-reload
 }
 
-- 
2.16.4

openSUSE Build Service is sponsored by