You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
pcs/SOURCES/show-info-page-instead-of-w...

147 lines
5.5 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

From 6e7fa90fc265063b65e3192ed513d0a52b000a2c Mon Sep 17 00:00:00 2001
From: Ivan Devat <idevat@redhat.com>
Date: Tue, 5 Nov 2024 16:35:02 +0100
Subject: [PATCH] show info page instead of webui
---
pcs/Makefile.am | 1 +
pcs/daemon/app/webui_info_handler.py | 31 ++++++++++++++++++++++++++++
pcs/daemon/run.py | 4 +++-
pcs_test/smoke.sh.in | 4 ++--
pcsd/public/ui_instructions.html | 26 ++++++++---------------
5 files changed, 46 insertions(+), 20 deletions(-)
create mode 100644 pcs/daemon/app/webui_info_handler.py
diff --git a/pcs/Makefile.am b/pcs/Makefile.am
index 28244dd7..4d4401fa 100644
--- a/pcs/Makefile.am
+++ b/pcs/Makefile.am
@@ -206,6 +206,7 @@ EXTRA_DIST = \
daemon/app/webui/core.py \
daemon/app/webui/session.py \
daemon/app/webui/sinatra_ui.py \
+ daemon/app/webui_info_handler.py \
daemon/async_tasks/__init__.py \
daemon/async_tasks/scheduler.py \
daemon/async_tasks/task.py \
diff --git a/pcs/daemon/app/webui_info_handler.py b/pcs/daemon/app/webui_info_handler.py
new file mode 100644
index 00000000..3ab8275b
--- /dev/null
+++ b/pcs/daemon/app/webui_info_handler.py
@@ -0,0 +1,31 @@
+from pcs.daemon.app.common import (
+ BaseHandler,
+ RoutesType,
+)
+
+
+class _WebuiInfoHandler(BaseHandler):
+ __path = None
+
+ def initialize(self, path):
+ self.__path = path
+
+ def get(self):
+ self.set_status(404)
+ self.render(self.__path)
+
+
+def get_routes(path: str) -> RoutesType:
+ return [
+ # The following two rules can be compressed into one: r"/(ui/?)?".
+ # However, the content of the parentheses used here should be captured
+ # and passed in to the handlers get method as an argument.
+ # Unfortunately, it seems that tornado version 6.4.1 don't pass this
+ # argument (unlike version 6.3.3). Maybe it's a bug (it needs further
+ # inspection). These rules are a safe way to avoid surprises.
+ # Moreover, the captured parameter is irrelevant to the functionality
+ # of the handler.
+ (r"/", _WebuiInfoHandler, dict(path=path)),
+ (r"/ui/?", _WebuiInfoHandler, dict(path=path)),
+ (r"/ui/.*", _WebuiInfoHandler, dict(path=path)),
+ ]
diff --git a/pcs/daemon/run.py b/pcs/daemon/run.py
index b555bc18..10e394eb 100644
--- a/pcs/daemon/run.py
+++ b/pcs/daemon/run.py
@@ -35,6 +35,7 @@ from pcs.daemon.app import capabilities as capabilities_app
from pcs.daemon.app import (
sinatra_remote,
sinatra_ui,
+ webui_info_handler,
)
try:
@@ -141,7 +142,8 @@ def configure_app(
# Even with disabled (standalone) webui the following routes must be
# provided because they can be used via unix socket from cockpit.
routes.extend(
- sinatra_ui.get_routes(auth_provider, ruby_pcsd_wrapper)
+ webui_info_handler.get_routes(webui_fallback)
+ + sinatra_ui.get_routes(auth_provider, ruby_pcsd_wrapper)
)
return Application(
diff --git a/pcs_test/smoke.sh.in b/pcs_test/smoke.sh.in
index fdfe8be2..a9bb8344 100755
--- a/pcs_test/smoke.sh.in
+++ b/pcs_test/smoke.sh.in
@@ -71,10 +71,10 @@ if [ "$webui_http_code_response" = "200" ]; then
curl --insecure --cookie ${cookie_file} --header "X-Requested-With: XMLHttpRequest" --data "hidden[hidden_input]=&config[stonith-enabled]=false" https://localhost:2224/managec/${cluster_name}/update_cluster_settings > "${output_file}"
cat "${output_file}"; echo ""
[ "$(cat ${output_file})" = "Update Successful" ]
-elif [ "$webui_http_code_response" = "401" ]; then
+elif [ "$webui_http_code_response" = "404" ]; then
curl --insecure https://localhost:2224/ui/ > "${output_file}"
cat "${output_file}"; echo ""
- [ "$(cat "${output_file}")" = '{"notauthorized":"true"}' ]
+ grep "HA cluster management has been moved" "${output_file}"
else
echo "Unexpected response from https://localhost:2224/ui/ - http code: '${webui_http_code_response}'"
exit 1
diff --git a/pcsd/public/ui_instructions.html b/pcsd/public/ui_instructions.html
index a120ed3d..5f9214d0 100644
--- a/pcsd/public/ui_instructions.html
+++ b/pcsd/public/ui_instructions.html
@@ -1,27 +1,19 @@
<!DOCTYPE html>
<html>
<head>
- <title>Pcs WebUI instructions</title>
+ <title>HA cluster management has been moved</title>
<meta charset="utf-8" />
</head>
<body>
- <h1>Pcs WebUI instructions</h1>
+ <h1>HA cluster management has been moved</h1>
<p>
- WebUI is not a part of pcs repository but it has its own
- <a href="https://github.com/ClusterLabs/pcs-web-ui">repository</a>.
- </p>
- <p>
- You can clone <a href="https://github.com/ClusterLabs/pcs-web-ui">WebUI repository</a>
- and build the web application into pcs by:
- </p>
- <pre><code>
- $ npm install
- $ npm run build
- $ mv ./build [/path/to/]pcs/pcsd/public/ui
- </code></pre>
- <p>
- For more details, see instructions in
- <a href="https://github.com/ClusterLabs/pcs-web-ui/blob/main/README.md">README.md</a>.
+ Since RHEL 10.0, pcsd web UI is no longer available. Management of high
+ availability clusters has been moved to an add-on for the RHEL web console.
+ The HA Cluster Management add-on can be installed from the cockpit-ha-cluster
+ RPM package or from the RHEL web console. To learn more, please visit:
+ <a href="https://access.redhat.com/solutions/7099451">
+ https://access.redhat.com/solutions/7099451
+ </a>
</p>
</body>
</html>
--
2.47.0