thomas - r7232 - in flumotion/trunk: . flumotion/admin/command

flumotion-commit at lists.fluendo.com flumotion-commit at lists.fluendo.com
Tue Aug 12 18:29:21 CEST 2008


Author: thomas
Date: Tue Aug 12 18:29:21 2008
New Revision: 7232

Log:
	* flumotion/admin/command/common.py:
	* flumotion/admin/command/component.py:
	* flumotion/admin/command/main.py:
	* flumotion/admin/command/worker.py:
	  managerDeferred->loginDeferred
	  adminModel->medium
	  More generic variable names for subclassing.



Modified:
   flumotion/trunk/ChangeLog
   flumotion/trunk/flumotion/admin/command/common.py
   flumotion/trunk/flumotion/admin/command/component.py
   flumotion/trunk/flumotion/admin/command/main.py
   flumotion/trunk/flumotion/admin/command/worker.py

Modified: flumotion/trunk/ChangeLog
==============================================================================
--- flumotion/trunk/ChangeLog	(original)
+++ flumotion/trunk/ChangeLog	Tue Aug 12 18:29:21 2008
@@ -1,5 +1,15 @@
 2008-08-12  Thomas Vander Stichele  <thomas at apestaart dot org>
 
+	* flumotion/admin/command/common.py:
+	* flumotion/admin/command/component.py:
+	* flumotion/admin/command/main.py:
+	* flumotion/admin/command/worker.py:
+	  managerDeferred->loginDeferred
+	  adminModel->medium
+	  More generic variable names for subclassing.
+
+2008-08-12  Thomas Vander Stichele  <thomas at apestaart dot org>
+
 	* configure.ac:
 	  Final renames.
 

Modified: flumotion/trunk/flumotion/admin/command/common.py
==============================================================================
--- flumotion/trunk/flumotion/admin/command/common.py	(original)
+++ flumotion/trunk/flumotion/admin/command/common.py	Tue Aug 12 18:29:21 2008
@@ -118,7 +118,7 @@
 
     def do(self, args):
         # call our callback after connecting
-        self.getRootCommand().managerDeferred.addCallback(self._callback, args)
+        self.getRootCommand().loginDeferred.addCallback(self._callback, args)
 
     def _callback(self, result, args):
         return self.doCallback(args)

Modified: flumotion/trunk/flumotion/admin/command/component.py
==============================================================================
--- flumotion/trunk/flumotion/admin/command/component.py	(original)
+++ flumotion/trunk/flumotion/admin/command/component.py	Tue Aug 12 18:29:21 2008
@@ -44,7 +44,7 @@
                 "with 'component -i [component-id]'")
 
         p = self.parentCommand
-        d = self.getRootCommand().adminModel.callRemote('deleteComponent',
+        d = self.getRootCommand().medium.callRemote('deleteComponent',
             self.parentCommand.componentState)
 
         def cb(result):
@@ -90,7 +90,7 @@
             args = []
 
         p = self.parentCommand
-        d = self.getRootCommand().adminModel.componentCallRemote(
+        d = self.getRootCommand().medium.componentCallRemote(
             self.parentCommand.componentState, methodName, *args)
 
         def cb(result):
@@ -200,7 +200,7 @@
                 "with 'component -i [component-id]'")
 
         # call our callback after connecting
-        d = self.getRootCommand().managerDeferred
+        d = self.getRootCommand().loginDeferred
         d.addCallback(self._callback)
         d.addErrback(self._errback)
 
@@ -210,7 +210,7 @@
             self.uiState = uiState
 
         componentCommand = self.parentCommand
-        model = componentCommand.parentCommand.adminModel
+        model = componentCommand.parentCommand.medium
         d = model.componentCallRemote(
             componentCommand.componentState, 'getUIState')
         d.addCallback(getUIStateCb)
@@ -236,7 +236,7 @@
             self.stdout.write("Component is already happy.\n")
             return 0
 
-        d = self.getRootCommand().adminModel.callRemote('componentStart',
+        d = self.getRootCommand().medium.callRemote('componentStart',
             self.parentCommand.componentState)
 
         def cb(result):
@@ -269,7 +269,7 @@
             self.stdout.write("Component is already sleeping.\n")
             return 0
 
-        d = self.getRootCommand().adminModel.callRemote('componentStop',
+        d = self.getRootCommand().medium.callRemote('componentStop',
             self.parentCommand.componentState)
 
         def cb(result):
@@ -313,10 +313,10 @@
     def handleOptions(self, options):
         self.componentId = options.componentId
         # call our callback after connecting
-        self.getRootCommand().managerDeferred.addCallback(self._callback)
+        self.getRootCommand().loginDeferred.addCallback(self._callback)
 
     def _callback(self, result):
-        d = self.parentCommand.adminModel.callRemote('getPlanetState')
+        d = self.parentCommand.medium.callRemote('getPlanetState')
 
         def gotPlanetStateCb(result):
             self.planetState = result

Modified: flumotion/trunk/flumotion/admin/command/main.py
==============================================================================
--- flumotion/trunk/flumotion/admin/command/main.py	(original)
+++ flumotion/trunk/flumotion/admin/command/main.py	Tue Aug 12 18:29:21 2008
@@ -41,7 +41,7 @@
 # Because we run a reactor and use deferreds, the flow is slightly different
 # from the usual Command flow.
 
-# Nagios will first create a managerDeferred instance variable, which will
+# Nagios will first create a loginDeferred instance variable, which will
 # allow subcommands to hook into the connection and schedule callbacks.
 
 # Nagios will then parse the command line, allowing all subcommands to
@@ -58,8 +58,8 @@
     usage = "%prog %command"
     description = "Run commands on Flumotion manager."
 
-    managerDeferred = None # deferred that fires upon connection
-    adminModel = None      # AdminModel connected to the manager
+    loginDeferred = None # deferred that fires upon connection
+    medium = None    # medium giving access over the connection
 
     subCommandClasses = [component.Component, manager.Manager, worker.Worker]
 
@@ -87,7 +87,7 @@
 
     def parse(self, argv):
         # instantiated here so our subcommands can chain to it
-        self.managerDeferred = defer.Deferred()
+        self.loginDeferred = defer.Deferred()
 
         self.debug('parse: chain up')
         # chain up to parent first
@@ -128,8 +128,8 @@
             reactor.callLater(0, reactor.stop)
             return
 
-        self.managerDeferred.addCallback(cb)
-        self.managerDeferred.addErrback(eb)
+        self.loginDeferred.addCallback(cb)
+        self.loginDeferred.addErrback(eb)
 
         # now run the reactor
         self.debug('parse: run the reactor')
@@ -162,33 +162,33 @@
         # gratuitous changes
         try:
             # platform-3
-            self.adminModel = admin.AdminModel(connection.authenticator)
+            self.medium = admin.AdminModel(connection.authenticator)
             self.debug("code is platform-3")
         except TypeError:
             # trunk
-            self.adminModel = admin.AdminModel()
+            self.medium = admin.AdminModel()
             self.debug("code is trunk")
 
-        if hasattr(self.adminModel, 'connectToHost'):
+        if hasattr(self.medium, 'connectToHost'):
             # platform-3
-            d = self.adminModel.connectToHost(connection.host,
+            d = self.medium.connectToHost(connection.host,
                 connection.port, not connection.use_ssl)
         else:
-            d = self.adminModel.connectToManager(connection)
+            d = self.medium.connectToManager(connection)
 
         d.addCallback(self._connectedCb)
         d.addErrback(self._connectedEb)
 
     def _connectedCb(self, result):
         self.debug('Connected to manager.')
-        self.managerDeferred.callback(result)
+        self.loginDeferred.callback(result)
 
     def _connectedEb(self, failure):
         if failure.check(errors.ConnectionFailedError):
             sys.stderr.write("Unable to connect to manager.\n")
         if failure.check(errors.ConnectionRefusedError):
             sys.stderr.write("Manager refused connection.\n")
-        self.managerDeferred.errback(failure)
+        self.loginDeferred.errback(failure)
 
 
 def main(args):

Modified: flumotion/trunk/flumotion/admin/command/worker.py
==============================================================================
--- flumotion/trunk/flumotion/admin/command/worker.py	(original)
+++ flumotion/trunk/flumotion/admin/command/worker.py	Tue Aug 12 18:29:21 2008
@@ -71,7 +71,7 @@
             args = []
 
         p = self.parentCommand
-        d = self.getRootCommand().adminModel.callRemote(
+        d = self.getRootCommand().medium.callRemote(
             'workerCallRemote', workerName, methodName, *args)
 
         def cb(result):
@@ -147,7 +147,7 @@
 
         p = self.parentCommand
         workerName = p.options.name
-        d = self.getRootCommand().adminModel.callRemote(
+        d = self.getRootCommand().medium.callRemote(
             'workerCallRemote', workerName, 'runFunction',
             moduleName, methodName, *args)
 
@@ -219,10 +219,10 @@
 
     def handleOptions(self, options):
         # call our callback after connecting
-        self.getRootCommand().managerDeferred.addCallback(self._callback)
+        self.getRootCommand().loginDeferred.addCallback(self._callback)
 
     def _callback(self, result):
-        d = self.parentCommand.adminModel.callRemote('getWorkerHeavenState')
+        d = self.parentCommand.medium.callRemote('getWorkerHeavenState')
 
         def gotWorkerHeavenStateCb(result):
             self.workerHeavenState = result


More information about the flumotion-commit mailing list