[asterisk-commits] pabelanger: branch pabelanger/DefaultManagerEnabled r2067 - in /asterisk/team...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Sep 1 13:53:53 CDT 2011


Author: pabelanger
Date: Thu Sep  1 13:53:49 2011
New Revision: 2067

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=2067
Log:
Working :D

Removed:
    asterisk/team/pabelanger/DefaultManagerEnabled/tests/directed_pickup/configs/ast1/manager.general.conf.inc
Modified:
    asterisk/team/pabelanger/DefaultManagerEnabled/lib/python/asterisk/TestCase.py
    asterisk/team/pabelanger/DefaultManagerEnabled/lib/python/asterisk/asterisk.py

Modified: asterisk/team/pabelanger/DefaultManagerEnabled/lib/python/asterisk/TestCase.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/pabelanger/DefaultManagerEnabled/lib/python/asterisk/TestCase.py?view=diff&rev=2067&r1=2066&r2=2067
==============================================================================
--- asterisk/team/pabelanger/DefaultManagerEnabled/lib/python/asterisk/TestCase.py (original)
+++ asterisk/team/pabelanger/DefaultManagerEnabled/lib/python/asterisk/TestCase.py Thu Sep  1 13:53:49 2011
@@ -53,15 +53,14 @@
         """
         for c in range(count):
             logger.info("Creating Asterisk instance %d" % (c + 1))
-            self.ast.append(Asterisk(base=self.base))
+            host = "127.0.0.%d" % (c + 1)
+            self.ast.append(Asterisk(base=self.base, host=host))
             # Copy shared config files
             self.ast[c].install_configs("%s/configs" %
                     (self.test_name))
             # Copy test specific config files
             self.ast[c].install_configs("%s/configs/ast%d" %
                     (self.test_name, c + 1))
-            host = "bindaddr = 127.0.0.2"
-            self.ast[c].append_config("manager.general.conf.inc", host)
 
     def create_ami_factory(self, count=1, username="user", secret="mysecret", port=5038):
         """

Modified: asterisk/team/pabelanger/DefaultManagerEnabled/lib/python/asterisk/asterisk.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/pabelanger/DefaultManagerEnabled/lib/python/asterisk/asterisk.py?view=diff&rev=2067&r1=2066&r2=2067
==============================================================================
--- asterisk/team/pabelanger/DefaultManagerEnabled/lib/python/asterisk/asterisk.py (original)
+++ asterisk/team/pabelanger/DefaultManagerEnabled/lib/python/asterisk/asterisk.py Thu Sep  1 13:53:49 2011
@@ -107,6 +107,8 @@
 
         self.install_configs(os.getcwd() + "/configs")
 
+        self.__setup_configs()
+
     def start(self):
         """Start this instance of Asterisk.
 
@@ -250,7 +252,7 @@
         except IOError:
             logger.warn("The destination is not writable '%s'" % target_path)
 
-    def append_config(self, filename, value):
+    def overwrite_file(self, path, filename, values):
         target_filename = os.path.join(self.astetcdir, filename)
 
         if not os.path.exists(target_filename):
@@ -265,7 +267,9 @@
             logger.error("Unexpected error: %s" % sys.exc_info()[0])
             return
 
-        f.write(value)
+        for (var, val) in values:
+            f.write('%s = %s\n' % (var, val))
+
         f.close()
 
     def cli_originate(self, argstr, blocking=True):
@@ -351,6 +355,20 @@
         except OSError:
             pass
         return output
+
+    def __setup_configs(self):
+        self.__setup_manager_conf()
+
+    def __setup_manager_conf(self):
+        values = []
+
+        if self.host == '127.0.0.1':
+            return
+
+        values.append(['bindaddr', self.host])
+
+        self.overwrite_file(self.directories['astetcdir'],
+            "manager.general.conf.inc", values)
 
     def __gen_ast_conf(self, ast_conf, dir_cat, ast_conf_options):
         for (var, val) in dir_cat.options:




More information about the asterisk-commits mailing list