From 80147f6d37eb925d8ca67bbcc5ec936a3ee6d602 Mon Sep 17 00:00:00 2001 From: Adam Samalik Date: Tue, 2 May 2023 13:07:15 +0200 Subject: [PATCH] initial import --- .gitignore | 1 + ...llow-dashes-underscores-in-nodenames.patch | 38 +++++++++ gating.yaml | 6 ++ sap-cluster-connector.spec | 81 +++++++++++++++++++ sources | 1 + tests/run_tests.sh | 18 +++++ tests/tests.yml | 13 +++ 7 files changed, 158 insertions(+) create mode 100644 .gitignore create mode 100644 bz1827096-sap-cluster-connector-allow-dashes-underscores-in-nodenames.patch create mode 100644 gating.yaml create mode 100644 sap-cluster-connector.spec create mode 100644 sources create mode 100755 tests/run_tests.sh create mode 100644 tests/tests.yml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..cc20e3d --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/sap_cluster_connector-f3644f5.tar.gz diff --git a/bz1827096-sap-cluster-connector-allow-dashes-underscores-in-nodenames.patch b/bz1827096-sap-cluster-connector-allow-dashes-underscores-in-nodenames.patch new file mode 100644 index 0000000..377ea85 --- /dev/null +++ b/bz1827096-sap-cluster-connector-allow-dashes-underscores-in-nodenames.patch @@ -0,0 +1,38 @@ +From 42d6ce2143f4439fed8c8b31e03dde655f1bbadb Mon Sep 17 00:00:00 2001 +From: Frank Danapfel +Date: Tue, 21 Apr 2020 14:11:36 +0200 +Subject: [PATCH] Allow nodenames with dashes and/or underscores in lsn + function + +--- + redhat/sap_cluster_connector | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/redhat/sap_cluster_connector b/redhat/sap_cluster_connector +index a88b27a..6250887 100755 +--- a/redhat/sap_cluster_connector ++++ b/redhat/sap_cluster_connector +@@ -401,7 +401,7 @@ sub list_sap_nodes { + chomp $crm_res_location_in; + #printf "DBG: where-result: %s\n", $crm_res_location_in; + my $current_node=""; +- if ( $crm_res_location_in =~ /^resource\s+(\w)+\sis running on:\s+(\w+)\W*/ ) { ++ if ( $crm_res_location_in =~ /^resource\s+(\w)+\sis running on:\s+([a-zA-Z0-9_-]+)/ ) { + #printf "DBG: where-result: match\n"; + $current_node = $2; + } +@@ -425,12 +425,12 @@ sub list_sap_nodes { + while () { + chomp; + # printf "%s\n", $_; +- if ( /^group_color:\s*(\w+)\s+allocation score on\s+(\w+):\s+(.*)$/ ) { ++ if ( /^group_color:\s*(\w+)\s+allocation score on\s+([a-zA-Z0-9_-]+):\s+(.*)$/ ) { + # printf "DBG: group 1: %s, 2: %s, 3: %s\n", $1, $2, $3; + $resource{$1}->{nodes}->{$2}->{gc}=$3; + push(@{$resource{$1}->{priorities}->{$3}}, $2); + } +- if ( /^native_color:\s*(\w+)\s+allocation score on\s+(\w+):\s+(.*)$/ ) { ++ if ( /^native_color:\s*(\w+)\s+allocation score on\s+([a-zA-Z0-9_-]+):\s+(.*)$/ ) { + # printf "DBG: native 1: %s, 2: %s, 3: %s\n", $1, $2, $3; + $resource{$1}->{nodes}->{$2}->{nc}=$3; + push(@{$resource{$1}->{priorities}->{$3}}, $2); diff --git a/gating.yaml b/gating.yaml new file mode 100644 index 0000000..6985029 --- /dev/null +++ b/gating.yaml @@ -0,0 +1,6 @@ +--- !Policy +product_versions: + - rhel-8 +decision_context: osci_compose_gate +rules: + - !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional} diff --git a/sap-cluster-connector.spec b/sap-cluster-connector.spec new file mode 100644 index 0000000..8ec08e8 --- /dev/null +++ b/sap-cluster-connector.spec @@ -0,0 +1,81 @@ +# +# 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. +# + +# Below is the script used to generate a new source file +# from the sap_cluster_connector upstream git repo. +# +# TAG=$(git log --pretty="format:%h" -n 1) +# distdir="sap_cluster_connector-${TAG}" +# TARFILE="${distdir}.tar.gz" +# rm -rf $TARFILE $distdir +# git archive --prefix=$distdir/ HEAD | gzip > $TARFILE +# + +%global sap_script_prefix sap_cluster_connector +%global sap_script_hash f3644f5 + +Name: sap-cluster-connector +Summary: SAP cluster connector script +Version: 3.0.1 +Release: 5%{?rcver:%{rcver}}%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist} +License: GPLv2+ +URL: https://github.com/fdanapfel/sap_cluster_connector +%if 0%{?fedora} || 0%{?centos_version} || 0%{?rhel} +Group: System Environment/Base +%else +Group: Productivity/Clustering/HA +%endif +Source0: %{sap_script_prefix}-%{sap_script_hash}.tar.gz +Patch0: bz1827096-sap-cluster-connector-allow-dashes-underscores-in-nodenames.patch + +BuildArch: noarch + +Requires: resource-agents-sap >= 4.1.1-28 +Requires: perl + +%description +The SAP connector script interface with Pacemaker to allow SAP +instances to be managed in a cluster environment. + +%prep +%setup -q -n %{sap_script_prefix}-%{sap_script_hash} +%patch0 -p1 + +%build + +%install +test -d %{buildroot}/%{_bindir} || mkdir -p %{buildroot}/%{_bindir} +mkdir -p %{buildroot}/%{_datadir}/sap_cluster_connector +mkdir -p %{buildroot}/%{_mandir}/man8 +cp redhat/sap_cluster_connector %{buildroot}/%{_bindir} +cp -rv redhat/{run_checks,checks} %{buildroot}/%{_datadir}/sap_cluster_connector +gzip redhat/man/*.8 +cp redhat/man/*.8.gz %{buildroot}/%{_mandir}/man8 + +%clean +rm -rf %{buildroot} + +%files +%defattr(-,root,root) +%{_bindir}/sap_cluster_connector +%{_mandir}/man8/sap_cluster_connector* +%{_datadir}/sap_cluster_connector + +%changelog +* Thu Apr 30 2020 Oyvind Albrigtsen - 3.0.1-5 +- sap-cluster-connector: allow dashes/underscores in nodenames + + Resolves: rhbz#1827096 + +* Tue Jun 25 2019 Oyvind Albrigtsen - 3.0.1-4 +- Initial build as separate package + + Resolves: rhbz#1688346 diff --git a/sources b/sources new file mode 100644 index 0000000..23c5433 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (sap_cluster_connector-f3644f5.tar.gz) = 9b4e85f9c5e28cb7416ceba11e381dcf51c4c4f49df427e771317650d768cce816dd2bb029b0de103761511940b4de2c01e610e2281d519d41b1e9c2d84d9033 diff --git a/tests/run_tests.sh b/tests/run_tests.sh new file mode 100755 index 0000000..26456d2 --- /dev/null +++ b/tests/run_tests.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +err=0 + +for bin in "sap_cluster_connector help"; do + output="$($bin 2>&1)" + if [ $? -ne 0 ]; then + echo -e "ERROR: $bin failed:\n$output" + err=$((err+1)) + else + echo "INFO: $bin works..." + fi +done + +if [ $err -ge 1 ]; then + echo -e "\nERROR: $err tests FAILED..." + exit 1 +fi diff --git a/tests/tests.yml b/tests/tests.yml new file mode 100644 index 0000000..599794d --- /dev/null +++ b/tests/tests.yml @@ -0,0 +1,13 @@ +- hosts: localhost + roles: + - role: standard-test-basic + tags: + - classic + - container + required_packages: + - sap-cluster-connector + + tests: + - subpackage_tests: + dir: . + run: ./run_tests.sh