Skip to content

Commit

Permalink
Use new environment variables type
Browse files Browse the repository at this point in the history
  • Loading branch information
chrismeyersfsu committed Dec 16, 2024
1 parent 7cfa5dc commit 354e2f4
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/awx_plugins/credentials/injectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@
import stat
import tempfile

from awx_plugins.interfaces._temporary_private_api import ( # noqa: WPS436
EnvVarsType,
)
from awx_plugins.interfaces._temporary_private_container_api import ( # noqa: WPS436
get_incontainer_path,
)
from awx_plugins.interfaces._temporary_private_credential_api import ( # noqa: WPS436
Credential,
GenericOptionalPrimitiveType,
)
from awx_plugins.interfaces._temporary_private_django_api import ( # noqa: WPS436
get_vmware_certificate_validation_setting,
Expand All @@ -22,7 +24,7 @@

def aws(
cred: Credential,
env: dict[str, GenericOptionalPrimitiveType],
env: EnvVarsType,
private_data_dir: str,
) -> None:
env['AWS_ACCESS_KEY_ID'] = cred.get_input('username', default='')
Expand All @@ -37,7 +39,7 @@ def aws(

def gce(
cred: Credential,
env: dict[str, GenericOptionalPrimitiveType],
env: EnvVarsType,
private_data_dir: str,
) -> str:
project = cred.get_input('project', default='')
Expand Down Expand Up @@ -80,7 +82,7 @@ def gce(

def azure_rm(
cred: Credential,
env: dict[str, GenericOptionalPrimitiveType],
env: EnvVarsType,
private_data_dir: str,
) -> None:
client = cred.get_input('client', default='')
Expand All @@ -102,7 +104,7 @@ def azure_rm(

def vmware(
cred: Credential,
env: dict[str, GenericOptionalPrimitiveType],
env: EnvVarsType,
private_data_dir: str,
) -> None:
env['VMWARE_USER'] = cred.get_input('username', default='')
Expand Down Expand Up @@ -147,7 +149,7 @@ def _openstack_data(cred: Credential):

def openstack(
cred: Credential,
env: dict[str, GenericOptionalPrimitiveType],
env: EnvVarsType,
private_data_dir: str,
) -> None:
handle, path = tempfile.mkstemp(dir=os.path.join(private_data_dir, 'env'))
Expand All @@ -166,7 +168,7 @@ def openstack(

def kubernetes_bearer_token(
cred: Credential,
env: dict[str, GenericOptionalPrimitiveType],
env: EnvVarsType,
private_data_dir: str,
) -> None:
env['K8S_AUTH_HOST'] = cred.get_input('host', default='')
Expand All @@ -188,7 +190,7 @@ def kubernetes_bearer_token(

def terraform(
cred: Credential,
env: dict[str, GenericOptionalPrimitiveType],
env: EnvVarsType,
private_data_dir: str,
) -> None:
handle, path = tempfile.mkstemp(dir=os.path.join(private_data_dir, 'env'))
Expand Down

0 comments on commit 354e2f4

Please sign in to comment.