Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
chrismeyersfsu committed Mar 20, 2019
1 parent 5135b8a commit 0605854
Show file tree
Hide file tree
Showing 4 changed files with 690 additions and 674 deletions.
26 changes: 15 additions & 11 deletions awx/main/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
UnifiedJob, Notification,
Inventory, SmartInventoryMembership,
Job, AdHocCommand, ProjectUpdate, InventoryUpdate, SystemJob,
Project,
JobEvent, ProjectUpdateEvent, InventoryUpdateEvent, AdHocCommandEvent, SystemJobEvent,
build_safe_env
)
Expand All @@ -65,8 +64,8 @@
from awx.main.dispatch.publish import task
from awx.main.dispatch import get_local_queuename, reaper
from awx.main.utils import (get_ssh_version, update_scm_url,
build_proot_temp_dir, get_licenser,
OutputEventFilter, OutputVerboseFilter, ignore_inventory_computed_fields,
get_licenser,
ignore_inventory_computed_fields,
ignore_inventory_group_removal, extract_ansible_vars, schedule_task_manager)
from awx.main.utils.safe_yaml import safe_dump, sanitize_jinja
from awx.main.utils.reload import stop_local_services
Expand Down Expand Up @@ -961,6 +960,12 @@ def get_password_prompts(self, passwords={}):
'''
return OrderedDict()

def create_expect_passwords_data_struct(self, password_prompts, passwords):
expect_passwords = {}
for k, v in password_prompts.items():
expect_passwords[k] = passwords.get(v, '') or ''
return expect_passwords

def pre_run_hook(self, instance):
'''
Hook for any steps to run before the job/task starts
Expand Down Expand Up @@ -1041,7 +1046,6 @@ def run(self, pk, **kwargs):
status, rc, tb = 'error', None, ''
output_replacements = []
extra_update_fields = {}
stdout_handle = None
fact_modification_times = {}
self.event_ct = 0
private_data_dir = None
Expand Down Expand Up @@ -1099,10 +1103,10 @@ def run(self, pk, **kwargs):
)
self.write_args_file(private_data_dir, args)

expect_passwords = {}
password_prompts = self.get_password_prompts(passwords)
for k, v in password_prompts.items():
expect_passwords[k] = passwords.get(v, '') or ''
expect_passwords = self.create_expect_passwords_data_struct(password_prompts, passwords)

# TODO: Probably remove this when cleaning up isolated path
_kw = dict(
extra_update_fields=extra_update_fields,
proot_cmd=getattr(settings, 'AWX_PROOT_CMD', 'bwrap'),
Expand Down Expand Up @@ -1369,9 +1373,9 @@ def build_args(self, job, private_data_dir, passwords):

ssh_username, become_username, become_method = '', '', ''
if creds:
ssh_username = creds.username
become_method = creds.become_method
become_username = creds.become_username
ssh_username = creds.get_input('username', default='')
become_method = creds.get_input('become_method', default='')
become_username = creds.get_input('become_username', default='')
else:
become_method = None
become_username = ""
Expand Down Expand Up @@ -2140,7 +2144,7 @@ def build_env(self, inventory_update, private_data_dir, isolated, private_data_f
'cloudforms': 'CLOUDFORMS_INI_PATH'
}
if inventory_update.source in ini_mapping:
cred_data = private_data_files.get('credentials', '')
cred_data = private_data_files.get('credentials', {})
env[ini_mapping[inventory_update.source]] = cred_data.get(
inventory_update.get_cloud_credential(), ''
)
Expand Down
Loading

0 comments on commit 0605854

Please sign in to comment.