diff --git a/keepercommander/commands/discover/__init__.py b/keepercommander/commands/discover/__init__.py index cf98c418b..25e5df3f9 100644 --- a/keepercommander/commands/discover/__init__.py +++ b/keepercommander/commands/discover/__init__.py @@ -49,7 +49,7 @@ def from_configuration_uid(params: KeeperParams, configuration_uid: str): None) if gateway is None: - print(f'{bcolors.FAIL}Gateway [{gateway_uid}] was not found.{bcolors.ENDC}') + # print(f'{bcolors.FAIL}Gateway [{gateway_uid}] was not found.{bcolors.ENDC}') return application_id = utils.base64_url_encode(gateway.applicationUid) diff --git a/keepercommander/commands/discover/job_start.py b/keepercommander/commands/discover/job_start.py index 6b6af0d10..247411899 100644 --- a/keepercommander/commands/discover/job_start.py +++ b/keepercommander/commands/discover/job_start.py @@ -43,8 +43,8 @@ class PAMGatewayActionDiscoverJobStartCommand(PAMGatewayActionDiscoverCommandBas action='store_true', help='Skip discovering cloud users.') parser.add_argument('--cred', required=False, dest='credentials', action='append', help='List resource credentials.') - parser.add_argument('--cred_file', required=False, dest='credential_file', - action='store', help='A file containing ') + parser.add_argument('--cred-file', required=False, dest='credential_file', + action='store', help='A JSON file containing list of credentials.') def get_parser(self): return PAMGatewayActionDiscoverJobStartCommand.parser @@ -105,6 +105,7 @@ def execute(self, params, **kwargs): jobs = Jobs(record=gateway_context.configuration, params=params) current_job_item = jobs.current_job + removed_prior_job = None if current_job_item is not None: if current_job_item.is_running is True: print("") @@ -122,10 +123,11 @@ def execute(self, params, **kwargs): status.execute(params=params) print("") - yn = input("Do you wish to remove the active discovery job and run a new one [Y/N]>").lower() + yn = input("Do you wish to remove the active discovery job and run a new one [Y/N]> ").lower() while True: if yn[0] == "y": jobs.cancel(current_job_item.job_id) + removed_prior_job = current_job_item.job_id break elif yn[0] == "n": print(f"{bcolors.FAIL}Not starting a discovery job.{bcolors.ENDC}") @@ -221,8 +223,10 @@ def execute(self, params, **kwargs): if "has been queued" in data.get("Response", ""): - print("") - print("The discovery job is currently running.") + if removed_prior_job is None: + print("The discovery job is currently running.") + else: + print(f"Active discovery job {removed_prior_job} has been removed and new discovery job is running.") print(f"To check the status, use the command '{bcolors.OKGREEN}pam action discover status{bcolors.ENDC}'.") print(f"To stop and remove the current job, use the command " f"'{bcolors.OKGREEN}pam action discover remove -j '.") diff --git a/keepercommander/commands/discover/result_process.py b/keepercommander/commands/discover/result_process.py index 2aea79d5d..2314c4dca 100644 --- a/keepercommander/commands/discover/result_process.py +++ b/keepercommander/commands/discover/result_process.py @@ -842,6 +842,15 @@ def _prompt_admin(self, parent_vertex: DAGVertex, content: DiscoveryObject, acl: ) print("") + @staticmethod + def _display_auto_add_results(bulk_add_records: List[BulkRecordAdd]): + + add_count = len(bulk_add_records) + if add_count > 0: + print("") + print(f"{bcolors.OKGREEN}From the rules, automatically queued {add_count} " + f"record{'' if add_count == 1 else 's'} to be added.{bcolors.ENDC}") + @staticmethod def _prompt_confirm_add(bulk_add_records: List[BulkRecordAdd]): @@ -1265,6 +1274,9 @@ def execute(self, params: KeeperParams, **kwargs): # A function to get directory users directory_info_func=self._get_directory_info, + # Pass method that will display auto added records. + auto_add_result_func=self._display_auto_add_results, + # Provides a cache of the record key to record UID. record_cache=record_cache, diff --git a/libs/discovery_common-1.0.17-py3-none-any.whl b/libs/discovery_common-1.0.18-py3-none-any.whl similarity index 63% rename from libs/discovery_common-1.0.17-py3-none-any.whl rename to libs/discovery_common-1.0.18-py3-none-any.whl index 24ce73ef6..55667d213 100644 Binary files a/libs/discovery_common-1.0.17-py3-none-any.whl and b/libs/discovery_common-1.0.18-py3-none-any.whl differ diff --git a/requirements.txt b/requirements.txt index 405daaea1..5f50bc49c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -25,4 +25,4 @@ pydantic>=2.6.4 # pip uninstall discovery-common -y # python3 setup.py wheel --whlsrc ~/src/discovery-common --libdir $PWD/libs --reqfiles $PWD/requirements.txt # pip install $(ls libs/discovery_common-*) -./libs/discovery_common-1.0.17-py3-none-any.whl +./libs/discovery_common-1.0.18-py3-none-any.whl