zaheer - in flumotion/trunk: . flumotion/common flumotion/manager
flumotion-commit at lists.fluendo.com
flumotion-commit at lists.fluendo.com
Tue Jun 5 20:07:09 CEST 2007
Author: zaheer
Date: Tue Jun 5 20:07:07 2007
New Revision: 5105
Modified:
flumotion/trunk/ChangeLog
flumotion/trunk/flumotion/common/config.py
flumotion/trunk/flumotion/manager/manager.py
Log:
* flumotion/common/config.py (BaseConfigParser.parseFeedId):
Make sure feedIds stored in eater dict are proper feedIds.
* flumotion/manager/manager.py (Vishnu.parseFeedId,
Vishnu.fixOldEaterConfig, Vishnu.verifyExistingComponentState,
Vishnu.makeNewComponentState):
Move common code out to new function. Translate feedIds to proper
feedIds.
Modified: flumotion/trunk/ChangeLog
==============================================================================
--- flumotion/trunk/ChangeLog (original)
+++ flumotion/trunk/ChangeLog Tue Jun 5 20:07:07 2007
@@ -1,5 +1,15 @@
2007-06-05 Zaheer Abbas Merali <zaheerabbas at merali dot org>
+ * flumotion/common/config.py (BaseConfigParser.parseFeedId):
+ Make sure feedIds stored in eater dict are proper feedIds.
+ * flumotion/manager/manager.py (Vishnu.parseFeedId,
+ Vishnu.fixOldEaterConfig, Vishnu.verifyExistingComponentState,
+ Vishnu.makeNewComponentState):
+ Move common code out to new function. Translate feedIds to proper
+ feedIds.
+
+2007-06-05 Zaheer Abbas Merali <zaheerabbas at merali dot org>
+
* flumotion/test/test_component.py (PipelineTest.__init__,
PipelineTest.config):
* flumotion/test/test_component_httpstreamer.py
Modified: flumotion/trunk/flumotion/common/config.py
==============================================================================
--- flumotion/trunk/flumotion/common/config.py (original)
+++ flumotion/trunk/flumotion/common/config.py Tue Jun 5 20:07:07 2007
@@ -490,7 +490,12 @@
# we have an eater node with no feeds
raise ConfigError(
"Eater node %s with no <feed> nodes, is not allowed" % name)
- return [(name, feedId) for feedId in feedIds]
+ def parseFeedId(feedId):
+ if feedId.find(':') == -1:
+ return "%s:default" % feedId
+ else:
+ return feedId
+ return [(name, parseFeedId(feedId)) for feedId in feedIds]
def _parseProperty(self, node):
name, = self.parseAttributes(node, ('name',))
Modified: flumotion/trunk/flumotion/manager/manager.py
==============================================================================
--- flumotion/trunk/flumotion/manager/manager.py (original)
+++ flumotion/trunk/flumotion/manager/manager.py Tue Jun 5 20:07:07 2007
@@ -980,34 +980,41 @@
# (2) we don't know anything about this component, but since it
# logged in, we will deal with it, at least allowing the
# admin to control it.
+ def parseFeedId(feedId):
+ if feedId.find(':') == -1:
+ return "%s:default" % feedId
+ else:
+ return feedId
+
+ def fixOldEaterConfig(state):
+ # check for components that have no eater dict but a
+ # non-empty source list, and file all these under
+ # eater default
+ eaterConfig = conf.get('eater', {})
+ sourceConfig = conf.get('source', [])
+ if eaterConfig == {}:
+ eaters = registry.getRegistry().getComponent(
+ conf.get('type')).getEaters()
+ eatersDict = {}
+ try:
+ eatersTuple = [(None, parseFeedId(s)) for s in sourceConfig]
+ eatersDict = config.buildEatersDict(eatersTuple, eaters)
+ except errors.ConfigError:
+ message = messages.Warning(T_(
+ N_("Component logged in with old deprecated "
+ "configuration and creating an eaters config "
+ "caused an error. Restarting this component "
+ "will result in bad things. Best thing to do "
+ "is stop the component, restart manager and "
+ "start it again.")))
+ state.append('messages', message)
+ conf.set('eater', eatersDict)
def verifyExistingComponentState(jobState, state):
# condition (1)
state.setJobState(jobState)
-
if conf:
- # check for components that have no eater dict but a
- # non-empty source list, and file all these under
- # eater default
- eaterConfig = conf.get('eater', {})
- sourceConfig = conf.get('source', [])
- if eaterConfig == {}:
- eaters = registry.getRegistry().getComponent(
- conf.get('type')).getEaters()
- eatersDict = {}
- try:
- eatersTuple = [(None, s) for s in sourceConfig]
- eatersDict = config.buildEatersDict(eatersTuple, eaters)
- except errors.ConfigError:
- message = messages.Warning(T_(
- N_("Component logged in with old deprecated "
- "configuration and creating an eaters config "
- "caused an error. Restarting this component "
- "will result in bad things. Best thing to do "
- "is stop the component, restart manager and "
- "start it again.")))
- state.append('messages', message)
- conf.set('eater', eatersDict)
+ fixOldEaterConfig(state)
if state.get('config') != conf:
diff = config.dictDiff(state.get('config'), conf)
diffMsg = config.dictDiffMessageString(diff,
@@ -1034,6 +1041,7 @@
if conf:
flowName, compName = conf['parent'], conf['name']
+ fixOldEaterConfig(state)
else:
# unfortunately there is a window in which a component does
# not have a config. accept that so that an admin can stop
@@ -1049,29 +1057,6 @@
state.set('name', compName)
state.set('type', conf['type'])
state.set('workerRequested', jobState.get('workerName'))
- # check for components that have no eater dict but a
- # non-empty source list, and file all these under
- # eater default
- eaterConfig = conf.get('eater', {})
- sourceConfig = conf.get('source', [])
- if eaterConfig == {}:
- eaters = registry.getRegistry().getComponent(
- conf.get('type')).getEaters()
- eatersDict = {}
- try:
- eatersTuple = [(None, s) for s in sourceConfig]
- eatersDict = config.buildEatersDict(eatersTuple, eaters)
- except errors.ConfigError:
- message = messages.Warning(T_(
- N_("Component logged in with old deprecated "
- "configuration and creating an eaters config "
- "caused an error. Restarting this component "
- "will result in bad things. Best thing to do "
- "is stop the component, restart manager and "
- "start it again.")))
- state.append('messages', message)
- conf.set('eater', eatersDict)
-
state.set('config', conf)
# check if we have this flow yet and add if not
More information about the flumotion-commit
mailing list