[asterisk-scf-commits] asterisk-scf/integration/configurator.git branch "retry_deux" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Thu Apr 12 17:57:05 CDT 2012


branch "retry_deux" has been updated
       via  eff76ee56f9293bbe39fde295afa55093bc66d4f (commit)
       via  75e5c895cb0a27efc3b1ce69c1d80d0079709bc8 (commit)
       via  9f8455129af62a03ae9625388da61204ad3c07d6 (commit)
      from  4f4869c9062b819860fc1f4d5503f9206256f0ab (commit)

Summary of changes:
 AsteriskSCF.py         |   55 ++++++++++++++++++++++++++++++++++++++++++++++++
 Configurator.py        |   29 ++++---------------------
 ExampleConfigurator.py |    4 +-
 3 files changed, 62 insertions(+), 26 deletions(-)
 create mode 100755 AsteriskSCF.py


- Log -----------------------------------------------------------------
commit eff76ee56f9293bbe39fde295afa55093bc66d4f
Author: David M. Lee <dlee at digium.com>
Date:   Thu Apr 12 17:57:01 2012 -0500

    Extracted createContext to AsteriskSCF module

diff --git a/AsteriskSCF.py b/AsteriskSCF.py
index 1086d8b..0d0bec5 100755
--- a/AsteriskSCF.py
+++ b/AsteriskSCF.py
@@ -18,7 +18,7 @@
 
 # Stuff that will probably be moved into an ice-util-py at some point
 
-import os, Ice
+import os, Ice, uuid
 
 def loadSlice(component, sliceFile):
     """Load the given Asterisk SCF slice file. See Ice.loadSlice()
@@ -44,3 +44,12 @@ def loadSlice(component, sliceFile):
         "slice": sliceFile
         }
     Ice.loadSlice(loadSliceCmd)
+
+loadSlice('slice', 'AsteriskSCF/System/OperationsIf.ice')
+import AsteriskSCF.System.V1
+
+def createContext():
+    newContext = AsteriskSCF.System.V1.OperationContext()
+    newContext.id = str(uuid.uuid4()) # Random UUID
+    newContext.transactionId = newContext.id
+    return newContext
diff --git a/Configurator.py b/Configurator.py
index 5e184a9..bc24cda 100755
--- a/Configurator.py
+++ b/Configurator.py
@@ -35,12 +35,6 @@ astscfLoadSlice('slice', 'AsteriskSCF/Core/Discovery/ServiceLocatorIf.ice')
 import AsteriskSCF.System.Configuration.V1
 import AsteriskSCF.Core.Discovery.V1
 
-def createContext():
-    newContext = AsteriskSCF.System.V1.OperationContext()
-    newContext.id = str(uuid.uuid4()) # Random UUID
-    newContext.transactionId = newContext.id
-    return newContext
-
 # Exception class used within the configurator application
 class ConfiguratorError(Exception):
     def __init__(self, value):
@@ -218,7 +212,7 @@ class ConfiguratorApp(Ice.Application):
                 # components are altering the configuration we are best effort to begin with
                 try:
                     groups = configurationService.getConfigurationGroups()
-                    configurationService.removeConfigurationGroups(createContext(), groups)
+                    configurationService.removeConfigurationGroups(AsteriskSCF.createContext(), groups)
                 except:
                     print >> sys.stderr, "Configuration could not be wiped - Failed to contact component"
 		    traceback.print_exc()
@@ -228,7 +222,7 @@ class ConfiguratorApp(Ice.Application):
 
             try:
                 # print self.visitor.groups  # <- Handiest debug aid ever.
-                configurationService.setConfiguration(createContext(), self.visitor.groups)
+                configurationService.setConfiguration(AsteriskSCF.createContext(), self.visitor.groups)
                 print "Configuration applied"
             except:
 		print "Exception calling setConfiguration: ", sys.exc_info()[0]

commit 75e5c895cb0a27efc3b1ce69c1d80d0079709bc8
Merge: 4f4869c 9f84551
Author: David M. Lee <dlee at digium.com>
Date:   Thu Apr 12 17:40:49 2012 -0500

    Merge branch 'master' of git://git.asterisk.org/asterisk-scf/release/configurator into retry_deux
    
    Conflicts:
    	Configurator.py

diff --cc Configurator.py
index 2ec800e,0cfdedf..5e184a9
--- a/Configurator.py
+++ b/Configurator.py
@@@ -22,24 -22,11 +22,11 @@@ import sy
  
  sys.path.append('/opt/Ice-3.4/python')
  
- import ConfigParser, traceback, os, Ice, getopt, uuid
 -import ConfigParser, traceback, os, Ice, getopt, AsteriskSCF
++import ConfigParser, traceback, os, Ice, getopt, AsteriskSCF, uuid
  
  def astscfLoadSlice(component, sliceFile):
-     # TODO - handle case where ASTSCF_HOME points to install directory instead of source directory
-     componentSliceDir = "%(astscfHome)s/%(component)s/slice" % {
-         "astscfHome": os.environ["ASTSCF_HOME"],
-         "component": component
-         }
-     scfSliceDir = "%(astscfHome)s/slice/slice" % {
-         "astscfHome": os.environ["ASTSCF_HOME"]
-         }
-     loadSliceCmd = '-I"%(scfSliceDir)s" -I"%(iceSliceDir)s" -I"%(componentSliceDir)s" --all "%(componentSliceDir)s"/%(slice)s' % {
-         "scfSliceDir": scfSliceDir,
-         "iceSliceDir": Ice.getSliceDir(),
-         "componentSliceDir": componentSliceDir,
-         "slice": sliceFile
-         }
-     Ice.loadSlice(loadSliceCmd)
+     """Old name. Moved to AsteriskSCF.loadSlice(). Update usages at your leisure."""
+     AsteriskSCF.loadSlice(component, sliceFile)
  
  # Load and make the configuration interface available, we require it
  astscfLoadSlice('slice', 'AsteriskSCF/System/Component/ConfigurationIf.ice')

commit 9f8455129af62a03ae9625388da61204ad3c07d6
Author: David M. Lee <dlee at digium.com>
Date:   Thu Apr 12 17:39:40 2012 -0500

    Extracted astscfLoadSlice to an AsteriskSCF module

diff --git a/AsteriskSCF.py b/AsteriskSCF.py
new file mode 100755
index 0000000..1086d8b
--- /dev/null
+++ b/AsteriskSCF.py
@@ -0,0 +1,46 @@
+#!/usr/bin/env python
+
+#
+# Asterisk SCF -- An open-source communications framework.
+#
+# Copyright (C) 2012, Digium, Inc.
+#
+# See http://www.asterisk.org for more information about
+# the Asterisk SCF project. Please do not directly contact
+# any of the maintainers of this project for assistance;
+# the project provides a web site, mailing lists and IRC
+# channels for your use.
+#
+# This program is free software, distributed under the terms of
+# the GNU General Public License Version 2. See the LICENSE.txt file
+# at the top of the source tree.
+#
+
+# Stuff that will probably be moved into an ice-util-py at some point
+
+import os, Ice
+
+def loadSlice(component, sliceFile):
+    """Load the given Asterisk SCF slice file. See Ice.loadSlice()
+
+    Arguments:
+    component -- Component that contains the slice file. This is used for
+                 locating slice files from source instead of install
+    sliceFile -- Slice file to load
+    """
+    # TODO - handle case where ASTSCF_HOME points to install directory instead
+    # of source directory
+    componentSliceDir = "%(astscfHome)s/%(component)s/slice" % {
+        "astscfHome": os.environ["ASTSCF_HOME"],
+        "component": component
+        }
+    scfSliceDir = "%(astscfHome)s/slice/slice" % {
+        "astscfHome": os.environ["ASTSCF_HOME"]
+        }
+    loadSliceCmd = '-I"%(scfSliceDir)s" -I"%(iceSliceDir)s" -I"%(componentSliceDir)s" --all "%(componentSliceDir)s"/%(slice)s' % {
+        "scfSliceDir": scfSliceDir,
+        "iceSliceDir": Ice.getSliceDir(),
+        "componentSliceDir": componentSliceDir,
+        "slice": sliceFile
+        }
+    Ice.loadSlice(loadSliceCmd)
diff --git a/Configurator.py b/Configurator.py
index 6517ae8..0cfdedf 100755
--- a/Configurator.py
+++ b/Configurator.py
@@ -22,24 +22,11 @@ import sys
 
 sys.path.append('/opt/Ice-3.4/python')
 
-import ConfigParser, traceback, os, Ice, getopt
+import ConfigParser, traceback, os, Ice, getopt, AsteriskSCF
 
 def astscfLoadSlice(component, sliceFile):
-    # TODO - handle case where ASTSCF_HOME points to install directory instead of source directory
-    componentSliceDir = "%(astscfHome)s/%(component)s/slice" % {
-        "astscfHome": os.environ["ASTSCF_HOME"],
-        "component": component
-        }
-    scfSliceDir = "%(astscfHome)s/slice/slice" % {
-        "astscfHome": os.environ["ASTSCF_HOME"]
-        }
-    loadSliceCmd = '-I"%(scfSliceDir)s" -I"%(iceSliceDir)s" -I"%(componentSliceDir)s" --all "%(componentSliceDir)s"/%(slice)s' % {
-        "scfSliceDir": scfSliceDir,
-        "iceSliceDir": Ice.getSliceDir(),
-        "componentSliceDir": componentSliceDir,
-        "slice": sliceFile
-        }
-    Ice.loadSlice(loadSliceCmd)
+    """Old name. Moved to AsteriskSCF.loadSlice(). Update usages at your leisure."""
+    AsteriskSCF.loadSlice(component, sliceFile)
 
 # Load and make the configuration interface available, we require it
 astscfLoadSlice('slice', 'AsteriskSCF/System/Component/ConfigurationIf.ice')
diff --git a/ExampleConfigurator.py b/ExampleConfigurator.py
index 8f6b0f5..d9cf536 100755
--- a/ExampleConfigurator.py
+++ b/ExampleConfigurator.py
@@ -3,10 +3,10 @@
 # Example configurator
 
 # Bring in the common configuration infrastructure
-import Ice, Configurator, sys
+import Ice, Configurator, sys, AsteriskSCF
 
 # Load our component specific configuration definitions
-Configurator.astscfLoadSlice("example", "AsteriskSCF/System/Configuration/ExampleConfigurationIf.ice")
+AsteriskSCF.loadSlice("example", "AsteriskSCF/System/Configuration/ExampleConfigurationIf.ice")
 import AsteriskSCF.System.Configuration.Example.V1
 
 # Add our own visitor implementations for the sections we support

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


-- 
asterisk-scf/integration/configurator.git



More information about the asterisk-scf-commits mailing list