Skip to content

Commit

Permalink
no longer shadow secrets module from python
Browse files Browse the repository at this point in the history
  • Loading branch information
Mic92 authored and mergify[bot] committed Jan 14, 2025
1 parent d5dd0a9 commit 1cc26e1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
11 changes: 10 additions & 1 deletion buildbot_nix/buildbot_nix/models.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import json
import os
import re
import sys
from collections.abc import Callable, Mapping
from enum import Enum
from pathlib import Path
Expand All @@ -10,7 +12,6 @@
from pydantic_core import CoreSchema, core_schema

from .errors import BuildbotNixError
from .secrets import read_secret_file


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


def read_secret_file(secret_file: Path) -> str:
directory = os.environ.get("CREDENTIALS_DIRECTORY")
if directory is None:
print("directory not set", file=sys.stderr)
sys.exit(1)
return Path(directory).joinpath(secret_file).read_text().rstrip()


# note that serialization isn't correct, as there is no way to *rename* the field `nix_type` to `_type`,
# one must always specify `by_alias = True`, such as `model_dump(by_alias = True)`, relevant issue:
# https://github.com/pydantic/pydantic/issues/8379
Expand Down
11 changes: 0 additions & 11 deletions buildbot_nix/buildbot_nix/secrets.py

This file was deleted.

0 comments on commit 1cc26e1

Please sign in to comment.