Skip to content

Commit

Permalink
Merge pull request #878 from spolti/KIECLOUD-711-blue
Browse files Browse the repository at this point in the history
[KIECLOUD-711] - Add retry mechanism when trying to create the kerber…
  • Loading branch information
spolti authored Apr 7, 2023
2 parents 5cbd21e + 0fdf130 commit bcac4fd
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions hack/build-osbs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ function check_for_required_envs()

function get_kerb_ticket() {
set +e
retries=10
delay=5
if [ -n "$KERBEROS_PASSWORD" ]; then
echo "$KERBEROS_PASSWORD" | kinit "$KERBEROS_PRINCIPAL"
_klist
Expand All @@ -84,8 +86,13 @@ function get_kerb_ticket() {
exit -1
fi
elif [ -n "$KERBEROS_KEYTAB" ]; then
kinit -k -t "$KERBEROS_KEYTAB" "$KERBEROS_PRINCIPAL"
_klist
for i in `seq 1 $retries`; do
kinit -k -t "$KERBEROS_KEYTAB" "$KERBEROS_PRINCIPAL"
[ $? -eq 0 ] && break
echo "Failed to acquire Kerberos ticket, retrying (try $i of $retries)..."
_klist
sleep $delay
done
if [ "$?" -ne 0 ]; then
echo "Failed to get kerberos token for $KERBEROS_PRINCIPAL with $KERBEROS_KEYTAB"
exit -1
Expand Down

0 comments on commit bcac4fd

Please sign in to comment.