Skip to content

Commit

Permalink
Update packages 0509 (#75)
Browse files Browse the repository at this point in the history
* Update packages

* Bump version: 1.1.5 → 1.1.6

* Bump version: 1.1.6 → 1.1.7

* Update astroid package to 2.12.7

* Update pyproject.toml and scripts according to pylint recommendations

Pylint complained about useless options or unknown options, and those have been removed. Also added 60 second timeouts to the requests calls.

* Bump version: 1.1.7 → 1.1.8

* Format with black

Python checks workflow failed and complained about formatting, so I did run black . to reformat the code

* Bump version: 1.1.8 → 1.1.9

* Add env variable for PYTHON_KEYRING_BACKEND

Because the python checks fail on this we are trying to resolve by adding the env variable, source: pypa/pip#7883 (comment)

* Bump version: 1.1.9 → 1.1.10
  • Loading branch information
DawidDlubek-TomTom authored Sep 7, 2022
1 parent 3c3235f commit f43661f
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 102 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 1.1.5
current_version = 1.1.10
commit = True
tag = False
message = Bump version: {current_version} → {new_version}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/pr-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:

env:
REQUIRED_COVERAGE: 30
PYTHON_KEYRING_BACKEND: keyring.backends.null.Keyring

jobs:
python:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
workflow_dispatch:

env:
VERSION: 1.1.5
VERSION: 1.1.10

jobs:
release:
Expand Down
41 changes: 14 additions & 27 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

74 changes: 1 addition & 73 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "vault-assessment-prometheus-exporter"
version = "1.1.5"
version = "1.1.10"
description = "Prometheus exporter to monitor custom metadata for KV2 secrets for (self-imposed) expiration."
authors = ["Eugene Davis <[email protected]>"]
readme = "README.md"
Expand Down Expand Up @@ -63,16 +63,6 @@ limit-inference-results = 100

[tool.pylint.'MESSAGES CONTROL']
disable = [
"print-statement",
"parameter-unpacking",
"unpacking-in-except",
"old-raise-syntax",
"backtick",
"long-suffix",
"old-ne-operator",
"old-octal-literal",
"import-star-module-level",
"non-ascii-bytes-literal",
"raw-checker-failed",
"bad-inline-option",
"locally-disabled",
Expand All @@ -81,68 +71,6 @@ disable = [
"useless-suppression",
"deprecated-pragma",
"use-symbolic-message-instead",
"apply-builtin",
"basestring-builtin",
"buffer-builtin",
"cmp-builtin",
"coerce-builtin",
"execfile-builtin",
"file-builtin",
"long-builtin",
"raw_input-builtin",
"reduce-builtin",
"standarderror-builtin",
"unicode-builtin",
"xrange-builtin",
"coerce-method",
"delslice-method",
"getslice-method",
"setslice-method",
"no-absolute-import",
"old-division",
"dict-iter-method",
"dict-view-method",
"next-method-called",
"metaclass-assignment",
"indexing-exception",
"raising-string",
"reload-builtin",
"oct-method",
"hex-method",
"nonzero-method",
"cmp-method",
"input-builtin",
"round-builtin",
"intern-builtin",
"unichr-builtin",
"map-builtin-not-iterating",
"zip-builtin-not-iterating",
"range-builtin-not-iterating",
"filter-builtin-not-iterating",
"using-cmp-argument",
"eq-without-hash",
"div-method",
"idiv-method",
"rdiv-method",
"exception-message-attribute",
"invalid-str-codec",
"sys-max-int",
"bad-python3-import",
"deprecated-string-function",
"deprecated-str-translate-call",
"deprecated-itertools-function",
"deprecated-types-field",
"next-method-defined",
"dict-items-not-iterating",
"dict-keys-not-iterating",
"dict-values-not-iterating",
"deprecated-operator-function",
"deprecated-urllib-function",
"xreadlines-attribute",
"deprecated-sys-function",
"exception-escape",
"comprehension-escape",
"bad-continuation"
]

[tool.pylint.REFACTORING]
Expand Down
3 changes: 3 additions & 0 deletions vault_monitor/expiration_monitor/entity_expiration_monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
from vault_monitor.expiration_monitor.expiration_monitor import ExpirationMonitor
from vault_monitor.expiration_monitor.vault_time import ExpirationMetadata

TIMEOUT = 60


class EntityExpirationMonitor(ExpirationMonitor):
"""
Expand Down Expand Up @@ -37,6 +39,7 @@ def get_expiration_info(self) -> ExpirationMetadata:
response = requests.get(
f"{self.vault_client.url}/v1/identity/entity/id/{self.monitored_path}",
headers={"X-Vault-Namespace": self.vault_client.adapter.namespace, "X-Vault-Token": self.vault_client.token},
timeout=TIMEOUT,
)
response.raise_for_status()

Expand Down
3 changes: 3 additions & 0 deletions vault_monitor/expiration_monitor/secret_expiration_monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
from vault_monitor.expiration_monitor.expiration_monitor import ExpirationMonitor
from vault_monitor.expiration_monitor.vault_time import ExpirationMetadata

TIMEOUT = 60


class SecretExpirationMonitor(ExpirationMonitor):
"""
Expand All @@ -25,6 +27,7 @@ def get_expiration_info(self) -> ExpirationMetadata:
response = requests.get(
f"{self.vault_client.url}/v1/{self.mount_point}/metadata/{self.monitored_path}",
headers={"X-Vault-Namespace": self.vault_client.adapter.namespace, "X-Vault-Token": self.vault_client.token},
timeout=TIMEOUT,
)
response.raise_for_status()

Expand Down
4 changes: 4 additions & 0 deletions vault_monitor/expiration_monitor/set_expiration.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from vault_monitor.expiration_monitor.create_monitors import recurse_secrets

LOGGER = logging.getLogger("set_expiration")
TIMEOUT = 60

# Disable certain things for scripts only, as over-doing the DRY-ness of them can cause them to be less useful as samples
# pylint: disable=duplicate-code,too-many-arguments,too-many-locals
Expand Down Expand Up @@ -85,6 +86,7 @@ def set_expiration(
f"{vault_client_url}/v1/{mount_point}/metadata/{secret_path}",
headers={"X-Vault-Namespace": vault_client_namespace, "X-Vault-Token": vault_client_token, "Content-Type": "application/merge-patch+json"},
json={"custom_metadata": expiration_info.get_serialized_expiration_metadata()},
timeout=TIMEOUT,
)

if response.status_code == 405:
Expand All @@ -95,6 +97,7 @@ def set_expiration(
response = requests.get(
f"{vault_client_url}/v1/{mount_point}/metadata/{secret_path}",
headers={"X-Vault-Namespace": vault_client_namespace, "X-Vault-Token": vault_client_token, "Content-Type": "application/merge-patch+json"},
timeout=TIMEOUT,
)
response.raise_for_status()

Expand All @@ -117,6 +120,7 @@ def set_expiration(
f"{vault_client_url}/v1/{mount_point}/metadata/{secret_path}",
headers={"X-Vault-Namespace": vault_client_namespace, "X-Vault-Token": vault_client_token},
json=metadata,
timeout=TIMEOUT,
)

response.raise_for_status()
Expand Down

0 comments on commit f43661f

Please sign in to comment.