Add ansible-lint to tox linters (#258)

* Add ansible-lint to tox linters

* Bump black

* Black formatting

* fix linting
This commit is contained in:
Mike Graves
2025-05-19 15:53:38 -04:00
committed by GitHub
parent 69bcd79b92
commit f54297c2ac
5 changed files with 11 additions and 9 deletions

View File

@@ -1,2 +1,2 @@
bugfixes: bugfixes:
- openshift_auth - fix issue where openshift_auth module sometimes does not delete the auth token. Based on stale PR (https://github.com/openshift/community.okd/pull/194). - openshift_auth - fix issue where openshift_auth module sometimes does not delete the auth token. Based on stale PR (https://github.com/openshift/community.okd/pull/194).

View File

@@ -295,9 +295,9 @@ class OpenShiftMigrateTemplateInstances(AnsibleOpenshiftModule):
object_type in transforms.keys() object_type in transforms.keys()
and obj["ref"].get("apiVersion") != transforms[object_type] and obj["ref"].get("apiVersion") != transforms[object_type]
): ):
ti_elem["status"]["objects"][i]["ref"][ ti_elem["status"]["objects"][i]["ref"]["apiVersion"] = (
"apiVersion" transforms[object_type]
] = transforms[object_type] )
ti_to_be_migrated.append(ti_elem) ti_to_be_migrated.append(ti_elem)
return ti_to_be_migrated return ti_to_be_migrated

View File

@@ -225,7 +225,7 @@ def get_oauthaccesstoken_objectname_from_token(token_name):
sha256Prefix = "sha256~" sha256Prefix = "sha256~"
if token_name.startswith(sha256Prefix): if token_name.startswith(sha256Prefix):
content = token_name[len(sha256Prefix):] content = token_name[len(sha256Prefix) :]
else: else:
content = token_name content = token_name
b64encoded = urlsafe_b64encode(hashlib.sha256(content.encode()).digest()).rstrip( b64encoded = urlsafe_b64encode(hashlib.sha256(content.encode()).digest()).rstrip(

View File

@@ -421,9 +421,9 @@ class OpenShiftRoute(AnsibleOpenshiftModule):
if tls_insecure_policy == "disallow": if tls_insecure_policy == "disallow":
tls_insecure_policy = None tls_insecure_policy = None
else: else:
tls_ca_cert = ( tls_ca_cert = tls_cert = tls_dest_ca_cert = tls_key = (
tls_cert tls_insecure_policy
) = tls_dest_ca_cert = tls_key = tls_insecure_policy = None ) = None
route = { route = {
"apiVersion": "route.openshift.io/v1", "apiVersion": "route.openshift.io/v1",

View File

@@ -8,7 +8,7 @@ install_command = pip install {opts} {packages}
[testenv:black] [testenv:black]
deps = deps =
black >= 23.0, < 24.0 black >= 25.0, < 26.0
commands = commands =
black {toxinidir}/plugins {toxinidir}/tests black {toxinidir}/plugins {toxinidir}/tests
@@ -24,10 +24,12 @@ commands =
deps = deps =
flake8 flake8
{[testenv:black]deps} {[testenv:black]deps}
{[testenv:ansible-lint]deps}
commands = commands =
black -v --check --diff {toxinidir}/plugins {toxinidir}/tests black -v --check --diff {toxinidir}/plugins {toxinidir}/tests
flake8 {toxinidir} flake8 {toxinidir}
ansible-lint
[flake8] [flake8]
# E123, E125 skipped as they are invalid PEP-8. # E123, E125 skipped as they are invalid PEP-8.