def CheckForPrimaryMongo(self): try: exists = False for pod in self.pods.items: if pod.status.pod_ip != None: if pod.status.phase.lower() == 'running': if self.sidecarIP != pod.status.pod_ip: member = Member(_id=None, IP=pod.status.pod_ip, priority=None) alive = member.CheckIfAlive() if alive == True: primary = member.CheckIfPrimary() if primary == True: return True return False except Exception as error: print('Watcher.CheckForPrimaryMongo: ERROR - {}'.format(error))