Goma: Fix log dir handling.

Make goma parsing optional to allow the handlers to affect the
chroot-based dynamic configs. Fix the log dir handling to
pass through a valid path to the Goma instance.

BUG=chromium:1031259
TEST=run_tests

Change-Id: I3e4fa23b8ba72b2209053422da98bbf2ea70e5d6
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/1972711
Tested-by: Alex Klein <saklein@chromium.org>
Reviewed-by: David Burger <dburger@chromium.org>
Commit-Queue: Alex Klein <saklein@chromium.org>
diff --git a/api/field_handler.py b/api/field_handler.py
index b54c0cd..78aa201 100644
--- a/api/field_handler.py
+++ b/api/field_handler.py
@@ -35,8 +35,9 @@
 class ChrootHandler(object):
   """Translate a Chroot message to chroot enter arguments and env."""
 
-  def __init__(self, clear_field):
+  def __init__(self, clear_field, parse_goma):
     self.clear_field = clear_field
+    self.parse_goma = parse_goma
 
   def handle(self, message):
     """Parse a message for a chroot field."""
@@ -54,16 +55,17 @@
 
   def parse_chroot(self, chroot_message):
     """Parse a Chroot message instance."""
-    return controller_util.ParseChroot(chroot_message)
+    return controller_util.ParseChroot(chroot_message,
+                                       parse_goma=self.parse_goma)
 
 
-def handle_chroot(message, clear_field=True):
+def handle_chroot(message, clear_field=True, parse_goma=True):
   """Find and parse the chroot field, returning the Chroot instance.
 
   Returns:
     chroot_lib.Chroot
   """
-  handler = ChrootHandler(clear_field)
+  handler = ChrootHandler(clear_field, parse_goma)
   chroot = handler.handle(message)
   if chroot:
     return chroot
@@ -186,7 +188,7 @@
     self._original_message.CopyFrom(self.field)
 
   def _sync(self, src, dest):
-    logging.info('Syncing %s to %s')
+    logging.info('Syncing %s to %s', src, dest)
     # TODO: This would probably be more efficient with rsync.
     osutils.EmptyDir(dest)
     osutils.CopyDirContents(src, dest)