Rebased to latest upstream sources

This commit is contained in:
Tomas Jelinek 2017-02-22 13:25:59 +01:00
parent 2aa1067734
commit 195f96ae8d
9 changed files with 285 additions and 250 deletions

2
.gitignore vendored
View File

@ -39,3 +39,5 @@
/rack-1.6.4.gem
/sinatra-1.4.7.gem
/pcs-0.9.155.tar.gz
/pcs-0.9.156.tar.gz
/sinatra-1.4.8.gem

View File

@ -1,135 +0,0 @@
From 79543d3f4864ad3cbff98c2600033c49158d79ac Mon Sep 17 00:00:00 2001
From: Adam Williamson <awilliam@redhat.com>
Date: Wed, 4 Jan 2017 17:54:15 -0800
Subject: [PATCH] Tests: handle change in an error message in lxml 3.7
---
pcs/lib/commands/test/test_resource_agent.py | 4 ++--
pcs/lib/commands/test/test_stonith_agent.py | 4 ++--
pcs/lib/test/test_resource_agent.py | 5 +++--
pcs/test/tools/assertions.py | 11 +++++++++++
pcs/test/test_lib_cib_tools.py | 4 ++--
4 files changed, 20 insertions(+), 8 deletions(-)
diff --git a/pcs/lib/commands/test/test_resource_agent.py b/pcs/lib/commands/test/test_resource_agent.py
index 9652591..ed86d00 100644
--- a/pcs/lib/commands/test/test_resource_agent.py
+++ b/pcs/lib/commands/test/test_resource_agent.py
@@ -8,7 +8,7 @@ from __future__ import (
import logging
from lxml import etree
-from pcs.test.tools.assertions import assert_raise_library_error
+from pcs.test.tools.assertions import assert_raise_library_error, start_tag_error_text
from pcs.test.tools.custom_mock import MockLibraryReportProcessor
from pcs.test.tools.pcs_unittest import mock, TestCase
@@ -353,7 +353,7 @@ class TestDescribeAgent(TestCase):
report_codes.UNABLE_TO_GET_AGENT_METADATA,
{
"agent": "ocf:test:Dummy",
- "reason": "Start tag expected, '<' not found, line 1, column 1",
+ "reason": start_tag_error_text(),
}
)
)
diff --git a/pcs/lib/commands/test/test_stonith_agent.py b/pcs/lib/commands/test/test_stonith_agent.py
index eaf5f93..d1e3ed0 100644
--- a/pcs/lib/commands/test/test_stonith_agent.py
+++ b/pcs/lib/commands/test/test_stonith_agent.py
@@ -8,7 +8,7 @@ from __future__ import (
import logging
from lxml import etree
-from pcs.test.tools.assertions import assert_raise_library_error
+from pcs.test.tools.assertions import assert_raise_library_error, start_tag_error_text
from pcs.test.tools.custom_mock import MockLibraryReportProcessor
from pcs.test.tools.pcs_unittest import mock, TestCase
@@ -204,7 +204,7 @@ class TestDescribeAgent(TestCase):
report_codes.UNABLE_TO_GET_AGENT_METADATA,
{
"agent": "fence_dummy",
- "reason": "Start tag expected, '<' not found, line 1, column 1",
+ "reason": start_tag_error_text(),
}
)
)
diff --git a/pcs/lib/test/test_resource_agent.py b/pcs/lib/test/test_resource_agent.py
index 5298415..e45b359 100644
--- a/pcs/lib/test/test_resource_agent.py
+++ b/pcs/lib/test/test_resource_agent.py
@@ -12,6 +12,7 @@ from pcs.test.tools.assertions import (
ExtendedAssertionsMixin,
assert_raise_library_error,
assert_xml_equal,
+ start_tag_error_text,
)
from pcs.test.tools.misc import create_patcher
from pcs.test.tools.pcs_unittest import TestCase, mock
@@ -1069,7 +1070,7 @@ class StonithdMetadataGetMetadataTest(TestCase, ExtendedAssertionsMixin):
self.agent._get_metadata,
{
"agent": "stonithd",
- "message": "Start tag expected, '<' not found, line 1, column 1",
+ "message": start_tag_error_text(),
}
)
@@ -1196,7 +1197,7 @@ class CrmAgentMetadataGetMetadataTest(TestCase, ExtendedAssertionsMixin):
self.agent._get_metadata,
{
"agent": self.agent_name,
- "message": "Start tag expected, '<' not found, line 1, column 1",
+ "message": start_tag_error_text(),
}
)
diff --git a/pcs/test/tools/assertions.py b/pcs/test/tools/assertions.py
index 4c8f8df..16e2571 100644
--- a/pcs/test/tools/assertions.py
+++ b/pcs/test/tools/assertions.py
@@ -7,10 +7,21 @@ from __future__ import (
import doctest
from lxml.doctestcompare import LXMLOutputChecker
+from lxml.etree import LXML_VERSION
from pcs.lib.errors import LibraryError
from pcs.test.tools.misc import prepare_diff
+def start_tag_error_text():
+ """lxml 3.7+ gives a longer 'start tag expected' error message,
+ handle it here so multiple tests can just get the appropriate
+ string from this function.
+ """
+ msg = "Start tag expected, '<' not found, line 1, column 1"
+ if LXML_VERSION >= (3, 7, 0, 0):
+ msg += " (<string>, line 1)"
+ return msg
+
def console_report(*lines):
#after lines append last new line
return "\n".join(lines + ("",))
--- a/pcs/test/test_lib_cib_tools.py
+++ b/pcs/test/test_lib_cib_tools.py
@@ -13,6 +13,7 @@
from pcs.test.tools.assertions import (
assert_raise_library_error,
assert_xml_equal,
+ start_tag_error_text,
)
from pcs.test.tools.misc import get_test_resource as rc
from pcs.test.tools.pcs_unittest import mock
@@ -488,7 +489,7 @@
report_codes.CIB_UPGRADE_FAILED,
{
"reason":
- "Start tag expected, '<' not found, line 1, column 1",
+ start_tag_error_text(),
}
)
)
--
2.11.0

View File

@ -1,31 +0,0 @@
From cbc8eb0eeff7ac9076d1455ac4f54113c84dd693 Mon Sep 17 00:00:00 2001
From: Adam Williamson <awilliam@redhat.com>
Date: Wed, 4 Jan 2017 16:00:15 -0800
Subject: [PATCH] Fix tests for Python 3.6
We need to set a proper value for `env.booth.name` in two more
tests, or Python chokes trying to `os.path.join()` a MagicMock.
---
pcs/lib/commands/test/test_booth.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/pcs/lib/commands/test/test_booth.py b/pcs/lib/commands/test/test_booth.py
index c24eea2..872760f 100644
--- a/pcs/lib/commands/test/test_booth.py
+++ b/pcs/lib/commands/test/test_booth.py
@@ -111,6 +111,7 @@ def test_raises_when_booth_config_in_use(self):
@patch_commands("parse", mock.Mock(side_effect=LibraryError()))
def test_raises_when_cannot_get_content_of_config(self):
env = mock.MagicMock()
+ env.booth.name = "somename"
assert_raise_library_error(
lambda: commands.config_destroy(env),
(
@@ -126,6 +127,7 @@ def test_raises_when_cannot_get_content_of_config(self):
@patch_commands("parse", mock.Mock(side_effect=LibraryError()))
def test_remove_config_even_if_cannot_get_its_content_when_forced(self):
env = mock.MagicMock()
+ env.booth.name = "somename"
env.report_processor = MockLibraryReportProcessor()
commands.config_destroy(env, ignore_config_load_problems=True)
env.booth.remove_config.assert_called_once_with()

View File

@ -1,19 +1,18 @@
From 1db647b1ecb6af2f819e97d5ae98e4d916ab2b5a Mon Sep 17 00:00:00 2001
From 76751bb5483683ef7c928878fe3307e13b3e4ee3 Mon Sep 17 00:00:00 2001
From: Tomas Jelinek <tojeline@redhat.com>
Date: Thu, 22 Sep 2016 12:55:20 +0200
Subject: [PATCH] fedfix
---
pcs/pcs | 2 +-
pcsd/Makefile | 18 +++---------------
pcs/test/suite.py | 2 +-
pcsd/Makefile | 25 +++----------------------
pcsd/pcsd.rb | 1 +
pcsd/pcsd.service-runner | 3 ++-
pcsd/session.rb | 1 +
pcsd/ssl.rb | 1 +
6 files changed, 9 insertions(+), 17 deletions(-)
5 files changed, 8 insertions(+), 25 deletions(-)
diff --git a/pcs/pcs b/pcs/pcs
index 4585fd5..d35933e 100755
index 4585fd57..d35933e4 100755
--- a/pcs/pcs
+++ b/pcs/pcs
@@ -1,4 +1,4 @@
@ -22,13 +21,28 @@ index 4585fd5..d35933e 100755
from __future__ import absolute_import
import os.path
diff --git a/pcs/test/suite.py b/pcs/test/suite.py
index 064b47e0..cf660d9e 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 9a4a4ba..4fd3786 100644
index 4b197669..ad21cb3d 100644
--- a/pcsd/Makefile
+++ b/pcsd/Makefile
@@ -1,21 +1,9 @@
@@ -1,30 +1,11 @@
-build_gems: get_gems
- bundle install --local --deployment
-#ffi makes symlink with absolute path. Let's change it to relative path.
- rm vendor/bundle/ruby/gems/ffi-1.9.17/ext/ffi_c/libffi-x86_64-linux/include/ffitarget.h
- ln -s \
- ../../libffi/src/x86/ffitarget.h \
- vendor/bundle/ruby/gems/ffi-1.9.17/ext/ffi_c/libffi-x86_64-linux/include/ffitarget.h
-
-# RHEL6 needs special rpam-ruby19 gem to work with 1.8.7
-# also bundler is not available on RHEL6 in rpm
@ -37,8 +51,10 @@ index 9a4a4ba..4fd3786 100644
mkdir -p vendor/bundle/ruby
- gem install --verbose --no-rdoc --no-ri -l -i vendor/bundle/ruby \
- vendor/cache/backports-3.6.8.gem \
- vendor/cache/json-1.8.3.gem \
- vendor/cache/multi_json-1.12.0.gem \
- vendor/cache/ethon-0.9.1.gem \
- vendor/cache/ffi-1.9.14.gem \
- vendor/cache/json-2.0.3.gem \
- vendor/cache/multi_json-1.12.1.gem \
- vendor/cache/open4-1.3.4.gem \
+ gem install --force --verbose --no-rdoc --no-ri -l -i vendor/bundle/ruby \
vendor/cache/orderedhash-0.0.6.gem \
@ -46,22 +62,24 @@ index 9a4a4ba..4fd3786 100644
- vendor/cache/rack-protection-1.5.3.gem \
- vendor/cache/rack-test-0.6.3.gem \
- vendor/cache/rpam-ruby19-feist-1.2.1.1.gem \
- vendor/cache/tilt-2.0.3.gem \
+ vendor/cache/rpam-ruby19-1.2.1.gem \
vendor/cache/sinatra-1.4.7.gem \
vendor/cache/sinatra-1.4.8.gem \
vendor/cache/sinatra-contrib-1.4.7.gem \
- vendor/cache/tilt-2.0.6.gem \
-- '--with-ldflags="-Wl,-z,now -Wl,-z,relro"'
get_gems:
diff --git a/pcsd/pcsd.rb b/pcsd/pcsd.rb
index dcfd5a0..adc8dc2 100644
index f45011e0..a07fc3c3 100644
--- a/pcsd/pcsd.rb
+++ b/pcsd/pcsd.rb
@@ -1,3 +1,4 @@
+gem 'sinatra', '= 1.4.7'
+gem 'sinatra', '= 1.4.8'
require 'sinatra'
require 'sinatra/reloader' if development?
require 'sinatra/cookies'
diff --git a/pcsd/pcsd.service-runner b/pcsd/pcsd.service-runner
index 883d290..712913e 100644
index 883d2908..712913ea 100644
--- a/pcsd/pcsd.service-runner
+++ b/pcsd/pcsd.service-runner
@@ -3,8 +3,9 @@
@ -75,25 +93,6 @@ index 883d290..712913e 100644
$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 c54a493..79f305d 100644
--- a/pcsd/session.rb
+++ b/pcsd/session.rb
@@ -1,3 +1,4 @@
+gem 'rack', '= 1.6.4'
require 'rack/session/pool'
class SessionPoolLifetime < Rack::Session::Pool
diff --git a/pcsd/ssl.rb b/pcsd/ssl.rb
index 7bbff46..c4f5a90 100644
--- a/pcsd/ssl.rb
+++ b/pcsd/ssl.rb
@@ -1,4 +1,5 @@
require 'rubygems'
+gem 'rack', '= 1.6.4'
require 'webrick'
require 'webrick/https'
require 'openssl'
--
2.9.3
2.11.0

View File

@ -0,0 +1,107 @@
From 44d20a50848a4a915f85087f8521413dad7df159 Mon Sep 17 00:00:00 2001
From: Tomas Jelinek <tojeline@redhat.com>
Date: Tue, 21 Feb 2017 16:37:57 +0100
Subject: [PATCH] fix libcurl issues in python3
---
pcs/lib/external.py | 21 ++++++++++-----------
pcs/test/test_lib_external.py | 5 ++---
pcs/utils.py | 19 +++++++++----------
3 files changed, 21 insertions(+), 24 deletions(-)
diff --git a/pcs/lib/external.py b/pcs/lib/external.py
index 0b2b5edc..5e3133dd 100644
--- a/pcs/lib/external.py
+++ b/pcs/lib/external.py
@@ -572,18 +572,17 @@ class NodeCommunicator(object):
"""
def __debug_callback(data_type, debug_data):
prefixes = {
- pycurl.DEBUG_TEXT: "* ",
- pycurl.DEBUG_HEADER_IN: "< ",
- pycurl.DEBUG_HEADER_OUT: "> ",
- pycurl.DEBUG_DATA_IN: "<< ",
- pycurl.DEBUG_DATA_OUT: ">> ",
+ pycurl.DEBUG_TEXT: b"* ",
+ pycurl.DEBUG_HEADER_IN: b"< ",
+ pycurl.DEBUG_HEADER_OUT: b"> ",
+ pycurl.DEBUG_DATA_IN: b"<< ",
+ pycurl.DEBUG_DATA_OUT: b">> ",
}
if data_type in prefixes:
- debug_output.write("{prefix}{data}{suffix}".format(
- prefix=prefixes[data_type],
- data=debug_data,
- suffix="" if debug_data.endswith("\n") else "\n"
- ).encode("utf-8"))
+ debug_output.write(prefixes[data_type])
+ debug_output.write(debug_data)
+ if not debug_data.endswith(b"\n"):
+ debug_output.write(b"\n")
output = io.BytesIO()
debug_output = io.BytesIO()
@@ -681,7 +680,7 @@ class NodeCommunicator(object):
else:
raise NodeConnectionException(host, request, reason)
finally:
- debug_data = debug_output.getvalue().decode("utf-8")
+ debug_data = debug_output.getvalue().decode("utf-8", "ignore")
self._logger.debug(
(
"Communication debug info for calling: {url}\n"
diff --git a/pcs/test/test_lib_external.py b/pcs/test/test_lib_external.py
index e8b0dc34..3868b0f2 100644
--- a/pcs/test/test_lib_external.py
+++ b/pcs/test/test_lib_external.py
@@ -506,8 +506,8 @@ class NodeCommunicatorTest(TestCase):
},
expected_response_data.encode("utf-8"),
[
- (pycurl.DEBUG_TEXT, "text"),
- (pycurl.DEBUG_DATA_OUT, "data out")
+ (pycurl.DEBUG_TEXT, b"text"),
+ (pycurl.DEBUG_DATA_OUT, b"data out")
]
)
mock_pycurl_init.return_value = mock_pycurl_obj
@@ -1952,4 +1952,3 @@ class IsProxySetTest(TestCase):
"no_proxy": "*",
"all_proxy": "test.proxy",
}))
-
diff --git a/pcs/utils.py b/pcs/utils.py
index 8190fa82..858cb3c1 100644
--- a/pcs/utils.py
+++ b/pcs/utils.py
@@ -346,18 +346,17 @@ def sendHTTPRequest(
def __debug_callback(data_type, debug_data):
prefixes = {
- pycurl.DEBUG_TEXT: "* ",
- pycurl.DEBUG_HEADER_IN: "< ",
- pycurl.DEBUG_HEADER_OUT: "> ",
- pycurl.DEBUG_DATA_IN: "<< ",
- pycurl.DEBUG_DATA_OUT: ">> ",
+ pycurl.DEBUG_TEXT: b"* ",
+ pycurl.DEBUG_HEADER_IN: b"< ",
+ pycurl.DEBUG_HEADER_OUT: b"> ",
+ pycurl.DEBUG_DATA_IN: b"<< ",
+ pycurl.DEBUG_DATA_OUT: b">> ",
}
if data_type in prefixes:
- debug_output.write("{prefix}{data}{suffix}".format(
- prefix=prefixes[data_type],
- data=debug_data,
- suffix="" if debug_data.endswith("\n") else "\n"
- ).encode("utf-8"))
+ debug_output.write(prefixes[data_type])
+ debug_output.write(debug_data)
+ if not debug_data.endswith(b"\n"):
+ debug_output.write(b"\n")
output = BytesIO()
debug_output = BytesIO()
--
2.11.0

View File

@ -0,0 +1,27 @@
From 4d19c6b7ad538032b9718635baa311394fd9b3b8 Mon Sep 17 00:00:00 2001
From: Tomas Jelinek <tojeline@redhat.com>
Date: Wed, 22 Feb 2017 13:17:22 +0100
Subject: [PATCH] fix linking fonts to pcsd
fc-list can return more than one font therefore the resulting symlink is
pointing to a wrong path. fc-match returns one best match.
---
Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 443290ef..003c78c7 100644
--- a/Makefile
+++ b/Makefile
@@ -160,7 +160,7 @@ endif
$(foreach font,$(pcsd_fonts),\
$(eval font_file = $(word 1,$(subst ;, ,$(font)))) \
$(eval font_def = $(word 2,$(subst ;, ,$(font)))) \
- $(eval font_path = $(shell fc-list '--format=%{file}' '$(font_def)')) \
+ $(eval font_path = $(shell fc-match '--format=%{file}' '$(font_def)')) \
$(if $(font_path),ln -s -f $(font_path) ${DESTDIR}${PCSD_PARENT_DIR}/pcsd/public/css/$(font_file);,$(error Font $(font_def) not found)) \
)
--
2.11.0

25
fix-test.patch Normal file
View File

@ -0,0 +1,25 @@
From 054d0ae696beb6e6436da43313ef43da4a45b9cc Mon Sep 17 00:00:00 2001
From: Tomas Jelinek <tojeline@redhat.com>
Date: Tue, 21 Feb 2017 14:45:59 +0100
Subject: [PATCH] fix test
---
pcsd/test/test_config.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pcsd/test/test_config.rb b/pcsd/test/test_config.rb
index 9ae520a4..755e35c2 100644
--- a/pcsd/test/test_config.rb
+++ b/pcsd/test/test_config.rb
@@ -122,7 +122,7 @@ class TestConfig < Test::Unit::TestCase
]
}'
cfg = PCSConfig.new(text)
- if Gem.loaded_specs['json'] and Gem.loaded_specs['json'].version >= Gem::Version.create('2.0')
+ if JSON::VERSION_MAJOR >= 2
parser_error = "Unable to parse pcs_settings file: 409: unexpected token at '\"rh71-node2\"\n ]\n }\n ]\n}'"
else
parser_error = "Unable to parse pcs_settings file: 399: unexpected token at '\"rh71-node2\"\n ]\n }\n ]\n}'"
--
2.11.0

135
pcs.spec
View File

@ -1,6 +1,6 @@
Name: pcs
Version: 0.9.155
Release: 3%{?dist}
Version: 0.9.156
Release: 1%{?dist}
License: GPLv2
URL: https://github.com/ClusterLabs/pcs
Group: System Environment/Base
@ -14,52 +14,88 @@ Source1: pcsd-bundle-config-1
Source11: https://rubygems.org/downloads/orderedhash-0.0.6.gem
Source12: https://rubygems.org/downloads/rack-1.6.4.gem
Source13: https://rubygems.org/downloads/rpam-ruby19-1.2.1.gem
Source14: https://rubygems.org/downloads/sinatra-1.4.7.gem
Source14: https://rubygems.org/downloads/sinatra-1.4.8.gem
Source15: https://rubygems.org/downloads/sinatra-contrib-1.4.7.gem
Patch0: fedfix.patch
# Fix tests for Python 3.6
Patch1: https://github.com/ClusterLabs/pcs/pull/122.patch
# Fix tests for lxml 3.7
# https://github.com/ClusterLabs/pcs/pull/121 , rediffed on 0.9.155
Patch2: 0001-Tests-handle-change-in-an-error-message-in-lxml-3.7.patch
Patch1: fix-test.patch
Patch2: fix-libcurl-issues-in-python3.patch
Patch3: fix-linking-fonts-to-pcsd.patch
# git for patches
BuildRequires: git
# python for pcs
BuildRequires: python3 python3-devel python3-setuptools
BuildRequires: python3
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 gcc-c++
BuildRequires: gcc
BuildRequires: gcc-c++
# ruby and gems for pcsd
BuildRequires: ruby ruby-devel rubygem-bundler rubygem-io-console
BuildRequires: rubygem-backports rubygem-json rubygem-multi_json rubygem-open4
BuildRequires: rubygem-rack-protection rubygem-rack-test rubygem-tilt
BuildRequires: ruby
BuildRequires: ruby-devel
BuildRequires: rubygem-bundler
BuildRequires: rubygem-backports
BuildRequires: rubygem-ethon
BuildRequires: rubygem-ffi
BuildRequires: rubygem-io-console
BuildRequires: rubygem-json
BuildRequires: rubygem-multi_json
BuildRequires: rubygem-open4
BuildRequires: rubygem-rack-protection
BuildRequires: rubygem-rack-test
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 tests
BuildRequires: corosync
BuildRequires: pacemaker pacemaker-cli
BuildRequires: fence-agents-all fence-virt
BuildRequires: pacemaker
BuildRequires: pacemaker-cli
BuildRequires: fence-agents-all
BuildRequires: fence-virt
BuildRequires: booth-site
BuildRequires: python3-lxml python3-mock
BuildRequires: rubygem-test-unit
# python and libraries for pcs, setuptools for pcs entrypoint
Requires: python3 python3-setuptools python3-lxml
Requires: python3
Requires: python3-lxml
Requires: python3-pycurl
Requires: python3-setuptools
# ruby and gems for pcsd
Requires: ruby
Requires: rubygem-backports rubygem-json rubygem-multi_json rubygem-open4
Requires: rubygem-rack-protection rubygem-rack-test rubygem-tilt
Requires: rubygem-backports
Requires: rubygem-ethon
Requires: rubygem-ffi
Requires: rubygem-json
Requires: rubygem-multi_json
Requires: rubygem-open4
Requires: rubygem-rack-protection
Requires: rubygem-rack-test
Requires: rubygem-tilt
# pcsd fonts
Requires: liberation-sans-fonts
Requires: overpass-fonts
# for killall
Requires: psmisc
# for working with certificates (validation etc.)
Requires: openssl
# cluster stack and related packages
Requires: corosync pacemaker pacemaker-cli
Requires: corosync
Requires: pacemaker
Requires: pacemaker-cli
# clufter currently doesn't have python3 package
Requires: python-clufter => 0.59.0
# for post, preun and postun macros
@ -73,13 +109,14 @@ Provides: bundled(rubygem-rack) = 1.6.4
Provides: bundled(rubygem-rpam-ruby19) = 1.2.1
# fedora provides a patched verison of sinatra which works with rack 2.0.1 but
# doesn't work with rack 1.6.4
Provides: bundled(rubygem-sinatra) = 1.4.7
Provides: bundled(rubygem-sinatra) = 1.4.8
Provides: bundled(rubygem-sinatra-contrib) = 1.4.7
%description
pcs is a corosync and pacemaker configuration tool. It permits users to
easily view, modify and created pacemaker based clusters.
easily view, modify and create pacemaker based clusters.
%define PCS_PREFIX /usr
%prep
%setup -q
@ -98,9 +135,13 @@ UpdateTimestamps() {
}
%patch0 -p1
%patch1 -p1
%patch2 -p1
UpdateTimestamps -p1 %{PATCH0}
%patch1 -p1
UpdateTimestamps -p1 %{PATCH1}
%patch2 -p1
UpdateTimestamps -p1 %{PATCH2}
%patch3 -p1
UpdateTimestamps -p1 %{PATCH3}
mkdir -p pcsd/.bundle
cp -f %SOURCE1 pcsd/.bundle/config
@ -115,7 +156,6 @@ cp -f %SOURCE15 pcsd/vendor/cache
%build
%define PCS_PREFIX /usr
%install
rm -rf $RPM_BUILD_ROOT
pwd
@ -133,6 +173,8 @@ make install_pcsd \
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
run_all_tests(){
@ -141,34 +183,29 @@ run_all_tests(){
pcsd_dir=$RPM_BUILD_ROOT%{PCS_PREFIX}/lib/pcsd
export PYTHONPATH="${PYTHONPATH}:${sitelib}"
#run pcs tests and remove them, we do not distribute them in rpm
#run pcs tests and remove them, we do not distribute them in the rpm
# disabled tests:
#
# pcs.test.test_cluster.ClusterTest.testUIDGID
# touches live cluster configuration, cannot run in mock environment
#
# pcs.lib.booth.test.test_env.SetKeyfileAccessTest.test_set_desired_file_access
# touches live cluster configuration, test need to be fixed
# Traceback (most recent call last):
# File "/builddir/build/BUILDROOT/pcs-0.9.152-6.el7.x86_64/usr/lib/python2.7/site-packages/pcs/lib/booth/test/test_env.py", line 148, in test_set_desired_file_access
# env.set_keyfile_access(file_path)
# File "/builddir/build/BUILDROOT/pcs-0.9.152-6.el7.x86_64/usr/lib/python2.7/site-packages/pcs/lib/booth/env.py", line 63, in set_keyfile_access
# raise report_keyfile_io_error(file_path, "chown", e)
# LibraryError: ERROR FILE_IO_ERROR: {u'reason': u"Operation not permitted: '/builddir/build/BUILDROOT/pcs-0.9.152-6.el7.x86_64/usr/lib/python2.7/site-packages/pcs/test/resources/temp-keyfile'", u'file_role': u'BOOTH_KEY', u'file_path': u'/builddir/build/BUILDROOT/pcs-0.9.152-6.el7.x86_64/usr/lib/python2.7/site-packages/pcs/test/resources/temp-keyfile', u'operation': u'chown'}
%{__python3} ${sitelib}/pcs/test/suite.py -v --no-color --all-but \
# pcs.test.cib_resource.test_create.Success.test_base_create_with_agent_name_including_systemd_instance
# It requires systemd to be running so pacemaker can connect to it via dbus.
# This is not possible during building.
# AssertionError: 0 != 1 : Expected return code "0", but was "1"
# command: resource create R systemd:lvm2-pvscan@252:2 --no-default-ops
# stdout: Error: Agent 'systemd:lvm2-pvscan@252:2' is not installed or does
# not provide valid metadata: error: crm_abort: systemd_unit_exec:
# Triggered fatal assert at systemd.c:728 : systemd_init(), use --force to
# override
%{__python3} ${sitelib}/pcs/test/suite.py -v --vanilla --all-but \
pcs.test.test_cluster.ClusterTest.testUIDGID \
pcs.lib.booth.test.test_env.SetKeyfileAccessTest.test_set_desired_file_access \
pcs.test.cib_resource.test_create.Success.test_base_create_with_agent_name_including_systemd_instance \
test_result_python=$?
#remove pcs tests, we do not distribute them in rpm
find ${sitelib}/pcs -name test -type d -print0|xargs -0 rm -rf -v --
# Temporary disable test failing due to recent JSON.
# https://github.com/ClusterLabs/pcs/issues/126
sed -i '/test_parse_malformed/a\ pend "Broken by recent JSON"' ${pcsd_dir}/test/test_config.rb
#remove pcs tests, we do not distribute them in the rpm
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 \
@ -176,7 +213,7 @@ run_all_tests(){
-I${pcsd_dir}/test \
${pcsd_dir}/test/test_all_suite.rb
test_result_ruby=$?
#remove pcsd tests, we do not distribute them in rpm
#remove pcsd tests, we do not distribute them in the rpm
rm -r -v ${pcsd_dir}/test
if [ $test_result_python -ne 0 ]; then
@ -212,6 +249,7 @@ end
%systemd_postun_with_restart pcsd.service
%files
%doc CHANGELOG.md
%doc README
%license COPYING
%{python3_sitelib}/pcs
@ -237,11 +275,14 @@ end
%exclude /usr/lib/pcsd/*.debian
%exclude /usr/lib/pcsd/pcsd.service
%exclude /usr/lib/pcsd/pcsd.conf
%exclude %{python3_sitelib}/pcs/bash_completion.sh
%exclude %{python3_sitelib}/pcs/bash_completion
%exclude %{python3_sitelib}/pcs/pcs.8
%exclude %{python3_sitelib}/pcs/pcs
%changelog
* Wed Feb 22 2017 Tomas Jelinek <tojeline@redhat.com> - 0.9.156-1
- Rebased to latest upstream sources (see CHANGELOG.md)
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.9.155-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

View File

@ -1,7 +1,7 @@
SHA512 (pcs-0.9.155.tar.gz) = a8de72fde5a0c0559ab417dfee05ce56b884612b64b6aabc8dc4ff1ee59057338e8585b4544a097a230ba0450f93c742e54bba72b8f1c671412f66f2f8db50bb
SHA512 (pcs-0.9.156.tar.gz) = 8f2097a17db9028010b0edaa7a21976d4e55ec6b5791ad549320755348aabe414e339ce5e089885ed45e2849eb040fceae1ece416cc68dffeab9c2edc31d1e99
SHA512 (pcsd-bundle-config-1) = f2a2df2dab39c2012cc6a91517716dde8f5a48788d1069c4addf619bc4dc45a98fd48f0f7964b5400e43e84fe96f942a550d2762553fea97e63dc7ad9b8be823
SHA512 (orderedhash-0.0.6.gem) = b2dae648187437ea7d9d9be47b9ff8d0e1a96bc2ff9e50117033d5bd4cf09cfff3c0740c99c322910138cac90f33b425705ee7a30be84aa193e6afd9f576f64a
SHA512 (rack-1.6.4.gem) = 304a6ae21bfd38008fd7d147f82c44397f3a1d2e689bd01de689aedc6ea0e8784605207fd314bc796974edc5dfcab81636664ea2becb0489302999f99501d41a
SHA512 (rpam-ruby19-1.2.1.gem) = b403964295e96a6247289518ff46e59bbae6c78bcfb647e12b7dbb247698642b4a1ee04492521b782fb3c594c2ede8143c765819fecde087e2ec850e3aea3503
SHA512 (sinatra-1.4.7.gem) = f13531390af95e0bb42f7c5cc350e3aee7136c1bb81b487ef71cc194ed6675722a1c23ff6b65ac0e3b2c1a0986bfa733c4a0f24cf9bbe0168a18cd4d18d8a13a
SHA512 (sinatra-1.4.8.gem) = e56a5a6d7ceb0be4bc537feb6ada2956f1fd64b452dee347b259837aa02041dfa53d9808531cdd0a02a91093ba92f7c505c39f0dd990dfbc6e872681f40bc5e9
SHA512 (sinatra-contrib-1.4.7.gem) = dbb4deaed6844a70352e4fbe0f7b71d000acd525a3f6a20c2dc66d3ddc87b93a3b9c33ac315a0a5f4e30b82631c14196fefc9b6fe29c0aee29ea6db4d000361c