Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
logger = logging.getLogger()
logger.setLevel(logging.INFO)

MAX_ERROR_LENGTH = 2048

# these are coming from the kubectl layer
os.environ['PATH'] = '/opt/kubectl:/opt/awscli:' + os.environ['PATH']

Expand Down Expand Up @@ -86,7 +88,12 @@ def kubectl(verb, file, *opts):
retry = retry - 1
logger.info("kubectl timed out, retries left: %s" % retry)
else:
raise Exception(output)
error_msg = output.decode('utf-8', errors='replace')

if len(error_msg) > MAX_ERROR_LENGTH:
error_msg = error_msg[:MAX_ERROR_LENGTH] + "...[truncated]"

raise Exception(error_msg)
else:
logger.info(output)
return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
logger = logging.getLogger()
logger.setLevel(logging.INFO)

MAX_ERROR_LENGTH = 2048

# these are coming from the kubectl layer
os.environ['PATH'] = '/opt/kubectl:/opt/awscli:' + os.environ['PATH']

Expand Down Expand Up @@ -61,7 +63,12 @@ def kubectl(args):
retry = retry - 1
logger.info("kubectl timed out, retries left: %s" % retry)
else:
raise Exception(output)
error_msg = output.decode('utf-8', errors='replace')

if len(error_msg) > MAX_ERROR_LENGTH:
error_msg = error_msg[:MAX_ERROR_LENGTH] + "...[truncated]"

raise Exception(error_msg)
else:
logger.info(output)
return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
logger = logging.getLogger()
logger.setLevel(logging.INFO)

MAX_ERROR_LENGTH = 2048

# these are coming from the kubectl layer
os.environ['PATH'] = '/opt/kubectl:/opt/awscli:' + os.environ['PATH']

Expand Down Expand Up @@ -88,7 +90,12 @@ def kubectl(verb, file, *opts):
retry = retry - 1
logger.info("kubectl timed out, retries left: %s" % retry)
else:
raise Exception(output)
error_msg = output.decode('utf-8', errors='replace')

if len(error_msg) > MAX_ERROR_LENGTH:
error_msg = error_msg[:MAX_ERROR_LENGTH] + "...[truncated]"

raise Exception(error_msg)
else:
logger.info(output)
return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
logger = logging.getLogger()
logger.setLevel(logging.INFO)

MAX_ERROR_LENGTH = 2048

# these are coming from the kubectl layer
os.environ['PATH'] = '/opt/kubectl:/opt/awscli:' + os.environ['PATH']

Expand Down Expand Up @@ -63,7 +65,12 @@ def kubectl(args):
retry = retry - 1
logger.info("kubectl timed out, retries left: %s" % retry)
else:
raise Exception(output)
error_msg = output.decode('utf-8', errors='replace')

if len(error_msg) > MAX_ERROR_LENGTH:
error_msg = error_msg[:MAX_ERROR_LENGTH] + "...[truncated]"

raise Exception(error_msg)
else:
logger.info(output)
return
Expand Down
Loading