Skip to content

Commit

Permalink
move inv and cred plugins into awx_plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
chrismeyersfsu committed Aug 14, 2024
1 parent 96a3938 commit 83efafc
Show file tree
Hide file tree
Showing 13 changed files with 993 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from urllib.parse import quote, urlencode, urljoin

from django.utils.translation import gettext_lazy as _
from .plugin import translate_function as _
import requests

aim_inputs = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from botocore.exceptions import ClientError

from .plugin import CredentialPlugin
from django.utils.translation import gettext_lazy as _
from .plugin import translate_function as _


secrets_manager_inputs = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from .plugin import CredentialPlugin

from django.utils.translation import gettext_lazy as _
from .plugin import translate_function as _


# https://github.com/Azure/msrestazure-for-python/blob/master/msrestazure/azure_cloud.py
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from .plugin import CredentialPlugin, raise_for_status
from django.utils.translation import gettext_lazy as _
from .plugin import translate_function as _
from urllib.parse import urljoin
import requests

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from urllib.parse import urljoin, quote

from django.utils.translation import gettext_lazy as _
from .plugin import translate_function as _
import requests
import base64
import binascii
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from .plugin import CredentialPlugin

from django.conf import settings
from django.utils.translation import gettext_lazy as _
from .plugin import settings
from .plugin import translate_function as _
from delinea.secrets.vault import PasswordGrantAuthorizer, SecretsVault
from base64 import b64decode

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from .plugin import CredentialPlugin, CertFiles, raise_for_status

import requests
from django.utils.translation import gettext_lazy as _
from .plugin import translate_function as _

base_inputs = {
'fields': [
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,19 @@
CredentialPlugin = namedtuple('CredentialPlugin', ['name', 'inputs', 'backend'])


try:
from django.utils.translation import gettext_lazy as translate_function
except ModuleNotFoundError:
translate_function = lambda *args, **kwargs: None


class Settings():

This comment has been minimized.

Copy link
@webknjaz

webknjaz Oct 10, 2024

Member

This stub is only used in https://github.com/ansible/awx-plugins/blob/87cfd10/src/awx_plugins/credentials/dsv.py#L94-L102 and is actually never set anywhere, so the behavior is not branchy and always skips that if-block.
Coverage data also supports my observation that the code branch is unreachable within this repo: https://app.codecov.io/gh/ansible/awx-plugins/commit/87cfd1097291f060e6e9680bafdea6a65652a754/blob/src/awx_plugins/credentials/dsv.py?flags[0]=pytest#L95.

Git paleontology led me to ansible/awx@a317b6b#diff-db8fce7cd0a0837a198e93d45d9a620c2ccf58c8d319626aa6757677d03fb303R41-R49 which clearly depends on global Django settings.
And the stub introduced here is a no-op. It's never imported or set within AWX.

This comment has been minimized.

Copy link
@webknjaz

webknjaz Oct 10, 2024

Member

I relocated this to dsv since it's only used there: 397afb2.

DEBUG = False


settings = Settings()


def raise_for_status(resp):
resp.raise_for_status()
if resp.status_code >= 300:
Expand Down
Loading

0 comments on commit 83efafc

Please sign in to comment.