Compare commits

..

1 commit

Author SHA1 Message Date
Ondrej Mular
07f9520591 Rebased to latest upstream sources 2018-10-01 02:48:18 -04:00
12 changed files with 617 additions and 1123 deletions

View file

@ -1 +0,0 @@
1

77
.gitignore vendored
View file

@ -49,79 +49,4 @@
/pyagentx-0.4.pcs.2.tar.gz
/sinatra-contrib-2.0.0.gem
/pcs-0.9.164.tar.gz
/pcs-0.10.0.1.tar.gz
/tornado-5.0.2.tar.gz
/pcs-0.10.0.alpha.1.tar.gz
/sinatra-contrib-2.0.3.gem
/pcs-0.10.0.alpha.2.tar.gz
/tilt-2.0.8.gem
/pcs-0.10.0.alpha.6.tar.gz
/pcs-0.10.1.tar.gz
/pcs-0.10.2.tar.gz
/pcs-web-ui-0.1.1.tar.gz
/pcs-web-ui-node-modules-0.1.1.tar.xz
/pcs-0.10.3.tar.gz
/tornado-6.0.3.tar.gz
/pcs-0.10.4.tar.gz
/pcs-0.10.5.tar.gz
/pcs-web-ui-0.1.2.tar.gz
/pcs-web-ui-node-modules-0.1.2.tar.xz
/tilt-2.0.9.gem
/dacite-1.1.0.tar.gz
/pcs-67591ed1487cb0aefa181fdfc166c8a66b55d25a.tar.gz
/dacite-1.5.0.python3.9.fix.tar.gz
/dacite-1.5.1.tar.gz
/pcs-0.10.6.tar.gz
/pcs-web-ui-0.1.3.tar.gz
/pcs-web-ui-node-modules-0.1.3.tar.xz
/pcs-0.10.7.tar.gz
/dacite-1.6.0.tar.gz
/pcs-0.10.8.tar.gz
/pcs-web-ui-0.1.5.tar.gz
/pcs-web-ui-node-modules-0.1.5.tar.xz
/daemons-1.4.0.gem
/eventmachine-1.2.7.gem
/mustermann-1.1.1.gem
/rack-2.2.3.gem
/rack-protection-2.0.8.1.gem
/ruby2_keywords-0.0.5.gem
/sinatra-2.0.8.1.gem
/thin-1.8.1.gem
/tilt-2.0.10.gem
/pcs-0.10.9.tar.gz
/pcs-web-ui-0.1.6.tar.gz
/pcs-web-ui-node-modules-0.1.6-fips-fix.tar.xz
/pcs-0.10.11.tar.gz
/pcs-web-ui-0.1.9.tar.gz
/pcs-web-ui-node-modules-0.1.9.tar.xz
/pcs-web-ui-0.1.12.tar.gz
/pcs-web-ui-node-modules-0.1.12.tar.xz
/pcs-0.11.2.tar.gz
/pcs-0.11.3.tar.gz
/pcs-web-ui-0.1.14.tar.gz
/pcs-web-ui-node-modules-0.1.14.tar.xz
/pcs-0.11.4.15-f7301.tar.gz
/pcs-web-ui-0.1.16.tar.gz
/pcs-web-ui-node-modules-0.1.16.tar.xz
/pcs-ee602830794f09a06880cd7e37a802b27113f185.tar.gz
/dacite-1.8.0.tar.gz
/pcs-0.11.5.tar.gz
/pcs-web-ui-0.1.16.1.tar.gz
/pcs-web-ui-node-modules-0.1.16.1.tar.xz
/pcs-0.11.6.tar.gz
/pcs-web-ui-node-modules-0.1.17.tar.xz
/pcs-web-ui-0.1.17.tar.gz
/dacite-1.8.1.tar.gz
/pcs-0.11.7.tar.gz
/pcs-web-ui-0.1.18.tar.gz
/pcs-web-ui-node-modules-0.1.18.tar.xz
/pcs-0.11.8.tar.gz
/pcs-web-ui-0.1.20.tar.gz
/pcs-web-ui-node-modules-0.1.20.tar.xz
/pcs-0.12.0.tar.gz
/pcs-web-ui-0.1.22.tar.gz
/pcs-web-ui-node-modules-0.1.22.tar.xz
/dacite-1.9.2.tar.gz
/pcs-0.12.1.tar.gz
/pcs-web-ui-0.1.23.tar.gz
/pcs-web-ui-node-modules-0.1.23.tar.xz
/pcs-0.9.166.tar.gz

View file

@ -1,63 +0,0 @@
From 72588f150e89b6f06810321245a13157b7e00b09 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
Date: Tue, 29 Jul 2025 23:42:00 +0200
Subject: [PATCH] Do not require wheel when setuptools is new enough
Current version of setuptools creates wheels on its own.
---
README.md | 2 +-
configure.ac | 7 +++++--
rpm/pcs.spec.in | 2 +-
3 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/README.md b/README.md
index a06143eba..636485be6 100644
--- a/README.md
+++ b/README.md
@@ -47,7 +47,7 @@ Apart from the dependencies listed above, these are also required for
installation:
* python development files (packages python3-devel, python3-setuptools 66.1+,
- python3-pip, python3-wheel)
+ python3-pip, python3-wheel if python3-setuptools < 71)
* ruby development files (package ruby-devel)
* rubygems
* rubygem bundler (package rubygem-bundler or ruby-bundler or bundler)
diff --git a/configure.ac b/configure.ac
index 4e7d36599..0a782bfa7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -347,12 +347,15 @@ AC_SUBST([PYAGENTX_VERSION])
# pip 19.0 required for PEP517 support
PCS_CHECK_PYMOD([pip], [>= 23.0])
-# pip builds a wheel first
-PCS_CHECK_PYMOD([wheel])
if test "x$tests_only" != "xyes"; then
# setuptools 61.0.0 required for PEP621 support
PCS_CHECK_PYMOD([setuptools], [>= 66.1])
+ # wheel is required if setuptools < 71
+ AC_PIP_MODULE([setuptools], [>= 71], [], [], [need_wheel=yes])
+ if test "x$need_wheel" = "xyes"; then
+ PCS_CHECK_PYMOD([wheel])
+ fi
PCS_CHECK_PYMOD([cryptography])
PCS_CHECK_PYMOD([lxml])
PCS_CHECK_PYMOD([pyparsing], [>= 3.0.0])
diff --git a/rpm/pcs.spec.in b/rpm/pcs.spec.in
index 55881a398..639a3e974 100644
--- a/rpm/pcs.spec.in
+++ b/rpm/pcs.spec.in
@@ -86,7 +86,7 @@ BuildRequires: python%{python3_version}-pip >= 23
BuildRequires: python%{python3_version}-setuptools >= 66.1
# for building wheel during make install
-BuildRequires: python%{python3_version}-wheel
+BuildRequires: (python%{python3_version}-wheel if python%{python3_version}-setuptools < 71)
# for bundling dateutil
%if "@cirpmworkarounds@" != "yes"
--
2.50.1

311
fedfix.patch Normal file
View file

@ -0,0 +1,311 @@
From ecdf30a8e657bd40ec901d6ab01d3b2a8d4cdbd4 Mon Sep 17 00:00:00 2001
From: Ivan Devat <idevat@redhat.com>
Date: Mon, 19 Feb 2018 17:54:35 +0100
Subject: [PATCH] fedfix
Gems for fedora was adapted.
Codebase was adapted for sinatra 2 and rack 2.
---
pcs/pcs | 2 +-
pcs/test/suite.py | 2 +-
pcsd/Makefile | 36 ++++++++----------------------------
pcsd/pcsd.rb | 18 +++++-------------
pcsd/pcsd.service-runner | 3 ++-
pcsd/session.rb | 25 ++++++++++++-------------
pcsd/ssl.rb | 1 -
pcsd/test/test_session.rb | 37 +++++++++++++++++++------------------
8 files changed, 48 insertions(+), 76 deletions(-)
diff --git a/pcs/pcs b/pcs/pcs
index 736f9cd2..3dff69a5 100755
--- a/pcs/pcs
+++ b/pcs/pcs
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
from __future__ import absolute_import
import os.path
diff --git a/pcs/test/suite.py b/pcs/test/suite.py
index 809596bc..98c5a268 100755
--- a/pcs/test/suite.py
+++ b/pcs/test/suite.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
from __future__ import (
absolute_import,
division,
diff --git a/pcsd/Makefile b/pcsd/Makefile
index 21550c5a..c83bd958 100644
--- a/pcsd/Makefile
+++ b/pcsd/Makefile
@@ -1,33 +1,13 @@
-FFI_VERSION="1.9.25"
-FFI_C_DIR=vendor/bundle/ruby/gems/ffi-${FFI_VERSION}/ext/ffi_c
-
-build_gems: get_gems
- bundle install --local --deployment
- #ffi makes symlink with absolute path. Let's change it to relative path.
- for fname in `ls ${FFI_C_DIR}/libffi-*/include/ffitarget.h`; do \
- if [[ -L "$$fname" ]]; then \
- target=$$(readlink $$fname | sed "s~.*/${FFI_C_DIR}\(/libffi/src/[^/]\+/ffitarget.h\)~../..\1~"); \
- rm $$fname; \
- ln -s $$target $$fname; \
- fi; \
- done;
-
-build_gems_without_bundler:
+# Comment from specfile from distgit 9b7a65231 Mamoru TASAKA:
+# So it seems that with rubygems 2.7.3 --install-dir option always
+# needs --no-user-install???
+# tld;dr; added flag --no-user-install, details in the commit
+build_gems:
mkdir -p vendor/bundle/ruby
- gem install --verbose --no-rdoc --no-ri -l --ignore-dependencies -i vendor/bundle/ruby \
- vendor/cache/backports-3.11.3.gem \
- vendor/cache/ethon-0.11.0.gem \
- vendor/cache/ffi-${FFI_VERSION}.gem \
- vendor/cache/json-2.1.0.gem \
- vendor/cache/multi_json-1.13.1.gem \
- vendor/cache/open4-1.3.4.gem \
- vendor/cache/rack-1.6.10.gem \
- vendor/cache/rack-protection-1.5.5.gem \
- vendor/cache/rack-test-0.7.0.gem \
+ gem install --force --verbose --no-rdoc --no-ri -l --no-user-install -i vendor/bundle/ruby \
+ vendor/cache/orderedhash-0.0.6.gem \
vendor/cache/rpam-ruby19-1.2.1.gem \
- vendor/cache/sinatra-1.4.8.gem \
- vendor/cache/sinatra-contrib-1.4.7.gem \
- vendor/cache/tilt-2.0.8.gem \
+ vendor/cache/sinatra-contrib-2.0.0.gem \
-- '--with-ldflags="-Wl,-z,now -Wl,-z,relro"'
get_gems:
diff --git a/pcsd/pcsd.rb b/pcsd/pcsd.rb
index 9f9bd091..712505a8 100644
--- a/pcsd/pcsd.rb
+++ b/pcsd/pcsd.rb
@@ -86,6 +86,11 @@ before do
$session_storage = env[:__session_storage]
$session_storage_env = env
end
+ begin
+ $session_storage.drop_expired(request)
+ rescue => e
+ $logger.warn("Exception while removing expired sessions: #{e}")
+ end
# urls which are accesible for everybody including not logged in users
always_accessible = [
@@ -162,19 +167,6 @@ $thread_cfgsync = Thread.new {
end
}
-$thread_session_expired = Thread.new {
- while true
- sleep(60 * 5)
- begin
- if $session_storage
- $session_storage.drop_expired($session_storage_env)
- end
- rescue => e
- $logger.warn("Exception while removing expired sessions: #{e}")
- end
- end
-}
-
helpers do
def is_ajax?
return request.env['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest'
diff --git a/pcsd/pcsd.service-runner b/pcsd/pcsd.service-runner
index 883d2908..712913ea 100644
--- a/pcsd/pcsd.service-runner
+++ b/pcsd/pcsd.service-runner
@@ -3,8 +3,9 @@
# it also serves as a holder of a selinux context
begin
- # add pcsd to the load path (ruby -I)
+ # add pcsd and bundled gems to the load path (ruby -I)
libdir = File.dirname(__FILE__)
+ $LOAD_PATH.unshift(*Dir[libdir + '/vendor/bundle/ruby/gems/*/lib'])
$LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir)
# change current directory (ruby -C)
diff --git a/pcsd/session.rb b/pcsd/session.rb
index 8b09ed82..f42bf73e 100644
--- a/pcsd/session.rb
+++ b/pcsd/session.rb
@@ -1,4 +1,3 @@
-gem 'rack', '< 2.0.0'
require 'rack/session/pool'
class SessionPoolLifetime < Rack::Session::Pool
@@ -14,14 +13,14 @@ class SessionPoolLifetime < Rack::Session::Pool
super
end
- def get_session(env, sid)
- with_lock(env) do
+ def find_session(req, sid)
+ with_lock(req) do
now = Time.now()
# delete the session if expired
if @default_options[:expire_after] and sid and @pool_timestamp[sid] and
@pool_timestamp[sid] < (now - @default_options[:expire_after])
then
- delete_session(sid)
+ remove_session(sid)
end
# create new session if nonexistent
unless sid and session = @pool[sid]
@@ -34,8 +33,8 @@ class SessionPoolLifetime < Rack::Session::Pool
end
end
- def set_session(env, session_id, new_session, options)
- with_lock(env) do
+ def write_session(req, session_id, new_session, options)
+ with_lock(req) do
@pool.store session_id, new_session
# bump session's access time
@pool_timestamp[session_id] = Time.now()
@@ -43,30 +42,30 @@ class SessionPoolLifetime < Rack::Session::Pool
end
end
- def destroy_session(env, session_id, options)
- with_lock(env) do
- delete_session(session_id)
+ def delete_session(req, session_id, options)
+ with_lock(req) do
+ remove_session(session_id)
generate_sid unless options[:drop]
end
end
- def drop_expired(env)
+ def drop_expired(req)
return unless lifetime = @default_options[:expire_after]
- with_lock(env) {
+ with_lock(req) {
threshold = Time.now() - lifetime
sid_to_delete = []
@pool_timestamp.each { |sid, timestamp|
sid_to_delete << sid if timestamp < threshold
}
sid_to_delete.each { |sid|
- delete_session(sid)
+ remove_session(sid)
}
}
end
private
- def delete_session(sid)
+ def remove_session(sid)
@pool.delete(sid)
@pool_timestamp.delete(sid)
end
diff --git a/pcsd/ssl.rb b/pcsd/ssl.rb
index b834228e..a7d5c0bf 100644
--- a/pcsd/ssl.rb
+++ b/pcsd/ssl.rb
@@ -2,7 +2,6 @@ require 'rubygems'
require 'webrick'
require 'webrick/https'
require 'openssl'
-gem 'rack', '< 2.0.0'
require 'rack'
require 'socket'
diff --git a/pcsd/test/test_session.rb b/pcsd/test/test_session.rb
index e72bf012..c212b1a0 100644
--- a/pcsd/test/test_session.rb
+++ b/pcsd/test/test_session.rb
@@ -2,18 +2,19 @@ require 'test/unit'
require 'pcsd_test_utils.rb'
require 'session.rb'
+require 'sinatra'
class TestSessionPool < Test::Unit::TestCase
def setup()
- @env = {
+ @request = Sinatra::Request.new({
'rack.multithread' => true,
- }
+ })
end
def fixture_get_pool(lifetime)
pool = SessionPoolLifetime.new(nil, {:expire_after => lifetime,})
- (1..3).each { |i| pool.set_session(@env, "sid#{i}", {'value' => i}, {}) }
+ (1..3).each { |i| pool.write_session(@request, "sid#{i}", {'value' => i}, {}) }
return pool
end
@@ -23,14 +24,14 @@ class TestSessionPool < Test::Unit::TestCase
# touch sessions each second
lifetime.times {
sleep(1)
- assert_equal({'value' => 1}, pool.get_session(@env, 'sid1')[1])
- assert_equal({'value' => 3}, pool.get_session(@env, 'sid3')[1])
+ assert_equal({'value' => 1}, pool.find_session(@request, 'sid1')[1])
+ assert_equal({'value' => 3}, pool.find_session(@request, 'sid3')[1])
}
# after @lifetime passes the unused session gets removed on access
sleep(1)
- assert_equal({'value' => 1}, pool.get_session(@env, 'sid1')[1])
- assert_equal({'value' => 3}, pool.get_session(@env, 'sid3')[1])
- assert_equal({}, pool.get_session(@env, 'sid2')[1])
+ assert_equal({'value' => 1}, pool.find_session(@request, 'sid1')[1])
+ assert_equal({'value' => 3}, pool.find_session(@request, 'sid3')[1])
+ assert_equal({}, pool.find_session(@request, 'sid2')[1])
end
def test_drop_expired_explicit()
@@ -39,12 +40,12 @@ class TestSessionPool < Test::Unit::TestCase
# touch sessions each second (otherwise they will be removed on access)
lifetime.times {
sleep(1)
- pool.get_session(@env, 'sid2')
- pool.set_session(@env, 'sid3', {'value' => 33}, {})
+ pool.find_session(@request, 'sid2')
+ pool.write_session(@request, 'sid3', {'value' => 33}, {})
}
sleep(1)
- pool.drop_expired(@env)
+ pool.drop_expired(@request)
assert_equal(
{
'sid2' => {'value' => 2,},
@@ -57,14 +58,14 @@ class TestSessionPool < Test::Unit::TestCase
def test_no_lifetime()
pool = fixture_get_pool(nil)
sleep(1)
- assert_equal({'value' => 1}, pool.get_session(@env, 'sid1')[1])
- assert_equal({'value' => 2}, pool.get_session(@env, 'sid2')[1])
- assert_equal({'value' => 3}, pool.get_session(@env, 'sid3')[1])
+ assert_equal({'value' => 1}, pool.find_session(@request, 'sid1')[1])
+ assert_equal({'value' => 2}, pool.find_session(@request, 'sid2')[1])
+ assert_equal({'value' => 3}, pool.find_session(@request, 'sid3')[1])
sleep(1)
- pool.drop_expired(@env)
- assert_equal({'value' => 1}, pool.get_session(@env, 'sid1')[1])
- assert_equal({'value' => 2}, pool.get_session(@env, 'sid2')[1])
- assert_equal({'value' => 3}, pool.get_session(@env, 'sid3')[1])
+ pool.drop_expired(@request)
+ assert_equal({'value' => 1}, pool.find_session(@request, 'sid1')[1])
+ assert_equal({'value' => 2}, pool.find_session(@request, 'sid2')[1])
+ assert_equal({'value' => 3}, pool.find_session(@request, 'sid3')[1])
end
end
--
2.18.0

View file

@ -1,32 +0,0 @@
From a2899ef0e20bb638f47e74077281e73f4f18faf3 Mon Sep 17 00:00:00 2001
From: Miroslav Lisik <mlisik@redhat.com>
Date: Thu, 10 Jul 2025 19:48:28 +0200
Subject: [PATCH 2/2] fix ruby NameError exception in pcsd/pcsd.rb occuring
with older rack
---
pcsd/pcsd.rb | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/pcsd/pcsd.rb b/pcsd/pcsd.rb
index e8ae9f106..c9f668851 100644
--- a/pcsd/pcsd.rb
+++ b/pcsd/pcsd.rb
@@ -74,9 +74,11 @@ configure do
CAPABILITIES_PCSD = capabilities_pcsd.freeze
end
-error Rack::QueryParser::QueryLimitError do
- $logger.warn(env['sinatra.error'].message)
- return 400, env['sinatra.error'].message
+if Rack.const_defined?(:QueryParser) and Rack::QueryParser.const_defined?(:QueryLimitError)
+ error Rack::QueryParser::QueryLimitError do
+ $logger.warn(env['sinatra.error'].message)
+ return 400, env['sinatra.error'].message
+ end
end
get '/remote/?:command?' do
--
2.50.1

View file

@ -1,14 +0,0 @@
--- !Policy
product_versions:
- fedora-*
decision_context: bodhi_update_push_testing
subject_type: koji_build
rules:
- !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.tier0.functional}
--- !Policy
product_versions:
- fedora-*
decision_context: bodhi_update_push_stable
subject_type: koji_build
rules:
- !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.tier0.functional}

1023
pcs.spec

File diff suppressed because it is too large Load diff

View file

@ -1,32 +0,0 @@
summary: PCS gating test plan
description: Runs upstream tier0, tier1 and smoke tests
discover:
dist-git-source: true
dist-git-install-builddeps: true
how: shell
tests:
- name: tier0
test: |
./prepare-tests.sh
$TMT_SOURCE_DIR/pcs-*/pcs_test/suite --tier0 -v --vanilla --installed
duration: 10m
tier: 0
tag: fast
- name: tier1
test: |
./prepare-tests.sh
$TMT_SOURCE_DIR/pcs-*/pcs_test/suite --tier1 -v --vanilla --installed
duration: 2h
tier: 1
- name: smoke
test: |
systemctl start pcsd
./prepare-tests.sh
$TMT_SOURCE_DIR/pcs-*/pcs_test/smoke.sh
duration: 10m
tier: smoke
tag: fast
execute:
how: tmt

View file

@ -1,22 +0,0 @@
#!/bin/sh
set -eo xtrace
cd $TMT_SOURCE_DIR
# Use stamp file to abort if this script already ran
if [ -e tests-prepared-stamp ]; then exit 0; fi
# RPM 4.20 changed the builddir structure - unpacked sources go to *-build but
# tmt copies them back to pcs-*, so the pcs-*-build folder is empty
# Remove pcs-web-ui, pcs-*-build for "cd pcs-*" to have exactly one match
rm -rf pcs-web-ui-* pcs-*-build
cd pcs-*/
# Run autotools, use bundled dependencies from the system
export PYTHONPATH=/usr/lib/pcs/pcs_bundled/packages/
export GEM_HOME=/usr/lib/pcsd/vendor/bundle/
# We need to use cd pcs-* because when pcs-web-ui starts using autotools, running
# autogen and configure with expanded TMT_SOURCE_DIR will match that too
./autogen.sh
./configure --enable-webui --enable-local-build --enable-use-local-cache-only \
--enable-individual-bundling --with-pcs-lib-dir=/usr/lib
# Remove pcs sources to make sure tests are not using any of those files
rm -rf pcs
touch ../tests-prepared-stamp

View file

@ -1,8 +0,0 @@
xml:
# exclude ruby templates from checks
exclude_path: .*\.erb$
shellsyntax:
# exclude ruby templates from checks
ignore:
- /usr/lib*/pcsd/vendor/bundle/gems/thin*/lib/thin/controllers/*.erb

View file

@ -1,148 +0,0 @@
From e7fa056f582c992d3d2b289911be20440fb839ac Mon Sep 17 00:00:00 2001
From: Ivan Devat <idevat@redhat.com>
Date: Tue, 5 Nov 2024 16:35:02 +0100
Subject: [PATCH 1/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 | 24 ++++++++++-----------
5 files changed, 48 insertions(+), 16 deletions(-)
create mode 100644 pcs/daemon/app/webui_info_handler.py
diff --git a/pcs/Makefile.am b/pcs/Makefile.am
index 1297473ff..8d4b93073 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 000000000..3ab8275bf
--- /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 558315c23..cfe9999fc 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 fdfe8be2c..a9bb83447 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 a120ed3d4..b9c1c3152 100644
--- a/pcsd/public/ui_instructions.html
+++ b/pcsd/public/ui_instructions.html
@@ -1,27 +1,25 @@
<!DOCTYPE html>
<html>
<head>
- <title>Pcs WebUI instructions</title>
+ <title>Web UI is disabled</title>
<meta charset="utf-8" />
</head>
<body>
- <h1>Pcs WebUI instructions</h1>
+ <h1>Package <code>pcs-web-ui</code> is not installed</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>.
+ Since Fedora 42, pcsd web UI is distributed with pcs as <code>pcs-web-ui
+ </code> package. This<br>package can be uninstalled to disable the web UI.
</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:
+ To re-enable pcsd web UI, install the <code>pcs-web-ui</code> RPM package.
</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>.
+ Another option is to try pcsd web UI as an application for
+ <a href="https://cockpit-project.org/">Cockpit</a>
+ - a web-based<br>graphical interface for servers. The HA Cluster Management
+ application can be<br>installed from within the Applications pane in
+ Cockpit or by installing the<br><code>cockpit-ha-cluster</code> RPM
+ package.
</p>
</body>
</html>
--
2.50.1

View file

@ -1,5 +1,6 @@
SHA512 (pcsd-bundle-config-1) = f2a2df2dab39c2012cc6a91517716dde8f5a48788d1069c4addf619bc4dc45a98fd48f0f7964b5400e43e84fe96f942a550d2762553fea97e63dc7ad9b8be823
SHA512 (orderedhash-0.0.6.gem) = b2dae648187437ea7d9d9be47b9ff8d0e1a96bc2ff9e50117033d5bd4cf09cfff3c0740c99c322910138cac90f33b425705ee7a30be84aa193e6afd9f576f64a
SHA512 (rpam-ruby19-1.2.1.gem) = b403964295e96a6247289518ff46e59bbae6c78bcfb647e12b7dbb247698642b4a1ee04492521b782fb3c594c2ede8143c765819fecde087e2ec850e3aea3503
SHA512 (sinatra-contrib-2.0.0.gem) = 2e9c1fccfee050af8ef93ce0fe92504930ee41db3ff5aec3c2260ab49f334474386787057011adcb6cfa7de62f9e24ea228944d25bdf8af316b0b7614008ce03
SHA512 (pyagentx-0.4.pcs.2.tar.gz) = d4194fec9a3e5fefe3793d49b7fec1feafef294c7e613a06046c2993daeefc5cb39d7c5b2b402ff83e49b2d976953f862264288c758c0be09d997b5323cc558a
SHA512 (dacite-1.9.2.tar.gz) = 69513bc1acd43e45a208ce4b4186072f92d9057a6a88c77d56f21405fbed7964d94fe4f6a37c99754a793caa2bd0584664dfab69169ef0d3564bb09d37769e59
SHA512 (pcs-0.12.1.tar.gz) = 4f17a8d9c15b8c9208c94a264f5f79f03abc451e3f4ae4ba0fb338055a26407d4961466dd8f3565f6882c2c00f1d6a1ec8fd15dadcb0cf1a5586d37c56c77238
SHA512 (pcs-web-ui-0.1.23.tar.gz) = 6bc709926f26a02d33fb3865d15a1cf15db51a07dd9b25c63f33277c427c3403c189e2ac5e7adc795b254ad0bdb50f1bc4be70f1385bc8522ca502142d41fc26
SHA512 (pcs-web-ui-node-modules-0.1.23.tar.xz) = f39dd1fd391f10b874b5fec34da1a2f2496d66b31af736ee1dfc2ef6e0b518efd03053fd00312c84e10a33ffda492e12d48a898a21efb6241e5459828e500e80
SHA512 (pcs-0.9.166.tar.gz) = afb1f6e95154fc0b20515d1317d07738c1fff4c90e32c3baa2b710ee0ba6aa1d01be477eb631bfbc740e2bdfff1535e6048c022ba3333395bc0f23d7d818334b