diff --git a/mythtv/bindings/python/MythTV/database.py b/mythtv/bindings/python/MythTV/database.py
index 7e3c4fe42b..fe4fe86731 100644
a
|
b
|
class DBCache( MythSchema ): |
1360 | 1360 | return self.dbconfig.profile |
1361 | 1361 | |
1362 | 1362 | def getMasterBackend(self): |
1363 | | return self._gethostfromaddr(self.settings.NULL.MasterServerIP) |
| 1363 | return self.settings.NULL.MasterServerName |
1364 | 1364 | |
1365 | 1365 | def getStorageGroup(self, groupname=None, hostname=None): |
1366 | 1366 | """ |
diff --git a/mythtv/bindings/python/MythTV/methodheap.py b/mythtv/bindings/python/MythTV/methodheap.py
index 04c7e98bb4..f8dbb12e65 100644
a
|
b
|
class MythXML( XMLConnection ): |
1142 | 1142 | self.log = MythLog('Python XML Connection') |
1143 | 1143 | if backend is None: |
1144 | 1144 | # use master backend |
1145 | | backend = self.db.settings.NULL.MasterServerIP |
1146 | | if re.match(r'(?:\d{1,3}\.){3}\d{1,3}',backend) or \ |
| 1145 | backendname = self.db.settings.NULL.MasterServerName |
| 1146 | self.host = self.db.settings[backendname].BackendServerAddr |
| 1147 | self.port = int(self.db.settings[backendname].BackendStatusPort) |
| 1148 | elif re.match(r'(?:\d{1,3}\.){3}\d{1,3}',backend) or \ |
1147 | 1149 | check_ipv6(backend): |
1148 | 1150 | # process ip address |
1149 | | host = self.db._gethostfromaddr(backend) |
| 1151 | host = self.db._gethostfromaddr(backend, 'BackendServerAddr') |
1150 | 1152 | self.host = backend |
1151 | 1153 | self.port = int(self.db.settings[host].BackendStatusPort) |
1152 | 1154 | else: |
1153 | | # assume given a hostname |
1154 | | self.host = backend |
1155 | | self.port = int(self.db.settings[self.host].BackendStatusPort) |
1156 | | if not self.port: |
| 1155 | # assume given a canonical host address |
| 1156 | try: |
| 1157 | host = self.db._gethostfromaddr(backend, 'BackendServerAddr') |
| 1158 | self.host = backend |
| 1159 | self.port = int(self.db.settings[host].BackendStatusPort) |
| 1160 | except MythDBError: |
1157 | 1161 | # try a truncated hostname |
1158 | | self.host = backend.split('.')[0] |
1159 | | self.port = int(self.db.setting[self.host].BackendStatusPort) |
| 1162 | host = backend.split('.')[0] |
| 1163 | self.host = self.db._getpreferredaddr(host) |
| 1164 | if not self.host: |
| 1165 | raise MythDBError(MythError.DB_SETTING, |
| 1166 | backend+': BackendServerAddr') |
| 1167 | self.port = int(self.db.settings[host].BackendStatusPort) |
1160 | 1168 | if not self.port: |
1161 | 1169 | raise MythDBError(MythError.DB_SETTING, |
1162 | 1170 | backend+': BackendStatusPort') |
diff --git a/mythtv/bindings/python/MythTV/mythproto.py b/mythtv/bindings/python/MythTV/mythproto.py
index b388e9619f..70ac6b6079 100644
a
|
b
|
class BECache( object ): |
76 | 76 | |
77 | 77 | if backend is None: |
78 | 78 | # no backend given, use master |
79 | | self.host = self.db.settings.NULL.MasterServerIP |
80 | | self.hostname = self.db._gethostfromaddr(self.host) |
81 | | |
| 79 | self.hostname = self.db.settings.NULL.MasterServerName |
| 80 | self.host = self.db._getpreferredaddr(self.hostname) |
82 | 81 | else: |
83 | 82 | backend = backend.strip('[]') |
84 | 83 | if self._reip.match(backend): |
… |
… |
class BECache( object ): |
95 | 94 | # given backend is hostname, pull address from database |
96 | 95 | self.hostname = backend |
97 | 96 | self.host = self.db._getpreferredaddr(backend) |
| 97 | if not self.host: |
| 98 | # given backend is canonical name, use it as ip address |
| 99 | self.host = backend |
| 100 | self.hostname = self.db._gethostfromaddr( |
| 101 | backend, 'BackendServerAddr') |
98 | 102 | |
99 | 103 | # lookup port from database |
100 | 104 | self.port = int(self.db.settings[self.hostname].BackendServerPort) |