[Asterisk-code-review] Remote testsuite: make remote asterisk default ARI host (testsuite[master])

Anonymous Coward asteriskteam at digium.com
Mon Nov 23 19:00:26 CST 2015


Anonymous Coward #1000019 has submitted this change and it was merged.

Change subject: Remote testsuite: make remote asterisk default ARI host
......................................................................


Remote testsuite: make remote asterisk default ARI host

This change adjust the default ARI host automatically so
that it uses the remote host name when so configured.

Change-Id: Ia0d784c100fb43bbd7f949d4fcd281853cc8593d
---
M lib/python/asterisk/ari.py
1 file changed, 7 insertions(+), 1 deletion(-)

Approvals:
  Anonymous Coward #1000019: Verified
  Matt Jordan: Looks good to me, but someone else must approve
  Joshua Colp: Looks good to me, approved



diff --git a/lib/python/asterisk/ari.py b/lib/python/asterisk/ari.py
index 1649f49..064f5d5 100644
--- a/lib/python/asterisk/ari.py
+++ b/lib/python/asterisk/ari.py
@@ -28,6 +28,7 @@
 
 LOGGER = logging.getLogger(__name__)
 
+DEFAULT_HOST = '127.0.0.1'
 DEFAULT_PORT = 8088
 
 #: Default matcher to ensure we don't have any validation failures on the
@@ -60,7 +61,12 @@
         self.apps = test_config.get('apps', 'testsuite')
         if isinstance(self.apps, list):
             self.apps = ','.join(self.apps)
-        host = test_config.get('host', '127.0.0.1')
+        default_host = DEFAULT_HOST
+        if self.global_config.config:
+            asterisks = self.global_config.config.get('asterisk-instances')
+            if asterisks:
+                default_host = asterisks[0]['host']
+        host = test_config.get('host', default_host)
         port = test_config.get('port', DEFAULT_PORT)
         userpass = (test_config.get('username', 'testsuite'),
                     test_config.get('password', 'testsuite'))

-- 
To view, visit https://gerrit.asterisk.org/1665
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia0d784c100fb43bbd7f949d4fcd281853cc8593d
Gerrit-PatchSet: 2
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: Scott Griepentrog <sgriepentrog at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>
Gerrit-Reviewer: Scott Griepentrog <sgriepentrog at digium.com>



More information about the asterisk-code-review mailing list