Skip to content

Commit

Permalink
Move plugin test out of awx into here
Browse files Browse the repository at this point in the history
  • Loading branch information
chrismeyersfsu committed Dec 18, 2024
1 parent ec19a5a commit 6f2c4a2
Show file tree
Hide file tree
Showing 5 changed files with 568 additions and 18 deletions.
1 change: 1 addition & 0 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ per-file-ignores =
src/awx_plugins/inventory/plugins.py: ANN001, ANN002, ANN003, ANN101, ANN102, ANN201, ANN202, ANN206, B950, C812, C819, D100, D101, D102, D205, D209, D400, D401, LN001, LN002, N801, WPS110, WPS111, WPS202, WPS210, WPS214, WPS301, WPS319, WPS324, WPS331, WPS336, WPS337, WPS338, WPS347, WPS421, WPS433, WPS450, WPS510, WPS529
tests/credential_plugins_test.py: ANN101, B017, C419, D100, D102, D103, D205, D209, D400, DAR, PT011, S105, WPS111, WPS117, WPS118, WPS202, WPS352, WPS421, WPS433, WPS507, WPS441
tests/importable_test.py: ANN101, DAR
tests/managed_credential_plugins_test.py: DAR, DCO020, S101, S105, S108, S404, S603, WPS201, WPS202, WPS210, WPS430, WPS436, WPS441, WPS442, WPS450

# Count the number of occurrences of each error/warning code and print a report:
statistics = true
Expand Down
9 changes: 5 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ repos:
# args:
# - --unsafe
- id: detect-private-key
exclude: tests/managed_credential_plugins_test.py

# Heavy checks:
- id: check-ast
Expand Down Expand Up @@ -193,7 +194,7 @@ repos:
name: MyPy, for Python 3.13
additional_dependencies:
- >- # standard interface declarations for AWX plugins
awx_plugins.interfaces == 0.0.1a3
awx_plugins.interfaces == 0.0.1a4
- azure-identity # needed by credentials.azure_kv
- azure-keyvault # needed by credentials.azure_kv
- boto3-stubs # needed by credentials.awx_secretsmanager
Expand Down Expand Up @@ -224,7 +225,7 @@ repos:
name: MyPy, for Python 3.12
additional_dependencies:
- >- # standard interface declarations for AWX plugins
awx_plugins.interfaces == 0.0.1a3
awx_plugins.interfaces == 0.0.1a4
- azure-identity # needed by credentials.azure_kv
- azure-keyvault # needed by credentials.azure_kv
- boto3-stubs # needed by credentials.awx_secretsmanager
Expand Down Expand Up @@ -255,7 +256,7 @@ repos:
name: MyPy, for Python 3.11
additional_dependencies:
- >- # standard interface declarations for AWX plugins
awx_plugins.interfaces == 0.0.1a3
awx_plugins.interfaces == 0.0.1a4
- azure-identity # needed by credentials.azure_kv
- azure-keyvault # needed by credentials.azure_kv
- boto3-stubs # needed by credentials.awx_secretsmanager
Expand Down Expand Up @@ -288,7 +289,7 @@ repos:
- id: pylint
additional_dependencies:
- >- # standard interface declarations for AWX plugins
awx_plugins.interfaces == 0.0.1a3
awx_plugins.interfaces == 0.0.1a4
- azure-identity # needed by credentials.azure_kv
- azure-keyvault # needed by credentials.azure_kv
- boto3 # needed by credentials.awx_secretsmanager
Expand Down
1 change: 1 addition & 0 deletions dependencies/direct/py.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ covdefaults
coverage # accessed directly from tox
coverage-enable-subprocess
hypothesis
Jinja2
pytest
pytest-cov
pytest-mock
Expand Down
36 changes: 22 additions & 14 deletions src/awx_plugins/credentials/plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,24 @@
)

from .injectors import (
aws,
azure_rm,
gce,
kubernetes_bearer_token,
openstack,
terraform,
vmware,
aws as aws_injector,
azure_rm as azure_rm_injector,
gce as gce_injector,
kubernetes_bearer_token as kubernetes_bearer_token_injector,
openstack as openstack_injector,
terraform as terraform_injector,
vmware as vmware_injector,
)


__all__ = () # noqa: WPS410


ssh = ManagedCredentialType(
namespace='ssh',
kind='ssh',
name=gettext_noop('Machine'),
managed=True,
inputs={
'fields': [
{
Expand Down Expand Up @@ -215,7 +219,7 @@
kind='cloud',
name=gettext_noop('Amazon Web Services'),
managed=True,
custom_injectors=aws,
custom_injectors=aws_injector,
inputs={
'fields': [
{
Expand Down Expand Up @@ -254,7 +258,7 @@
kind='cloud',
name=gettext_noop('OpenStack'),
managed=True,
custom_injectors=openstack,
custom_injectors=openstack_injector,
inputs={
'fields': [
{
Expand Down Expand Up @@ -328,7 +332,7 @@
kind='cloud',
name=gettext_noop('VMware vCenter'),
managed=True,
custom_injectors=vmware,
custom_injectors=vmware_injector,
inputs={
'fields': [
{
Expand Down Expand Up @@ -401,7 +405,7 @@
kind='cloud',
name=gettext_noop('Google Compute Engine'),
managed=True,
custom_injectors=gce,
custom_injectors=gce_injector,
inputs={
'fields': [
{
Expand Down Expand Up @@ -449,7 +453,7 @@
kind='cloud',
name=gettext_noop('Microsoft Azure Resource Manager'),
managed=True,
custom_injectors=azure_rm,
custom_injectors=azure_rm_injector,
inputs={
'fields': [
{
Expand Down Expand Up @@ -726,7 +730,8 @@
namespace='kubernetes_bearer_token',
kind='kubernetes',
name=gettext_noop('OpenShift or Kubernetes API Bearer Token'),
custom_injectors=kubernetes_bearer_token,
managed=True,
custom_injectors=kubernetes_bearer_token_injector,
inputs={
'fields': [
{
Expand Down Expand Up @@ -766,6 +771,7 @@
namespace='registry',
kind='registry',
name=gettext_noop('Container Registry'),
managed=True,
inputs={
'fields': [
{
Expand Down Expand Up @@ -807,6 +813,7 @@
namespace='galaxy_api_token',
kind='galaxy',
name=gettext_noop('Ansible Galaxy/Automation Hub API Token'),
managed=True,
inputs={
'fields': [
{
Expand Down Expand Up @@ -845,6 +852,7 @@
namespace='gpg_public_key',
kind='cryptography',
name=gettext_noop('GPG Public Key'),
managed=True,
inputs={
'fields': [
{
Expand All @@ -867,7 +875,7 @@
kind='cloud',
name=gettext_noop('Terraform backend configuration'),
managed=True,
custom_injectors=terraform,
custom_injectors=terraform_injector,
inputs={
'fields': [
{
Expand Down
Loading

0 comments on commit 6f2c4a2

Please sign in to comment.