Ticket #13593: Python_Replace_deprecated_settings.patch

File Python_Replace_deprecated_settings.patch, 4.1 KB (added by rcrdnalor, 4 years ago)

Replace deprecated settings 'MasterServerIP' and 'MasterServerPort?'

  • mythtv/bindings/python/MythTV/database.py

    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 ): 
    13601360        return self.dbconfig.profile
    13611361
    13621362    def getMasterBackend(self):
    1363         return self._gethostfromaddr(self.settings.NULL.MasterServerIP)
     1363        return self.settings.NULL.MasterServerName
    13641364
    13651365    def getStorageGroup(self, groupname=None, hostname=None):
    13661366        """
  • mythtv/bindings/python/MythTV/methodheap.py

    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 ): 
    11421142        self.log = MythLog('Python XML Connection')
    11431143        if backend is None:
    11441144            # 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 \
    11471149                    check_ipv6(backend):
    11481150            # process ip address
    1149             host = self.db._gethostfromaddr(backend)
     1151            host = self.db._gethostfromaddr(backend, 'BackendServerAddr')
    11501152            self.host = backend
    11511153            self.port = int(self.db.settings[host].BackendStatusPort)
    11521154        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:
    11571161                # 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)
    11601168                if not self.port:
    11611169                    raise MythDBError(MythError.DB_SETTING,
    11621170                                        backend+': BackendStatusPort')
  • mythtv/bindings/python/MythTV/mythproto.py

    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 ): 
    7676
    7777        if backend is None:
    7878            # 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)
    8281        else:
    8382            backend = backend.strip('[]')
    8483            if self._reip.match(backend):
    class BECache( object ): 
    9594                # given backend is hostname, pull address from database
    9695                self.hostname = backend
    9796                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')
    98102
    99103        # lookup port from database
    100104        self.port = int(self.db.settings[self.hostname].BackendServerPort)