diff --git a/awx/main/expect/isolated_manager.py b/awx/main/expect/isolated_manager.py index 71ce262fef..9b4ce1db6a 100644 --- a/awx/main/expect/isolated_manager.py +++ b/awx/main/expect/isolated_manager.py @@ -468,13 +468,11 @@ class IsolatedManager(object): return OutputEventFilter(job_event_callback) - def run(self, instance, host, private_data_dir, proot_temp_dir): + def run(self, instance, private_data_dir, proot_temp_dir): """ Run a job on an isolated host. :param instance: a `model.Job` instance - :param host: the hostname (or IP address) to run the - isolated job on :param private_data_dir: an absolute path on the local file system where job-specific data should be written (i.e., `/tmp/ansible_awx_xyz/`) @@ -486,7 +484,7 @@ class IsolatedManager(object): `ansible-playbook` run. """ self.instance = instance - self.host = host + self.host = instance.execution_node self.private_data_dir = private_data_dir self.proot_temp_dir = proot_temp_dir status, rc = self.dispatch() diff --git a/awx/main/tasks.py b/awx/main/tasks.py index e9ff60b0da..be10d3ef58 100644 --- a/awx/main/tasks.py +++ b/awx/main/tasks.py @@ -881,10 +881,8 @@ class BaseTask(Task): extra_update_fields = {} event_ct = 0 stdout_handle = None - isolated_host = instance.get_isolated_execution_node_name() try: - kwargs['isolated'] = isolated_host is not None self.pre_run_hook(instance, **kwargs) if instance.cancel_flag: instance = self.update_model(instance.pk, status='canceled') @@ -944,7 +942,7 @@ class BaseTask(Task): credential, env, safe_env, args, safe_args, kwargs['private_data_dir'] ) - if isolated_host is None: + if instance.is_isolated() is False: stdout_handle = self.get_stdout_handle(instance) else: stdout_handle = isolated_manager.IsolatedManager.get_stdout_handle( @@ -960,7 +958,7 @@ class BaseTask(Task): ssh_key_path = self.get_ssh_key_path(instance, **kwargs) # If we're executing on an isolated host, don't bother adding the # key to the agent in this environment - if ssh_key_path and isolated_host is None: + if ssh_key_path and instance.is_isolated() is False: ssh_auth_sock = os.path.join(kwargs['private_data_dir'], 'ssh_auth.sock') args = run.wrap_args_with_ssh_agent(args, ssh_key_path, ssh_auth_sock) safe_args = run.wrap_args_with_ssh_agent(safe_args, ssh_key_path, ssh_auth_sock) @@ -980,11 +978,11 @@ class BaseTask(Task): proot_cmd=getattr(settings, 'AWX_PROOT_CMD', 'bwrap'), ) instance = self.update_model(instance.pk, output_replacements=output_replacements) - if isolated_host: + if instance.is_isolated() is True: manager_instance = isolated_manager.IsolatedManager( args, cwd, env, stdout_handle, ssh_key_path, **_kw ) - status, rc = manager_instance.run(instance, isolated_host, + status, rc = manager_instance.run(instance, kwargs['private_data_dir'], kwargs.get('proot_temp_dir')) else: @@ -1335,7 +1333,7 @@ class RunJob(BaseTask): job_request_id = '' if self.request.id is None else self.request.id pu_ig = job.instance_group pu_en = job.execution_node - if kwargs['isolated']: + if job.is_isolated() is True: pu_ig = pu_ig.controller pu_en = settings.CLUSTER_HOST_ID local_project_sync = job.project.create_project_update(