Browse Source

[213] Unify config and spec

Michal 'vorner' Vaner 13 years ago
parent
commit
4e0d6d115c

+ 12 - 11
src/lib/python/isc/bind10/component.py

@@ -459,22 +459,22 @@ class Configurator:
         plan_add = []
         plan_add = []
         for cname in new.keys():
         for cname in new.keys():
             if cname not in old:
             if cname not in old:
-                component_spec = new[cname]
+                component_config = new[cname]
                 creator = Component
                 creator = Component
-                if 'special' in component_spec:
+                if 'special' in component_config:
                     # TODO: Better error handling
                     # TODO: Better error handling
-                    creator = self.__specials[component_spec['special']]
-                component = creator(component_spec.get('process', cname),
-                                    self.__boss, component_spec['kind'],
-                                    component_spec.get('address'),
-                                    component_spec.get('params'))
-                priority = component_spec.get('priority', 0)
+                    creator = self.__specials[component_config['special']]
+                component = creator(component_config.get('process', cname),
+                                    self.__boss, component_config['kind'],
+                                    component_config.get('address'),
+                                    component_config.get('params'))
+                priority = component_config.get('priority', 0)
                 # We store tuples, priority first, so we can easily sort
                 # We store tuples, priority first, so we can easily sort
                 plan_add.append((priority, {
                 plan_add.append((priority, {
                     'component': component,
                     'component': component,
                     'command': START_CMD,
                     'command': START_CMD,
                     'name': cname,
                     'name': cname,
-                    'spec': component_spec
+                    'config': component_config
                 }))
                 }))
         # Push the starts there sorted by priority
         # Push the starts there sorted by priority
         plan.extend([command for (_, command) in sorted(plan_add,
         plan.extend([command for (_, command) in sorted(plan_add,
@@ -505,7 +505,7 @@ class Configurator:
         at last 'component' (a component object to work with) and 'command'
         at last 'component' (a component object to work with) and 'command'
         (the command to do). Currently, both existing commands need 'name' of
         (the command to do). Currently, both existing commands need 'name' of
         the component as well (the identifier from configuration). The 'start'
         the component as well (the identifier from configuration). The 'start'
-        one needs the 'spec' to be there, which is the configuration description
+        one needs the 'config' to be there, which is the configuration description
         of the component.
         of the component.
         """
         """
         done = 0
         done = 0
@@ -518,7 +518,8 @@ class Configurator:
                              command, component.name())
                              command, component.name())
                 if command == START_CMD:
                 if command == START_CMD:
                     component.start()
                     component.start()
-                    self._components[task['name']] = (task['spec'], component)
+                    self._components[task['name']] = (task['config'],
+                                                      component)
                 elif command == STOP_CMD:
                 elif command == STOP_CMD:
                     if component.running():
                     if component.running():
                         component.stop()
                         component.stop()

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

@@ -557,25 +557,25 @@ class ConfiguratorTest(BossUtils, unittest.TestCase):
                 'component': stopped,
                 'component': stopped,
                 'command': 'start',
                 'command': 'start',
                 'name': 'first',
                 'name': 'first',
-                'spec': {'a': 1}
+                'config': {'a': 1}
             },
             },
             {
             {
                 'component': started,
                 'component': started,
                 'command': 'stop',
                 'command': 'stop',
                 'name': 'second',
                 'name': 'second',
-                'spec': {}
+                'config': {}
             },
             },
             {
             {
                 'component': FailComponent('third', self, 'needed'),
                 'component': FailComponent('third', self, 'needed'),
                 'command': 'start',
                 'command': 'start',
                 'name': 'third',
                 'name': 'third',
-                'spec': {}
+                'config': {}
             },
             },
             {
             {
                 'component': self.__component_test('fourth', self, 'core'),
                 'component': self.__component_test('fourth', self, 'core'),
                 'command': 'start',
                 'command': 'start',
                 'name': 'fourth',
                 'name': 'fourth',
-                'spec': {}
+                'config': {}
             }
             }
         ]
         ]
         # Don't include the preparation into the log
         # Don't include the preparation into the log