|
13 | 13 | ) |
14 | 14 | from sqlalchemy import select |
15 | 15 |
|
16 | | -try: |
17 | | - from custos.clients.resource_secret_management_client import ResourceSecretManagementClient |
18 | | - from custos.clients.utils.exceptions.CustosExceptions import KeyDoesNotExist |
19 | | - from custos.transport.settings import CustosServerClientSettings |
20 | | - |
21 | | - logging.getLogger("custos.clients.resource_secret_management_client").setLevel(logging.CRITICAL) |
22 | | - |
23 | | - custos_sdk_available = True |
24 | | -except ImportError: |
25 | | - custos_sdk_available = False |
26 | | - |
27 | 16 | try: |
28 | 17 | import hvac |
29 | 18 | except ImportError: |
@@ -184,34 +173,6 @@ def _get_vault_value(self, key): |
184 | 173 | return self.sa_session.scalars(stmt).first() |
185 | 174 |
|
186 | 175 |
|
187 | | -class CustosVault(Vault): |
188 | | - def __init__(self, config): |
189 | | - if not custos_sdk_available: |
190 | | - raise InvalidVaultConfigException( |
191 | | - "Custos sdk library 'custos-sdk' is not available. Make sure the custos-sdk is installed." |
192 | | - ) |
193 | | - custos_settings = CustosServerClientSettings( |
194 | | - custos_host=config.get("custos_host"), |
195 | | - custos_port=config.get("custos_port"), |
196 | | - custos_client_id=config.get("custos_client_id"), |
197 | | - custos_client_sec=config.get("custos_client_sec"), |
198 | | - ) |
199 | | - self.client = ResourceSecretManagementClient(custos_settings) |
200 | | - |
201 | | - def read_secret(self, key: str) -> Optional[str]: |
202 | | - try: |
203 | | - response = self.client.get_kv_credential(key=key) |
204 | | - return response.get("value") |
205 | | - except KeyDoesNotExist: |
206 | | - return None |
207 | | - |
208 | | - def write_secret(self, key: str, value: str) -> None: |
209 | | - self.client.set_kv_credential(key=key, value=value) |
210 | | - |
211 | | - def list_secrets(self, key: str) -> list[str]: |
212 | | - raise NotImplementedError() |
213 | | - |
214 | | - |
215 | 176 | class UserVaultWrapper(Vault): |
216 | 177 | def __init__(self, vault: Vault, user): |
217 | 178 | self.vault = vault |
@@ -300,8 +261,6 @@ def from_vault_type(app, vault_type: Optional[str], cfg: dict) -> Vault: |
300 | 261 | vault = HashicorpVault(cfg) |
301 | 262 | elif vault_type == "database": |
302 | 263 | vault = DatabaseVault(app.model.context, cfg) |
303 | | - elif vault_type == "custos": |
304 | | - vault = CustosVault(cfg) |
305 | 264 | else: |
306 | 265 | raise InvalidVaultConfigException(f"Unknown vault type: {vault_type}") |
307 | 266 | vault_prefix = cfg.get("path_prefix") or "/galaxy" |
|
0 commit comments