fix for exit code 1 and truncation of errors by waagent
@@ -419,6 +419,7 @@ def enable():
check_error = True, log_cmd = False)
# now ensure the permissions and ownership is set recursively
+ try:
workspaceId = public_settings.get('workspaceId')
etc_final_path = os.path.join(EtcOMSAgentPath, workspaceId)
if (os.path.isdir(etc_final_path)):
@@ -445,6 +446,8 @@ def enable():
os.chmod(os.path.join(root, f), 0o640)
else:
os.chmod(os.path.join(root, f), 0640)
+ except:
+ hutil_log_info('Failed to set permissions for OMS directories, could potentially have issues uploading.')
if exit_code is 0:
# Create a marker file to denote the workspace that was
@@ -945,11 +948,12 @@ def run_command_and_log(cmd, check_error = True, log_cmd = True):
hutil_log_info('Output: \n{0}'.format(output))
# also write output to STDOUT since WA agent uploads that to Azlinux Kusto DB
+ # take only the last 3200 characters as extension cuts off after that
try:
if sys.version_info >= (3,):
- print(output)
+ print(output[-3200:])
else:
- print output
+ print output[-3200:]
except:
hutil_log_info('Failed to write output to STDOUT')
