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

Method run

keepercommander/discovery_common/process.py:1362–1562  ·  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_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

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

Callers 1

executeMethod · 0.95

Calls 14

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

Tested by

no test coverage detected