message_util: Fix empty-message parse error.

BUG=chromium:1063400
TEST=run_pytest
TEST=cq
TEST=manually ran inside and outside endpoint

Change-Id: I597ddc951ea4d22735016091577e61ce26adc2bc
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/2274912
Tested-by: Alex Klein <saklein@chromium.org>
Reviewed-by: Michael Mortensen <mmortensen@google.com>
Commit-Queue: Alex Klein <saklein@chromium.org>
diff --git a/api/message_util.py b/api/message_util.py
index d3d748f..bb8fd0a 100644
--- a/api/message_util.py
+++ b/api/message_util.py
@@ -20,6 +20,7 @@
 
 from google.protobuf import json_format
 
+from chromite.lib import cros_logging as logging
 from chromite.lib import osutils
 
 
@@ -209,17 +210,21 @@
       InvalidInputFileError: When a path has not been given, does not exist,
         or cannot be read.
     """
-    if not path and not self.path:
+    target_path = path or self.path
+    if not target_path:
       raise InvalidInputFileError('No input file has been specified.')
-    if not os.path.exists(path or self.path):
+    if not os.path.exists(target_path):
       raise InvalidInputFileError('The input file does not exist.')
 
     try:
-      content = osutils.ReadFile(path or self.path, mode=self.read_mode)
+      content = osutils.ReadFile(target_path, mode=self.read_mode)
     except IOError as e:
       raise InvalidInputFileError('Unable to read input file: %s' % e)
 
-    self.serializer.deserialize(content, message)
+    if content:
+      self.serializer.deserialize(content, message)
+    else:
+      logging.warning('No content found in %s to deserialize.', target_path)
 
   def write_from(self, message, path=None):
     """Write serialized data from the message to a file.