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

f778fe
From 764f74bb363613c63c3757637267bf37ee2381a0 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
f778fe
index d896b0c..16eb0c5 100644
f778fe
--- a/pcs/cluster.py
f778fe
+++ b/pcs/cluster.py
f778fe
@@ -452,13 +452,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
f778fe
index 0c5f682..0c4d6fc 100644
f778fe
--- a/pcs/lib/commands/resource.py
f778fe
+++ b/pcs/lib/commands/resource.py
f778fe
@@ -69,7 +69,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
 
f778fe
@@ -99,7 +100,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
f778fe
index 045ce68..afd7d0a 100644
f778fe
--- a/pcs/test/cib_resource/test_create.py
f778fe
+++ b/pcs/test/cib_resource/test_create.py
f778fe
@@ -1463,11 +1463,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):
f778fe
@@ -1567,10 +1566,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
f778fe
index 5bc9517..9ab1dd5 100644
f778fe
--- a/pcs/test/test_resource.py
f778fe
+++ b/pcs/test/test_resource.py
f778fe
@@ -4973,10 +4973,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(
f778fe
@@ -4995,10 +4995,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):
f778fe
@@ -5019,10 +5019,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):
f778fe
@@ -5043,10 +5043,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
-- 
f778fe
1.8.3.1
f778fe