Blame SOURCES/bz1408476-01-accept-RA-with-instantiated-systemd-service-in-name.patch

585c70
From efd4958f35d7760bd4d80c4d82e257708c25416d Mon Sep 17 00:00:00 2001
585c70
From: Ivan Devat <idevat@redhat.com>
585c70
Date: Fri, 6 Jan 2017 09:06:35 +0100
585c70
Subject: [PATCH] accept RA with instantiated systemd serv. in name
585c70
585c70
Accept resource agent with instantiated systemd service in name.
585c70
---
585c70
 pcs/utils.py | 6 ++++++
585c70
 1 file changed, 6 insertions(+)
585c70
585c70
diff --git a/pcs/utils.py b/pcs/utils.py
585c70
index d5b6dcf..6daecf3 100644
585c70
--- a/pcs/utils.py
585c70
+++ b/pcs/utils.py
585c70
@@ -1524,6 +1524,12 @@ def is_valid_resource(resource, caseInsensitiveCheck=False):
585c70
         return is_file_abs_path(agent)
585c70
     elif resource.startswith("systemd:"):
585c70
         _, agent_name = resource.split(":", 1)
585c70
+        # For Instantiated services we need to make sure that the
585c70
+        # <agent_name>@.service file exists
585c70
+        # For example: we need recognize systemd:getty@tty3 as existing service.
585c70
+        if '@' in agent_name:
585c70
+            agent_name, instance_name = agent_name.split("@", 1)
585c70
+            agent_name += '@'
585c70
         agent1 = os.path.join(
585c70
             "/etc/systemd/system/", agent_name + ".service"
585c70
         )
585c70
-- 
585c70
1.8.3.1
585c70