Commit e7c2ec90 authored by Paul Rich's avatar Paul Rich
Browse files

Merge branch 'Fix-96-Abigious-log-messages-in-Util.py' into 'develop'

Fixing the ambiguity between the two error messages when it fails to write.  One…

See merge request !52
parents 3fccd335 20a3877a
......@@ -1032,44 +1032,40 @@ class disk_writer_thread(Thread):
#on open, even though I believe the linux kernel gets this wrong.
fd = os.open(file_msg.filename, os.O_WRONLY|os.O_APPEND|os.O_NONBLOCK)
except IOError as (num, strerror):
errcode = errno.errorcode[num]
if num == errno.EACCES:
logger.error("Unable to write to %s with error code: "
"%s. Permission Denied.", errcode,
file_msg.filename)
logger.error("Unable to write to %s with error code: %s. Permission Denied.", file_msg.filename, errcode)
messages_to_remove.append(file_msg)
elif num == errno.EDQUOT:
logger.error("Unable to write to %s. Quota Exceeded.", file_msg.filename)
logger.error("Unable to write to %s with error code: %s. Quota Exceeded.", file_msg.filename, errcode)
messages_to_remove.append(file_msg)
elif num in [errno.EFAULT,errno.EINVAL,errno.EIO]:
logger.error("Unable to write to %s. Fatal Error.", file_msg.filename)
logger.error("Unable to write to %s with error code: %s. Fatal Error.", file_msg.filename, errcode)
messages_to_remove.append(file_msg)
elif num == errno.ENXIO:
logger.error("Why are you trying to open a pipe?")
messages_to_remove.append(file_msg)
else:
logger.debug("Failed to write to %s. Holding message for retry.",
file_msg.filename)
logger.debug("Failed to write to %s with error code: %s. Holding message for retry.",
file_msg.filename, errcode)
continue
except OSError as (num, strerror):
errcode = errno.errorcode[num]
if num == errno.EACCES:
logger.error("Unable to write to %s. Permission Denied.",file_msg.filename)
logger.error("OSError: Unable to write to %s with error code: %s. Permission Denied.",file_msg.filename, errcode)
messages_to_remove.append(file_msg)
elif num == errno.EDQUOT:
logger.error("Unable to write to %s. Quota Exceeded.", file_msg.filename)
logger.error("OSError: Unable to write to %s with error code: %s. Quota Exceeded.", file_msg.filename, errcode)
messages_to_remove.append(file_msg)
elif num in [errno.EFAULT,errno.EINVAL,errno.EIO]:
logger.error("Unable to write to %s. Fatal Error.", file_msg.filename)
logger.error("OSError: Unable to write to %s with error code: %s. Fatal Error.", file_msg.filename, errcode)
messages_to_remove.append(file_msg)
elif num == errno.ENXIO:
logger.error("Why are you trying to open a pipe?")
logger.error("OSError: Why are you trying to open a pipe?")
messages_to_remove.append(file_msg)
else:
logger.debug("Failed to write to %s. Holding message for retry.",
file_msg.filename)
logger.debug("OSError: Failed to write to %s with error code: %s. Holding message for retry.",
file_msg.filename, errcode)
continue
except Exception:
logger.critical("Unknown error recieved when writing to cobaltlog %s. "\
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment