Rebased to latest upstream sources

This commit is contained in:
Ivan Devat 2018-07-26 10:22:42 +02:00
parent c9ec744a14
commit 6341d90428
6 changed files with 299 additions and 404 deletions

5
.gitignore vendored
View File

@ -49,3 +49,8 @@
/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

View File

@ -0,0 +1,59 @@
From 911d2d37e44842d2341f052df1ff0546278c04e0 Mon Sep 17 00:00:00 2001
From: Ivan Devat <idevat@redhat.com>
Date: Mon, 19 Feb 2018 17:54:35 +0100
Subject: [PATCH 1/2] adapt working with ruby gems to fedora
---
pcsd/Makefile | 36 ++----------------------------------
1 file changed, 2 insertions(+), 34 deletions(-)
diff --git a/pcsd/Makefile b/pcsd/Makefile
index 2067560..604f74d 100644
--- a/pcsd/Makefile
+++ b/pcsd/Makefile
@@ -1,40 +1,8 @@
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:
- mkdir -p vendor/bundle/ruby
- gem install --verbose --no-rdoc --no-ri -l --ignore-dependencies -i vendor/bundle/ruby \
- vendor/cache/activesupport-5.2.0.gem \
- vendor/cache/backports-3.11.3.gem \
- vendor/cache/concurrent-ruby-1.0.5.gem \
- vendor/cache/ethon-0.11.0.gem \
- vendor/cache/ffi-${FFI_VERSION}.gem \
- vendor/cache/i18n-1.0.1.gem \
- vendor/cache/json-2.1.0.gem \
- vendor/cache/minitest-5.11.3.gem \
- vendor/cache/multi_json-1.13.1.gem \
- vendor/cache/musterman-1.0.2.gem \
- vendor/cache/open4-1.3.4.gem \
- vendor/cache/rack-2.0.5.gem \
- vendor/cache/rack-protection-2.0.3.gem \
- vendor/cache/rack-test-1.0.0.gem \
- vendor/cache/sinatra-2.0.3.gem \
- vendor/cache/sinatra-contrib-2.0.3.gem \
- vendor/cache/thread_safe-0.3.6.gem \
- vendor/cache/tilt-2.0.8.gem \
- vendor/cache/tzinfo-1.2.5.gem \
- -- '--with-ldflags="-Wl,-z,now -Wl,-z,relro"'
+build_gems:
+ echo "no gems"
get_gems:
bundle package
--
1.8.3.1

40
disable-gui.patch Normal file
View File

@ -0,0 +1,40 @@
From 259942f3d5cc6d908422ef793213dd9f310a9fbc Mon Sep 17 00:00:00 2001
From: Ivan Devat <idevat@redhat.com>
Date: Tue, 17 Jul 2018 12:59:17 +0200
Subject: [PATCH 2/2] disable gui
---
pcs/daemon/run.py | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/pcs/daemon/run.py b/pcs/daemon/run.py
index e5e9478..d1c91c7 100644
--- a/pcs/daemon/run.py
+++ b/pcs/daemon/run.py
@@ -58,14 +58,15 @@ def configure_app(
https_server_manage,
)
- if not disable_gui:
- routes.extend(
- app_gui.get_routes(
- session_storage,
- ruby_pcsd_wrapper,
- public_dir
- )
- )
+ # gui is not prepared yet
+ # if not disable_gui:
+ # routes.extend(
+ # app_gui.get_routes(
+ # session_storage,
+ # ruby_pcsd_wrapper,
+ # public_dir
+ # )
+ # )
return Application(routes, debug=debug)
return make_app
--
1.8.3.1

View File

@ -1,311 +0,0 @@
From f7b706961ce0f51beebe24bdce1d56eb38ec8fca 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 d7d98f60..c83bd958 100644
--- a/pcsd/Makefile
+++ b/pcsd/Makefile
@@ -1,33 +1,13 @@
-FFI_VERSION="1.9.18"
-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.9.1.gem \
- vendor/cache/ethon-0.10.1.gem \
- vendor/cache/ffi-${FFI_VERSION}.gem \
- vendor/cache/json-2.1.0.gem \
- vendor/cache/multi_json-1.12.2.gem \
- vendor/cache/open4-1.3.4.gem \
- vendor/cache/rack-1.6.4.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 61b28044..39c69608 100644
--- a/pcsd/pcsd.rb
+++ b/pcsd/pcsd.rb
@@ -83,6 +83,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 = [
@@ -156,19 +161,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 eaf2cbf1..2668c958 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.13.6

282
pcs.spec
View File

@ -1,7 +1,10 @@
Name: pcs
Version: 0.9.164
Release: 4%{?dist}
License: GPLv2
Version: 0.10.0.alpha.2
Release: 1%{?dist}
# https://fedoraproject.org/wiki/Licensing:Main?rd=Licensing#Good_Licenses
# GPLv2: pcs
# ASL 2.0: tornado
License: GPLv2 and ASL 2.0
URL: https://github.com/ClusterLabs/pcs
Group: System Environment/Base
Summary: Pacemaker Configuration System
@ -9,37 +12,40 @@ Summary: Pacemaker Configuration System
%global pcs_snmp_pkg_name pcs-snmp
%global pyagentx_version 0.4.pcs.2
%global bundled_lib_dir pcs/bundled
%global pyagentx_dir %{bundled_lib_dir}/pyagentx
%global tornado_version 5.0.2
%global bundled_src_dir pcs/bundled
# https://fedoraproject.org/wiki/Changes/Avoid_usr_bin_python_in_RPM_Build#Python_bytecompilation
# Enforce python3 because bytecompilation of tornado produced warnings:
# DEPRECATION WARNING: python2 invoked with /usr/bin/python.
# Use /usr/bin/python3 or /usr/bin/python2
# /usr/bin/python will be removed or switched to Python 3 in the future.
%global __python %{__python3}
#part after last slash is recognized as filename in look-aside repository
#desired name is achived by trick with hash anchor
Source0: %{url}/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source1: pcsd-bundle-config-1
Source11: https://rubygems.org/downloads/orderedhash-0.0.6.gem
Source12: https://rubygems.org/downloads/rpam-ruby19-1.2.1.gem
Source13: https://rubygems.org/downloads/sinatra-contrib-2.0.0.gem
Source41: https://github.com/ondrejmular/pyagentx/archive/v%{pyagentx_version}.tar.gz#/pyagentx-%{pyagentx_version}.tar.gz
Source42: https://github.com/tornadoweb/tornado/archive/v%{tornado_version}.tar.gz#/tornado-%{tornado_version}.tar.gz
Patch0: fedfix.patch
Patch0: adapt-working-with-ruby-gems-to-fedora.patch
Patch1: disable-gui.patch
# git for patches
BuildRequires: git
#printf from coreutils is used in makefile
BuildRequires: coreutils
# python for pcs
BuildRequires: python3
BuildRequires: python3 >= 3.6
BuildRequires: python3-devel
BuildRequires: python3-setuptools
# python libraries for tests
BuildRequires: python3-lxml
BuildRequires: python3-mock
BuildRequires: python3-pycurl
# gcc for compiling custom rubygems
BuildRequires: gcc
BuildRequires: gcc-c++
# ruby and gems for pcsd
BuildRequires: ruby
BuildRequires: ruby >= 2.2.0
BuildRequires: ruby-devel
BuildRequires: rubygem-bundler
BuildRequires: rubygem-backports
@ -56,19 +62,15 @@ BuildRequires: rubygem-sinatra
BuildRequires: rubygem-tilt
# ruby libraries for tests
BuildRequires: rubygem-test-unit
# pam devel for compiling rubygem-rpam-ruby19
BuildRequires: pam-devel
# pcsd fonts and font management tools for creating symlinks to fonts
BuildRequires: fontconfig
BuildRequires: liberation-sans-fonts
BuildRequires: overpass-fonts
# for post, preun and postun macros
BuildRequires: systemd
# for UpdateTimestamps sanitization function
BuildRequires: diffstat
# for post, preun and postun macros
BuildRequires: systemd
# for tests
BuildRequires: corosync
BuildRequires: pacemaker
BuildRequires: python3-lxml
BuildRequires: python3-pyOpenSSL
BuildRequires: corosync >= 2.99
BuildRequires: pacemaker >= 2.0.0
BuildRequires: pacemaker-cli
# fence-agents-all disabled because of problems:
@ -82,16 +84,19 @@ BuildRequires: pacemaker-cli
# BuildRequires: fence-agents-all
# BuildRequires: fence-virt
BuildRequires: booth-site
# printf (from package coreutils) is used in make
BuildRequires: coreutils
# pcsd fonts and font management tools for creating symlinks to fonts
BuildRequires: fontconfig
BuildRequires: liberation-sans-fonts
BuildRequires: overpass-fonts
# python and libraries for pcs, setuptools for pcs entrypoint
Requires: python3
Requires: python3 >= 3.6
Requires: python3-lxml
Requires: python3-pycurl
Requires: python3-setuptools
Requires: python3-clufter => 0.70.0
Requires: python3-pycurl
# ruby and gems for pcsd
Requires: ruby
Requires: ruby >= 2.2.0
Requires: rubygem-backports
Requires: rubygem-ethon
Requires: rubygem-ffi
@ -103,26 +108,24 @@ Requires: rubygem-rack-protection
Requires: rubygem-rack-test
Requires: rubygem-sinatra
Requires: rubygem-tilt
# pcsd fonts
Requires: liberation-sans-fonts
Requires: overpass-fonts
# for killall
Requires: psmisc
# for working with certificates (validation etc.)
Requires: openssl
Requires: python3-pyOpenSSL
# cluster stack and related packages
Requires: corosync
Requires: pacemaker
Requires: corosync >= 2.99
Requires: pacemaker >= 2.0.0
Requires: pacemaker-cli
Requires: python3-clufter => 0.70.0
# for post, preun and postun macros
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd
# pcsd fonts
Requires: liberation-sans-fonts
Requires: overpass-fonts
Provides: bundled(rubygem-orderedhash) = 0.0.6
Provides: bundled(rubygem-rpam-ruby19) = 1.2.1
Provides: bundled(rubygem-sinatra-contrib) = 2.0.0
Provides: bundled(tornado) = %{tornado_version}
%description
pcs is a corosync and pacemaker configuration tool. It permits users to
@ -132,7 +135,10 @@ easily view, modify and create pacemaker based clusters.
%package -n %{pcs_snmp_pkg_name}
Group: System Environment/Base
Summary: Pacemaker cluster SNMP agent
License: GPLv2, BSD 2-clause
# https://fedoraproject.org/wiki/Licensing:Main?rd=Licensing#Good_Licenses
# GPLv2: pcs
# BSD-2-Clause: pyagentx
License: GPLv2 and BSD-2-Clause
URL: https://github.com/ClusterLabs/pcs
# tar for unpacking pyagetx source tar ball
@ -167,23 +173,24 @@ UpdateTimestamps() {
%patch0 -p1
UpdateTimestamps -p1 %{PATCH0}
UpdateTimestamps -p1 %{PATCH1}
mkdir -p pcsd/.bundle
cp -f %SOURCE1 pcsd/.bundle/config
mkdir -p pcsd/vendor/cache
#copy ruby gems
cp -f %SOURCE11 pcsd/vendor/cache
cp -f %SOURCE12 pcsd/vendor/cache
cp -f %SOURCE13 pcsd/vendor/cache
#ruby gems copied
mkdir -p %{bundled_lib_dir}
tar -xzf %SOURCE41 -C %{bundled_lib_dir}
mv %{bundled_lib_dir}/pyagentx-%{pyagentx_version} %{pyagentx_dir}
cp %{pyagentx_dir}/LICENSE.txt pyagentx_LICENSE.txt
cp %{pyagentx_dir}/CONTRIBUTORS.txt pyagentx_CONTRIBUTORS.txt
cp %{pyagentx_dir}/README.md pyagentx_README.md
mkdir -p %{bundled_src_dir}
tar -xzf %SOURCE41 -C %{bundled_src_dir}
mv %{bundled_src_dir}/pyagentx-%{pyagentx_version} %{bundled_src_dir}/pyagentx
cp %{bundled_src_dir}/pyagentx/LICENSE.txt pyagentx_LICENSE.txt
cp %{bundled_src_dir}/pyagentx/CONTRIBUTORS.txt pyagentx_CONTRIBUTORS.txt
cp %{bundled_src_dir}/pyagentx/README.md pyagentx_README.md
tar -xzf %SOURCE42 -C %{bundled_src_dir}
mv %{bundled_src_dir}/tornado-%{tornado_version} %{bundled_src_dir}/tornado
cp %{bundled_src_dir}/tornado/LICENSE tornado_LICENSE
cp %{bundled_src_dir}/tornado/README.rst tornado_README.rst
%build
%define debug_package %{nil}
@ -196,21 +203,13 @@ make install \
PREFIX=%{PCS_PREFIX} \
PYTHON=%{__python3} \
PYTHON_SITELIB=%{python3_sitelib} \
SYSTEMCTL_OVERRIDE=true \
BASH_COMPLETION_DIR=$RPM_BUILD_ROOT/usr/share/bash-completion/completions \
PYAGENTX_DIR=`readlink -f %{pyagentx_dir}` \
SYSTEMCTL_OVERRIDE=true
make install_pcsd \
DESTDIR=$RPM_BUILD_ROOT \
PREFIX=%{PCS_PREFIX} \
PYTHON=%{__python3} \
PYTHON_SITELIB=%{python3_sitelib} \
BASH_COMPLETION_DIR=/usr/share/bash-completion/completions \
BUNDLE_PYAGENTX_SRC_DIR=`readlink -f %{bundled_src_dir}/pyagentx` \
BUNDLE_TORNADO_SRC_DIR=`readlink -f %{bundled_src_dir}/tornado` \
SYSTEMCTL_OVERRIDE=true \
hdrdir="%{_includedir}" \
rubyhdrdir="%{_includedir}" \
includedir="%{_includedir}"
#after the ruby gem compilation we do not need ruby gems in the cache
rm -r -v $RPM_BUILD_ROOT%{PCS_PREFIX}/lib/pcsd/vendor/cache
%check
# In the building environment LC_CTYPE is set to C which causes tests to fail
@ -256,9 +255,113 @@ run_all_tests(){
#
# Tests after pcs.common.test.test_node_communicator.RequestDataUrlEncodeTest.test_with_data
# contains some issues with current pacemaker version
# ======================================================================
# FAIL: test_with_data (pcs.common.test.test_node_communicator.RequestDataUrlEncodeTest)
# ----------------------------------------------------------------------
# Traceback (most recent call last):
# File "/builddir/build/BUILDROOT/pcs-0.10.0.alpha.1-1.fc29.x86_64/usr/lib/python3.7/site-packages/pcs/common/test/test_node_communicator.py", line 80, in test_with_data
# self.assertEqual(expected_raw_data, data.data)
# AssertionError: 'key1[44 chars]3F%27%22%3B%5B%5D%28%29%2A%5E%24%23%40%21%7E%60%7B%3A%7D%3C%3E' != 'key1[44 chars]3F%27%22%3B%5B%5D%28%29%2A%5E%24%23%40%21~%60%7B%3A%7D%3C%3E'
# - key1=value1&spacial+characters=%2B-%2B%2F%25%26%3F%27%22%3B%5B%5D%28%29%2A%5E%24%23%40%21%7E%60%7B%3A%7D%3C%3E
# ? ^^^
# + key1=value1&spacial+characters=%2B-%2B%2F%25%26%3F%27%22%3B%5B%5D%28%29%2A%5E%24%23%40%21~%60%7B%3A%7D%3C%3E
# ? ^
# ======================================================================
# FAIL: test_report_invalid_ssl_ciphers (pcs.daemon.test.test_env.Prepare)
# ----------------------------------------------------------------------
# Traceback (most recent call last):
# File "/builddir/build/BUILDROOT/pcs-0.10.0.alpha.1-1.fc29.x86_64/usr/lib/python3.7/site-packages/pcs/daemon/test/test_env.py", line 124, in test_report_invalid_ssl_ciphers
# errors=["Invalid ciphers: '('No cipher can be selected.',)'"]
# File "/builddir/build/BUILDROOT/pcs-0.10.0.alpha.1-1.fc29.x86_64/usr/lib/python3.7/site-packages/pcs/daemon/test/test_env.py", line 57, in assert_environ_produces_modified_pcsd_env
# {**default_env_values, **specific_env_values}
# AssertionError: {'PCS[478 chars]None, 'NO_PROXY': None, 'PCSD_DEV': False, 'has_errors': False} != {'PCS[478 chars]None, 'NO_PROXY': None, 'PCSD_DEV': False, 'has_errors': True}
# {'GEM_HOME': '/usr/lib/pcsd/vendor/bundle/ruby',
# 'HTTPS_PROXY': None,
# 'NOTIFY_SOCKET': None,
# 'NO_PROXY': None,
# 'PCSD_BIND_ADDR': {None},
# 'PCSD_CMDLINE_ENTRY': '/usr/lib/pcsd/sinatra_cmdline_wrapper.rb',
# 'PCSD_DEBUG': False,
# 'PCSD_DEV': False,
# 'PCSD_DISABLE_GUI': False,
# 'PCSD_PORT': 2224,
# 'PCSD_SESSION_LIFETIME': 3600,
# 'PCSD_SSL_CIPHERS': 'invalid',
# 'PCSD_SSL_OPTIONS': <Options.OP_NO_TLSv1_1|OP_NO_TLSv1|OP_NO_SSLv3|OP_CIPHER_SERVER_PREFERENCE|OP_NO_COMPRESSION: 373424128>,
# 'PCSD_STATIC_FILES_DIR': '/usr/lib/pcsd/public',
# - 'has_errors': False}
# ? ^^^^
# + 'has_errors': True}
# ? ^^^
# ======================================================================
# FAIL: test_error_if_files_with_bad_content (pcs.daemon.test.test_ssl.Pair)
# ----------------------------------------------------------------------
# Traceback (most recent call last):
# File "/builddir/build/BUILDROOT/pcs-0.10.0.alpha.1-1.fc29.x86_64/usr/lib/python3.7/site-packages/pcs/daemon/test/test_ssl.py", line 46, in test_error_if_files_with_bad_content
# self.assertEqual(self.pair.check(), list(DAMAGED_SSL_FILES_ERRORS))
# AssertionError: Lists differ: ["Inv[155 chars]ines:get_name:no start line'", "Invalid SSL ke[160 chars]ne'"] != ["Inv[155 chars]ines:PEM_read_bio:no start line'", "Invalid SS[168 chars]ne'"]
# First differing element 0:
# "Inva[124 chars]ources/daemon.cert': 'PEM routines:get_name:no start line'"
# "Inva[124 chars]ources/daemon.cert': 'PEM routines:PEM_read_bio:no start line'"
# ['Invalid SSL certificate '
# "'/builddir/build/BUILDROOT/pcs-0.10.0.alpha.1-1.fc29.x86_64/usr/lib/python3.7/site-packages/pcs/test/resources/daemon.cert': "
# - "'PEM routines:get_name:no start line'",
# ? ^ ^ ^^^^
# + "'PEM routines:PEM_read_bio:no start line'",
# ? ^^^^^ ^^ ^^^
# 'Invalid SSL key '
# "'/builddir/build/BUILDROOT/pcs-0.10.0.alpha.1-1.fc29.x86_64/usr/lib/python3.7/site-packages/pcs/test/resources/daemon.key': "
# - "'PEM routines:get_name:no start line'"]
# ? ^ ^ ^^^^
# + "'PEM routines:PEM_read_bio:no start line'"]
# ? ^^^^^ ^^ ^^^
# ======================================================================
# FAIL: test_raises_when_ssl_files_are_damaged (pcs.daemon.test.test_ssl.PcsdSSLTest)
# ----------------------------------------------------------------------
# Traceback (most recent call last):
# File "/builddir/build/BUILDROOT/pcs-0.10.0.alpha.1-1.fc29.x86_64/usr/lib/python3.7/site-packages/pcs/daemon/test/test_ssl.py", line 81, in test_raises_when_ssl_files_are_damaged
# self.assertEqual(ctx_manager.exception.args, DAMAGED_SSL_FILES_ERRORS)
# AssertionError: Tuples differ: ("Inv[155 chars]ines:get_name:no start line'", "Invalid SSL ke[160 chars]ne'") != ("Inv[155 chars]ines:PEM_read_bio:no start line'", "Invalid SS[168 chars]ne'")
# First differing element 0:
# "Inva[124 chars]ources/daemon.cert': 'PEM routines:get_name:no start line'"
# "Inva[124 chars]ources/daemon.cert': 'PEM routines:PEM_read_bio:no start line'"
# ('Invalid SSL certificate '
# "'/builddir/build/BUILDROOT/pcs-0.10.0.alpha.1-1.fc29.x86_64/usr/lib/python3.7/site-packages/pcs/test/resources/daemon.cert': "
# - "'PEM routines:get_name:no start line'",
# ? ^ ^ ^^^^
# + "'PEM routines:PEM_read_bio:no start line'",
# ? ^^^^^ ^^ ^^^
# 'Invalid SSL key '
# "'/builddir/build/BUILDROOT/pcs-0.10.0.alpha.1-1.fc29.x86_64/usr/lib/python3.7/site-packages/pcs/test/resources/daemon.key': "
# - "'PEM routines:get_name:no start line'")
# ? ^ ^ ^^^^
# + "'PEM routines:PEM_read_bio:no start line'")
# ? ^^^^^ ^^ ^^^
# ======================================================================
# FAIL: testLSBResource (pcs.test.test_resource.ResourceTest)
# ----------------------------------------------------------------------
# Traceback (most recent call last):
# File "/builddir/build/BUILDROOT/pcs-0.10.0.alpha.1-1.fc29.x86_64/usr/lib/python3.7/site-packages/pcs/test/test_resource.py", line 2543, in testLSBResource
# "Error: invalid resource option 'foo', there are no options"
# File "/builddir/build/BUILDROOT/pcs-0.10.0.alpha.1-1.fc29.x86_64/usr/lib/python3.7/site-packages/pcs/test/tools/assertions.py", line 87, in assert_pcs_fail
# returncode=1
# File "/builddir/build/BUILDROOT/pcs-0.10.0.alpha.1-1.fc29.x86_64/usr/lib/python3.7/site-packages/pcs/test/tools/assertions.py", line 171, in assert_pcs_result
# stdout=stdout
# AssertionError: "Error: Agent 'lsb:network' is not installed or d[112 chars]de\n" != "Error: invalid resource option 'foo', there are [41 chars]de\n"
# - Error: Agent 'lsb:network' is not installed or does not provide valid metadata: Metadata query for lsb:network failed: Input/output error, use --force to override
# + Error: invalid resource option 'foo', there are no options allowed, use --force to override
# : Stdout is not as expected
# command: resource create --no-default-ops D2 lsb:network foo=bar
# diff is (expected is 2nd):
# - Error: Agent 'lsb:network' is not installed or does not provide valid metadata: Metadata query for lsb:network failed: Input/output error, use --force to override
# + Error: invalid resource option 'foo', there are no options allowed, use --force to override
# Full stdout:
# Error: Agent 'lsb:network' is not installed or does not provide valid metadata: Metadata query for lsb:network failed: Input/output error, use --force to override
# ----------------------------------------------------------------------
%{__python3} ${sitelib}/pcs/test/suite.py -v --vanilla --all-but \
BUNDLED_LIB_LOCATION=$RPM_BUILD_ROOT%{PCS_PREFIX}/lib/pcs/bundled/packages \
%{__python3} ${sitelib}/pcs/test/suite.py -v --vanilla --all-but \
pcs.test.test_cluster.ClusterTest.testUIDGID \
pcs.test.cib_resource.test_create.Success.test_base_create_with_agent_name_including_systemd_instance \
pcs.lib.commands.test.test_resource_agent.DescribeAgentUtf8.test_describe \
@ -408,11 +511,10 @@ run_all_tests(){
pcs.daemon.test.test_app_gui.SinatraGuiProtected.test_take_result_from_ruby \
pcs.daemon.test.test_app_gui.Static.test_css \
pcs.common.test.test_node_communicator.RequestDataUrlEncodeTest.test_with_data \
pcs.test.test_acl.ACLTest.testAutoUpgradeofCIB \
pcs.test.test_cluster.ClusterUpgradeTest.testClusterUpgrade \
pcs.test.test_properties.PropertyTest.test_set_property_validation_integer \
pcs.test.test_resource.ResourceTest.testLSBResource \
pcs.test.test_resource.ResourceTest.testResourceEnableUnmanaged \
pcs.daemon.test.test_env.Prepare.test_report_invalid_ssl_ciphers \
pcs.daemon.test.test_ssl.Pair.test_error_if_files_with_bad_content \
pcs.daemon.test.test_ssl.PcsdSSLTest.test_raises_when_ssl_files_are_damaged \
pcs.test.test_resource.ResourceTest.testLSBResource \
test_result_python=$?
@ -420,7 +522,8 @@ run_all_tests(){
find ${sitelib}/pcs -name test -type d -print0|xargs -0 rm -r -v --
#run pcsd tests and remove them
GEM_HOME=${pcsd_dir}/vendor/bundle/ruby ruby \
#GEM_HOME is not needed anymore since all required gems are in fedora
ruby \
-I${pcsd_dir} \
-I${pcsd_dir}/test \
${pcsd_dir}/test/test_all_suite.rb
@ -436,21 +539,6 @@ run_all_tests(){
run_all_tests
%pretrans -p <lua>
-- workaround for upgrading from a broken package pcs-0.9.150-1.fc24
-- taken from https://fedoraproject.org/wiki/Packaging:Directory_Replacement
-- see https://bugzilla.redhat.com/show_bug.cgi?id=1370095 for details
for i, path in pairs({
"/usr/lib/pcsd/vendor/bundle/ruby/extensions",
"/usr/lib/pcsd/vendor/bundle/ruby/gems",
"/usr/lib/pcsd/vendor/bundle/ruby/specifications"
}) do
st = posix.stat(path)
if st and st.type == "link" then
os.remove(path)
end
end
%post
%systemd_post pcsd.service
@ -460,18 +548,31 @@ end
%preun
%systemd_preun pcsd.service
%preun -n %{pcs_snmp_pkg_name}
%systemd_preun pcs_snmp_agent.service
%postun
%systemd_postun_with_restart pcsd.service
%postun -n %{pcs_snmp_pkg_name}
%systemd_postun_with_restart pcs_snmp_agent.service
%files
%doc CHANGELOG.md
%doc README.md
%doc tornado_README.rst
%license tornado_LICENSE
%license COPYING
%{python3_sitelib}/pcs
%{python3_sitelib}/pcs-%{version}-py3.*.egg-info
# version temporary hardcoded because setup.py:
# UserWarning: Normalizing '0.10.0.alpha.1' to '0.10.0a1'
# so we keep veriosn 0.10.0 in sources
%{python3_sitelib}/pcs-0.10.0-py3.*.egg-info
/usr/sbin/pcs
/usr/sbin/pcsd
/usr/lib/pcsd/*
/usr/lib/pcsd/.bundle/config
/usr/lib/pcs/bundled/packages/tornado*
/usr/lib/systemd/system/pcsd.service
/usr/share/bash-completion/completions/pcs
/var/lib/pcsd
@ -480,12 +581,12 @@ end
%config(noreplace) /etc/logrotate.d/pcsd
%config(noreplace) /etc/sysconfig/pcsd
%ghost %config(noreplace) /var/lib/pcsd/cfgsync_ctl
%ghost %config(noreplace) /var/lib/pcsd/known-hosts
%ghost %config(noreplace) /var/lib/pcsd/pcsd.cookiesecret
%ghost %config(noreplace) /var/lib/pcsd/pcsd.crt
%ghost %config(noreplace) /var/lib/pcsd/pcsd.key
%ghost %config(noreplace) /var/lib/pcsd/pcs_settings.conf
%ghost %config(noreplace) /var/lib/pcsd/pcs_users.conf
%ghost %config(noreplace) /var/lib/pcsd/tokens
%{_mandir}/man8/pcs.*
%{_mandir}/man8/pcsd.*
%exclude /usr/lib/pcsd/*.debian
@ -504,13 +605,16 @@ end
%{_mandir}/man8/pcs_snmp_agent.*
%config(noreplace) /etc/sysconfig/pcs_snmp_agent
%dir /var/log/pcs
%doc COPYING
%doc CHANGELOG.md
%doc pyagentx_LICENSE.txt
%doc pyagentx_CONTRIBUTORS.txt
%doc pyagentx_README.md
%license COPYING
%license pyagentx_LICENSE.txt
%changelog
* Thu Aug 02 2018 Ivan Devát <idevat@redhat.com> - 0.10.0.alpha.2-1
- Rebased to latest upstream sources (see CHANGELOG.md)
* Wed Jul 25 2018 Ivan Devát <idevat@redhat.com> - 0.9.164-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild

View File

@ -1,6 +1,4 @@
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 (pcs-0.9.164.tar.gz) = f5c26e470ace01e961f50ec6883d78e3556a572c274b7093005d496baed4fc33d38409169b06b67722b2fed32d5fd42cf8eb2b6832fe8e55027bf12a37dd5dc4
SHA512 (tornado-5.0.2.tar.gz) = 8e6d2757ef4179fc8f23efa63f6b22e5c303a8a1da1efda6a8df4a2acc22f0e67bed2ca504eac82c491c5bd0a087f9dcc76c4b6bd27afdf2fdc8c988f1dc1096
SHA512 (pcs-0.10.0.alpha.2.tar.gz) = da840a9b06cec6e0d0dc4aa1f8bf9180603470ffb62f94dc6c21112a44dcee70cc22ebd01a414c9614590faba724abf25cc0ec0718635d775316f0817f016bd1