Blame SOURCES/cache-tokens-read-from-pcsd.patch

f40c32
From 7bfa0658bd7e6ffa526ed965fb4a9680414320e5 Mon Sep 17 00:00:00 2001
f40c32
From: Tomas Jelinek <tojeline@redhat.com>
f40c32
Date: Tue, 19 Feb 2019 15:40:05 +0100
f40c32
Subject: [PATCH 1/3] cache tokens read from pcsd
f40c32
f40c32
---
f40c32
 pcs/cluster.py | 4 ++++
f40c32
 pcs/status.py  | 1 +
f40c32
 pcs/utils.py   | 1 +
f40c32
 3 files changed, 6 insertions(+)
f40c32
f40c32
diff --git a/pcs/cluster.py b/pcs/cluster.py
f40c32
index 7d13e11e..8cb27c82 100644
f40c32
--- a/pcs/cluster.py
f40c32
+++ b/pcs/cluster.py
f40c32
@@ -1167,6 +1167,7 @@ def start_cluster_nodes(nodes):
f40c32
     )
f40c32
     was_error = False
f40c32
 
f40c32
+    utils.read_token_file() # cache node tokens
f40c32
     task_list = [
f40c32
         IsComponentStartSupported(node) for node in nodes
f40c32
     ]
f40c32
@@ -1278,6 +1279,7 @@ def wait_for_nodes_started(node_list, timeout=None):
f40c32
         else:
f40c32
             print(output)
f40c32
     else:
f40c32
+        utils.read_token_file() # cache node tokens
f40c32
         node_errors = parallel_for_nodes(
f40c32
             wait_for_remote_node_started, node_list, stop_at, interval
f40c32
         )
f40c32
@@ -1296,6 +1298,7 @@ def stop_cluster_nodes(nodes):
f40c32
             % "', '".join(unknown_nodes)
f40c32
         )
f40c32
 
f40c32
+    utils.read_token_file() # cache node tokens
f40c32
     stopping_all = set(nodes) >= set(all_nodes)
f40c32
     if "--force" not in utils.pcs_options and not stopping_all:
f40c32
         error_list = []
f40c32
@@ -1406,6 +1409,7 @@ def destroy_cluster(argv, keep_going=False):
f40c32
     if len(argv) > 0:
f40c32
         # stop pacemaker and resources while cluster is still quorate
f40c32
         nodes = argv
f40c32
+        utils.read_token_file() # cache node tokens
f40c32
         node_errors = parallel_for_nodes(
f40c32
             utils.repeat_if_timeout(utils.stopPacemaker),
f40c32
             nodes,
f40c32
diff --git a/pcs/status.py b/pcs/status.py
f40c32
index 69cea716..647faed8 100644
f40c32
--- a/pcs/status.py
f40c32
+++ b/pcs/status.py
f40c32
@@ -401,6 +401,7 @@ def check_nodes(node_list, prefix=""):
f40c32
         ))
f40c32
         status_list.append(returncode)
f40c32
 
f40c32
+    utils.read_token_file() # cache node tokens
f40c32
     utils.run_parallel(
f40c32
         utils.create_task_list(report, utils.checkAuthorization, node_list)
f40c32
     )
f40c32
diff --git a/pcs/utils.py b/pcs/utils.py
f40c32
index 343a611b..839e931f 100644
f40c32
--- a/pcs/utils.py
f40c32
+++ b/pcs/utils.py
f40c32
@@ -245,6 +245,7 @@ def remove_uid_gid_file(uid,gid):
f40c32
 def readTokens():
f40c32
     return read_token_file()["tokens"]
f40c32
 
f40c32
+@simple_cache
f40c32
 def read_token_file():
f40c32
     data = {
f40c32
         "tokens": {},
f40c32
-- 
f40c32
2.17.0
f40c32