databricks-tellr 0.4.3.dev13__tar.gz → 0.4.3.dev14__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (15) hide show
  1. {databricks_tellr-0.4.3.dev13 → databricks_tellr-0.4.3.dev14}/PKG-INFO +1 -1
  2. {databricks_tellr-0.4.3.dev13 → databricks_tellr-0.4.3.dev14}/databricks_tellr/secret_key.py +22 -4
  3. {databricks_tellr-0.4.3.dev13 → databricks_tellr-0.4.3.dev14}/databricks_tellr.egg-info/PKG-INFO +1 -1
  4. {databricks_tellr-0.4.3.dev13 → databricks_tellr-0.4.3.dev14}/pyproject.toml +1 -1
  5. {databricks_tellr-0.4.3.dev13 → databricks_tellr-0.4.3.dev14}/README.md +0 -0
  6. {databricks_tellr-0.4.3.dev13 → databricks_tellr-0.4.3.dev14}/databricks_tellr/__init__.py +0 -0
  7. {databricks_tellr-0.4.3.dev13 → databricks_tellr-0.4.3.dev14}/databricks_tellr/_templates/app.yaml.template +0 -0
  8. {databricks_tellr-0.4.3.dev13 → databricks_tellr-0.4.3.dev14}/databricks_tellr/_templates/requirements.txt.template +0 -0
  9. {databricks_tellr-0.4.3.dev13 → databricks_tellr-0.4.3.dev14}/databricks_tellr/deploy.py +0 -0
  10. {databricks_tellr-0.4.3.dev13 → databricks_tellr-0.4.3.dev14}/databricks_tellr/identifiers.py +0 -0
  11. {databricks_tellr-0.4.3.dev13 → databricks_tellr-0.4.3.dev14}/databricks_tellr.egg-info/SOURCES.txt +0 -0
  12. {databricks_tellr-0.4.3.dev13 → databricks_tellr-0.4.3.dev14}/databricks_tellr.egg-info/dependency_links.txt +0 -0
  13. {databricks_tellr-0.4.3.dev13 → databricks_tellr-0.4.3.dev14}/databricks_tellr.egg-info/requires.txt +0 -0
  14. {databricks_tellr-0.4.3.dev13 → databricks_tellr-0.4.3.dev14}/databricks_tellr.egg-info/top_level.txt +0 -0
  15. {databricks_tellr-0.4.3.dev13 → databricks_tellr-0.4.3.dev14}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: databricks-tellr
3
- Version: 0.4.3.dev13
3
+ Version: 0.4.3.dev14
4
4
  Summary: Tellr deployment tooling for Databricks Apps
5
5
  Requires-Python: >=3.10
6
6
  Description-Content-Type: text/markdown
@@ -19,6 +19,7 @@ from typing import Any
19
19
 
20
20
  import requests
21
21
  from cryptography.fernet import Fernet
22
+ from databricks.sdk.errors import NotFound
22
23
  from databricks.sdk.service.apps import (
23
24
  App,
24
25
  AppResource,
@@ -113,6 +114,21 @@ def preflight_lakebase_privileges(cur: Any, schema_name: str) -> None:
113
114
 
114
115
 
115
116
  def _looks_absent(exc: Exception) -> bool:
117
+ """True when *exc* means the secret/scope genuinely does not exist.
118
+
119
+ The SDK raises a typed ``NotFound`` (subclass ``ResourceDoesNotExist``,
120
+ ``error_code == "RESOURCE_DOES_NOT_EXIST"``) whose ``str()`` is a human
121
+ message like ``"Failed to get secret X for scope Y"`` that does NOT contain
122
+ the code — so match on the exception TYPE (and ``error_code``), never the
123
+ message text. A permission denial is a distinct ``PermissionDenied`` (403)
124
+ that is not a ``NotFound``, so it is correctly NOT treated as absent — the
125
+ guard against overwriting a live key still holds.
126
+ """
127
+ if isinstance(exc, NotFound):
128
+ return True
129
+ if getattr(exc, "error_code", None) == "RESOURCE_DOES_NOT_EXIST":
130
+ return True
131
+ # Fallback for un-typed errors that still name the code in their text.
116
132
  return "RESOURCE_DOES_NOT_EXIST" in str(exc).upper()
117
133
 
118
134
 
@@ -129,11 +145,13 @@ def read_secret_key(ws: Any, scope: str, key: str) -> str | None:
129
145
  except Exception as exc: # noqa: BLE001
130
146
  if _looks_absent(exc):
131
147
  return None
148
+ _code = getattr(exc, "error_code", None)
132
149
  raise SecretKeyError(
133
- f"Could not read secret {scope}/{key}: {exc}. This is not a "
134
- f"'not found' error, so it is most likely a permission problem — "
135
- f"refusing to continue rather than risk overwriting a key that may "
136
- f"already protect stored credentials."
150
+ f"Could not read secret {scope}/{key}: "
151
+ f"[{type(exc).__name__}{'/' + _code if _code else ''}] {exc}. "
152
+ f"This is not a recognized 'not found' error (most likely a permission "
153
+ f"problem) refusing to continue rather than risk overwriting a key "
154
+ f"that may already protect stored credentials."
137
155
  ) from exc
138
156
 
139
157
  if resp is None or not resp.value:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: databricks-tellr
3
- Version: 0.4.3.dev13
3
+ Version: 0.4.3.dev14
4
4
  Summary: Tellr deployment tooling for Databricks Apps
5
5
  Requires-Python: >=3.10
6
6
  Description-Content-Type: text/markdown
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "databricks-tellr"
7
- version = "0.4.3.dev13"
7
+ version = "0.4.3.dev14"
8
8
  description = "Tellr deployment tooling for Databricks Apps"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"