From 8beed7f4091c6041ce43522f36f43455f5f52d27 Mon Sep 17 00:00:00 2001 From: Chris Church Date: Thu, 9 Apr 2015 10:32:14 -0400 Subject: [PATCH] Disable ControlPersist for ad hoc commands, should avoid any issues with proot or needing to clean up sockets afterwards. --- awx/main/tasks.py | 9 +++------ awx/plugins/callback/job_event_callback.py | 2 -- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/awx/main/tasks.py b/awx/main/tasks.py index 87ddbebc64..197bbb8a59 100644 --- a/awx/main/tasks.py +++ b/awx/main/tasks.py @@ -1209,12 +1209,9 @@ class RunAdHocCommand(BaseTask): elif settings.DEBUG: env['JOB_CALLBACK_DEBUG'] = '1' - # Create a directory for ControlPath sockets that is unique to each - # ad hoc command and visible inside the proot environment (when enabled). - cp_dir = os.path.join(kwargs['private_data_dir'], 'cp') - if not os.path.exists(cp_dir): - os.mkdir(cp_dir, 0700) - env['ANSIBLE_SSH_CONTROL_PATH'] = os.path.join(cp_dir, 'ansible-ssh-%%h-%%p-%%r') + # Specify empty SSH args (should disable ControlPersist entirely for + # ad hoc commands). + env.setdefault('ANSIBLE_SSH_ARGS', '') return env diff --git a/awx/plugins/callback/job_event_callback.py b/awx/plugins/callback/job_event_callback.py index 3011fd6d72..3f91c55b19 100644 --- a/awx/plugins/callback/job_event_callback.py +++ b/awx/plugins/callback/job_event_callback.py @@ -458,8 +458,6 @@ class AdHocCommandCallbackModule(BaseCallbackModule): Callback module for logging ansible ad hoc events via ZMQ or the REST API. ''' - # FIXME: Clean up lingering control persist sockets. - def __init__(self): self.ad_hoc_command_id = int(os.getenv('AD_HOC_COMMAND_ID', '0')) self.rest_api_path = '/api/v1/ad_hoc_commands/%d/events/' % self.ad_hoc_command_id