Skip to content

Commit 1cc26e1

Browse files
Mic92mergify[bot]
authored andcommitted
no longer shadow secrets module from python
1 parent d5dd0a9 commit 1cc26e1

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

buildbot_nix/buildbot_nix/models.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import json
2+
import os
23
import re
4+
import sys
35
from collections.abc import Callable, Mapping
46
from enum import Enum
57
from pathlib import Path
@@ -10,7 +12,6 @@
1012
from pydantic_core import CoreSchema, core_schema
1113

1214
from .errors import BuildbotNixError
13-
from .secrets import read_secret_file
1415

1516

1617
class InternalError(Exception):
@@ -28,6 +29,14 @@ class AuthBackendConfig(str, Enum):
2829
none = "none"
2930

3031

32+
def read_secret_file(secret_file: Path) -> str:
33+
directory = os.environ.get("CREDENTIALS_DIRECTORY")
34+
if directory is None:
35+
print("directory not set", file=sys.stderr)
36+
sys.exit(1)
37+
return Path(directory).joinpath(secret_file).read_text().rstrip()
38+
39+
3140
# note that serialization isn't correct, as there is no way to *rename* the field `nix_type` to `_type`,
3241
# one must always specify `by_alias = True`, such as `model_dump(by_alias = True)`, relevant issue:
3342
# https://github.com/pydantic/pydantic/issues/8379

buildbot_nix/buildbot_nix/secrets.py

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)