Skip to content

Commit

Permalink
Increase type usage
Browse files Browse the repository at this point in the history
  • Loading branch information
chrismeyersfsu committed Nov 19, 2024
1 parent 8bf79b0 commit e56d661
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/awx_plugins/credentials/injectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
import stat
import tempfile

from awx_plugins.interfaces._temporary_private_api import ( # noqa: WPS436
Credential,
)
from awx_plugins.interfaces._temporary_private_container_api import ( # noqa: WPS436
get_incontainer_path,
)
Expand All @@ -16,7 +19,7 @@
import yaml


def aws(cred, env, private_data_dir):
def aws(cred: Credential, env: dict, private_data_dir: str):
env['AWS_ACCESS_KEY_ID'] = cred.get_input('username', default='')
env['AWS_SECRET_ACCESS_KEY'] = cred.get_input('password', default='')

Expand All @@ -27,7 +30,7 @@ def aws(cred, env, private_data_dir):
env['AWS_SESSION_TOKEN'] = env['AWS_SECURITY_TOKEN']


def gce(cred, env, private_data_dir):
def gce(cred: Credential, env: dict, private_data_dir: str):
project = cred.get_input('project', default='')
username = cred.get_input('username', default='')

Expand Down Expand Up @@ -66,7 +69,7 @@ def gce(cred, env, private_data_dir):
return path


def azure_rm(cred, env, private_data_dir):
def azure_rm(cred: Credential, env: dict, private_data_dir: str):
client = cred.get_input('client', default='')
tenant = cred.get_input('tenant', default='')

Expand All @@ -84,7 +87,7 @@ def azure_rm(cred, env, private_data_dir):
env['AZURE_CLOUD_ENVIRONMENT'] = cred.get_input('cloud_environment')


def vmware(cred, env, private_data_dir):
def vmware(cred: Credential, env: dict, private_data_dir: str):
env['VMWARE_USER'] = cred.get_input('username', default='')
env['VMWARE_PASSWORD'] = cred.get_input('password', default='')
env['VMWARE_HOST'] = cred.get_input('host', default='')
Expand All @@ -93,7 +96,7 @@ def vmware(cred, env, private_data_dir):
)


def _openstack_data(cred):
def _openstack_data(cred: Credential):
openstack_auth = dict(
auth_url=cred.get_input('host', default=''),
username=cred.get_input('username', default=''),
Expand Down Expand Up @@ -125,7 +128,7 @@ def _openstack_data(cred):
return openstack_data


def openstack(cred, env, private_data_dir):
def openstack(cred: Credential, env: dict, private_data_dir: str):
handle, path = tempfile.mkstemp(dir=os.path.join(private_data_dir, 'env'))
f = os.fdopen(handle, 'w')
openstack_data = _openstack_data(cred)
Expand All @@ -140,7 +143,7 @@ def openstack(cred, env, private_data_dir):
env['OS_CLIENT_CONFIG_FILE'] = get_incontainer_path(path, private_data_dir)


def kubernetes_bearer_token(cred, env, private_data_dir):
def kubernetes_bearer_token(cred: Credential, env: dict, private_data_dir: str):
env['K8S_AUTH_HOST'] = cred.get_input('host', default='')
env['K8S_AUTH_API_KEY'] = cred.get_input('bearer_token', default='')
if cred.get_input('verify_ssl') and 'ssl_ca_cert' in cred.inputs:
Expand All @@ -158,7 +161,7 @@ def kubernetes_bearer_token(cred, env, private_data_dir):
env['K8S_AUTH_VERIFY_SSL'] = 'False'


def terraform(cred, env, private_data_dir):
def terraform(cred: Credential, env: dict, private_data_dir: str):
handle, path = tempfile.mkstemp(dir=os.path.join(private_data_dir, 'env'))
with os.fdopen(handle, 'w') as f:
os.chmod(path, stat.S_IRUSR | stat.S_IWUSR)
Expand Down

0 comments on commit e56d661

Please sign in to comment.