Blame SOURCES/bz1459503-01-OSP-workarounds-not-compatible-wi.patch

a3a2ad
From b5f98fed9903bc6c4e30056aa99f3be6fcb68917 Mon Sep 17 00:00:00 2001
f778fe
From: Ivan Devat <idevat@redhat.com>
f778fe
Date: Wed, 7 Jun 2017 14:36:05 +0200
f778fe
Subject: [PATCH] squash bz1459503 OSP workarounds not compatible wi
f778fe
f778fe
reuse existing pcmk authkey during setup
f778fe
f778fe
show only warn if `resource create` creates remote
f778fe
---
f778fe
 pcs/cluster.py                       | 10 +++++++++-
f778fe
 pcs/lib/commands/resource.py         |  6 ++++--
f778fe
 pcs/test/cib_resource/test_create.py | 13 ++++++-------
f778fe
 pcs/test/test_resource.py            | 24 ++++++++++++------------
f778fe
 4 files changed, 31 insertions(+), 22 deletions(-)
f778fe
f778fe
diff --git a/pcs/cluster.py b/pcs/cluster.py
a3a2ad
index b66bec78..a3cc74c6 100644
f778fe
--- a/pcs/cluster.py
f778fe
+++ b/pcs/cluster.py
a3a2ad
@@ -501,13 +501,21 @@ def cluster_setup(argv):
f778fe
         print("Destroying cluster on nodes: {0}...".format(
f778fe
             ", ".join(primary_addr_list)
f778fe
         ))
f778fe
+
f778fe
+        try:
f778fe
+            pcmk_authkey_content = (
f778fe
+                open(settings.pacemaker_authkey_file, "rb").read()
f778fe
+            )
f778fe
+        except EnvironmentError as e:
f778fe
+            pcmk_authkey_content = generate_key()
f778fe
+
f778fe
         destroy_cluster(primary_addr_list)
f778fe
         print()
f778fe
 
f778fe
         try:
f778fe
             file_definitions = {}
f778fe
             file_definitions.update(
f778fe
-                node_communication_format.pcmk_authkey_file(generate_key())
f778fe
+                node_communication_format.pcmk_authkey_file(pcmk_authkey_content)
f778fe
             )
f778fe
             if modifiers["encryption"] == "1":
f778fe
                 file_definitions.update(
f778fe
diff --git a/pcs/lib/commands/resource.py b/pcs/lib/commands/resource.py
a3a2ad
index 8cda3102..cb45771f 100644
f778fe
--- a/pcs/lib/commands/resource.py
f778fe
+++ b/pcs/lib/commands/resource.py
a3a2ad
@@ -67,7 +67,8 @@ def _validate_remote_connection(
f778fe
     report_list.append(
f778fe
         reports.get_problem_creator(
f778fe
             report_codes.FORCE_NOT_SUITABLE_COMMAND,
f778fe
-            allow_not_suitable_command
f778fe
+            is_forced=True,
f778fe
+            # allow_not_suitable_command
f778fe
         )(reports.use_command_node_add_remote)
f778fe
     )
f778fe
 
a3a2ad
@@ -97,7 +98,8 @@ def _validate_guest_change(
f778fe
     report_list.append(
f778fe
         reports.get_problem_creator(
f778fe
             report_codes.FORCE_NOT_SUITABLE_COMMAND,
f778fe
-            allow_not_suitable_command
f778fe
+            is_forced=True
f778fe
+            # allow_not_suitable_command
f778fe
         )(create_report)
f778fe
     )
f778fe
 
f778fe
diff --git a/pcs/test/cib_resource/test_create.py b/pcs/test/cib_resource/test_create.py
a3a2ad
index c554ec24..282ce1c5 100644
f778fe
--- a/pcs/test/cib_resource/test_create.py
f778fe
+++ b/pcs/test/cib_resource/test_create.py
a3a2ad
@@ -1581,11 +1581,10 @@ class FailOrWarnGroup(ResourceTest):
f778fe
         )
f778fe
 
f778fe
     def test_fail_when_on_pacemaker_remote_attempt(self):
f778fe
-        self.assert_pcs_fail(
f778fe
+        self.assert_pcs_success(
f778fe
             "resource create R2 ocf:pacemaker:remote",
f778fe
-            "Error: this command is not sufficient for creating a remote"
f778fe
-                " connection, use 'pcs cluster node add-remote'"
f778fe
-                ", use --force to override\n"
f778fe
+            "Warning: this command is not sufficient for creating a remote"
f778fe
+                " connection, use 'pcs cluster node add-remote'\n"
f778fe
         )
f778fe
 
f778fe
     def test_warn_when_on_pacemaker_remote_attempt(self):
a3a2ad
@@ -1685,10 +1684,10 @@ class FailOrWarnGroup(ResourceTest):
f778fe
         )
f778fe
 
f778fe
     def test_fail_when_on_pacemaker_remote_guest_attempt(self):
f778fe
-        self.assert_pcs_fail(
f778fe
+        self.assert_pcs_success(
f778fe
             "resource create R2 ocf:heartbeat:Dummy meta remote-node=HOST",
f778fe
-            "Error: this command is not sufficient for creating a guest node,"
f778fe
-            " use 'pcs cluster node add-guest', use --force to override\n"
f778fe
+            "Warning: this command is not sufficient for creating a guest node,"
f778fe
+            " use 'pcs cluster node add-guest'\n"
f778fe
         )
f778fe
 
f778fe
     def test_warn_when_on_pacemaker_remote_guest_attempt(self):
f778fe
diff --git a/pcs/test/test_resource.py b/pcs/test/test_resource.py
a3a2ad
index d8f68c12..eac7eb04 100644
f778fe
--- a/pcs/test/test_resource.py
f778fe
+++ b/pcs/test/test_resource.py
a3a2ad
@@ -5110,10 +5110,10 @@ class ResourceUpdateSpcialChecks(unittest.TestCase, AssertPcsMixin):
f778fe
         self.assert_pcs_success(
f778fe
             "resource create R ocf:heartbeat:Dummy",
f778fe
         )
f778fe
-        self.assert_pcs_fail(
f778fe
+        self.assert_pcs_success(
f778fe
             "resource update R meta remote-node=HOST",
f778fe
-            "Error: this command is not sufficient for creating a guest node,"
f778fe
-            " use 'pcs cluster node add-guest', use --force to override\n"
f778fe
+            "Warning: this command is not sufficient for creating a guest node,"
f778fe
+            " use 'pcs cluster node add-guest'\n"
f778fe
         )
f778fe
     def test_update_warn_on_pacemaker_guest_attempt(self):
f778fe
         self.assert_pcs_success(
a3a2ad
@@ -5132,10 +5132,10 @@ class ResourceUpdateSpcialChecks(unittest.TestCase, AssertPcsMixin):
f778fe
             "Warning: this command is not sufficient for creating a guest node,"
f778fe
             " use 'pcs cluster node add-guest'\n"
f778fe
         )
f778fe
-        self.assert_pcs_fail(
f778fe
+        self.assert_pcs_success(
f778fe
             "resource update R meta remote-node=",
f778fe
-            "Error: this command is not sufficient for removing a guest node,"
f778fe
-            " use 'pcs cluster node remove-guest', use --force to override\n"
f778fe
+            "Warning: this command is not sufficient for removing a guest node,"
f778fe
+            " use 'pcs cluster node remove-guest'\n"
f778fe
         )
f778fe
 
f778fe
     def test_update_warn_on_pacemaker_guest_attempt_remove(self):
a3a2ad
@@ -5156,10 +5156,10 @@ class ResourceUpdateSpcialChecks(unittest.TestCase, AssertPcsMixin):
f778fe
         self.assert_pcs_success(
f778fe
             "resource create R ocf:heartbeat:Dummy",
f778fe
         )
f778fe
-        self.assert_pcs_fail(
f778fe
+        self.assert_pcs_success(
f778fe
             "resource meta R remote-node=HOST",
f778fe
-            "Error: this command is not sufficient for creating a guest node,"
f778fe
-            " use 'pcs cluster node add-guest', use --force to override\n"
f778fe
+            "Warning: this command is not sufficient for creating a guest node,"
f778fe
+            " use 'pcs cluster node add-guest'\n"
f778fe
         )
f778fe
 
f778fe
     def test_meta_warn_on_pacemaker_guest_attempt(self):
a3a2ad
@@ -5180,10 +5180,10 @@ class ResourceUpdateSpcialChecks(unittest.TestCase, AssertPcsMixin):
f778fe
             "Warning: this command is not sufficient for creating a guest node,"
f778fe
             " use 'pcs cluster node add-guest'\n"
f778fe
         )
f778fe
-        self.assert_pcs_fail(
f778fe
+        self.assert_pcs_success(
f778fe
             "resource meta R remote-node=",
f778fe
-            "Error: this command is not sufficient for removing a guest node,"
f778fe
-            " use 'pcs cluster node remove-guest', use --force to override\n"
f778fe
+            "Warning: this command is not sufficient for removing a guest node,"
f778fe
+            " use 'pcs cluster node remove-guest'\n"
f778fe
         )
f778fe
 
f778fe
     def test_meta_warn_on_pacemaker_guest_attempt_remove(self):
f778fe
-- 
a3a2ad
2.13.6
f778fe