Skip to content

Commit

Permalink
modify the sudo failed log and add line to eol
Browse files Browse the repository at this point in the history
  • Loading branch information
feng-j678 committed Nov 19, 2024
1 parent 4060cc4 commit 3be69d9
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/core/src/bootstrap/Bootstrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,15 +153,15 @@ def check_sudo_status_with_retry(self, raise_if_not_sudo=True):
try:
sudo_status = self.check_sudo_status(raise_if_not_sudo=raise_if_not_sudo)
if sudo_status and attempts > 1:
self.composite_logger.log_debug("Sudo Check Successfully [Attempts={0}][MaxAttempts={1}]".format(str(attempts), Constants.MAX_CHECK_SUDO_RETRY_COUNT))
self.composite_logger.log_debug("Sudo Check Successfully [RetryCount={0}][MaxRetryCount={1}]".format(str(attempts), Constants.MAX_CHECK_SUDO_RETRY_COUNT))
return sudo_status
except Exception as exception:
if attempts >= Constants.MAX_CHECK_SUDO_RETRY_COUNT:
self.composite_logger.log_error("Sudo Check Failed, reached [MaxAttempts={0}][Exception={1}]".format(str(attempts), str(exception)))
self.composite_logger.log_error("Customer environment error (sudo failure). [Exception={0}][RetryCount={1}]".format(str(exception), str(attempts)))
if raise_if_not_sudo:
raise

self.composite_logger.log_debug("Retrying sudo status check after a delay of [ElapsedTimeInSeconds={0}][Attempts={1}]".format(Constants.MAX_CHECK_SUDO_INTERVAL_IN_SEC, str(attempts)))
self.composite_logger.log_debug("Retrying sudo status check after a delay of [ElapsedTimeInSeconds={0}][RetryCount={1}]".format(Constants.MAX_CHECK_SUDO_INTERVAL_IN_SEC, str(attempts)))
time.sleep(Constants.MAX_CHECK_SUDO_INTERVAL_IN_SEC)

def check_sudo_status(self, raise_if_not_sudo=True):
Expand Down Expand Up @@ -193,3 +193,4 @@ def check_sudo_status(self, raise_if_not_sudo=True):
"Exception details: " + str(exception))
if raise_if_not_sudo:
raise

0 comments on commit 3be69d9

Please sign in to comment.