do not allow ansible connection type of local for ad_hoc

This commit is contained in:
Wayne Witzel III 2017-10-04 17:55:36 -04:00
parent 00afc87af1
commit 02e3f45422
No known key found for this signature in database
GPG Key ID: B4F07BDC564D6301

View File

@ -2139,6 +2139,9 @@ class RunAdHocCommand(BaseTask):
args.append('-%s' % ('v' * min(5, ad_hoc_command.verbosity)))
if ad_hoc_command.extra_vars_dict:
if ad_hoc_command.extra_vars_dict.get('ansible_connection') == 'local':
raise ValueError(_("unable to use the `local` connection plugin with ad hoc commands"))
args.extend(['-e', json.dumps(ad_hoc_command.extra_vars_dict)])
args.extend(['-m', ad_hoc_command.module_name])