MCPcopy Create free account
hub / github.com/Keeper-Security/Commander / run

Method run

keepercommander/discovery_common/process.py:1365–1569  ·  view source on GitHub ↗

Process the discovery results. :param record_cache: A dictionary of record types to keys to record UID. :param prompt_func: Function to call when the user needs to make a decision about an object. :param smart_add: If we have resource cred, add the resource and the

(self,
            prompt_func: Callable,
            record_prepare_func: Callable,
            smart_add: bool = False,
            record_lookup_func: Optional[Callable] = None,
            record_create_func: Optional[Callable] = None,
            record_convert_func: Optional[Callable] = None,
            prompt_confirm_add_func: Optional[Callable] = None,
            prompt_admin_func: Optional[Callable] = None,
            auto_add_result_func: Optional[Callable] = None,
            directory_info_func: Optional[Callable] = None,
            context: Optional[Any] = None,
            record_cache: Optional[dict] = None,
            force_quit: bool = False
            )

Source from the content-addressed store, hash-verified

1363 return self._get_count(self.infra.get_root) == 0
1364
1365 def run(self,
1366 prompt_func: Callable,
1367 record_prepare_func: Callable,
1368 smart_add: bool = False,
1369 record_lookup_func: Optional[Callable] = None,
1370 record_create_func: Optional[Callable] = None,
1371 record_convert_func: Optional[Callable] = None,
1372 prompt_confirm_add_func: Optional[Callable] = None,
1373 prompt_admin_func: Optional[Callable] = None,
1374 auto_add_result_func: Optional[Callable] = None,
1375 directory_info_func: Optional[Callable] = None,
1376 context: Optional[Any] = None,
1377 record_cache: Optional[dict] = None,
1378 force_quit: bool = False
1379 ) -> BulkProcessResults:
1380 """
1381 Process the discovery results.
1382
1383 :param record_cache: A dictionary of record types to keys to record UID.
1384 :param prompt_func: Function to call when the user needs to make a decision about an object.
1385 :param smart_add: If we have resource cred, add the resource and the users. DEPRECATED
1386 :param record_lookup_func: Function to look up a record by UID.
1387 :param record_prepare_func: Function to call to prepare a record to be created.
1388 :param record_create_func: Function to call to save the prepared records.
1389 :param record_convert_func: Function to convert record to use this gateway.
1390 :param prompt_confirm_add_func: Function to call if quiting and record have been added to queue.
1391 :param prompt_admin_func: Function to prompt user for admin.
1392 :param auto_add_result_func: Function to call after auto adding. Provided records to bulk add.
1393 :param directory_info_func: Function to get users of a directory from vault records.
1394 :param context: Context passed to the prompt and add function. These could be objects that are not in the scope
1395 of the function.
1396 :param force_quit: Used for testing. Throw a Quit exception after processing.
1397 :return:
1398 """
1399 sync_point = self.job.sync_point
1400 if sync_point is None:
1401 raise Exception("The job does not have a sync point for the graph.")
1402
1403 # Get the root vertex, which has nothing we care about.
1404 # But from the root, get the configuration vertex.
1405 # There will be only one.
1406 self.logger.debug(f"loading the graph at sync point {sync_point}")
1407 self.infra.load(sync_point=sync_point)
1408 if not self.infra.has_discovery_data:
1409 raise NoDiscoveryDataException("There is no discovery data to process.")
1410
1411 # If the graph is corrupted, delete the bad vertices.
1412 #
1413 if self.infra.dag.is_corrupt is True:
1414 self.logger.debug("the graph is corrupt, deleting vertex")
1415 for uid in self.infra.dag.corrupt_uids:
1416 vertex = self.infra.dag.get_vertex(uid)
1417 vertex.delete()
1418 self.infra.dag.corrupt_uids = []
1419 self.logger.info("fixed the corrupted vertices")
1420
1421 root = self.infra.get_root
1422 configuration = root.has_vertices()[0]

Callers 1

executeMethod · 0.95

Calls 14

_get_countMethod · 0.95
_process_levelMethod · 0.95
QuitExceptionClass · 0.85
get_vertexMethod · 0.80
has_verticesMethod · 0.80
search_contentMethod · 0.80
debugMethod · 0.45
loadMethod · 0.45
deleteMethod · 0.45

Tested by

no test coverage detected