Skip to content

Commit

Permalink
Merge pull request #16 from deeprave/action-upgrades
Browse files Browse the repository at this point in the history
Action upgrades
  • Loading branch information
deeprave authored Jan 8, 2024
2 parents de40036 + 9142ab5 commit 545990e
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 19 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/poetry-test-and-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
poetry-version: ["1.7.1"]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
# Fetch all tags
fetch-depth: 0
Expand All @@ -26,7 +26,7 @@ jobs:
python-version: ${{ matrix.python-version }}

- name: Setup python and poetry
uses: abatilo/actions-poetry@v2.3.0
uses: abatilo/actions-poetry@v2.4.0
with:
poetry-version: ${{ matrix.poetry-version }}

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release-build-and-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup python and poetry
uses: abatilo/actions-poetry@v2.3.0
uses: abatilo/actions-poetry@v2.4.0
with:
poetry-version: ${{ matrix.poetry-version }}
python-version: ${{ matrix.python-version }}
Expand Down
9 changes: 8 additions & 1 deletion envex/lib/hvac_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def __init__(
"""
self._mount_point = None
if verify in (True, None):
verify = os.getenv("VAULT_åCACERT") or True
verify = os.getenv("VAULT_CACERT") or True
if isinstance(verify, str):
verify = expand(verify)
if cert is None:
Expand Down Expand Up @@ -124,6 +124,13 @@ def client(self):
except Exception as exc:
logging.debug(f"{exc.__class__.__name__} Vault client cannot authenticate {exc}")

@property
def sealed(self) -> bool:
if self.client:
response = self.client.seal_status
return response["sealed"]
return None

@property
def base_path(self) -> str:
return self._base_path
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "envex"
version = "2.2.1"
version = "2.3.0"
description = "Environment interface with .env and hashicorp vault support"
authors = ["David Nugent <[email protected]>"]
readme = "README.md"
Expand Down
2 changes: 1 addition & 1 deletion tests/lib/test_hvac_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def test_set_secret_in_vault(self, mocker):
secrets_manager.set_secret("key", "secret_value")

# Assert that the secret is set in the Vault
secrets_manager._client.write.assert_called_once_with("secret/test/key", value="secret_value")
secrets_manager._client.write.assert_called_once_with("test/key", value="secret_value")

# Assert that the secret is cached
secrets_manager._cache.put.assert_called_once_with("key", "secret_value")
Expand Down
32 changes: 20 additions & 12 deletions tests/test_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,27 +111,35 @@ def test_env_list(monkeypatch):
monkeypatch.setattr(envex.dot_env, "open_env", dotenv)
env = envex.Env(readenv=True)

result = env.list("ALISTOFIPS")
assert isinstance(result, list)
assert len(result) == 3
result = _extracted_from_test_env_list_5(env, "ALISTOFIPS", 3)
assert result == ["::1", "127.0.0.1", "mydomain.com"]

result = env("ALISTOFIPS", type=list)
assert isinstance(result, list)
assert len(result) == 3
result = _extracted_from_test_env_list_10(env, "ALISTOFIPS", 3)
assert result == ["::1", "127.0.0.1", "mydomain.com"]

result = env.list("LISTOFQUOTEDVALUES")
assert isinstance(result, list)
assert len(result) == 4
result = _extracted_from_test_env_list_5(env, "LISTOFQUOTEDVALUES", 4)
assert result == ["1", "two", "3", "four"]

result = env("LISTOFQUOTEDVALUES", type=list)
assert isinstance(result, list)
assert len(result) == 4
result = _extracted_from_test_env_list_10(env, "LISTOFQUOTEDVALUES", 4)
assert result == ["1", "two", "3", "four"]


def _extracted_from_test_env_list_5(env, arg1, arg2):
result = env.list(arg1)
return _extracted_from__extracted_from_test_env_list_10_11(result, arg2)


def _extracted_from__extracted_from_test_env_list_10_11(result, arg2):
assert isinstance(result, list)
assert len(result) == arg2
return result


def _extracted_from_test_env_list_10(env, arg1, arg2):
result = env(arg1, type=list)
return _extracted_from__extracted_from_test_env_list_10_11(result, arg2)


def test_env_iter(monkeypatch):
monkeypatch.setattr(envex.dot_env, "open_env", dotenv)
env = envex.Env(readenv=True, update=False)
Expand Down

0 comments on commit 545990e

Please sign in to comment.