From 29a162574abfbdf2e165d1f2123db3e7499399ba Mon Sep 17 00:00:00 2001 From: Ondrej Mular Date: Tue, 9 Oct 2018 09:38:20 -0400 Subject: [PATCH] Resolves: rhbz#1618911 --- .gitignore | 1 + ...for-instalation-without-bundled-gems.patch | 83 ----- disable-gui.patch | 10 +- do-not-use-bundled-ruby-gems.patch | 25 -- ...e-test-resources-from-python-package.patch | 26 ++ exclude-tests-from-python-package.patch | 25 ++ pcs.spec | 292 +++++++----------- skip-tests-which-require-root-user.patch | 59 ++++ sources | 2 +- 9 files changed, 223 insertions(+), 300 deletions(-) delete mode 100644 add-support-for-instalation-without-bundled-gems.patch delete mode 100644 do-not-use-bundled-ruby-gems.patch create mode 100644 exclude-test-resources-from-python-package.patch create mode 100644 exclude-tests-from-python-package.patch create mode 100644 skip-tests-which-require-root-user.patch diff --git a/.gitignore b/.gitignore index 36ff26c..eb3f5e5 100644 --- a/.gitignore +++ b/.gitignore @@ -55,3 +55,4 @@ /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 diff --git a/add-support-for-instalation-without-bundled-gems.patch b/add-support-for-instalation-without-bundled-gems.patch deleted file mode 100644 index bb8aec2..0000000 --- a/add-support-for-instalation-without-bundled-gems.patch +++ /dev/null @@ -1,83 +0,0 @@ -From 25b22ebeb007534ef86815f4e303e773c060c722 Mon Sep 17 00:00:00 2001 -From: Ivan Devat -Date: Fri, 24 Aug 2018 20:01:04 +0200 -Subject: [PATCH 1/2] add support for instalation without bundled gems - ---- - pcs/daemon/env.py | 2 ++ - pcs/daemon/ruby_pcsd.py | 8 +++++--- - pcs/daemon/run.py | 2 +- - pcs/settings_default.py | 2 ++ - 4 files changed, 10 insertions(+), 4 deletions(-) - -diff --git a/pcs/daemon/env.py b/pcs/daemon/env.py -index 6433a31..b311d88 100644 ---- a/pcs/daemon/env.py -+++ b/pcs/daemon/env.py -@@ -166,6 +166,8 @@ class EnvLoader: - return self.__has_true_in_environ(PCSD_DEBUG) - - def gem_home(self): -+ if settings.pcsd_gem_path is None: -+ return None - return self.__in_pcsd_path( - settings.pcsd_gem_path, - "Ruby gem location" -diff --git a/pcs/daemon/ruby_pcsd.py b/pcs/daemon/ruby_pcsd.py -index 43aa9fb..a3910ba 100644 ---- a/pcs/daemon/ruby_pcsd.py -+++ b/pcs/daemon/ruby_pcsd.py -@@ -61,8 +61,8 @@ def process_response_logs(rb_log_list): - class Wrapper: - # pylint: disable=too-many-instance-attributes - def __init__( -- self, gem_home, pcsd_cmdline_entry, debug=False, ruby_executable="ruby", -- https_proxy=None, no_proxy=None -+ self, pcsd_cmdline_entry, gem_home=None, debug=False, -+ ruby_executable="ruby", https_proxy=None, no_proxy=None - ): - self.__gem_home = gem_home - self.__pcsd_cmdline_entry = pcsd_cmdline_entry -@@ -98,9 +98,11 @@ class Wrapper: - - async def send_to_ruby(self, request_json): - env = { -- "GEM_HOME": self.__gem_home, - "PCSD_DEBUG": "true" if self.__debug else "false" - } -+ if self.__gem_home is not None: -+ env["GEM_HOME"] = self.__gem_home -+ - if self.__no_proxy is not None: - env["NO_PROXY"] = self.__no_proxy - if self.__https_proxy is not None: -diff --git a/pcs/daemon/run.py b/pcs/daemon/run.py -index d1c91c7..004972f 100644 ---- a/pcs/daemon/run.py -+++ b/pcs/daemon/run.py -@@ -86,8 +86,8 @@ def main(): - - sync_config_lock = Lock() - ruby_pcsd_wrapper = ruby_pcsd.Wrapper( -- gem_home=env.GEM_HOME, - pcsd_cmdline_entry=env.PCSD_CMDLINE_ENTRY, -+ gem_home=env.GEM_HOME, - debug=env.PCSD_DEBUG, - ruby_executable=settings.ruby_executable, - https_proxy=env.HTTPS_PROXY, -diff --git a/pcs/settings_default.py b/pcs/settings_default.py -index d9cb0e4..45e3c09 100644 ---- a/pcs/settings_default.py -+++ b/pcs/settings_default.py -@@ -74,6 +74,8 @@ default_ssl_options = ",".join([ - "OP_NO_TLSv1", - "OP_NO_TLSv1_1", - ]) -+# Set pcsd_gem_path to None if there are no bundled ruby gems and the path does -+# not exists. - pcsd_gem_path = "vendor/bundle/ruby" - ruby_executable = "/usr/bin/ruby" - --- -1.8.3.1 - diff --git a/disable-gui.patch b/disable-gui.patch index d2388c9..eb71e43 100644 --- a/disable-gui.patch +++ b/disable-gui.patch @@ -1,17 +1,17 @@ -From 458f280e60d564adbc51a9eda406b014edeea23d Mon Sep 17 00:00:00 2001 +From a6105339c18a7ac1a69f4c61d0c436c38249798a Mon Sep 17 00:00:00 2001 From: Ivan Devat Date: Tue, 17 Jul 2018 12:59:17 +0200 -Subject: [PATCH] disable gui +Subject: [PATCH 1/4] 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 +index 2b6e00ed..2d3dfbca 100644 --- a/pcs/daemon/run.py +++ b/pcs/daemon/run.py -@@ -58,14 +58,15 @@ def configure_app( +@@ -59,14 +59,15 @@ def configure_app( https_server_manage, ) @@ -36,5 +36,5 @@ index e5e9478..d1c91c7 100644 return Application(routes, debug=debug) return make_app -- -1.8.3.1 +2.18.0 diff --git a/do-not-use-bundled-ruby-gems.patch b/do-not-use-bundled-ruby-gems.patch deleted file mode 100644 index 4b7a433..0000000 --- a/do-not-use-bundled-ruby-gems.patch +++ /dev/null @@ -1,25 +0,0 @@ -From fac7ecf0baf41e97426327ac49b02e6067969cbe Mon Sep 17 00:00:00 2001 -From: Ivan Devat -Date: Sat, 25 Aug 2018 09:27:12 +0200 -Subject: [PATCH 2/2] do not use bundled ruby gems - ---- - pcs/settings_default.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/pcs/settings_default.py b/pcs/settings_default.py -index 45e3c09..e321981 100644 ---- a/pcs/settings_default.py -+++ b/pcs/settings_default.py -@@ -76,7 +76,7 @@ default_ssl_options = ",".join([ - ]) - # Set pcsd_gem_path to None if there are no bundled ruby gems and the path does - # not exists. --pcsd_gem_path = "vendor/bundle/ruby" -+pcsd_gem_path = None - ruby_executable = "/usr/bin/ruby" - - gui_session_lifetime_seconds=60 * 60 --- -1.8.3.1 - diff --git a/exclude-test-resources-from-python-package.patch b/exclude-test-resources-from-python-package.patch new file mode 100644 index 0000000..2b41cec --- /dev/null +++ b/exclude-test-resources-from-python-package.patch @@ -0,0 +1,26 @@ +From ebb9e4ac0ad43a12bfbac55537d18fc35188d870 Mon Sep 17 00:00:00 2001 +From: Ondrej Mular +Date: Tue, 2 Oct 2018 14:46:43 +0200 +Subject: [PATCH 4/4] exclude test resources from python package + +--- + setup.py | 3 --- + 1 file changed, 3 deletions(-) + +diff --git a/setup.py b/setup.py +index 9d9b9851..56eb2ab8 100644 +--- a/setup.py ++++ b/setup.py +@@ -28,9 +28,6 @@ setup( + 'bash_completion', + 'pcs.8', + 'pcs', +- 'test/resources/*.xml', +- 'test/resources/*.conf', +- 'test/resources/qdevice-certs/*' + ]}, + zip_safe=False, + entry_points={ +-- +2.18.0 + diff --git a/exclude-tests-from-python-package.patch b/exclude-tests-from-python-package.patch new file mode 100644 index 0000000..011c725 --- /dev/null +++ b/exclude-tests-from-python-package.patch @@ -0,0 +1,25 @@ +From f2fe4f03c5737130c6d20364931d993e08cbfa18 Mon Sep 17 00:00:00 2001 +From: Ondrej Mular +Date: Tue, 2 Oct 2018 09:22:10 +0200 +Subject: [PATCH 2/4] exclude tests from python package + +--- + setup.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/setup.py b/setup.py +index 7aa36421..9d9b9851 100644 +--- a/setup.py ++++ b/setup.py +@@ -23,7 +23,7 @@ setup( + author='Chris Feist', + author_email='cfeist@redhat.com', + url='https://github.com/ClusterLabs/pcs', +- packages=find_packages(), ++ packages=find_packages(exclude=["*.test.*", "*.test"]), + package_data={'pcs':[ + 'bash_completion', + 'pcs.8', +-- +2.18.0 + diff --git a/pcs.spec b/pcs.spec index aec2de1..9d1f856 100644 --- a/pcs.spec +++ b/pcs.spec @@ -1,6 +1,6 @@ Name: pcs -Version: 0.10.0.alpha.2 -Release: 3%{?dist} +Version: 0.10.0.alpha.6 +Release: 1%{?dist} # https://fedoraproject.org/wiki/Licensing:Main?rd=Licensing#Good_Licenses # GPLv2: pcs # ASL 2.0: tornado @@ -26,6 +26,10 @@ Summary: Pacemaker Configuration System # /usr/bin/python will be removed or switched to Python 3 in the future. %global __python %{__python3} +# we cannot use macro %%{_libdir} (which may point to lib64) as some paths to +# /usr/lib are hardcoded in settings.py and settings.rb +%global pcs_libdir %{_prefix}/lib + #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 @@ -37,6 +41,9 @@ Source41: https://github.com/ondrejmular/pyagentx/archive/v%{pyagentx_version}.t Source42: https://github.com/tornadoweb/tornado/archive/v%{tornado_version}.tar.gz#/tornado-%{tornado_version}.tar.gz Patch0: disable-gui.patch +Patch1: exclude-tests-from-python-package.patch +Patch2: skip-tests-which-require-root-user.patch +Patch3: exclude-test-resources-from-python-package.patch # git for patches BuildRequires: git @@ -53,7 +60,6 @@ BuildRequires: gcc-c++ # ruby and gems for pcsd BuildRequires: ruby >= 2.2.0 BuildRequires: ruby-devel -BuildRequires: rubygem-bundler BuildRequires: rubygem-backports BuildRequires: rubygem-ethon BuildRequires: rubygem-ffi @@ -92,6 +98,8 @@ BuildRequires: fence-virt BuildRequires: fence-agents-apc BuildRequires: fence-agents-scsi BuildRequires: fence-agents-ipmilan +# fence-agents-ilo2 issue with dependencies +# BuildRequires: fence-agents-ilo2 BuildRequires: booth-site # pcsd fonts and font management tools for creating symlinks to fonts BuildRequires: fontconfig @@ -162,26 +170,48 @@ Provides: bundled(pyagentx) = %{pyagentx_version} %description -n %{pcs_snmp_pkg_name} SNMP agent that provides information about pacemaker cluster to the master agent (snmpd) -%define PCS_PREFIX /usr %prep -%setup -q +%autosetup -p1 -S git -# -- following borrowed from python-simplejon.el5 -- +# -- following is inspired by python-simplejon.el5 -- # Update timestamps on the files touched by a patch, to avoid non-equal -# .pyc/.pyo files across the multilib peers within a build, where "Level" -# is the patch prefix option (e.g. -p1) -UpdateTimestamps() { - Level=$1 - PatchFile=$2 - # Locate the affected files: - for f in $(diffstat $Level -l $PatchFile); do - # Set the files to have the same timestamp as that of the patch: - touch -r $PatchFile $f +# .pyc/.pyo files across the multilib peers within a build + +update_times(){ + # update_times ... + # set the access and modification times of each file_to_touch to the times + # of reference_file + + # put all args to file_list + file_list=("$@") + # first argument is reference_file: so take it and remove from file_list + reference_file=${file_list[0]} + unset file_list[0] + + for fname in ${file_list[@]}; do + touch -r $reference_file $fname done } -%patch0 -p1 -UpdateTimestamps -p1 %{PATCH0} +update_times_patch(){ + # update_times_patch + # set the access and modification times of each file in patch to the times + # of patch_file_name + + patch_file_name=$1 + + # diffstat + # -l lists only the filenames. No histogram is generated. + # -p override the logic that strips common pathnames, + # simulating the patch "-p" option. (Strip the smallest prefix containing + # num leading slashes from each file name found in the patch file) + update_times ${patch_file_name} `diffstat -p1 -l ${patch_file_name}` +} + +update_times_patch %{PATCH0} +update_times_patch %{PATCH1} +update_times_patch %{PATCH2} +update_times_patch %{PATCH3} # prepare dirs/files necessary for building all bundles # ----------------------------------------------------- @@ -231,10 +261,12 @@ gem install \ # main pcs install make install \ DESTDIR=$RPM_BUILD_ROOT \ - PREFIX=%{PCS_PREFIX} \ + PREFIX=%{_prefix} \ + SYSTEMD_UNIT_DIR=%{_unitdir} \ + LIB_DIR=%{pcs_libdir} \ PYTHON=%{__python3} \ PYTHON_SITELIB=%{python3_sitelib} \ - BASH_COMPLETION_DIR=/usr/share/bash-completion/completions \ + BASH_COMPLETION_DIR=%{_datadir}/bash-completion/completions \ BUNDLE_PYAGENTX_SRC_DIR=`readlink -f %{bundled_src_dir}/pyagentx` \ BUNDLE_TORNADO_SRC_DIR=`readlink -f %{bundled_src_dir}/tornado` \ BUILD_GEMS=false \ @@ -244,7 +276,7 @@ make install \ 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/%{rubygem_cache_dir} +rm -r -v $RPM_BUILD_ROOT/%{pcs_libdir}/%{rubygem_cache_dir} %check # In the building environment LC_CTYPE is set to C which causes tests to fail @@ -259,152 +291,40 @@ export PYTHONCOERCECLOCALE=0 run_all_tests(){ #prepare environmet for tests - sitelib=$RPM_BUILD_ROOT%{python3_sitelib} - export PYTHONPATH="${PYTHONPATH}:${sitelib}" + export PYTHONPATH="${PYTHONPATH}:$RPM_BUILD_ROOT%{pcs_libdir}/pcs/bundled/packages" - #run pcs tests and remove them, we do not distribute them in the rpm + #run pcs tests # disabled tests: # - # pcs.test.test_cluster.ClusterTest.testUIDGID - # touches live cluster configuration, cannot run in mock environment # 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 - # ====================================================================== - # 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': , - # 'PCSD_STATIC_FILES_DIR': '/usr/lib/pcsd/public', - # - 'has_errors': False} - # ? ^^^^ - # + 'has_errors': True} - # ? ^^^ - # ====================================================================== - # THE SAME CASES: - # FAIL: test_error_if_files_with_bad_content (pcs.daemon.test.test_ssl.Pair) - # 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 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'"] - # ? ^^^^^ ^^ ^^^ - # ====================================================================== - # THE SAME CASES: - # FAIL: test_error_when_not_valid_agent (pcs.test.cib_resource.test_stonith_create.PlainStonith) - # FAIL: test_warning_when_not_valid_agent (pcs.test.cib_resource.test_stonith_create.PlainStonith) - # FAIL: test_nonextisting_agent (pcs.test.test_stonith.StonithDescribeTest) - # FAIL: testStonithCreation (pcs.test.test_stonith.StonithTest) - # ---------------------------------------------------------------------- - # Traceback (most recent call last): - # File "/builddir/build/BUILDROOT/pcs-0.10.0.alpha.2-3.fc29.x86_64/usr/lib/python3.7/site-packages/pcs/test/cib_resource/test_stonith_create.py", line 66, in test_error_when_not_valid_agent - # "$", re.MULTILINE - # File "/builddir/build/BUILDROOT/pcs-0.10.0.alpha.2-3.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.2-3.fc29.x86_64/usr/lib/python3.7/site-packages/pcs/test/tools/assertions.py", line 158, in assert_pcs_result - # stdout=stdout, - # AssertionError: Stdout does not match the expected regexp - # command: stonith create S absent - # regexp: - # ^Error: Agent 'absent' is not installed or does not provide valid metadata: Metadata query for stonith:absent failed: (-5|Input/output error), use --force to override - # $ (flags: MULTILINE, UNICODE) - # Full stdout: - # Error: Agent 'absent' is not installed or does not provide valid metadata: Agent absent not found or does not support meta-data: Invalid argument (22) - # Metadata query for stonith:absent failed: Input/output error, use --force to override - # ====================================================================== - # 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 - - - 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.test.cib_resource.test_stonith_create.PlainStonith.test_error_when_not_valid_agent \ - pcs.test.cib_resource.test_stonith_create.PlainStonith.test_warning_when_not_valid_agent \ - pcs.test.test_stonith.StonithDescribeTest.test_nonextisting_agent \ - pcs.test.test_stonith.StonithTest.testStonithCreation \ + # pcs.test.test_stonith.StonithTest.testStonithCreation + # requires fence_ilo which cannot be installed at the time because of + # issues with dependencies + # pcs.common.test.test_node_communicator.RequestDataUrlEncodeTest.test_with_data + # ====================================================================== + # 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 + # ? ^ + %{__python3} pcs/test/suite.py -v --vanilla --all-but \ pcs.common.test.test_node_communicator.RequestDataUrlEncodeTest.test_with_data \ - 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 \ + pcs.test.cib_resource.test_create.Success.test_base_create_with_agent_name_including_systemd_instance \ + pcs.test.test_stonith.StonithTest.testStonithCreation \ test_result_python=$? - #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 - pcsd_dir=$RPM_BUILD_ROOT%{PCS_PREFIX}/lib/pcsd - GEM_HOME=$RPM_BUILD_ROOT%{PCS_PREFIX}%{rubygem_bundle_dir} ruby \ + pcsd_dir=$RPM_BUILD_ROOT%{pcs_libdir}/pcsd + GEM_HOME=$RPM_BUILD_ROOT%{pcs_libdir}/%{rubygem_bundle_dir} ruby \ -I${pcsd_dir} \ -I${pcsd_dir}/test \ ${pcsd_dir}/test/test_all_suite.rb @@ -449,46 +369,42 @@ run_all_tests # 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 -/etc/pam.d/pcsd -%dir /var/log/pcsd -%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 +%{_sbindir}/pcs +%{_sbindir}/pcsd +%{pcs_libdir}/pcsd/* +%{pcs_libdir}/pcsd/.bundle/config +%{pcs_libdir}/pcs/bundled/packages/tornado* +%{_unitdir}/pcsd.service +%{_datadir}/bash-completion/completions/pcs +%{_sharedstatedir}/pcsd +%{_sysconfdir}/pam.d/pcsd +%dir %{_var}/log/pcsd +%config(noreplace) %{_sysconfdir}/logrotate.d/pcsd +%config(noreplace) %{_sysconfdir}/sysconfig/pcsd +%ghost %config(noreplace) %{_sharedstatedir}/pcsd/cfgsync_ctl +%ghost %config(noreplace) %{_sharedstatedir}/pcsd/known-hosts +%ghost %config(noreplace) %{_sharedstatedir}/pcsd/pcsd.cookiesecret +%ghost %config(noreplace) %{_sharedstatedir}/pcsd/pcsd.crt +%ghost %config(noreplace) %{_sharedstatedir}/pcsd/pcsd.key +%ghost %config(noreplace) %{_sharedstatedir}/pcsd/pcs_settings.conf +%ghost %config(noreplace) %{_sharedstatedir}/pcsd/pcs_users.conf %{_mandir}/man8/pcs.* %{_mandir}/man8/pcsd.* -%exclude /usr/lib/pcsd/*.debian -%exclude /usr/lib/pcsd/pcsd.service -%exclude /usr/lib/pcsd/pcsd.conf -%exclude /usr/lib/pcsd/pcsd.8 +%exclude %{pcs_libdir}/pcsd/*.debian +%exclude %{pcs_libdir}/pcsd/pcsd.service +%exclude %{pcs_libdir}/pcsd/pcsd.conf +%exclude %{pcs_libdir}/pcsd/pcsd.8 %exclude %{python3_sitelib}/pcs/bash_completion %exclude %{python3_sitelib}/pcs/pcs.8 %exclude %{python3_sitelib}/pcs/pcs %files -n %{pcs_snmp_pkg_name} -/usr/lib/pcs/pcs_snmp_agent -/usr/lib/pcs/bundled/packages/pyagentx* -/usr/lib/systemd/system/pcs_snmp_agent.service -/usr/share/snmp/mibs/PCMK-PCS*-MIB.txt +%{pcs_libdir}/pcs/pcs_snmp_agent +%{pcs_libdir}/pcs/bundled/packages/pyagentx* +%{_unitdir}/pcs_snmp_agent.service +%{_datadir}/snmp/mibs/PCMK-PCS*-MIB.txt %{_mandir}/man8/pcs_snmp_agent.* -%config(noreplace) /etc/sysconfig/pcs_snmp_agent -# The creation of /var/log/pcs is removed in the upstream (/var/log/pcsd is used -# instead) but this change is not in this build yet. If your build fails -# because of missing /var/log/pcs feel free to remove it. -%dir /var/log/pcs +%config(noreplace) %{_sysconfdir}/sysconfig/pcs_snmp_agent %doc CHANGELOG.md %doc pyagentx_CONTRIBUTORS.txt %doc pyagentx_README.md @@ -496,6 +412,10 @@ run_all_tests %license pyagentx_LICENSE.txt %changelog +* Tue Oct 09 2018 Ondrej Mular - 0.10.0.alpha.6-1 +- Rebased to latest upstream sources (see CHANGELOG.md) +- Resolves: rhbz#1618911 + * Fri Aug 31 2018 Ivan Devát - 0.10.0.alpha.2-3 - Started bundling rubygem-tilt (rubygem-tilt is orphaned in fedora due to rubygem-prawn dependency) - Enabled passing tests diff --git a/skip-tests-which-require-root-user.patch b/skip-tests-which-require-root-user.patch new file mode 100644 index 0000000..d6029a4 --- /dev/null +++ b/skip-tests-which-require-root-user.patch @@ -0,0 +1,59 @@ +From fa7e547053fc5bf7f26081558176fd2fcdee21f6 Mon Sep 17 00:00:00 2001 +From: Ondrej Mular +Date: Sat, 29 Sep 2018 00:16:12 +0200 +Subject: [PATCH 3/4] skip tests which require root user + +--- + pcs/test/test_cluster.py | 4 +++- + pcs/test/tools/misc.py | 6 ++++++ + 2 files changed, 9 insertions(+), 1 deletion(-) + +diff --git a/pcs/test/test_cluster.py b/pcs/test/test_cluster.py +index deff5160..eab81e00 100644 +--- a/pcs/test/test_cluster.py ++++ b/pcs/test/test_cluster.py +@@ -11,6 +11,7 @@ from pcs.test.tools.assertions import ( + from pcs.test.tools.misc import ( + get_test_resource as rc, + skip_unless_pacemaker_version, ++ skip_unless_root, + ) + from pcs.test.tools.pcs_runner import ( + pcs, +@@ -140,7 +141,7 @@ class ClusterUpgradeTest(unittest.TestCase, AssertPcsMixin): + assert r == 0 + + +- ++@skip_unless_root() + class ClusterStartStop(unittest.TestCase, AssertPcsMixin): + def setUp(self): + self.pcs_runner = PcsRunner(cib_file=None) +@@ -156,6 +157,7 @@ class ClusterStartStop(unittest.TestCase, AssertPcsMixin): + ) + + ++@skip_unless_root() + class ClusterEnableDisable(unittest.TestCase, AssertPcsMixin): + def setUp(self): + self.pcs_runner = PcsRunner(cib_file=None) +diff --git a/pcs/test/tools/misc.py b/pcs/test/tools/misc.py +index 23fd710a..7bfd3fba 100644 +--- a/pcs/test/tools/misc.py ++++ b/pcs/test/tools/misc.py +@@ -154,6 +154,12 @@ def skip_unless_lsb_network_available(): + "lsb:network resource agent is not available" + ) + ++def skip_unless_root(): ++ return skipUnless( ++ os.getuid() == 0, ++ "Root user required" ++ ) ++ + def create_patcher(target_prefix_or_module): + """ + Return function for patching tests with preconfigured target prefix +-- +2.18.0 + diff --git a/sources b/sources index 56a2b9d..b2c89f9 100644 --- a/sources +++ b/sources @@ -1,5 +1,5 @@ SHA512 (pcsd-bundle-config-1) = f2a2df2dab39c2012cc6a91517716dde8f5a48788d1069c4addf619bc4dc45a98fd48f0f7964b5400e43e84fe96f942a550d2762553fea97e63dc7ad9b8be823 SHA512 (pyagentx-0.4.pcs.2.tar.gz) = d4194fec9a3e5fefe3793d49b7fec1feafef294c7e613a06046c2993daeefc5cb39d7c5b2b402ff83e49b2d976953f862264288c758c0be09d997b5323cc558a SHA512 (tornado-5.0.2.tar.gz) = 8e6d2757ef4179fc8f23efa63f6b22e5c303a8a1da1efda6a8df4a2acc22f0e67bed2ca504eac82c491c5bd0a087f9dcc76c4b6bd27afdf2fdc8c988f1dc1096 -SHA512 (pcs-0.10.0.alpha.2.tar.gz) = da840a9b06cec6e0d0dc4aa1f8bf9180603470ffb62f94dc6c21112a44dcee70cc22ebd01a414c9614590faba724abf25cc0ec0718635d775316f0817f016bd1 SHA512 (tilt-2.0.8.gem) = 1767f2e5ce45afe95d84d32de7c2b6fe24ff7cb6f7ee8485d84344820b2f6e969ae60a6fbaa7141f7fe135c6540d96fa5b27fd8010b95c0ded5d049a315001d5 +SHA512 (pcs-0.10.0.alpha.6.tar.gz) = 5c12e95384ebcbfe3be481afa1807b3db770e177fce55b3edd9049690fb8833e58a27c3302f25ac2f4c5c60cead028ab31fdfb8f1c683b018d79201c2446ceeb