pcs/fix-wrong-name-for-library-command.patch
Miroslav Lisik 48490e1ce5 Resolves: rhbz#1881064
- Rebased to latest upstream sources (see CHANGELOG.md)
- Removed clufter related commands
2021-06-14 17:34:56 +02:00

152 lines
6.0 KiB
Diff

From e5781d95faae560f46ea56525d67eeb36b244a36 Mon Sep 17 00:00:00 2001
From: Ivan Devat <idevat@redhat.com>
Date: Thu, 10 Jun 2021 14:52:15 +0200
Subject: [PATCH 1/3] fix wrong name for library command
---
pcs/cli/common/lib_wrapper.py | 8 ++++----
pcs/cli/constraint_colocation/command.py | 2 +-
pcs/cli/constraint_order/command.py | 4 +++-
pcs/cli/constraint_ticket/command.py | 4 ++--
pcs_test/tier0/cli/common/test_lib_wrapper.py | 6 +++---
pcs_test/tier0/cli/constraint_ticket/test_command.py | 8 ++++----
6 files changed, 17 insertions(+), 15 deletions(-)
diff --git a/pcs/cli/common/lib_wrapper.py b/pcs/cli/common/lib_wrapper.py
index d9a6bd26..c41ce875 100644
--- a/pcs/cli/common/lib_wrapper.py
+++ b/pcs/cli/common/lib_wrapper.py
@@ -230,7 +230,7 @@ def load_module(env, middleware_factory, name):
env,
middleware.build(middleware_factory.cib),
{
- "set": constraint_colocation.create_with_set,
+ "create_with_set": constraint_colocation.create_with_set,
"show": constraint_colocation.show,
},
)
@@ -240,7 +240,7 @@ def load_module(env, middleware_factory, name):
env,
middleware.build(middleware_factory.cib),
{
- "set": constraint_order.create_with_set,
+ "create_with_set": constraint_order.create_with_set,
"show": constraint_order.show,
},
)
@@ -250,9 +250,9 @@ def load_module(env, middleware_factory, name):
env,
middleware.build(middleware_factory.cib),
{
- "set": constraint_ticket.create_with_set,
+ "create_with_set": constraint_ticket.create_with_set,
"show": constraint_ticket.show,
- "add": constraint_ticket.create,
+ "create": constraint_ticket.create,
"remove": constraint_ticket.remove,
},
)
diff --git a/pcs/cli/constraint_colocation/command.py b/pcs/cli/constraint_colocation/command.py
index f5cf91ab..10539aa6 100644
--- a/pcs/cli/constraint_colocation/command.py
+++ b/pcs/cli/constraint_colocation/command.py
@@ -18,7 +18,7 @@ def create_with_set(lib, argv, modifiers):
"""
modifiers.ensure_only_supported("-f", "--force")
command.create_with_set(
- lib.constraint_colocation.set,
+ lib.constraint_colocation.create_with_set,
argv,
modifiers,
)
diff --git a/pcs/cli/constraint_order/command.py b/pcs/cli/constraint_order/command.py
index 04a49c8e..7251a4a7 100644
--- a/pcs/cli/constraint_order/command.py
+++ b/pcs/cli/constraint_order/command.py
@@ -17,7 +17,9 @@ def create_with_set(lib, argv, modifiers):
* -f - CIB file
"""
modifiers.ensure_only_supported("--force", "-f")
- command.create_with_set(lib.constraint_order.set, argv, modifiers)
+ command.create_with_set(
+ lib.constraint_order.create_with_set, argv, modifiers
+ )
def show(lib, argv, modifiers):
diff --git a/pcs/cli/constraint_ticket/command.py b/pcs/cli/constraint_ticket/command.py
index 7823981e..b4cd2bcd 100644
--- a/pcs/cli/constraint_ticket/command.py
+++ b/pcs/cli/constraint_ticket/command.py
@@ -20,7 +20,7 @@ def create_with_set(lib, argv, modifiers):
"""
modifiers.ensure_only_supported("--force", "-f")
command.create_with_set(
- lib.constraint_ticket.set,
+ lib.constraint_ticket.create_with_set,
argv,
modifiers,
)
@@ -50,7 +50,7 @@ def add(lib, argv, modifiers):
if resource_role:
options["rsc-role"] = resource_role
- lib.constraint_ticket.add(
+ lib.constraint_ticket.create(
ticket,
resource_id,
options,
diff --git a/pcs_test/tier0/cli/common/test_lib_wrapper.py b/pcs_test/tier0/cli/common/test_lib_wrapper.py
index 3a8188c6..33538685 100644
--- a/pcs_test/tier0/cli/common/test_lib_wrapper.py
+++ b/pcs_test/tier0/cli/common/test_lib_wrapper.py
@@ -25,8 +25,8 @@ class LibraryWrapperTest(TestCase):
mock_middleware_factory.cib = dummy_middleware
mock_middleware_factory.corosync_conf_existing = dummy_middleware
mock_env = mock.MagicMock()
- Library(mock_env, mock_middleware_factory).constraint_order.set(
- "first", second="third"
- )
+ Library(
+ mock_env, mock_middleware_factory
+ ).constraint_order.create_with_set("first", second="third")
mock_order_set.assert_called_once_with(lib_env, "first", second="third")
diff --git a/pcs_test/tier0/cli/constraint_ticket/test_command.py b/pcs_test/tier0/cli/constraint_ticket/test_command.py
index 118bfa22..ca4835c3 100644
--- a/pcs_test/tier0/cli/constraint_ticket/test_command.py
+++ b/pcs_test/tier0/cli/constraint_ticket/test_command.py
@@ -24,12 +24,12 @@ class AddTest(TestCase):
)
lib = mock.MagicMock()
lib.constraint_ticket = mock.MagicMock()
- lib.constraint_ticket.add = mock.MagicMock()
+ lib.constraint_ticket.create = mock.MagicMock()
command.add(lib, ["argv"], _modifiers())
mock_parse_add.assert_called_once_with(["argv"])
- lib.constraint_ticket.add.assert_called_once_with(
+ lib.constraint_ticket.create.assert_called_once_with(
"ticket",
"resource_id",
{"loss-policy": "fence"},
@@ -60,12 +60,12 @@ class AddTest(TestCase):
)
lib = mock.MagicMock()
lib.constraint_ticket = mock.MagicMock()
- lib.constraint_ticket.add = mock.MagicMock()
+ lib.constraint_ticket.create = mock.MagicMock()
command.add(lib, ["argv"], _modifiers())
mock_parse_add.assert_called_once_with(["argv"])
- lib.constraint_ticket.add.assert_called_once_with(
+ lib.constraint_ticket.create.assert_called_once_with(
"ticket",
"resource_id",
{"loss-policy": "fence", "rsc-role": "resource_role"},
--
2.31.1