Browse Source

[213] Don't have two defaults

Michal 'vorner' Vaner 13 years ago
parent
commit
14f9cfa801

+ 14 - 6
src/bin/bind10/bob.spec

@@ -8,12 +8,15 @@
         "item_type": "named_set",
         "item_optional": false,
         "item_default": {
-          "b10-xfrin": { "address": "Xfrin" },
-          "b10-xfrout": { "address": "Xfrout" },
+          "b10-xfrin": { "address": "Xfrin", "kind": "dispensable" },
+          "b10-xfrout": { "address": "Xfrout", "kind": "dispensable" },
           "b10-auth": { "special": "auth", "kind": "needed" },
-          "b10-zonemgr": { "address": "Zonemgr" },
-          "b10-stats": { "address": "Stats" },
-          "b10-stats-httpd": { "address": "StatsHttpd" },
+          "b10-zonemgr": { "address": "Zonemgr", "kind": "dispensable" },
+          "b10-stats": { "address": "Stats", "kind": "dispensable" },
+          "b10-stats-httpd": {
+            "address": "StatsHttpd",
+            "kind": "dispensable"
+          },
           "b10-cmdctl": { "special": "cmdctl", "kind": "needed" }
         },
         "named_set_item_spec": {
@@ -34,7 +37,7 @@
             },
             {
               "item_name": "kind",
-              "item_optional": true,
+              "item_optional": false,
               "item_type": "string",
               "item_default": "dispensable"
             },
@@ -53,6 +56,11 @@
                 "item_type": "string",
                 "item_default": ""
               }
+            },
+            {
+              "item_name": "priority",
+              "item_optional": true,
+              "item_type": "integer"
             }
           ]
         }

+ 3 - 4
src/lib/python/isc/bind10/component.py

@@ -311,7 +311,7 @@ class Configurator:
     dictionary, each item represents one component that should be running.
     The key is an unique identifier used to reference the component. The
     value is a dictionary describing the component. All items in the
-    description is optional and they are as follows:
+    description is optional unless told otherwise and they are as follows:
     * `special` - Some components are started in a special way. If it is
       present, it specifies which class from the specials parameter should
       be used to create the component. In that case, some of the following
@@ -321,7 +321,7 @@ class Configurator:
       it defaults to the identifier of the component.
     * `kind` - The kind of component, either of 'core', 'needed' and
       'dispensable'. This specifies what happens if the component fails.
-      Defaults to despensable.
+      This one is required.
     * `address` - The address of the component on message bus. It is used
       to shut down the component. All special components currently either
       know their own address or don't need one and ignore it. The common
@@ -435,8 +435,7 @@ class Configurator:
                     # TODO: Better error handling
                     creator = self.__specials[component_spec['special']]
                 component = creator(component_spec.get('process', cname),
-                                    self.__boss,
-                                    component_spec.get('kind', 'dispensable'),
+                                    self.__boss, component_spec['kind'],
                                     component_spec.get('address'),
                                     component_spec.get('params'))
                 priority = component_spec.get('priority', 0)

+ 5 - 2
src/lib/python/isc/bind10/tests/component_test.py

@@ -693,7 +693,7 @@ class ConfiguratorTest(BossUtils, unittest.TestCase):
         # We don't use isinstance on purpose, it would allow a descendant
         self.assertTrue(type(component) is Component)
         plan = configurator._build_plan({}, {
-            'component': { }
+            'component': { 'kind': 'dispensable' }
         })
         self.assertEqual(1, len(plan))
         self.assertEqual('start', plan[0]['command'])
@@ -818,7 +818,10 @@ class ConfiguratorTest(BossUtils, unittest.TestCase):
         there. This tests it doesn't crash.
         """
         configurator = Configurator(self, self.__specials)
-        configurator._build_plan({}, {"c1": {}, "c2": {}})
+        configurator._build_plan({}, {
+                                         "c1": { 'kind': 'dispensable'},
+                                         "c2": { 'kind': 'dispensable'}
+                                     })
 
 if __name__ == '__main__':
     isc.log.init("bind10") # FIXME Should this be needed?