BIND 10 master, updated. 84d5eda2a6ae0d737aef68d56023fc33fef623e6 Merge branch 'trac3239_3'

BIND 10 source code commits bind10-changes at lists.isc.org
Wed Jan 29 10:44:28 UTC 2014


The branch, master has been updated
       via  84d5eda2a6ae0d737aef68d56023fc33fef623e6 (commit)
       via  782a17cac5214a4b5dae441b383b0504a40be9e9 (commit)
       via  8ef57d769740b0e9774bd912c1c28afdc1e418e3 (commit)
       via  a87c4023df07597dcd3cd0f0b850088233e54462 (commit)
      from  15884428d46cc9d5c948318682dd883b02f99d46 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 84d5eda2a6ae0d737aef68d56023fc33fef623e6
Merge: 1588442 782a17c
Author: Mukund Sivaraman <muks at isc.org>
Date:   Wed Jan 29 15:26:32 2014 +0530

    Merge branch 'trac3239_3'

-----------------------------------------------------------------------

Summary of changes:
 doc/guide/bind10-guide.xml               |   21 +++++++++++++---
 src/bin/bindctl/bindcmd.py               |    5 ++--
 src/lib/python/isc/config/config_data.py |   40 ++++++++++++++++++++++++------
 3 files changed, 52 insertions(+), 14 deletions(-)

-----------------------------------------------------------------------
diff --git a/doc/guide/bind10-guide.xml b/doc/guide/bind10-guide.xml
index 88425e2..6329d25 100644
--- a/doc/guide/bind10-guide.xml
+++ b/doc/guide/bind10-guide.xml
@@ -1554,7 +1554,10 @@ Parameters:
                 <term>integer</term>
                 <listitem>
                     <simpara>
-                        A basic integer; can be set directly with <command>config set</command>, to any integer value.
+                        A basic integer; can be set directly with
+                        <command>config set</command>, to any integer
+                        value. The value must not be quoted, or else, it
+                        will be parsed as a string.
                     </simpara>
                 </listitem>
             </varlistentry>
@@ -1562,7 +1565,10 @@ Parameters:
                 <term>real</term>
                 <listitem>
                     <simpara>
-                        A basic floating point number; can be set directly with <command>config set</command>, to any floating point value.
+                        A basic floating point number; can be set
+                        directly with <command>config set</command>, to
+                        any floating point value. The value must not be
+                        quoted, or else, it will be parsed as a string.
                     </simpara>
                 </listitem>
             </varlistentry>
@@ -1570,7 +1576,12 @@ Parameters:
                 <term>boolean</term>
                 <listitem>
                     <simpara>
-                        A basic boolean value; can be set directly with <command>config set</command>, to either <command>true</command> or <command>false</command>.
+                        A basic boolean value; can be set directly with
+                        <command>config set</command>, to either
+                        <command>true</command> or
+                        <command>false</command>. The value must not be
+                        quoted, or else, it will be parsed as a
+                        string. Integer values are not allowed.
                     </simpara>
                 </listitem>
             </varlistentry>
@@ -1578,7 +1589,9 @@ Parameters:
                 <term>string</term>
                 <listitem>
                     <simpara>
-                        A basic string value; can be set directly with <command>config set,</command> so any string. Double quotation marks are optional.
+                        A basic string value; can be set directly with
+                        <command>config set</command> to any
+                        string. Double quotation marks are optional.
                     </simpara>
                 </listitem>
             </varlistentry>
diff --git a/src/bin/bindctl/bindcmd.py b/src/bin/bindctl/bindcmd.py
index bcae95c..a83775b 100644
--- a/src/bin/bindctl/bindcmd.py
+++ b/src/bin/bindctl/bindcmd.py
@@ -446,8 +446,9 @@ WARNING: The Python readline module isn't available, so some command line
                     raise CmdMissParamSyntaxError(cmd.module, cmd.command, name)
                 param_nr += 1
 
-        # Convert parameter value according parameter spec file.
-        # Ignore check for commands belongs to module 'config' or 'execute
+        # Convert parameter value according to parameter spec
+        # file. Ignore check for commands belonging to module 'config'
+        # or 'execute'.
         if cmd.module != CONFIG_MODULE_NAME and\
            cmd.module != command_sets.EXECUTE_MODULE_NAME:
             for param_name in cmd.params:
diff --git a/src/lib/python/isc/config/config_data.py b/src/lib/python/isc/config/config_data.py
index e2b1357..3683f33 100644
--- a/src/lib/python/isc/config/config_data.py
+++ b/src/lib/python/isc/config/config_data.py
@@ -53,6 +53,22 @@ def spec_part_is_any(spec_part):
     return (type(spec_part) == dict and 'item_type' in spec_part and
             spec_part['item_type'] == "any")
 
+def _type_as_string(value):
+    if type(value) == int:
+        return 'integer'
+    elif type(value) == float:
+        return 'real'
+    elif type(value) == bool:
+        return 'boolean'
+    elif type(value) == str:
+        return 'string'
+    elif type(value) == list:
+        return 'list'
+    elif type(value) == dict:
+        return 'map'
+    else:
+        return '<unknown>'
+
 def check_type(spec_part, value):
     """Does nothing if the value is of the correct type given the
        specification part relevant for the value. Raises an
@@ -65,27 +81,35 @@ def check_type(spec_part, value):
 
     if data_type == "integer":
         if type(value) != int:
-            raise isc.cc.data.DataTypeError(str(value) + " is not an integer")
+            raise isc.cc.data.DataTypeError('%s is not an integer (%s was passed)' % \
+                                            (str(value), _type_as_string(value)))
         if value > sys.maxsize:
-            raise isc.cc.data.DataTypeError(str(value) + " is too large an integer")
+            raise isc.cc.data.DataTypeError('%s is too large an integer' % \
+                                            (str(value)))
     elif data_type == "real":
         if type(value) != float:
-            raise isc.cc.data.DataTypeError(str(value) + " is not a real")
+            raise isc.cc.data.DataTypeError('%s is not a real (%s was passed)' % \
+                                            (str(value), _type_as_string(value)))
         if float(value) > sys.float_info.max:
-            raise isc.cc.data.DataTypeError(str(value) + " is too large a float")
+            raise isc.cc.data.DataTypeError('%s is too large for a float' % \
+                                            (str(value)))
     elif data_type == "boolean" and type(value) != bool:
-        raise isc.cc.data.DataTypeError(str(value) + " is not a boolean")
+        raise isc.cc.data.DataTypeError('%s is not a boolean (%s was passed)' % \
+                                        (str(value), _type_as_string(value)))
     elif data_type == "string" and type(value) != str:
-        raise isc.cc.data.DataTypeError(str(value) + " is not a string")
+        raise isc.cc.data.DataTypeError('%s is not a string (%s was passed)' % \
+                                        (str(value), _type_as_string(value)))
     elif data_type == "list":
         if type(value) != list:
-            raise isc.cc.data.DataTypeError(str(value) + " is not a list")
+            raise isc.cc.data.DataTypeError('%s is not a list (%s was passed)' % \
+                                            (str(value), _type_as_string(value)))
         else:
             for element in value:
                 check_type(spec_part['list_item_spec'], element)
     elif data_type == "map" and type(value) != dict:
         # todo: check types of map contents too
-        raise isc.cc.data.DataTypeError(str(value) + " is not a map")
+        raise isc.cc.data.DataTypeError('%s is not a map (%s was passed)' % \
+                                        (str(value), _type_as_string(value)))
 
 def convert_type(spec_part, value):
     """Convert the given value(type is string) according specification



More information about the bind10-changes mailing list