diff --git a/ocf-shellfuncs-add-curl_retry.patch b/ocf-shellfuncs-add-curl_retry.patch new file mode 100644 index 0000000000000000000000000000000000000000..c8ad1992491053a4853600781e299f587c05d777 --- /dev/null +++ b/ocf-shellfuncs-add-curl_retry.patch @@ -0,0 +1,57 @@ +From fc0657b936f6a58f741e33f851b22f82bc68bffa Mon Sep 17 00:00:00 2001 +From: Oyvind Albrigtsen +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 + diff --git a/resource-agents.spec b/resource-agents.spec index 438fd7c67513ce32d16b311b87ceabdefb5bd9be..562426f2f99810dcb054201433d5255ac65b06f7 100644 --- a/resource-agents.spec +++ b/resource-agents.spec @@ -1,7 +1,7 @@ Name: resource-agents Summary: Open Source HA Reusable Cluster Resource Scripts Version: 4.13.0 -Release: 21 +Release: 22 License: GPLv2+ and LGPLv2+ URL: https://github.com/ClusterLabs/resource-agents 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 Patch0019: doc-writing-python-agents-add-description-of-is_prob.patch Patch0020: Filesystem-fail-when-incorrect-device-mounted-on-mou.patch +Patch0021: ocf-shellfuncs-add-curl_retry.patch Obsoletes: heartbeat-resources <= %{version} Provides: heartbeat-resources = %{version} @@ -124,6 +125,9 @@ export CFLAGS="$(echo '%{optflags}')" %{_mandir}/man8/{ocf-tester.8*,ldirectord.8*} %changelog +* Tue May 07 2024 bizhiyuan - 4.13.0-22 +- ocf shellfuncs add curl_retry + * Mon May 06 2024 zouzhimin - 4.13.0-21 - Filesystem: fail when incorrect device mounted on mountpoint