Initialize SecretsManager with proper error handling. Args: ksm_config_path (str): Path to KSM config file (optional) ksm_token (str): KSM access token (optional) Returns: SecretsManager: Initialized SecretsManager or None if failed
(ksm_config_path, ksm_token)
| 236 | # ============================================================================= |
| 237 | |
| 238 | def _initialize_secrets_manager(ksm_config_path, ksm_token): |
| 239 | """ |
| 240 | Initialize SecretsManager with proper error handling. |
| 241 | |
| 242 | Args: |
| 243 | ksm_config_path (str): Path to KSM config file (optional) |
| 244 | ksm_token (str): KSM access token (optional) |
| 245 | |
| 246 | Returns: |
| 247 | SecretsManager: Initialized SecretsManager or None if failed |
| 248 | """ |
| 249 | from keeper_secrets_manager_core import SecretsManager |
| 250 | from keeper_secrets_manager_core.storage import FileKeyValueStorage |
| 251 | |
| 252 | try: |
| 253 | if ksm_config_path: |
| 254 | if not os.path.exists(ksm_config_path): |
| 255 | print("ERROR: KSM config file not found") |
| 256 | return None |
| 257 | return SecretsManager(config=FileKeyValueStorage(ksm_config_path)) |
| 258 | else: |
| 259 | return SecretsManager(token=ksm_token) |
| 260 | except Exception as e: |
| 261 | print(f"ERROR: Failed to initialize SecretsManager: {e}") |
| 262 | return None |
| 263 | |
| 264 | |
| 265 | def _get_secret_by_uid_or_title(secrets_manager, record_identifier): |
no outgoing calls
no test coverage detected