[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 10:43:49 CDT 2012


branch "retry_deux" has been updated
       via  4f4869c9062b819860fc1f4d5503f9206256f0ab (commit)
       via  c29718e6ee53d23ee689193831968ba06dcafc54 (commit)
       via  a02be9ac84985a4ae3b9b43050c2ace3b4439cfa (commit)
       via  f75c28f13c57e4624f97412f96ccefd6bf89d0b0 (commit)
       via  cfb18a4d277998604e9eb1bfcf21d1fb5f47448c (commit)
      from  30e4d200128171712c9dbaab84a96c3c98bcba97 (commit)

Summary of changes:
 .gitignore             |    1 +
 Configurator.py        |   41 +++++++++++++++++++++++++++--------------
 ExampleConfigurator.py |    2 +-
 3 files changed, 29 insertions(+), 15 deletions(-)
 create mode 100644 .gitignore


- Log -----------------------------------------------------------------
commit 4f4869c9062b819860fc1f4d5503f9206256f0ab
Author: David M. Lee <dlee at digium.com>
Date:   Thu Apr 12 10:35:22 2012 -0500

    Extracted createContext function.

diff --git a/Configurator.py b/Configurator.py
index de8c349..2ec800e 100755
--- a/Configurator.py
+++ b/Configurator.py
@@ -48,8 +48,11 @@ astscfLoadSlice('slice', 'AsteriskSCF/Core/Discovery/ServiceLocatorIf.ice')
 import AsteriskSCF.System.Configuration.V1
 import AsteriskSCF.Core.Discovery.V1
 
-def uuidstr():
-    return str(uuid.uuid1())
+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):
@@ -227,12 +230,8 @@ class ConfiguratorApp(Ice.Application):
                 # There is a race condition here where another component could modify the groups present, but if two
                 # components are altering the configuration we are best effort to begin with
                 try:
-                    context = AsteriskSCF.System.V1.OperationContext()
-                    context.id = uuidstr()
-                    context.transactionId = context.id
-                    
                     groups = configurationService.getConfigurationGroups()
-                    configurationService.removeConfigurationGroups(context, groups)
+                    configurationService.removeConfigurationGroups(createContext(), groups)
                 except:
                     print >> sys.stderr, "Configuration could not be wiped - Failed to contact component"
 		    traceback.print_exc()
@@ -242,10 +241,7 @@ class ConfiguratorApp(Ice.Application):
 
             try:
                 # print self.visitor.groups  # <- Handiest debug aid ever.
-                context = AsteriskSCF.System.V1.OperationContext()
-                context.id = uuidstr()
-                context.transactionId = context.id
-                configurationService.setConfiguration(context, self.visitor.groups)
+                configurationService.setConfiguration(createContext(), self.visitor.groups)
                 print "Configuration applied"
             except:
 		print "Exception calling setConfiguration: ", sys.exc_info()[0]

commit c29718e6ee53d23ee689193831968ba06dcafc54
Merge: 30e4d20 a02be9a
Author: David M. Lee <dlee at digium.com>
Date:   Thu Apr 12 10:34:33 2012 -0500

    Merge remote-tracking branch 'origin/master' into retry_deux
    
    Conflicts:
    	Configurator.py

diff --cc Configurator.py
index 9a8862b,6517ae8..de8c349
--- a/Configurator.py
+++ b/Configurator.py
@@@ -22,11 -22,28 +22,28 @@@ import sy
  
  sys.path.append('/opt/Ice-3.4/python')
  
 -import ConfigParser, traceback, os, Ice, getopt
 +import ConfigParser, traceback, os, Ice, getopt, 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)
+ 
  # Load and make the configuration interface available, we require it
- Ice.loadSlice("-I\"" + os.environ["ASTSCF_HOME"] + "\" -I\"" + Ice.getSliceDir() + "\" --all \"" + os.environ["ASTSCF_HOME"] + "/AsteriskSCF/System/Component/ConfigurationIf.ice\"")
- Ice.loadSlice("-I\"" + os.environ["ASTSCF_HOME"] + "\" -I\"" + Ice.getSliceDir() + "\" --all \"" + os.environ["ASTSCF_HOME"] + "/AsteriskSCF/Core/Discovery/ServiceLocatorIf.ice\"")
+ astscfLoadSlice('slice', 'AsteriskSCF/System/Component/ConfigurationIf.ice')
+ astscfLoadSlice('slice', 'AsteriskSCF/Core/Discovery/ServiceLocatorIf.ice')
  
  import AsteriskSCF.System.Configuration.V1
  import AsteriskSCF.Core.Discovery.V1

commit a02be9ac84985a4ae3b9b43050c2ace3b4439cfa
Author: David M. Lee <dlee at digium.com>
Date:   Thu Apr 12 10:31:39 2012 -0500

    Updated example to new astscfLoadSlice function

diff --git a/ExampleConfigurator.py b/ExampleConfigurator.py
index ac27850..8f6b0f5 100755
--- a/ExampleConfigurator.py
+++ b/ExampleConfigurator.py
@@ -6,7 +6,7 @@
 import Ice, Configurator, sys
 
 # Load our component specific configuration definitions
-Ice.loadSlice('-I. --all ExampleConfigurationIf.ice')
+Configurator.astscfLoadSlice("example", "AsteriskSCF/System/Configuration/ExampleConfigurationIf.ice")
 import AsteriskSCF.System.Configuration.Example.V1
 
 # Add our own visitor implementations for the sections we support

commit f75c28f13c57e4624f97412f96ccefd6bf89d0b0
Author: David M. Lee <dlee at digium.com>
Date:   Thu Apr 12 10:03:21 2012 -0500

    Added astscfLoadSlice function.
    
    This should make loading AsteriskSCF slice files less hackish and more
    consistent.

diff --git a/Configurator.py b/Configurator.py
index a11a076..6517ae8 100755
--- a/Configurator.py
+++ b/Configurator.py
@@ -3,7 +3,7 @@
 #
 # Asterisk SCF -- An open-source communications framework.
 #
-# Copyright (C) 2011, Digium, Inc.
+# Copyright (C) 2011-2012, Digium, Inc.
 #
 # See http://www.asterisk.org for more information about
 # the Asterisk SCF project. Please do not directly contact
@@ -24,9 +24,26 @@ sys.path.append('/opt/Ice-3.4/python')
 
 import ConfigParser, traceback, os, Ice, getopt
 
+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)
+
 # Load and make the configuration interface available, we require it
-Ice.loadSlice("-I\"" + os.environ["ASTSCF_HOME"] + "\" -I\"" + Ice.getSliceDir() + "\" --all \"" + os.environ["ASTSCF_HOME"] + "/slice/slice/AsteriskSCF/System/Component/ConfigurationIf.ice\"")
-Ice.loadSlice("-I\"" + os.environ["ASTSCF_HOME"] + "\" -I\"" + Ice.getSliceDir() + "\" --all \"" + os.environ["ASTSCF_HOME"] + "/slice/slice/AsteriskSCF/Core/Discovery/ServiceLocatorIf.ice\"")
+astscfLoadSlice('slice', 'AsteriskSCF/System/Component/ConfigurationIf.ice')
+astscfLoadSlice('slice', 'AsteriskSCF/Core/Discovery/ServiceLocatorIf.ice')
 
 import AsteriskSCF.System.Configuration.V1
 import AsteriskSCF.Core.Discovery.V1

commit cfb18a4d277998604e9eb1bfcf21d1fb5f47448c
Author: David M. Lee <dlee at digium.com>
Date:   Thu Apr 12 09:49:28 2012 -0500

    Ignore .pyc files

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..0d20b64
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+*.pyc

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


-- 
asterisk-scf/integration/configurator.git



More information about the asterisk-scf-commits mailing list