mirror of
https://github.com/openshift/community.okd.git
synced 2026-03-26 19:03:14 +00:00
Fix sanity failures (#220)
* Fix sanity failures * Add github workflows
This commit is contained in:
5
.config/ansible-lint.yml
Normal file
5
.config/ansible-lint.yml
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
profile: production
|
||||
exclude_paths:
|
||||
- molecule
|
||||
- tests/sanity
|
||||
23
.github/workflows/changelog.yml
vendored
Normal file
23
.github/workflows/changelog.yml
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
---
|
||||
name: Changelog
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
- reopened
|
||||
- labeled
|
||||
- unlabeled
|
||||
- synchronize
|
||||
branches:
|
||||
- main
|
||||
- stable-*
|
||||
tags:
|
||||
- '*'
|
||||
|
||||
jobs:
|
||||
changelog:
|
||||
uses: ansible-network/github_actions/.github/workflows/changelog.yml@main
|
||||
29
.github/workflows/linters.yml
vendored
Normal file
29
.github/workflows/linters.yml
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
---
|
||||
name: Linters
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
- reopened
|
||||
- labeled
|
||||
- unlabeled
|
||||
- synchronize
|
||||
branches:
|
||||
- main
|
||||
- stable-*
|
||||
tags:
|
||||
- '*'
|
||||
jobs:
|
||||
linters:
|
||||
uses: ansible-network/github_actions/.github/workflows/tox-linters.yml@main
|
||||
ansible-lint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: ansible-network/github_actions/.github/actions/checkout_dependency@main
|
||||
|
||||
- name: Run ansible-lint
|
||||
uses: ansible/ansible-lint@v6.21.0
|
||||
23
.github/workflows/sanity-tests.yml
vendored
Normal file
23
.github/workflows/sanity-tests.yml
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
---
|
||||
name: Sanity tests
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
- reopened
|
||||
- synchronize
|
||||
branches:
|
||||
- main
|
||||
- stable-*
|
||||
tags:
|
||||
- '*'
|
||||
|
||||
jobs:
|
||||
sanity:
|
||||
uses: ansible-network/github_actions/.github/workflows/sanity.yml@main
|
||||
with:
|
||||
collection_pre_install: '-r source/tests/sanity/requirements.yml'
|
||||
21
.github/workflows/unit-tests.yml
vendored
Normal file
21
.github/workflows/unit-tests.yml
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
---
|
||||
name: Unit tests
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
- reopened
|
||||
- synchronize
|
||||
branches:
|
||||
- main
|
||||
- stable-*
|
||||
tags:
|
||||
- '*'
|
||||
|
||||
jobs:
|
||||
unit-source:
|
||||
uses: ansible-network/github_actions/.github/workflows/unit_source.yml@main
|
||||
4
changelogs/fragments/fix_sanity_failures.yml
Normal file
4
changelogs/fragments/fix_sanity_failures.yml
Normal file
@@ -0,0 +1,4 @@
|
||||
---
|
||||
trivial:
|
||||
- Fix sanity validate-modules and yamllint failures.
|
||||
- Add GH workflows.
|
||||
@@ -133,9 +133,10 @@ class InventoryModule(K8sInventoryModule):
|
||||
transport = 'oc'
|
||||
|
||||
def check_kubernetes_collection(self):
|
||||
|
||||
if not HAS_KUBERNETES_COLLECTION:
|
||||
K8sInventoryException("The kubernetes.core collection must be installed")
|
||||
raise K8sInventoryException(
|
||||
"The kubernetes.core collection must be installed"
|
||||
)
|
||||
|
||||
def fetch_objects(self, connections):
|
||||
self.check_kubernetes_collection()
|
||||
|
||||
@@ -66,7 +66,7 @@ class OpenShiftAdmPruneAuth(AnsibleOpenshiftModule):
|
||||
def update_resource_binding(self, ref_kind, ref_names, namespaced=False):
|
||||
|
||||
kind = 'ClusterRoleBinding'
|
||||
api_version = "rbac.authorization.k8s.io/v1",
|
||||
api_version = "rbac.authorization.k8s.io/v1"
|
||||
if namespaced:
|
||||
kind = "RoleBinding"
|
||||
resource = self.find_resource(kind=kind, api_version=api_version, fail=True)
|
||||
|
||||
@@ -4,7 +4,6 @@ from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
from datetime import datetime, timezone
|
||||
import traceback
|
||||
|
||||
from ansible.module_utils._text import to_native
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
from datetime import datetime, timezone, timedelta
|
||||
import traceback
|
||||
import copy
|
||||
|
||||
from ansible.module_utils._text import to_native
|
||||
|
||||
@@ -4,7 +4,6 @@ from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
from datetime import datetime, timezone, timedelta
|
||||
import traceback
|
||||
import time
|
||||
|
||||
from ansible.module_utils._text import to_native
|
||||
|
||||
@@ -7,7 +7,6 @@ from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
|
||||
import traceback
|
||||
from datetime import datetime
|
||||
|
||||
from ansible.module_utils.parsing.convert_bool import boolean
|
||||
|
||||
@@ -3,10 +3,8 @@
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
import traceback
|
||||
import copy
|
||||
|
||||
from ansible.module_utils._text import to_native
|
||||
from ansible.module_utils.parsing.convert_bool import boolean
|
||||
from ansible.module_utils.six import string_types
|
||||
|
||||
@@ -315,7 +313,7 @@ class OpenShiftImportImage(AnsibleOpenshiftModule):
|
||||
if not result["api_found"]:
|
||||
msg = 'Failed to find API for resource with apiVersion "{0}" and kind "{1}"'.format(
|
||||
api_version, kind
|
||||
),
|
||||
)
|
||||
self.fail_json(msg=msg)
|
||||
imagestream = None
|
||||
if len(result["resources"]) > 0:
|
||||
|
||||
@@ -4,7 +4,6 @@ from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
import os
|
||||
import traceback
|
||||
|
||||
from ansible.module_utils._text import to_native
|
||||
|
||||
|
||||
@@ -192,7 +192,6 @@ builds:
|
||||
# ENDREMOVE (downstream)
|
||||
|
||||
import copy
|
||||
import traceback
|
||||
|
||||
from ansible_collections.kubernetes.core.plugins.module_utils.args_common import AUTH_ARG_SPEC
|
||||
|
||||
|
||||
@@ -2,3 +2,4 @@ coverage==4.5.4
|
||||
pytest
|
||||
pytest-xdist
|
||||
pytest-forked
|
||||
pytest-ansible
|
||||
|
||||
3
tests/sanity/ignore-2.16.txt
Normal file
3
tests/sanity/ignore-2.16.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
plugins/modules/k8s.py validate-modules:parameter-type-not-in-doc
|
||||
plugins/modules/k8s.py validate-modules:return-syntax-error
|
||||
plugins/modules/openshift_process.py validate-modules:parameter-type-not-in-doc
|
||||
3
tests/sanity/ignore-2.17.txt
Normal file
3
tests/sanity/ignore-2.17.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
plugins/modules/k8s.py validate-modules:parameter-type-not-in-doc
|
||||
plugins/modules/k8s.py validate-modules:return-syntax-error
|
||||
plugins/modules/openshift_process.py validate-modules:parameter-type-not-in-doc
|
||||
@@ -10,7 +10,7 @@ from ansible_collections.community.okd.plugins.module_utils.openshift_ldap impor
|
||||
import pytest
|
||||
|
||||
try:
|
||||
import ldap
|
||||
import ldap # pylint: disable=unused-import
|
||||
except ImportError:
|
||||
pytestmark = pytest.mark.skip("This test requires the python-ldap library")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user