From 1ba74b14e91c49c0e6f5618f5572748dc4e1e11e Mon Sep 17 00:00:00 2001 From: Ivan Devat Date: Tue, 5 Nov 2024 16:35:02 +0100 Subject: [PATCH 2/2] 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, 48 insertions(+), 18 deletions(-) create mode 100644 pcs/daemon/app/webui_info_handler.py diff --git a/pcs/Makefile.am b/pcs/Makefile.am index 1297473f..8d4b9307 100644 --- a/pcs/Makefile.am +++ b/pcs/Makefile.am @@ -219,6 +219,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 handler’s 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 558315c2..cfe9999f 100644 --- a/pcs/daemon/run.py +++ b/pcs/daemon/run.py @@ -33,6 +33,7 @@ from pcs.daemon.app import ( auth, sinatra_remote, sinatra_ui, + webui_info_handler, ) from pcs.daemon.app import capabilities as capabilities_app @@ -168,7 +169,8 @@ def configure_app( # noqa: PLR0913 # 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..ac0117c8 100644 --- a/pcsd/public/ui_instructions.html +++ b/pcsd/public/ui_instructions.html @@ -1,27 +1,23 @@ - Pcs WebUI instructions + HA cluster management has been moved -

Pcs WebUI instructions

+

HA cluster management has been moved

- WebUI is not a part of pcs repository but it has its own - repository. + Since RHEL 10, 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 within + the RHEL web console or by installing the cockpit-ha-cluster + RPM package.

- You can clone WebUI repository - and build the web application into pcs by: -

-

-    $ npm install
-    $ npm run build
-    $ mv ./build [/path/to/]pcs/pcsd/public/ui
-  
-

- For more details, see instructions in - README.md. + To learn more, please visit: + + https://access.redhat.com/solutions/7099451 +

-- 2.50.0