ocf shellfuncs add curl_retry
This commit is contained in:
parent
873ef4e1fe
commit
3f00407650
57
ocf-shellfuncs-add-curl_retry.patch
Normal file
57
ocf-shellfuncs-add-curl_retry.patch
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
From fc0657b936f6a58f741e33f851b22f82bc68bffa Mon Sep 17 00:00:00 2001
|
||||||
|
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
|
||||||
|
Date: Tue, 6 Feb 2024 13:28:12 +0100
|
||||||
|
Subject: [PATCH 1/3] ocf-shellfuncs: add curl_retry()
|
||||||
|
|
||||||
|
---
|
||||||
|
heartbeat/ocf-shellfuncs.in | 34 ++++++++++++++++++++++++++++++++++
|
||||||
|
1 file changed, 34 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/heartbeat/ocf-shellfuncs.in b/heartbeat/ocf-shellfuncs.in
|
||||||
|
index c5edb6f5..a69a9743 100644
|
||||||
|
--- a/heartbeat/ocf-shellfuncs.in
|
||||||
|
+++ b/heartbeat/ocf-shellfuncs.in
|
||||||
|
@@ -672,6 +672,40 @@ EOF
|
||||||
|
systemctl daemon-reload
|
||||||
|
}
|
||||||
|
|
||||||
|
+# usage: curl_retry RETRIES SLEEP ARGS URL
|
||||||
|
+#
|
||||||
|
+# Use --show-error in ARGS to log HTTP error code
|
||||||
|
+#
|
||||||
|
+# returns:
|
||||||
|
+# 0 success
|
||||||
|
+# exit:
|
||||||
|
+# 1 fail
|
||||||
|
+curl_retry()
|
||||||
|
+{
|
||||||
|
+ local retries=$1 sleep=$2 opts=$3 url=$4
|
||||||
|
+ local tries=$(($retries + 1))
|
||||||
|
+ local args="--fail $opts $url"
|
||||||
|
+ local result rc
|
||||||
|
+
|
||||||
|
+ for try in $(seq $tries); do
|
||||||
|
+ ocf_log debug "curl $args try $try of $tries"
|
||||||
|
+ result=$(echo "$args" | xargs curl 2>&1)
|
||||||
|
+ rc=$?
|
||||||
|
+
|
||||||
|
+ ocf_log debug "result: $result"
|
||||||
|
+ [ $rc -eq 0 ] && break
|
||||||
|
+ sleep $sleep
|
||||||
|
+ done
|
||||||
|
+
|
||||||
|
+ if [ $rc -ne 0 ]; then
|
||||||
|
+ ocf_exit_reason "curl $args failed $tries tries"
|
||||||
|
+ exit $OCF_ERR_GENERIC
|
||||||
|
+ fi
|
||||||
|
+
|
||||||
|
+ echo "$result"
|
||||||
|
+ return $rc
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
# move process to root cgroup if realtime scheduling is enabled
|
||||||
|
ocf_move_to_root_cgroup_if_rt_enabled()
|
||||||
|
{
|
||||||
|
--
|
||||||
|
2.33.0
|
||||||
|
|
||||||
@ -1,7 +1,7 @@
|
|||||||
Name: resource-agents
|
Name: resource-agents
|
||||||
Summary: Open Source HA Reusable Cluster Resource Scripts
|
Summary: Open Source HA Reusable Cluster Resource Scripts
|
||||||
Version: 4.13.0
|
Version: 4.13.0
|
||||||
Release: 21
|
Release: 22
|
||||||
License: GPLv2+ and LGPLv2+
|
License: GPLv2+ and LGPLv2+
|
||||||
URL: https://github.com/ClusterLabs/resource-agents
|
URL: https://github.com/ClusterLabs/resource-agents
|
||||||
Source0: https://github.com/ClusterLabs/resource-agents/archive/v%{version}.tar.gz
|
Source0: https://github.com/ClusterLabs/resource-agents/archive/v%{version}.tar.gz
|
||||||
@ -26,6 +26,7 @@ Patch0017: docs-writing-python-agents-update-required-Python-ve.patch
|
|||||||
Patch0018: galera-allow-joiner-to-report-non-Primary-during-ini.patch
|
Patch0018: galera-allow-joiner-to-report-non-Primary-during-ini.patch
|
||||||
Patch0019: doc-writing-python-agents-add-description-of-is_prob.patch
|
Patch0019: doc-writing-python-agents-add-description-of-is_prob.patch
|
||||||
Patch0020: Filesystem-fail-when-incorrect-device-mounted-on-mou.patch
|
Patch0020: Filesystem-fail-when-incorrect-device-mounted-on-mou.patch
|
||||||
|
Patch0021: ocf-shellfuncs-add-curl_retry.patch
|
||||||
|
|
||||||
Obsoletes: heartbeat-resources <= %{version}
|
Obsoletes: heartbeat-resources <= %{version}
|
||||||
Provides: heartbeat-resources = %{version}
|
Provides: heartbeat-resources = %{version}
|
||||||
@ -124,6 +125,9 @@ export CFLAGS="$(echo '%{optflags}')"
|
|||||||
%{_mandir}/man8/{ocf-tester.8*,ldirectord.8*}
|
%{_mandir}/man8/{ocf-tester.8*,ldirectord.8*}
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue May 07 2024 bizhiyuan <bizhiyuan@kylinos.cn> - 4.13.0-22
|
||||||
|
- ocf shellfuncs add curl_retry
|
||||||
|
|
||||||
* Mon May 06 2024 zouzhimin <zouzhimin@kylinos.cn> - 4.13.0-21
|
* Mon May 06 2024 zouzhimin <zouzhimin@kylinos.cn> - 4.13.0-21
|
||||||
- Filesystem: fail when incorrect device mounted on mountpoint
|
- Filesystem: fail when incorrect device mounted on mountpoint
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user