fix(session_duration): Use jq with TZ=UTC (#1195)

This commit is contained in:
Pepe Fagoaga
2022-06-15 13:25:43 +02:00
committed by GitHub
parent d85d0f5877
commit 3944ea2055
3 changed files with 11 additions and 10 deletions
+2 -3
View File
@@ -21,10 +21,9 @@ execute_check() {
# Following logic looks for time remaining in the session and review it
# if it is less than 600 seconds, 10 minutes.
CURRENT_TIMESTAMP=$(date -u "+%s")
SESSION_TIME_REMAINING=$(expr $AWS_SESSION_EXPIRATION - $CURRENT_TIMESTAMP)
# echo SESSION TIME REMAINING IN SECONDS: $SESSION_TIME_REMAINING
SESSION_TIME_REMAINING=$(("${AWS_SESSION_EXPIRATION}" - "${CURRENT_TIMESTAMP}"))
MINIMUM_REMAINING_TIME_ALLOWED=600
if (( $MINIMUM_REMAINING_TIME_ALLOWED > $SESSION_TIME_REMAINING )); then
if (( "${MINIMUM_REMAINING_TIME_ALLOWED}" > "${SESSION_TIME_REMAINING}" )); then
# echo LESS THAN 10 MIN LEFT: RE-ASSUMING...
unset AWS_ACCESS_KEY_ID
unset AWS_SECRET_ACCESS_KEY