Adding log statement in modeldefs API if an error occur

Change-Id: I921100cf8c5d27870b584071b1ea46507e6fce31
diff --git a/VERSION b/VERSION
index 8a1af3b..ac12784 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.1.29
+2.1.30
diff --git a/containers/chameleon/Dockerfile.chameleon b/containers/chameleon/Dockerfile.chameleon
index 05afd4b..8079ba8 100644
--- a/containers/chameleon/Dockerfile.chameleon
+++ b/containers/chameleon/Dockerfile.chameleon
@@ -13,7 +13,7 @@
 # limitations under the License.
 
 # xosproject/chameleon
-FROM xosproject/xos-base:2.1.29
+FROM xosproject/xos-base:2.1.30
 
 # xos-base already has protoc and dependencies installed
 
diff --git a/containers/xos/Dockerfile.client b/containers/xos/Dockerfile.client
index ff8a605..2fd6869 100644
--- a/containers/xos/Dockerfile.client
+++ b/containers/xos/Dockerfile.client
@@ -13,7 +13,7 @@
 # limitations under the License.
 
 # xosproject/xos-client
-FROM xosproject/xos-libraries:2.1.29
+FROM xosproject/xos-libraries:2.1.30
 
 # Install XOS client
 COPY xos/xos_client /tmp/xos_client
diff --git a/containers/xos/Dockerfile.libraries b/containers/xos/Dockerfile.libraries
index 5e5e117..ac7ae17 100644
--- a/containers/xos/Dockerfile.libraries
+++ b/containers/xos/Dockerfile.libraries
@@ -13,7 +13,7 @@
 # limitations under the License.
 
 # xosproject/xos-libraries
-FROM xosproject/xos-base:2.1.29
+FROM xosproject/xos-base:2.1.30
 
 # Add libraries
 COPY lib /opt/xos/lib
diff --git a/containers/xos/Dockerfile.synchronizer-base b/containers/xos/Dockerfile.synchronizer-base
index ae53613..04ae9f3 100644
--- a/containers/xos/Dockerfile.synchronizer-base
+++ b/containers/xos/Dockerfile.synchronizer-base
@@ -13,7 +13,7 @@
 # limitations under the License.
 
 # xosproject/xos-synchronizer-base
-FROM xosproject/xos-client:2.1.29
+FROM xosproject/xos-client:2.1.30
 
 COPY xos/synchronizers/new_base /opt/xos/synchronizers/new_base
 COPY xos/xos/logger.py /opt/xos/xos/logger.py
diff --git a/containers/xos/Dockerfile.xos-core b/containers/xos/Dockerfile.xos-core
index e921bef..8d083b2 100644
--- a/containers/xos/Dockerfile.xos-core
+++ b/containers/xos/Dockerfile.xos-core
@@ -13,7 +13,7 @@
 # limitations under the License.
 
 # xosproject/xos-core
-FROM xosproject/xos-libraries:2.1.29
+FROM xosproject/xos-libraries:2.1.30
 
 # Install XOS
 ADD xos /opt/xos
diff --git a/xos/coreapi/xos_modeldefs_api.py b/xos/coreapi/xos_modeldefs_api.py
index 5a03b6d..3c96d65 100644
--- a/xos/coreapi/xos_modeldefs_api.py
+++ b/xos/coreapi/xos_modeldefs_api.py
@@ -19,6 +19,11 @@
 from xos.exceptions import *
 from apihelper import XOSAPIHelperMixin
 from apistats import REQUEST_COUNT, track_request_time
+from xosconfig import Config
+
+from multistructlog import create_logger
+
+log = create_logger(Config().get('logging'))
 
 def yaml_to_grpc(yaml_repr, grpc_container, yaml_key = None, grpc_parent = None):
     if isinstance(yaml_repr, dict):
@@ -30,7 +35,23 @@
             grpc_sub_container = grpc_container.add()
             yaml_to_grpc(i, grpc_sub_container, None, grpc_container)
     else:
-        setattr(grpc_parent, yaml_key, yaml_repr)
+        try:
+            setattr(grpc_parent, yaml_key, yaml_repr)
+        except Exception, e:
+            # NOTE would be nice to get the parent,
+            # for example given this data structure:
+            # - hint: ''
+            #   name: AdmControl
+            #   default: "0"
+            #   options:
+            #   - {'id': 0, 'label': 'ALL'}
+            #   - {'id': 1, 'label': 'Voice Only'}
+            #   - {'id': 2, 'label': 'Data Only'}
+            #
+            # we'll get the error: Failed to set attribute id on element FieldOption has it value is 0 and has the wrong type <type 'int'>
+            # while printing "name: AdmControl" would be much better
+            log.exception("Failed to set attribute %s on element %s has it value is %s and has the wrong type %s" % (yaml_key, grpc_parent.__class__.__name__, yaml_repr, type(yaml_repr)))
+            raise e
 
 class ModelDefsService(modeldefs_pb2_grpc.modeldefsServicer, XOSAPIHelperMixin):
     def __init__(self, thread_pool):
@@ -54,6 +75,7 @@
 
 if __name__=='__main__':
     ystr = open('protos/modeldefs.yaml').read()
+
     yaml_repr = yaml.load(ystr)
 
     modeldefs = modeldefs_pb2.ModelDefs()