diff --git a/HAM-logo.png b/HAM-logo.png new file mode 100755 index 0000000..aa7365a Binary files /dev/null and b/HAM-logo.png differ diff --git a/HAM-logo.svg b/HAM-logo.svg new file mode 100755 index 0000000..3b35fdf --- /dev/null +++ b/HAM-logo.svg @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/README.md b/README.md index 647afbc..b31b4d2 100644 --- a/README.md +++ b/README.md @@ -1,37 +1,159 @@ -# pcs +## PCS - Pacemaker/Corosync Configuration System -#### 介绍 -Pcs is a Corosync and Pacemaker configuration tool. It permits users to easily view, modify and create Pacemaker based clusters. Pcs contains pcsd, a pcs daemon, which operates as a remote server for pcs and provides a web UI. +Pcs is a Corosync and Pacemaker configuration tool. It permits users to +easily view, modify and create Pacemaker based clusters. Pcs contains pcsd, a +pcs daemon, which operates as a remote server for pcs and provides a web UI. -#### 软件架构 -软件架构说明 +--- +### Dependencies -#### 安装教程 +These are the runtime dependencies of pcs and pcsd: +* python 3.6+ +* python3-lxml +* python3-pycurl +* python3-setuptools +* python3-pyOpenSSL (python3-openssl) +* python3-tornado +* ruby 2.2.0+ +* killall (package psmisc) +* openssl +* corosync 3.x +* pacemaker 2.x -1. xxxx -2. xxxx -3. xxxx +It is also recommended to have these: +* python3-clufter +* liberation fonts (package liberation-sans-fonts or fonts-liberation or + fonts-liberation2) +* overpass fonts (package overpass-fonts) -#### 使用说明 +--- -1. xxxx -2. xxxx -3. xxxx +### Installation from Source -#### 参与贡献 +Apart from the dependencies listed above, these are also required for +installation: -1. Fork 本仓库 -2. 新建 Feat_xxx 分支 -3. 提交代码 -4. 新建 Pull Request +* python development files (package python3-devel) +* ruby development files (package ruby-devel) +* rubygems +* rubygem bundler (package rubygem-bundler or ruby-bundler or bundler) +* gcc +* gcc-c++ +* FFI development files (package libffi-devel or libffi-dev) +* fontconfig +* printf (package coreutils) +* redhat-rpm-config (if you are using Fedora) +* wget (to download bundled libraries) +During the installation, all required rubygems are automatically downloaded and +compiled. -#### 码云特技 +To install pcs and pcsd run the following in terminal: +```shell +# tar -xzvf pcs-0.10.1.tar.gz +# cd pcs-0.10.1 +# make install +# make install_pcsd +``` -1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md -2. 码云官方博客 [blog.gitee.com](https://blog.gitee.com) -3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解码云上的优秀开源项目 -4. [GVP](https://gitee.com/gvp) 全称是码云最有价值开源项目,是码云综合评定出的优秀开源项目 -5. 码云官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) -6. 码云封面人物是一档用来展示码云会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) +If you are using GNU/Linux with systemd, it is now time to: +```shell +# systemctl daemon-reload +``` + +Start pcsd and make it start on boot: +```shell +# systemctl start pcsd +# systemctl enable pcsd +``` + +--- + +### Packages + +Currently this is built into Fedora, RHEL and its clones and Debian and its +derivates. +* [Fedora package git repositories](https://src.fedoraproject.org/rpms/pcs) +* [Current Kylin git repositories](https://gitee.com/openkylin/pcs) +* [Debian-HA project home page](https://wiki.debian.org/Debian-HA) + +--- + +### Quick Start + +* **Authenticate cluster nodes** + + Set the same password for the `hacluster` user on all nodes. + ```shell + # passwd hacluster + ``` + + To authenticate the nodes, run the following command on one of the nodes + (replacing node1, node2, node3 with a list of nodes in your future cluster). + Specify all your cluster nodes in the command. Make sure pcsd is running on + all nodes. + ```shell + # pcs host auth node1 node2 node3 -u hacluster + ``` + +* **Create a cluster** + + To create a cluster run the following command on one node (replacing + cluster\_name with a name of your cluster and node1, node2, node3 with a list + of nodes in the cluster). `--start` and `--enable` will start your cluster + and configure the nodes to start the cluster on boot respectively. + ```shell + # pcs cluster setup cluster_name node1 node2 node3 --start --enable + ``` + +* **Check the cluster status** + + After a few moments the cluster should startup and you can get the status of + the cluster. + ```shell + # pcs status + ``` + +* **Add cluster resources** + + After this you can add stonith agents and resources: + ```shell + # pcs -h stonith create + ``` + and + ```shell + # pcs -h resource create + ``` + +--- + +### Accessing the Web UI + +Apart from command line interface you can use web user interface to view and +configure your cluster. To access the web UI open a browser to the following +URL (replace nodename with an address of your node): +``` +https://nodename:2224 +``` +Login as the `hacluster` user. + +--- + +### Further Documentation + +[ClusterLabs website](https://clusterlabs.org) is an excellent place to learn +more about Pacemaker clusters. +* [ClusterLabs quick start](https://clusterlabs.org/quickstart.html) +* [Clusters from Scratch](https://clusterlabs.org/pacemaker/doc/en-US/Pacemaker/2.0/html/Clusters_from_Scratch/index.html) +* [ClusterLabs documentation page](https://clusterlabs.org/pacemaker/doc/) + +--- + +### Inquiries +If you have any bug reports or feature requests please feel free to open a +github issue on the pcs project. + +Alternatively you can use ClusterLabs +[users mailinglist](https://oss.clusterlabs.org/mailman/listinfo/users) +which is also a great place to ask Pacemaker clusters related questions. diff --git a/backports-3.11.4.gem b/backports-3.11.4.gem new file mode 100644 index 0000000..3412bd8 Binary files /dev/null and b/backports-3.11.4.gem differ diff --git a/ethon-0.11.0.gem b/ethon-0.11.0.gem new file mode 100644 index 0000000..adbf866 Binary files /dev/null and b/ethon-0.11.0.gem differ diff --git a/ffi-1.9.25.gem b/ffi-1.9.25.gem new file mode 100644 index 0000000..0016be0 Binary files /dev/null and b/ffi-1.9.25.gem differ diff --git a/json-2.1.0.gem b/json-2.1.0.gem new file mode 100644 index 0000000..23d69ff Binary files /dev/null and b/json-2.1.0.gem differ diff --git a/mustermann-1.0.3.gem b/mustermann-1.0.3.gem new file mode 100644 index 0000000..ec1fc87 Binary files /dev/null and b/mustermann-1.0.3.gem differ diff --git a/open4-1.3.4-1.gem b/open4-1.3.4-1.gem new file mode 100644 index 0000000..34dc1fb Binary files /dev/null and b/open4-1.3.4-1.gem differ diff --git a/pcs-0.10.2.tar.gz b/pcs-0.10.2.tar.gz new file mode 100644 index 0000000..aed1dc5 Binary files /dev/null and b/pcs-0.10.2.tar.gz differ diff --git a/pcs-web-ui-0.1.1.tar.gz b/pcs-web-ui-0.1.1.tar.gz new file mode 100644 index 0000000..051c18d Binary files /dev/null and b/pcs-web-ui-0.1.1.tar.gz differ diff --git a/pcs-web-ui-node-modules-0.1.1.tar.xz b/pcs-web-ui-node-modules-0.1.1.tar.xz new file mode 100644 index 0000000..6429f24 Binary files /dev/null and b/pcs-web-ui-node-modules-0.1.1.tar.xz differ diff --git a/pcs.spec b/pcs.spec new file mode 100644 index 0000000..16c474e --- /dev/null +++ b/pcs.spec @@ -0,0 +1,512 @@ +Name: pcs +Version: 0.10.2 +Release: 5%{?dist} +# https://fedoraproject.org/wiki/Licensing:Main?rd=Licensing#Good_Licenses +# GPLv2: pcs +# ASL 2.0: tornado +# MIT: handlebars +License: GPLv2 and ASL 2.0 and MIT +URL: https://github.com/ClusterLabs/pcs +Group: System Environment/Base +Summary: Pacemaker Configuration System +#building only for architectures with pacemaker and corosync available +ExclusiveArch: i686 x86_64 s390x ppc64le aarch64 %{arm} + +%global version_or_commit %{version} +# %%global version_or_commit f556c4adb538c8a95d763472d370f3f5d27eb38a +%global pcs_source_name %{name}-%{version_or_commit} + +# ui_commit can be determined by hash, tag or branch +%global ui_commit 0.1.1 +%global ui_src_name pcs-web-ui-%{ui_commit} + +%global pcs_snmp_pkg_name pcs-snmp + +%global pyagentx_version 0.4.pcs.2 +%global tornado_version 5.0.2 +%global version_rubygem_backports 3.11.4 +%global version_rubygem_ethon 0.11.0 +%global version_rubygem_ffi 1.9.25 +%global version_rubygem_json 2.1.0 +%global version_rubygem_mustermann 1.0.3 +%global version_rubygem_open4 1.3.4 +%global version_rubygem_rack 2.0.6 +%global version_rubygem_rack_protection 2.0.4 +%global version_rubygem_rack_test 1.0.0 +%global version_rubygem_sinatra 2.0.4 +%global version_rubygem_tilt 2.0.9 + +# We do not use _libdir macro because upstream is not prepared for it. +# Pcs does not include binaries and thus it should live in /usr/lib. Tornado +# and gems include binaries and thus it should live in /usr/lib64. But the +# path to tornado/gems is hardcoded in pcs sources. Modify hard links in pcs +# sources is not the way since then rpmdiff complains that the same file has +# different content in different architectures. +%global pcs_libdir %{_prefix}/lib +%global bundled_src_dir pcs/bundled +%global pcsd_public_dir pcsd/public +%global rubygem_cache_dir pcsd/vendor/cache +%global rubygem_bundle_dir pcsd/vendor/bundle/ruby + +# mangling shebang in /usr/lib/pcsd/vendor/bundle/ruby/gems/rack-2.0.5/test/cgi/test from /usr/bin/env ruby to #!/usr/bin/ruby +#*** ERROR: ./usr/lib/pcsd/vendor/bundle/ruby/gems/rack-2.0.5/test/cgi/test.ru has shebang which doesn't start with '/' (../../bin/rackup) +#mangling shebang in /usr/lib/pcsd/vendor/bundle/ruby/gems/rack-2.0.5/test/cgi/rackup_stub.rb from /usr/bin/env ruby to #!/usr/bin/ruby +#*** WARNING: ./usr/lib/pcsd/vendor/bundle/ruby/gems/rack-2.0.5/test/cgi/sample_rackup.ru is executable but has empty or no shebang, removing executable bit +#*** WARNING: ./usr/lib/pcsd/vendor/bundle/ruby/gems/rack-2.0.5/test/cgi/lighttpd.conf is executable but has empty or no shebang, removing executable bit +#*** ERROR: ambiguous python shebang in /usr/lib/pcsd/vendor/bundle/ruby/gems/ffi-1.9.25/ext/ffi_c/libffi/generate-darwin-source-and-headers.py: #!/usr/bin/env python. Change it to python3 (or python2) explicitly. +%undefine __brp_mangle_shebangs + +# 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} + +Source0: %{url}/archive/%{version_or_commit}/%{pcs_source_name}.tar.gz +Source1: HAM-logo.png +Source2: pcsd-bundle-config-2 + +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 + +Source81: https://rubygems.org/downloads/backports-%{version_rubygem_backports}.gem +Source82: https://rubygems.org/downloads/ethon-%{version_rubygem_ethon}.gem +Source83: https://rubygems.org/downloads/ffi-%{version_rubygem_ffi}.gem +Source84: https://rubygems.org/downloads/json-%{version_rubygem_json}.gem +Source86: https://rubygems.org/downloads/mustermann-%{version_rubygem_mustermann}.gem +# We needed to re-upload open4 rubygem because of issues with sources in gating. +# Unfortunately, there was no newer version available, therefore we had to +# change its 'version' ourselves. +Source87: https://rubygems.org/downloads/open4-%{version_rubygem_open4}.gem#/open4-%{version_rubygem_open4}-1.gem +Source88: https://rubygems.org/downloads/rack-%{version_rubygem_rack}.gem +Source89: https://rubygems.org/downloads/rack-protection-%{version_rubygem_rack_protection}.gem +Source90: https://rubygems.org/downloads/rack-test-%{version_rubygem_rack_test}.gem +Source91: https://rubygems.org/downloads/sinatra-%{version_rubygem_sinatra}.gem +Source92: https://rubygems.org/downloads/tilt-%{version_rubygem_tilt}.gem + +Source100: https://github.com/idevat/pcs-web-ui/archive/%{ui_commit}/%{ui_src_name}.tar.gz +Source101: https://github.com/idevat/pcs-web-ui/releases/download/%{ui_commit}/pcs-web-ui-node-modules-%{ui_commit}.tar.xz + +# Patches from upstream. +# They should come before downstream patches to avoid unnecessary conflicts. +# Z-streams are exception here: they can come from upstream but should be +# applied at the end to keep z-stream changes as straightforward as possible. +#Patch1: bz1676957-01-fix-crashes-in-pcs-host-auth.patch +#Patch2: bz1657166-01-Updating-a-bundle-is-a-bit-cumber.patch +#Patch3: bz1725183-01-fix-and-options-for-non-root-users.patch +#Patch4: bz1740218-01-set-authkey-length-to-256-bytes.patch + +# Downstream patches do not come from upstream. They adapt pcs for specific +# RHEL needs. +#Patch101: do-not-support-cluster-setup-with-udp-u-transport.patch + +# git for patches +BuildRequires: git +#printf from coreutils is used in makefile +BuildRequires: coreutils +BuildRequires: execstack +# python for pcs +#BuildRequires: platform-python +BuildRequires: python3-devel +#BuildRequires: platform-python-setuptools +BuildRequires: python3-pycurl +# gcc for compiling custom rubygems +BuildRequires: gcc +BuildRequires: gcc-c++ +# ruby and gems for pcsd +BuildRequires: ruby >= 2.2.0 +BuildRequires: ruby-devel +BuildRequires: rubygems +# ruby libraries for tests +BuildRequires: rubygem-test-unit +# for touching patch files (sanitization function) +BuildRequires: diffstat +# for post, preun and postun macros +BuildRequires: systemd +# for tests +BuildRequires: python3-lxml +BuildRequires: python3-pyOpenSSL +BuildRequires: pacemaker-cli >= 2.0.0 +# BuildRequires: fence-agents-all +BuildRequires: fence-agents-apc +BuildRequires: fence-agents-scsi +BuildRequires: fence-agents-ipmilan +BuildRequires: booth-site +# pcsd fonts and font management tools for creating symlinks to fonts +BuildRequires: fontconfig +BuildRequires: liberation-sans-fonts +BuildRequires: overpass-fonts +# OpenEuler logo for creating symlink of favicon +BuildRequires: openEuler-logos + +# for building web ui +BuildRequires: npm + +# python and libraries for pcs, setuptools for pcs entrypoint +#Requires: platform-python +Requires: python3-lxml +#Requires: platform-python-setuptools +Requires: python3-clufter => 0.70.0 +Requires: python3-pycurl +# ruby and gems for pcsd +Requires: ruby >= 2.2.0 +Requires: rubygems +# for killall +Requires: psmisc +# for working with certificates (validation etc.) +Requires: openssl +Requires: python3-pyOpenSSL +# cluster stack and related packages +Requires: pcmk-cluster-manager >= 2.0.0 +Suggests: pacemaker +Requires: (corosync >= 2.99 if pacemaker) +# pcs enables corosync encryption by default so we require libknet1-plugins-all +Requires: (libknet1-plugins-all if corosync) +Requires: pacemaker-cli >= 2.0.0 +# for post, preun and postun macros +Requires(post): systemd +Requires(preun): systemd +Requires(postun): systemd +# pam is used for authentication inside daemon (python ctypes) +# more details: https://bugzilla.redhat.com/show_bug.cgi?id=1717113 +Requires: pam +# pcsd fonts +Requires: liberation-sans-fonts +Requires: overpass-fonts +# favicon openeuler logo +Requires: openEuler-logos + +Provides: bundled(tornado) = %{tornado_version} +Provides: bundled(backports) = %{version_rubygem_backports} +Provides: bundled(ethon) = %{version_rubygem_ethon} +Provides: bundled(ffi) = %{version_rubygem_ffi} +Provides: bundled(json) = %{version_rubygem_json} +Provides: bundled(mustermann) = %{version_rubygem_mustermann} +Provides: bundled(open4) = %{version_rubygem_open4} +Provides: bundled(rack) = %{version_rubygem_rack} +Provides: bundled(rack) = %{version_rubygem_rack_protection} +Provides: bundled(rack) = %{version_rubygem_rack_test} +Provides: bundled(sinatra) = %{version_rubygem_sinatra} +Provides: bundled(tilt) = %{version_rubygem_tilt} + +%description +pcs is a corosync and pacemaker configuration tool. It permits users to +easily view, modify and create pacemaker based clusters. + +# pcs-snmp package definition +%package -n %{pcs_snmp_pkg_name} +Group: System Environment/Base +Summary: Pacemaker cluster SNMP agent +# 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 +BuildRequires: tar + +Requires: pcs = %{version}-%{release} +Requires: pacemaker +Requires: net-snmp + +Provides: bundled(pyagentx) = %{pyagentx_version} + +%description -n %{pcs_snmp_pkg_name} +SNMP agent that provides information about pacemaker cluster to the master agent (snmpd) + +%prep +%autosetup -p1 -S git -n %{pcs_source_name} + +# -- 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 + +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 +} + +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 %{PATCH1} +#update_times_patch %{PATCH2} +#update_times_patch %{PATCH3} +#update_times_patch %{PATCH4} +#update_times_patch %{PATCH101} + +cp -f %SOURCE1 pcsd/public/images +# prepare dirs/files necessary for building web ui +# inside SOURCE100 is only directory %%{ui_src_name} +tar -xzf %SOURCE100 -C %{pcsd_public_dir} +tar -xf %SOURCE101 -C %{pcsd_public_dir}/%{ui_src_name} + +# prepare dirs/files necessary for building all bundles +# ----------------------------------------------------- +# 1) configuration for rubygems +mkdir -p pcsd/.bundle +cp -f %SOURCE2 pcsd/.bundle/config + +# 2) rubygems sources +mkdir -p pcsd/vendor/cache +cp -f %SOURCE81 pcsd/vendor/cache +cp -f %SOURCE82 pcsd/vendor/cache +cp -f %SOURCE83 pcsd/vendor/cache +cp -f %SOURCE84 pcsd/vendor/cache +cp -f %SOURCE86 pcsd/vendor/cache +# For reason why we are renaming open4 rubygem, see comment of source +# definition above. +cp -f %SOURCE87 pcsd/vendor/cache/open4-%{version_rubygem_open4}.gem +cp -f %SOURCE88 pcsd/vendor/cache +cp -f %SOURCE89 pcsd/vendor/cache +cp -f %SOURCE90 pcsd/vendor/cache +cp -f %SOURCE91 pcsd/vendor/cache +cp -f %SOURCE92 pcsd/vendor/cache + + +# 3) dir for python bundles +mkdir -p %{bundled_src_dir} + +# 4) sources for pyagentx +tar -xzf %SOURCE41 -C %{bundled_src_dir} +mv %{bundled_src_dir}/pyagentx-%{pyagentx_version} %{bundled_src_dir}/pyagentx +update_times %SOURCE41 `find %{bundled_src_dir}/pyagentx -follow` +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 + +# 5) sources for tornado +tar -xzf %SOURCE42 -C %{bundled_src_dir} +mv %{bundled_src_dir}/tornado-%{tornado_version} %{bundled_src_dir}/tornado +update_times %SOURCE42 `find %{bundled_src_dir}/tornado -follow` +cp %{bundled_src_dir}/tornado/LICENSE tornado_LICENSE +cp %{bundled_src_dir}/tornado/README.rst tornado_README.rst + +%build +%define debug_package %{nil} + +%install +rm -rf $RPM_BUILD_ROOT +pwd + +# build bundled rubygems (in main install it is disabled by BUILD_GEMS=false) +mkdir -p %{rubygem_bundle_dir} +gem install \ + --force --verbose --no-rdoc --no-ri -l --no-user-install \ + -i %{rubygem_bundle_dir} \ + %{rubygem_cache_dir}/backports-%{version_rubygem_backports}.gem \ + %{rubygem_cache_dir}/ethon-%{version_rubygem_ethon}.gem \ + %{rubygem_cache_dir}/ffi-%{version_rubygem_ffi}.gem \ + %{rubygem_cache_dir}/json-%{version_rubygem_json}.gem \ + %{rubygem_cache_dir}/mustermann-%{version_rubygem_mustermann}.gem \ + %{rubygem_cache_dir}/open4-%{version_rubygem_open4}.gem \ + %{rubygem_cache_dir}/rack-%{version_rubygem_rack}.gem \ + %{rubygem_cache_dir}/rack-protection-%{version_rubygem_rack_protection}.gem \ + %{rubygem_cache_dir}/rack-test-%{version_rubygem_rack_test}.gem \ + %{rubygem_cache_dir}/sinatra-%{version_rubygem_sinatra}.gem \ + %{rubygem_cache_dir}/tilt-%{version_rubygem_tilt}.gem \ + -- '--with-ldflags="-Wl,-z,relro -Wl,-z,ibt -Wl,-z,now -Wl,--gc-sections"' \ + '--with-cflags="-O2 -ffunction-sections"' + +# We can remove files required for gem compilation +rm -rf %{rubygem_bundle_dir}/gems/ffi-%{version_rubygem_ffi}/ext +rm -rf %{rubygem_bundle_dir}/gems/json-%{version_rubygem_json}/ext + + +# With this file there is "File is not stripped" problem during rpmdiff +# See https://docs.engineering.redhat.com/display/HTD/rpmdiff-elf-stripping +for fname in `find %{rubygem_bundle_dir}/extensions -type f -name "*.so"`; do + strip ${fname} +done + +# build web ui and put it to pcsd +make -C %{pcsd_public_dir}/%{ui_src_name} build +mv %{pcsd_public_dir}/%{ui_src_name}/build pcsd/public/ui +rm -r %{pcsd_public_dir}/%{ui_src_name} + +# main pcs install +make install \ + DESTDIR=$RPM_BUILD_ROOT \ + PREFIX=%{_prefix} \ + SYSTEMD_UNIT_DIR=%{_unitdir} \ + LIB_DIR=%{pcs_libdir} \ + PYTHON=%{__python3} \ + PYTHON_SITELIB=%{python3_sitelib} \ + 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 \ + SYSTEMCTL_OVERRIDE=true \ + hdrdir="%{_includedir}" \ + rubyhdrdir="%{_includedir}" \ + includedir="%{_includedir}" + +# With this file there is "File is not stripped" problem during rpmdiff +# See https://docs.engineering.redhat.com/display/HTD/rpmdiff-elf-stripping +for fname in `find ${RPM_BUILD_ROOT}%{pcs_libdir}/pcs/bundled/packages/tornado/ -type f -name "*.so"`; do + strip ${fname} +done + +# symlink favicon into pcsd directories +ln -fs /etc/favicon.png ${RPM_BUILD_ROOT}%{pcs_libdir}/%{pcsd_public_dir}/images/favicon.png + +#after the ruby gem compilation we do not need ruby gems in the cache +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 +# due to python prints a warning about it to stderr. The following environment +# variable disables the warning. +# On the live system either UTF8 locale is set or the warning is emmited +# which breaks pcs. That is the correct behavior since with wrong locales it +# would be probably broken anyway. +# The main concern here is to make the tests pass. +# See https://fedoraproject.org/wiki/Changes/python3_c.utf-8_locale for details. +export PYTHONCOERCECLOCALE=0 + +run_all_tests(){ + #run pcs tests + + # disabled tests: + # + # pcs_test.tier0.lib.commands.test_resource_agent.DescribeAgentUtf8.test_describe + # For an unknown reason this test is failing in mock environment and + # passing outside the mock environment. + # TODO: Investigate the issue + + BUNDLED_LIB_LOCATION=$RPM_BUILD_ROOT%{pcs_libdir}/pcs/bundled/packages \ + %{__python3} pcs_test/suite.py -v --vanilla --all-but \ + pcs_test.tier0.lib.commands.test_resource_agent.DescribeAgentUtf8.test_describe \ + + test_result_python=$? + + #run pcsd tests and remove them + 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 + test_result_ruby=$? + + if [ $test_result_python -ne 0 ]; then + return $test_result_python + fi + return $test_result_ruby +} + +remove_all_tests() { + pcsd_dir=$RPM_BUILD_ROOT%{pcs_libdir}/pcsd + #remove pcsd tests, we do not distribute them in the rpm + rm -r -v ${pcsd_dir}/test + + # remove javascript testing files + rm -r -v ${pcsd_dir}/public/js/dev +} + +#run_all_tests +#remove_all_tests + +%post +%systemd_post pcsd.service + +%post -n %{pcs_snmp_pkg_name} +%systemd_post pcs_snmp_agent.service + +%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 +%{_sbindir}/pcs +%{_sbindir}/pcsd +%{pcs_libdir}/pcs/pcs_internal +%{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) %attr(0600,root,root) %{_sharedstatedir}/pcsd/cfgsync_ctl +%ghost %config(noreplace) %attr(0600,root,root) %{_sharedstatedir}/pcsd/known-hosts +%ghost %config(noreplace) %attr(0600,root,root) %{_sharedstatedir}/pcsd/pcsd.cookiesecret +%ghost %config(noreplace) %attr(0600,root,root) %{_sharedstatedir}/pcsd/pcsd.crt +%ghost %config(noreplace) %attr(0600,root,root) %{_sharedstatedir}/pcsd/pcsd.key +%ghost %config(noreplace) %attr(0644,root,root) %{_sharedstatedir}/pcsd/pcs_settings.conf +%ghost %config(noreplace) %attr(0644,root,root) %{_sharedstatedir}/pcsd/pcs_users.conf +%{_mandir}/man8/pcs.* +%{_mandir}/man8/pcsd.* +%exclude %{pcs_libdir}/pcsd/*.debian +%exclude %{pcs_libdir}/pcsd/pcsd.service +%exclude %{pcs_libdir}/pcsd/pcsd.conf +%exclude %{pcs_libdir}/pcsd/pcsd.8 +%exclude %{pcs_libdir}/pcsd/public/js/dev/* +%exclude %{pcs_libdir}/pcsd/Gemfile +%exclude %{pcs_libdir}/pcsd/Gemfile.lock +%exclude %{pcs_libdir}/pcsd/Makefile +%exclude %{python3_sitelib}/pcs/bash_completion +%exclude %{python3_sitelib}/pcs/pcs.8 +%exclude %{python3_sitelib}/pcs/pcs + +%files -n %{pcs_snmp_pkg_name} +%{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) %{_sysconfdir}/sysconfig/pcs_snmp_agent +%doc CHANGELOG.md +%doc pyagentx_CONTRIBUTORS.txt +%doc pyagentx_README.md +%license COPYING +%license pyagentx_LICENSE.txt + +%changelog +* Sun Apr 26 2020 wangmian - 0.10.2-5 +- Change pcs ui + +* Wed Apr 22 2020 houjian - 0.10.2-4 +- Init the project diff --git a/pcsd-bundle-config-2 b/pcsd-bundle-config-2 new file mode 100644 index 0000000..c067a62 --- /dev/null +++ b/pcsd-bundle-config-2 @@ -0,0 +1,5 @@ +--- +BUNDLE_FROZEN: '1' +BUNDLE_PATH: vendor/bundle +BUNDLE_DISABLE_SHARED_GEMS: '1' +BUNDLE_BUILD: --with-ldflags="-Wl,-z,now -Wl,-z,relro" diff --git a/pyagentx-0.4.pcs.2.tar.gz b/pyagentx-0.4.pcs.2.tar.gz new file mode 100644 index 0000000..31d5423 Binary files /dev/null and b/pyagentx-0.4.pcs.2.tar.gz differ diff --git a/rack-2.0.6.gem b/rack-2.0.6.gem new file mode 100644 index 0000000..b40363b Binary files /dev/null and b/rack-2.0.6.gem differ diff --git a/rack-protection-2.0.4.gem b/rack-protection-2.0.4.gem new file mode 100644 index 0000000..f462db8 Binary files /dev/null and b/rack-protection-2.0.4.gem differ diff --git a/rack-test-1.0.0.gem b/rack-test-1.0.0.gem new file mode 100644 index 0000000..0faf0aa Binary files /dev/null and b/rack-test-1.0.0.gem differ diff --git a/sinatra-2.0.4.gem b/sinatra-2.0.4.gem new file mode 100644 index 0000000..04a17f5 Binary files /dev/null and b/sinatra-2.0.4.gem differ diff --git a/tilt-2.0.9.gem b/tilt-2.0.9.gem new file mode 100644 index 0000000..c9594ba Binary files /dev/null and b/tilt-2.0.9.gem differ diff --git a/tornado-5.0.2.tar.gz b/tornado-5.0.2.tar.gz new file mode 100644 index 0000000..35df595 Binary files /dev/null and b/tornado-5.0.2.tar.gz differ