Sync from SUSE:SLFO:Main hawk2 revision b93622147b46c7fe09d293b90e2ccb72

This commit is contained in:
Adrian Schröter 2025-02-06 18:22:04 +01:00
commit bcf5ffe6d0
9 changed files with 3416 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

20
_service Normal file
View File

@ -0,0 +1,20 @@
<services>
<service name="tar_scm" mode="disabled">
<param name="url">https://github.com/ClusterLabs/hawk.git</param>
<param name="scm">git</param>
<param name="exclude">.git</param>
<param name="filename">hawk2</param>
<param name="versionformat">2.6.6+git.%ct.%h</param>
<param name="revision">master</param>
<param name="changesgenerate">enable</param>
</service>
<service name="recompress" mode="disabled">
<param name="file">hawk2*.tar</param>
<param name="compression">bz2</param>
</service>
<service name="set_version" mode="disabled">
<param name="basename">hawk2</param>
</service>
</services>

4
_servicedata Normal file
View File

@ -0,0 +1,4 @@
<servicedata>
<service name="tar_scm">
<param name="url">https://github.com/ClusterLabs/hawk.git</param>
<param name="changesrevision">04dc953dfea67ca886f865571f3153c00837af93</param></service></servicedata>

11
hawk-rpmlintrc Normal file
View File

@ -0,0 +1,11 @@
addFilter("non-executable-script .*/srv/www/hawk/vendor/*")
addFilter("script-without-shebang .*/srv/www/hawk/vendor/*")
addFilter("wrong-script-end-of-line-encoding .*/srv/www/hawk/vendor/*")
addFilter("file-not-in-%lang .*/srv/www/hawk/vendor/*")
addFilter("hidden-file-or-dir .*/srv/www/hawk/vendor/*")
addFilter("zero-length .*/srv/www/hawk/vendor/*")
addFilter("unexpanded-macro .*/srv/www/hawk/vendor/bundle")
addFilter("hidden-file-or-dir /srv/www/hawk/.bundle")
addFilter("dangling-symlink /srv/www/hawk/public/doc/")
addFilter("zero-length .*/srv/www/hawk/public/assets/*")
addFilter("no-manual-page-for-binary hawk_*")

BIN
hawk2-2.6.6+git.1734344973.d7058a83.tar.bz2 (Stored with Git LFS) Normal file

Binary file not shown.

2971
hawk2.changes Normal file

File diff suppressed because it is too large Load Diff

259
hawk2.spec Normal file
View File

@ -0,0 +1,259 @@
#
# spec file for package hawk2
#
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
#Compat macro for new _fillupdir macro introduced in Nov 2017
%if ! %{defined _fillupdir}
%define _fillupdir /var/adm/fillup-templates
%endif
%define vendor_ruby vendor_ruby
%define init_style suse
%define pkg_group Productivity/Clustering/HA
%define www_base %{_datadir}
%define www_tmp %{_localstatedir}/lib/hawk/tmp
%define www_log %{_localstatedir}/log/hawk
%define gname haclient
%define uname hacluster
%define rb_build_versions %{rb_default_ruby}
%define rb_build_abi %{rb_default_ruby_abi}
%define rb_suffix %{rb_default_ruby_suffix}
Name: hawk2
Summary: HA Web Konsole
License: GPL-2.0-only
Group: %{pkg_group}
Version: 2.6.6+git.1734344973.d7058a83
Release: 0
URL: http://www.clusterlabs.org/wiki/Hawk
Source: %{name}-%{version}.tar.bz2
Source1: sysconfig.hawk
Source100: hawk-rpmlintrc
Patch1: make-sle16-compatible.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Provides: ha-cluster-webui
Obsoletes: hawk <= 1.1.0
Provides: hawk = %{version}
Requires: crmsh >= 3.0.0
Requires: graphviz
Requires: graphviz-gd
Requires: hawk-apiserver
Requires(post): %fillup_prereq
# Need a font of some kind for graphviz to work correctly (bsc#931950)
Requires: dejavu
Requires: pacemaker >= 1.1.8
Recommends: graphviz-gnome
Requires: iproute2
PreReq: permissions
BuildRequires: fdupes
BuildRequires: systemd-rpm-macros
%{?systemd_requires}
# declare the user/group we create in the preinstall script
Provides: user(%{uname})
Provides: group(%{gname})
BuildRequires: distribution-release
BuildRequires: timezone
BuildRequires: rubygem(%{rb_build_abi}:bundler)
Requires: rubygem(%{rb_build_abi}:bundler)
BuildRequires: rubygem(%{rb_build_abi}:rails) >= 8
Requires: rubygem(%{rb_build_abi}:rails) >= 8
BuildRequires: rubygem(%{rb_build_abi}:websocket-driver:0.7.6)
Requires: rubygem(%{rb_build_abi}:websocket-driver:0.7.6)
BuildRequires: rubygem(%{rb_build_abi}:puma) >= 5
Requires: rubygem(%{rb_build_abi}:puma) >= 5
BuildRequires: rubygem(%{rb_build_abi}:sass-rails) >= 6
Requires: rubygem(%{rb_build_abi}:sass-rails) >= 6
BuildRequires: rubygem(%{rb_build_abi}:virtus) >= 1.0.1
Requires: rubygem(%{rb_build_abi}:virtus) >= 1.0.1
BuildRequires: rubygem(%{rb_build_abi}:js-routes) >= 2.0.0
Requires: rubygem(%{rb_build_abi}:js-routes) >= 2.0.0
BuildRequires: rubygem(%{rb_build_abi}:fast_gettext) >= 1.4
Requires: rubygem(%{rb_build_abi}:fast_gettext) >= 1.4
BuildRequires: rubygem(%{rb_build_abi}:gettext_i18n_rails) >= 1.8
Requires: rubygem(%{rb_build_abi}:gettext_i18n_rails) >= 1.8
BuildRequires: rubygem(%{rb_build_abi}:gettext_i18n_rails_js) >= 1.3
Requires: rubygem(%{rb_build_abi}:gettext_i18n_rails_js) >= 1.3
BuildRequires: rubygem(%{rb_build_abi}:sprockets:4.2)
Requires: rubygem(%{rb_build_abi}:sprockets:4.2)
BuildRequires: rubygem(%{rb_build_abi}:kramdown) >= 1.14
Requires: rubygem(%{rb_build_abi}:kramdown) >= 1.14
BuildRequires: rubygem(%{rb_build_abi}:mini_mime) >= 1.1.5
Requires: rubygem(%{rb_build_abi}:mini_mime) >= 1.1.5
# TODO: remove uglifier completely
BuildRequires: rubygem(%{rb_build_abi}:uglifier) >= 1.14
Requires: rubygem(%{rb_build_abi}:uglifier) >= 1.14
BuildRequires: rubygem(%{rb_build_abi}:execjs) >= 2.8
BuildRequires: rubygem(%{rb_build_abi}:gettext) >= 3.2
BuildRequires: rubygem(%{rb_build_abi}:uglifier) >= 3
# TODO: remove execjs below
Requires: rubygem(%{rb_build_abi}:execjs) >= 2.8
# Help OBS scheduler:
BuildRequires: rubygem(%{rb_build_abi}:mail) >= 2.8
BuildRequires: rubygem(%{rb_build_abi}:tilt) >= 2
#/Help OBS scheduler
BuildRequires: git
BuildRequires: nodejs >= 10
BuildRequires: pam-devel
BuildRequires: shadow
%description
A web-based GUI for managing and monitoring the Pacemaker
High-Availability cluster resource manager.
%prep
%autosetup -p1
%build
sed -i 's$#!/.*$#!%{_bindir}/ruby.%{rb_suffix}$' hawk/bin/rails
sed -i 's$#!/.*$#!%{_bindir}/ruby.%{rb_suffix}$' hawk/bin/rake
sed -i 's$#!/.*$#!%{_bindir}/ruby.%{rb_suffix}$' hawk/bin/bundle
pushd hawk
if [ -x /usr/bin/bundle.ruby.%{rb_suffix} ]; then
bundlerexe=bundle.ruby.%{rb_suffix}
else
bundlerexe=bundle.%{rb_suffix}
fi
$bundlerexe exec bin/rails version
popd
export NOKOGIRI_USE_SYSTEM_LIBRARIES=1
CFLAGS="${CFLAGS} ${RPM_OPT_FLAGS}"
export CFLAGS
make WWW_BASE=%{www_base} WWW_TMP=%{www_tmp} WWW_LOG=%{www_log} INIT_STYLE=%{init_style} LIBDIR=%{_libdir} BINDIR=%{_bindir} SBINDIR=%{_sbindir} RUBY_SUFFIX=.%{rb_suffix}
# We need the Gemfile.lock only to set the permissions
# (see %attr(-, %{uname},%{gname})%{www_base}/hawk/Gemfile.lock)
# The content shoulhawk/Gemfile.lockd be generated locally.
# Btw, I tried "> hawk/Gemfile.lock" instead of "rm + touch"
# but there was a checksum error. So let's do "rm + touch".
rm hawk/Gemfile.lock
touch hawk/Gemfile.lock
%install
make WWW_BASE=%{www_base} WWW_TMP=%{www_tmp} WWW_LOG=%{www_log} INIT_STYLE=%{init_style} DESTDIR=%{buildroot} install
# copy of GPL
cp COPYING %{buildroot}%{www_base}/hawk/
# Hack so missing links to docs don't kill the build
mkdir -p %{buildroot}/usr/share/doc/manual/sle-ha-geo-quick_en-pdf
mkdir -p %{buildroot}/usr/share/doc/manual/sle-ha-guide_en-pdf
mkdir -p %{buildroot}/usr/share/doc/manual/sle-ha-manuals_en
mkdir -p %{buildroot}/usr/share/doc/manual/sle-ha-geo-manuals_en
mkdir -p %{buildroot}/usr/share/doc/manual/sle-ha-nfs-quick_en-pdf
mkdir -p %{buildroot}/usr/share/doc/manual/sle-ha-install-quick_en-pdf
# mark .mo files as such (works on SUSE but not FC12, as the latter wants directory to
# be "share/locale", not just "locale", and it also doesn't support appending to %%{name}.lang)
%find_lang hawk hawk.lang
# don't ship .po files (find_lang only grabs the mos, and we don't need the pos anyway)
rm %{buildroot}%{www_base}/hawk/locale/*/hawk.po
rm %{buildroot}%{www_base}/hawk/locale/*/hawk.po.time_stamp
rm %{buildroot}%{www_base}/hawk/locale/*/hawk.edit.po
# hard link duplicate files
%fdupes %{buildroot}
# more cruft to clean up (WTF?)
rm -f %{buildroot}%{www_log}/*
# likewise .git special files
find %{buildroot}%{www_base}/hawk -type f -name '.git*' -print0 | xargs --no-run-if-empty -0 rm
%{__ln_s} -f %{_sbindir}/service %{buildroot}%{_sbindir}/rchawk
install -p -d -m 755 %{buildroot}%{_sysconfdir}/hawk
install -D -m 0644 %{S:1} %{buildroot}%{_fillupdir}/sysconfig.hawk
%clean
rm -rf %{buildroot}
%verifyscript
%verify_permissions -e %{_sbindir}/hawk_chkpwd
%pre
getent group %{gname} >/dev/null || groupadd -r %{gname} -g 189
getent passwd %{uname} >/dev/null || useradd -r -g %{gname} -u 189 -s /sbin/nologin -c "cluster user" %{uname}
%service_add_pre hawk.service hawk-backend.service
%post
%set_permissions %{_sbindir}/hawk_chkpwd
%service_add_post hawk.service hawk-backend.service
%{fillup_only -n hawk}
%preun
%service_del_preun hawk.service hawk-backend.service
%postun
%service_del_postun hawk.service hawk-backend.service
%files -f hawk.lang
%defattr(644,root,root,755)
%{_fillupdir}/sysconfig.hawk
%attr(4750, root, %{gname})%{_sbindir}/hawk_chkpwd
%dir %{www_base}/hawk
# To let the hacluster write the hawk/Gemfile.lock
%attr(-, %{uname},%{gname})%{www_base}/hawk/Gemfile.lock
%{www_base}/hawk/log
%{www_base}/hawk/tmp
%{www_base}/hawk/app
%{www_base}/hawk/config
%dir %{_localstatedir}/lib/hawk
%dir %{www_base}/hawk/bin
%attr(0755, root, root)%{www_base}/hawk/bin/rake
%attr(0755, root, root)%{www_base}/hawk/bin/rails
%exclude %{www_base}/hawk/bin/hawk
%attr(0755, root, root)%{www_base}/hawk/bin/generate-ssl-cert
%attr(0755, root, root)%{www_base}/hawk/bin/bundle
%attr(0750, %{uname},%{gname})%{_sysconfdir}/hawk
%dir %attr(0750, %{uname},%{gname})%{www_log}
%dir %attr(0750, %{uname},%{gname})%{www_tmp}
%attr(-, %{uname},%{gname})%{www_tmp}/cache
%attr(-, %{uname},%{gname})%{www_tmp}/explorer
%attr(-, %{uname},%{gname})%{www_tmp}/home
%attr(-, %{uname},%{gname})%{www_tmp}/pids
%attr(-, %{uname},%{gname})%{www_tmp}/sessions
%attr(-, %{uname},%{gname})%{www_tmp}/sockets
%{www_base}/hawk/locale/hawk.pot
%{www_base}/hawk/public
%{www_base}/hawk/Rakefile
# We want Gemfile to explicitelly tell puma which gems to use
%{www_base}/hawk/Gemfile
%{www_base}/hawk/Gemfile.lock
%{www_base}/hawk/COPYING
%{www_base}/hawk/config.ru
%{www_base}/hawk/test
%{www_base}/hawk/spec
# itemizing content in %%{www_base}/hawk/locale to avoid
# duplicate files that would otherwise be the result of including hawk.lang
%dir %{www_base}/hawk/locale
%dir %{www_base}/hawk/locale/*
%dir %{www_base}/hawk/locale/*/*
# Not doing this itemization for %%lang files in vendor, it's frightfully
# hideous, so we're going to live with a handful of file-not-in-%%lang rpmlint
# warnings for bundled gems.
%{www_base}/hawk/vendor
%{_unitdir}/hawk.service
%{_unitdir}/hawk-backend.service
%attr(-,root,root) %{_sbindir}/rchawk
%changelog

View File

@ -0,0 +1,66 @@
Index: hawk2-2.6.6+git.1734344973.d7058a83/hawk/Gemfile
===================================================================
--- hawk2-2.6.6+git.1734344973.d7058a83.orig/hawk/Gemfile
+++ hawk2-2.6.6+git.1734344973.d7058a83/hawk/Gemfile
@@ -16,15 +16,15 @@
# trying to build packaged software?
#
-gem "rails", ">= 5.1"
+gem "rails", ">= 7.0"
gem "puma", ">= 4.3.5"
-gem "sass-rails", ">= 5.0"
+gem "sass-rails", ">= 6.0"
gem "virtus", ">= 1.0.1"
-gem "js-routes", ">= 1.4.1"
+gem "js-routes", ">= 2.0.0"
gem "fast_gettext", ">= 1.4"
gem "gettext_i18n_rails", ">= 1.8"
gem "gettext_i18n_rails_js", ">= 1.3"
-gem "sprockets", "~> 3.7"
+gem "sprockets", "~> 4.2"
gem "kramdown", ">= 1.14"
gem "uglifier", ">= 3"
Index: hawk2-2.6.6+git.1734344973.d7058a83/hawk/config/application.rb
===================================================================
--- hawk2-2.6.6+git.1734344973.d7058a83.orig/hawk/config/application.rb
+++ hawk2-2.6.6+git.1734344973.d7058a83/hawk/config/application.rb
@@ -44,6 +44,11 @@ module Hawk
config.middleware.use Rack::Deflater
end
+ JsRoutes.setup do |config|
+ config.module_type = nil
+ config.namespace = "Routes"
+ end
+
config.x.hawk_is_sles = system("cat /etc/os-release | grep 'ID=.*sles' >/dev/null 2>&1")
def lookup_daemon_dir
Index: hawk2-2.6.6+git.1734344973.d7058a83/hawk/config/boot.rb
===================================================================
--- hawk2-2.6.6+git.1734344973.d7058a83.orig/hawk/config/boot.rb
+++ hawk2-2.6.6+git.1734344973.d7058a83/hawk/config/boot.rb
@@ -38,7 +38,7 @@ else
gem "virtus", version: "~> 1.0"
require "virtus"
- gem "js-routes", version: ">= 1.3.3"
+ gem "js-routes", version: ">= 2.0.0"
require "js-routes"
gem "fast_gettext", version: "~> 1.4"
Index: hawk2-2.6.6+git.1734344973.d7058a83/hawk/config/environments/development.rb
===================================================================
--- hawk2-2.6.6+git.1734344973.d7058a83.orig/hawk/config/environments/development.rb
+++ hawk2-2.6.6+git.1734344973.d7058a83/hawk/config/environments/development.rb
@@ -27,7 +27,7 @@ Rails.application.configure do
config.cache_store = :memory_store
- config.assets.debug = true
+ config.assets.debug = false
config.assets.raise_runtime_errors = true
config.assets.js_compressor = nil
config.assets.css_compressor = nil

59
sysconfig.hawk Normal file
View File

@ -0,0 +1,59 @@
## Path: Cluster/Hawk
## Description: Mode of operation
## Type: string(production,development,test)
## Default: production
## ServiceRestart: hawk
# Hawk can run in production, development or test mode. Normally, this
# determines which database is used, but it may also have other
# implications.
HAWK_ENV="production"
## Path: Cluster/Hawk
## Description: Maximum number of threads
## Type: integer
## Default: 1
## ServiceRestart: hawk
# Sets the maximum number of threads used by the web server.
HAWK_THREADS="16"
## Path: Cluster/Hawk
## Description: Maximum number of worker processes
## Type: integer
## Default: 2
## ServiceRestart: hawk
# Sets the maximum number of separate worker processes spawned by the
# web server.
HAWK_WORKERS="1"
## Path: Cluster/Hawk
## Description: Listen address
## Type: ip
## Default: 0.0.0.0
## ServiceRestart: hawk
# Network address which Hawk listens to for connections.
HAWK_LISTEN="0.0.0.0"
## Path: Cluster/Hawk
## Description: Port
## Type: integer(0:65565)
## Default: 7630
## ServiceRestart: hawk
# Port which Hawk listens to.
HAWK_PORT="7630"
## Path: Cluster/Hawk
## Description: SSL key used by the web server
## Type: string
## Default: /etc/hawk/hawk.key
## ServiceRestart: hawk
# Configures an SSL key that the Hawk web server presents.
HAWK_KEY="/etc/hawk/hawk.key"
## Path: Cluster/Hawk
## Description: SSL certificate used by the web server
## Type: string
## Default: /etc/hawk/hawk.pem
## ServiceRestart: hawk
# Configures an SSL certificate that the Hawk web server presents.
HAWK_CERT="/etc/hawk/hawk.pem"