File tree Expand file tree Collapse file tree 2 files changed +10
-12
lines changed
buildbot_nix/buildbot_nix Expand file tree Collapse file tree 2 files changed +10
-12
lines changed Original file line number Diff line number Diff line change 1
1
import json
2
+ import os
2
3
import re
4
+ import sys
3
5
from collections .abc import Callable , Mapping
4
6
from enum import Enum
5
7
from pathlib import Path
10
12
from pydantic_core import CoreSchema , core_schema
11
13
12
14
from .errors import BuildbotNixError
13
- from .secrets import read_secret_file
14
15
15
16
16
17
class InternalError (Exception ):
@@ -28,6 +29,14 @@ class AuthBackendConfig(str, Enum):
28
29
none = "none"
29
30
30
31
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
+
31
40
# note that serialization isn't correct, as there is no way to *rename* the field `nix_type` to `_type`,
32
41
# one must always specify `by_alias = True`, such as `model_dump(by_alias = True)`, relevant issue:
33
42
# https://github.com/pydantic/pydantic/issues/8379
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments