def _get_config(self, nexus_host, filter=''):

        # For loop added to handle stale ncclient handle after switch reboot.
        # If the attempt fails,
        #     close the session, save first exception
        #     loop back around
        #     try again
        #     then quit
        for retry_count in (1, 2):
            mgr = self.nxos_connect(nexus_host)
            starttime = time.time()
            try:
                data_xml = mgr.get(filter=('subtree', filter)).data_xml
            except Exception as e:
                self.capture_and_print_timeshot(
                    starttime, "geterr", retry_count, switch=nexus_host)
                try:
                    self._close_session(mgr, nexus_host)
                except Exception:
                    pass

                # if transaction is snipp.EXEC_GET_INVENTORY_SNIPPET,
                # don't retry since this is used as a ping to
                # validate connection and retry is already built
                # into replay code.
                if snipp.EXEC_GET_INVENTORY_SNIPPET == filter:
                    raise cexc.NexusConfigFailed(nexus_host=nexus_host,
                                                 config=filter,
                                                 exc=e)

                # if first try, save first exception and retry
                if retry_count == 1:
                    first_exc = e
                else:
                    raise cexc.NexusConfigFailed(nexus_host=nexus_host,
                                                 config=filter,
                                                 exc=first_exc)
            else:
                self.capture_and_print_timeshot(
                    starttime, "get", switch=nexus_host)
                return data_xml
Add the farmer to the database.
dataset/ETHPy150Open openstack/networking-cisco/networking_cisco/plugins/ml2/drivers/cisco/nexus/nexus_network_driver.py/CiscoNexusDriver._get_config--crossover with--dataset/ETHPy150Open Storj/dataserv/dataserv/Farmer.py/Farmer.register