[svn-commits] pabelanger: branch pabelanger/non-root r685 - in /asterisk/team/pabelanger/no...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Aug 2 18:18:33 CDT 2010


Author: pabelanger
Date: Mon Aug  2 18:18:29 2010
New Revision: 685

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=685
Log:
resolve and init
---
Merged revisions 680,683-684 via svnmerge from 
https://origsvn.digium.com/svn/testsuite/asterisk/trunk

........
  r680 | pabelanger | 2010-08-02 11:11:23 -0400 (Mon, 02 Aug 2010) | 23 lines
  
  New install_configs() function and ability for backwards compatible configs
  
  Add the ability to specify a config directory to be installed.  Everything within
  the directory, except the .svn, branch-1.4, branch-1.6.2 and branch-1.8
  directories, will be copied over.
  
  Also includes in functionality for backwards compatible config files.  If a
  sub-directory is found to be the same as the running instance, it will use that
  version of .config file.
  
  For example: If testsuite is running a test against 1.4 (branch-1.4):
  
  configs/manager.conf
  configs/sip.conf
  configs/branch-1.4/sip.conf
  
  Because the sip.conf file exists in the branch-1.4 directory, it will be used
  in place of the top-level sip.conf.  As for the manager.conf file, because it
  does not exists in the branch-1.4 direcory, the top-level manager.conf will
  be used. 
  
  Review: https://reviewboard.asterisk.org/r/831/
........
  r683 | pabelanger | 2010-08-02 14:46:04 -0400 (Mon, 02 Aug 2010) | 3 lines
  
  Update install_configs() to only install top-level files, sub-directories
  will be ignored.
........
  r684 | pabelanger | 2010-08-02 15:03:47 -0400 (Mon, 02 Aug 2010) | 2 lines
  
  Document new functionality of install_config().
........

Modified:
    asterisk/team/pabelanger/non-root/   (props changed)
    asterisk/team/pabelanger/non-root/lib/python/asterisk/asterisk.py

Propchange: asterisk/team/pabelanger/non-root/
------------------------------------------------------------------------------
    automerge = *

Propchange: asterisk/team/pabelanger/non-root/
------------------------------------------------------------------------------
    automerge-email = paul.belanger at polybeacon.com

Propchange: asterisk/team/pabelanger/non-root/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon Aug  2 18:18:29 2010
@@ -1,1 +1,1 @@
-/asterisk/trunk:1-659
+/asterisk/trunk:1-659,680-684

Modified: asterisk/team/pabelanger/non-root/lib/python/asterisk/asterisk.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/pabelanger/non-root/lib/python/asterisk/asterisk.py?view=diff&rev=685&r1=684&r2=685
==============================================================================
--- asterisk/team/pabelanger/non-root/lib/python/asterisk/asterisk.py (original)
+++ asterisk/team/pabelanger/non-root/lib/python/asterisk/asterisk.py Mon Aug  2 18:18:29 2010
@@ -144,25 +144,26 @@
         """Installs all files located in the configuration directory for this
         instance of Asterisk.
 
+    def install_configs(self, cfg_path):
+        """Installs all files located in the configuration directory for this
+        instance of Asterisk.
+
         By default, the configuration used will be whatever is found in the
         system install of Asterisk.  However, custom configuration files to be
         used only by this instance can be provided via this API call.
 
         Keyword Arguments:
-        cfg_path -- This argument must be the path to the configuration directory 
-        to be installed into this instance of Asterisk.
+        cfg_path -- This argument must be the path to the configuration directory
+        to be installed into this instance of Asterisk. Only top-level files will
+        be installed, sub directories will be ignored. 
 
         Example Usage:
         asterisk.install_configs("tests/my-cool-test/configs")
         """
-	for dirname, dirnames, filenames in os.walk(cfg_path):
-            blacklist = [ ".svn", "1.4", "1.6.2", "1.8" ]
-            for b in blacklist:
-                if b in dirnames:
-                    dirnames.remove(b)
-            for filename in filenames:
-                target = "%s/%s" % (dirname, filename)
-		self.install_config(target)
+        for f in os.listdir(cfg_path):
+            target = "%s/%s" % (cfg_path, f)
+            if os.path.isfile(target):
+                self.install_config(target)
 
     def install_config(self, cfg_path):
         """Install a custom configuration file for this instance of Asterisk.
@@ -171,6 +172,21 @@
         system install of Asterisk.  However, custom configuration files to be
         used only by this instance can be provided via this API call.
 
+        Note: If a sub-directory is found to have the same name as the running
+        instance, install_config() will use the sub-directories version in place 
+        of the top-level version.
+
+        For example, testsuite is running a test against 1.4 (branch-1.4):
+
+            configs/manager.conf
+            configs/sip.conf
+            configs/branch-1.4/sip.conf
+
+        Because the sip.conf file exists in the branch-1.4 directory, it will
+        be used in place of the top-level sip.conf.  As for the manager.conf
+        file, because it does not exists in the branch-1.4 direcory, the
+        top-level manager.conf will be used.
+
         Keyword Arguments:
         cfg_path -- This argument must be the path to the configuration file
         to be installed into the directory tree for this instance of Asterisk.
@@ -182,8 +198,8 @@
             print "Config file '%s' does not exist" % cfg_path
             return
 
-	tmp = "%s/%s/%s" % (os.path.dirname(cfg_path), self.ast_version.branch, os.path.basename(cfg_path))
-	if os.path.exists(tmp):
+        tmp = "%s/%s/%s" % (os.path.dirname(cfg_path), self.ast_version.branch, os.path.basename(cfg_path))
+        if os.path.exists(tmp):
             cfg_path = tmp
         target_path = os.path.join(self.astetcdir, os.path.basename(cfg_path))
         if os.path.exists(target_path):
@@ -354,4 +370,3 @@
 		target_dir = "/"
 		dirname = dirname.lstrip("/tmp/x")
                 self.__makedirs(os.path.join(target_dir, dirname, d))
-




More information about the svn-commits mailing list