Compare commits

...

2 Commits

Author SHA1 Message Date
Than Ngo 20c4f3e892 - fix typo
Related: RHEL-16895
2024-01-25 20:07:21 +01:00
Than Ngo 45c5658483 - add tests and tools
- fix bash and python shebangs
Related: RHEL-16895
2024-01-25 18:20:37 +01:00
3 changed files with 1840 additions and 1 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,128 @@
commit 83db825f7f30445408efa6061631d8dd0590e891
Author: Than Ngo <than@redhat.com>
Date: Thu Jan 25 16:17:21 2024 +0100
add missing tools folders
Signed-off-by: Than Ngo <than@redhat.com>
diff --git a/roles/sap_general_preconfigure/tools/beautify-assert-output.sh b/roles/sap_general_preconfigure/tools/beautify-assert-output.sh
new file mode 100755
index 0000000..f48087c
--- /dev/null
+++ b/roles/sap_general_preconfigure/tools/beautify-assert-output.sh
@@ -0,0 +1,34 @@
+#!/bin/bash
+
+# default font color: Light Cyan, which should be readable on both bright and dark background
+__FONT_COLOR=36m
+
+if [[ ${1}. == "font_light_gray". ]]; then
+ __FONT_COLOR=37m
+elif [[ ${1}. == "font_no_color". ]]; then
+ __FONT_COLOR=30m
+fi
+
+if [[ ${2}. == "reset." ]]; then
+ awk 'BEGIN{printf ("\033['${__FONT_COLOR}'Resetting font color\n")}'
+ exit
+fi
+
+awk '{sub (" \"msg\": ", "")}
+ /TASK/{task_line=$0}
+ /fatal:/{fatal_line=$0; nfatal[host]++}
+ /...ignoring/{nfatal[host]--; if (nfatal[host]<0) nfatal[host]=0}
+ /^[a-z]/&&/: \[/{gsub ("\\[", ""); gsub ("]", ""); gsub (":", ""); host=$2}
+ /SAP note/{print "\033['${__FONT_COLOR}'[" host"] "$0}
+ /FAIL:/{nfail[host]++; print "\033[31m[" host"] "$0}
+ /WARN:/{nwarn[host]++; print "\033[33m[" host"] "$0}
+ /PASS:/{npass[host]++; print "\033[32m[" host"] "$0}
+ /INFO:/{print "\033[34m[" host"] "$0}
+ /changed/&&/unreachable/{print "\033['${__FONT_COLOR}'[" host"] "$0}
+ END{print ("---"); for (var in npass) {printf ("[%s] ", var); if (nfatal[var]>0) {
+ printf ("\033[31mFATAL ERROR!!! Playbook might have been aborted!!!\033['${__FONT_COLOR}' Last TASK and fatal output:\n"); print task_line, fatal_line
+ exit 199
+ }
+ else printf ("\033[31mFAIL: %d \033[33mWARN: %d \033[32mPASS: %d\033['${__FONT_COLOR}'\n", nfail[var], nwarn[var], npass[var])}
+ if (nfail[var] != 0) exit (nfail[var])
+ }'
diff --git a/roles/sap_hana_preconfigure/tools/beautify-assert-output.sh b/roles/sap_hana_preconfigure/tools/beautify-assert-output.sh
new file mode 100755
index 0000000..f48087c
--- /dev/null
+++ b/roles/sap_hana_preconfigure/tools/beautify-assert-output.sh
@@ -0,0 +1,34 @@
+#!/bin/bash
+
+# default font color: Light Cyan, which should be readable on both bright and dark background
+__FONT_COLOR=36m
+
+if [[ ${1}. == "font_light_gray". ]]; then
+ __FONT_COLOR=37m
+elif [[ ${1}. == "font_no_color". ]]; then
+ __FONT_COLOR=30m
+fi
+
+if [[ ${2}. == "reset." ]]; then
+ awk 'BEGIN{printf ("\033['${__FONT_COLOR}'Resetting font color\n")}'
+ exit
+fi
+
+awk '{sub (" \"msg\": ", "")}
+ /TASK/{task_line=$0}
+ /fatal:/{fatal_line=$0; nfatal[host]++}
+ /...ignoring/{nfatal[host]--; if (nfatal[host]<0) nfatal[host]=0}
+ /^[a-z]/&&/: \[/{gsub ("\\[", ""); gsub ("]", ""); gsub (":", ""); host=$2}
+ /SAP note/{print "\033['${__FONT_COLOR}'[" host"] "$0}
+ /FAIL:/{nfail[host]++; print "\033[31m[" host"] "$0}
+ /WARN:/{nwarn[host]++; print "\033[33m[" host"] "$0}
+ /PASS:/{npass[host]++; print "\033[32m[" host"] "$0}
+ /INFO:/{print "\033[34m[" host"] "$0}
+ /changed/&&/unreachable/{print "\033['${__FONT_COLOR}'[" host"] "$0}
+ END{print ("---"); for (var in npass) {printf ("[%s] ", var); if (nfatal[var]>0) {
+ printf ("\033[31mFATAL ERROR!!! Playbook might have been aborted!!!\033['${__FONT_COLOR}' Last TASK and fatal output:\n"); print task_line, fatal_line
+ exit 199
+ }
+ else printf ("\033[31mFAIL: %d \033[33mWARN: %d \033[32mPASS: %d\033['${__FONT_COLOR}'\n", nfail[var], nwarn[var], npass[var])}
+ if (nfail[var] != 0) exit (nfail[var])
+ }'
diff --git a/roles/sap_netweaver_preconfigure/tools/beautify-assert-output.sh b/roles/sap_netweaver_preconfigure/tools/beautify-assert-output.sh
new file mode 100755
index 0000000..f48087c
--- /dev/null
+++ b/roles/sap_netweaver_preconfigure/tools/beautify-assert-output.sh
@@ -0,0 +1,34 @@
+#!/bin/bash
+
+# default font color: Light Cyan, which should be readable on both bright and dark background
+__FONT_COLOR=36m
+
+if [[ ${1}. == "font_light_gray". ]]; then
+ __FONT_COLOR=37m
+elif [[ ${1}. == "font_no_color". ]]; then
+ __FONT_COLOR=30m
+fi
+
+if [[ ${2}. == "reset." ]]; then
+ awk 'BEGIN{printf ("\033['${__FONT_COLOR}'Resetting font color\n")}'
+ exit
+fi
+
+awk '{sub (" \"msg\": ", "")}
+ /TASK/{task_line=$0}
+ /fatal:/{fatal_line=$0; nfatal[host]++}
+ /...ignoring/{nfatal[host]--; if (nfatal[host]<0) nfatal[host]=0}
+ /^[a-z]/&&/: \[/{gsub ("\\[", ""); gsub ("]", ""); gsub (":", ""); host=$2}
+ /SAP note/{print "\033['${__FONT_COLOR}'[" host"] "$0}
+ /FAIL:/{nfail[host]++; print "\033[31m[" host"] "$0}
+ /WARN:/{nwarn[host]++; print "\033[33m[" host"] "$0}
+ /PASS:/{npass[host]++; print "\033[32m[" host"] "$0}
+ /INFO:/{print "\033[34m[" host"] "$0}
+ /changed/&&/unreachable/{print "\033['${__FONT_COLOR}'[" host"] "$0}
+ END{print ("---"); for (var in npass) {printf ("[%s] ", var); if (nfatal[var]>0) {
+ printf ("\033[31mFATAL ERROR!!! Playbook might have been aborted!!!\033['${__FONT_COLOR}' Last TASK and fatal output:\n"); print task_line, fatal_line
+ exit 199
+ }
+ else printf ("\033[31mFAIL: %d \033[33mWARN: %d \033[32mPASS: %d\033['${__FONT_COLOR}'\n", nfail[var], nwarn[var], npass[var])}
+ if (nfail[var] != 0) exit (nfail[var])
+ }'

View File

@ -45,7 +45,7 @@
Name: %{package_name}
Summary: System Roles to configure RHEL for running SAP NetWeaver- or SAP HANA-based products
Version: 3.6.0
Release: 1%{?dist}
Release: 3%{?dist}
License: GPL-3.0-or-later
Url: https://github.com/redhat-sap/community.sap_install
Source0: https://github.com/linux-system-roles/auto-maintenance/archive/%{mainid}/auto-maintenance-%{mainid}.tar.gz
@ -68,6 +68,12 @@ Patch4: redhat.sap_install-ed9bc223635d3e08661b506fdb9d62aef56032b0.patch
# add collection files
Patch5: redhat.sap_install-a5b1b5d4e79bebafd9ba75926dc56ada53f28e2d.patch
# add tests files
Patch6: redhat.sap_install-1.3.4-add_tests.patch
# add tools files
Patch7: redhat.sap_install-1.3.4-add_tools.patch
BuildArch: noarch
Requires: rhel-system-roles
@ -146,12 +152,18 @@ sed -i -e "s|for POWER ||g" roles/sap_hana_preconfigure/README.md
%patch -P3 -p1
%patch -P4 -p1
%patch -P5 -p1
%patch -P6 -p1
%patch -P7 -p1
popd
# remove zero file and symlinks
find . -type f -size 0 -delete
find . -type l -delete
# fix python and bash shebangs
find -type f \( -iname "*.py" \) -exec sed -i '1s=^#! */usr/bin/\(python\|env python\)[23]\?=#!/usr/bin/python3=' {} +
find -type f \( -iname "*.sh" \) -exec sed -i '1s=^#! */bin/bash=#!/usr/bin/bash=' {} +
%build
%if %{with html}
readmes=""
@ -250,6 +262,15 @@ popd
%endif
%changelog
* Thu Jan 25 2024 Than Ngo <than@redhat.com> - 3.6.0-3
- fix typo
Related: RHEL-16895
* Thu Jan 25 2024 Than Ngo <than@redhat.com> - 3.6.0-2
- add tests and tools
- fix bash and python shebangs
Related: RHEL-16895
* Mon Jan 22 2024 Than Ngo <than@redhat.com> - 3.6.0-1
- rebase sap roles to version 1.3.4
- add collection files