Skip to content

Commit

Permalink
Release v4.0.0: Bump python version to 3.12 and small fixes (#50)
Browse files Browse the repository at this point in the history
## v4.0.0 - 2024-10-17
### What's Changed
**Full Changelog**: v3.0.0...v4.0.0 by @obervinov in #50
#### 💥 Breaking Changes
* Bump python version to `3.12`
#### 🚀 Features
* Bump dependencies versions
* Bump workflows versions to `v2.0.0`
#### 🐛 Bug Fixes
* #49
  • Loading branch information
obervinov authored Oct 17, 2024
1 parent 73b8d04 commit 9e0f0cb
Show file tree
Hide file tree
Showing 10 changed files with 220 additions and 568 deletions.
16 changes: 3 additions & 13 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,8 @@ on:
- '!main'

jobs:
changelog:
uses: obervinov/_templates/.github/workflows/changelog.yaml@v1.2.6

pylint:
uses: obervinov/_templates/.github/workflows/pylint.yaml@v1.2.6

pytest:
uses: obervinov/_templates/.github/workflows/pytest-with-vault.yaml@v1.2.6
pr:
uses: obervinov/_templates/.github/workflows/pr.yaml@v2.0.0

pyproject:
uses: obervinov/_templates/.github/workflows/pyproject.yaml@v1.2.6

pr:
uses: obervinov/_templates/.github/workflows/pr.yaml@v1.2.6
needs: [changelog, pylint, pytest, pyproject]
uses: obervinov/_templates/.github/workflows/pyproject.yaml@v2.0.0
17 changes: 2 additions & 15 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,5 @@ on:
- closed

jobs:
changelog:
uses: obervinov/_templates/.github/workflows/changelog.yaml@v1.2.6

pylint:
uses: obervinov/_templates/.github/workflows/pylint.yaml@v1.2.6

pytest:
uses: obervinov/_templates/.github/workflows/pytest-with-vault.yaml@v1.2.6

pyproject:
uses: obervinov/_templates/.github/workflows/pyproject.yaml@v1.2.6

create-release:
uses: obervinov/_templates/.github/workflows/release.yaml@v1.2.6
needs: [changelog, pylint, pytest, pyproject]
release:
uses: obervinov/_templates/.github/workflows/release.yaml@v2.0.0
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).


## v4.0.0 - 2024-10-17
### What's Changed
**Full Changelog**: https://github.com/obervinov/vault-package/compare/v3.0.0...v4.0.0 by @obervinov in https://github.com/obervinov/vault-package/pull/50
#### 💥 Breaking Changes
* Bump python version to `3.12`
#### 🚀 Features
* Bump dependencies versions
* Bump workflows versions to `v2.0.0`
#### 🐛 Bug Fixes
* [Bug: Set the vault client namespace as the prefix for `dbengine` mount point](https://github.com/obervinov/vault-package/issues/49)


## v3.0.0 - 2024-06-12
### What's Changed
**Full Changelog**: https://github.com/obervinov/vault-package/compare/v2.0.4...v3.0.0 by @obervinov in https://github.com/obervinov/vault-package/pull/48
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,8 @@ name = myproject"
version = "1.0.0"
[tool.poetry.dependencies]
python = "^3.10"
vault = { git = "https://github.com/obervinov/vault-package.git", tag = "v3.0.0" }
python = "^3.12"
vault = { git = "https://github.com/obervinov/vault-package.git", tag = "v4.0.0" }
[build-system]
requires = ["poetry-core"]
Expand All @@ -198,4 +198,4 @@ poetry install
## <img src="https://github.com/obervinov/_templates/blob/main/icons/github-actions.png" width="25" title="github-actions"> GitHub Actions
| Name | Version |
| ------------------------ | ----------- |
| GitHub Actions Templates | [v1.2.6](https://github.com/obervinov/_templates/tree/v1.2.6) |
| GitHub Actions Templates | [v2.0.0](https://github.com/obervinov/_templates/tree/v2.0.0) |
9 changes: 5 additions & 4 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ Versions supported to fix vulnerabilities

| Version | Supported |
| ------- | ------------------ |
| 3.x.x | :white_check_mark: |
| 2.x.x | :x: |
| 1.x.x | :x: |
| 4.x.x | :white_check_mark: |
| 3.x.x | :x: |
| 2.x.x | :x: |
| 1.x.x | :x: |

## Reporting a Vulnerability

In order to inform me about the vulnerability, write the details to the mail `github.obervinov@proton.me`
In order to inform me about the vulnerability, just open an issue: https://github.com/obervinov/vault-package/security/advisories/new
655 changes: 173 additions & 482 deletions poetry.lock

Large diffs are not rendered by default.

23 changes: 9 additions & 14 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[tool.poetry]
name = "vault"
version = "3.0.0"
version = "4.0.0"
description = "This is an additional implementation compared to the hvac module. The main purpose of which is to simplify the use and interaction with vault for my standard projects. This module contains a set of methods for working with secrets and database engines in vault."
authors = ["Bervinov Oleg <obervinov@pm.me>"]
maintainers = ["Bervinov Oleg <obervinov@pm.me>"]
authors = ["Bervinov Oleg <bervinov.ob@gmail.com>"]
maintainers = ["Bervinov Oleg <bervinov.ob@gmail.com>"]
license = "MIT"
readme = "README.md"
packages = [{include = "vault"}]
Expand All @@ -17,20 +17,15 @@ include = ["CHANGELOG.md"]
"Bug Tracker" = "https://github.com/obervinov/vault-package/issues"

[tool.poetry.dependencies]
python = "^3.9 || ^3.10 || ^3.11"
requests = ">=2.29.0,<2.30.0"
python = "^3.12"
requests = "^2"
hvac = "^2"
keyring = "^24"
SecretStorage = "^3"
python-dateutil = "^2"
cryptography = "^42"
idna = "^3"
logger = { git = "https://github.com/obervinov/logger-package.git", tag = "v1.0.6" }
logger = { git = "https://github.com/obervinov/logger-package.git", tag = "v2.0.0" }

[tool.poetry.group.dev.dependencies]
pytest = "^8.2.2"
pylint = "^3.2.2"
flake8 = "^7.0.0"
pylint = "^3.3.1"
flake8 = "^7.1.1"
pytest = "^8.3.3"

[build-system]
requires = ["poetry-core"]
Expand Down
3 changes: 2 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,5 +136,6 @@ def fixture_configurator_client(vault_url, namespace, prepare_vault):
'id': prepare_vault['id'],
'secret-id': prepare_vault['secret-id']
}
}
},
dbengine={'mount_point': 'database'}
)
17 changes: 6 additions & 11 deletions vault/db_engine.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""This module contains the class and methods for working with the database engine in the Vault"""
from typing import Union
from logger import log

import hvac
Expand All @@ -15,11 +14,7 @@ class DBEngine:
Supported methods for:
- generate credentials
"""
def __init__(
self,
vault_client: object = None,
mount_point: str = 'database'
) -> None:
def __init__(self, vault_client: object = None, mount_point: str = None) -> None:
"""
A method for creating an instance of the database engine.
Expand All @@ -37,13 +32,13 @@ def __init__(
log.info('[VaultClient] configuration Database Engine for client %s', vault_client.client)
self.client = vault_client.client
self.vault_client = vault_client
self.mount_point = mount_point
if mount_point:
self.mount_point = mount_point
else:
self.mount_point = f"{vault_client.namespace}-database"

@reauthenticate_on_forbidden
def generate_credentials(
self,
role: str
) -> Union[dict, None]:
def generate_credentials(self, role: str) -> dict | None:
"""
A method for generating database credentials.
Expand Down
30 changes: 5 additions & 25 deletions vault/kv2_engine.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""This module contains the class and methods for working with the kv v2 engine in the vault"""
from typing import Union
from logger import log

import hvac
Expand All @@ -18,11 +17,7 @@ class KV2Engine:
- list secrets
- delete secret
"""
def __init__(
self,
vault_client: object = None,
**kwargs
) -> None:
def __init__(self, vault_client: object = None, **kwargs) -> None:
"""
A method for creating an instance of the kv v2 engine.
Expand Down Expand Up @@ -71,11 +66,7 @@ def __init__(
raise WrongKV2Configuration("Mount point not specified, KV2 Engine configuration error. Please set the argument mount_point=<mount_point_name>.")

@reauthenticate_on_forbidden
def read_secret(
self,
path: str = None,
key: str = None
) -> Union[str, dict, None]:
def read_secret(self, path: str = None, key: str = None) -> str | dict | None:
"""
A method for read secret from KV2 Engine.
Expand Down Expand Up @@ -104,12 +95,7 @@ def read_secret(
return None

@reauthenticate_on_forbidden
def write_secret(
self,
path: str = None,
key: str = None,
value: str = None
) -> object:
def write_secret(self, path: str = None, key: str = None, value: str = None) -> object:
"""
A method for create or update secret in KV2 Engine.
Expand Down Expand Up @@ -147,10 +133,7 @@ def write_secret(
)

@reauthenticate_on_forbidden
def list_secrets(
self,
path: str = None
) -> list:
def list_secrets(self, path: str = None) -> list:
"""
A method for list secrets from KV2 Engine.
Expand All @@ -172,10 +155,7 @@ def list_secrets(
return []

@reauthenticate_on_forbidden
def delete_secret(
self,
path: str = None
) -> bool:
def delete_secret(self, path: str = None) -> bool:
"""
A method for delete secret from KV2 Engine.
Expand Down

0 comments on commit 9e0f0cb

Please sign in to comment.