From 16c3fc5cec10836e034489e4454ca1e9b136bca2 Mon Sep 17 00:00:00 2001 From: nitzmahone Date: Tue, 5 Jul 2016 16:04:59 -0700 Subject: [PATCH] prevent spurious pywinrm arg warnings for non-pywinrm connection args (cherry picked from commit c5e0d3d17bcfecbf39690f2ae6fb20824c7d7de2) --- lib/ansible/plugins/connection/winrm.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/ansible/plugins/connection/winrm.py b/lib/ansible/plugins/connection/winrm.py index 0eefa79dcf5..659f17f92e0 100644 --- a/lib/ansible/plugins/connection/winrm.py +++ b/lib/ansible/plugins/connection/winrm.py @@ -111,9 +111,13 @@ class Connection(ConnectionBase): if unsupported_transports: raise AnsibleError('The installed version of WinRM does not support transport(s) %s' % list(unsupported_transports)) + # arg names we're going passing directly + internal_kwarg_mask = set(['self', 'endpoint', 'transport', 'username', 'password', 'scheme', 'path']) + self._winrm_kwargs = dict(username=self._winrm_user, password=self._winrm_pass) argspec = inspect.getargspec(Protocol.__init__) supported_winrm_args = set(argspec.args) + supported_winrm_args.update(internal_kwarg_mask) passed_winrm_args = set([v.replace('ansible_winrm_', '') for v in hostvars if v.startswith('ansible_winrm_')]) unsupported_args = passed_winrm_args.difference(supported_winrm_args) @@ -121,9 +125,6 @@ class Connection(ConnectionBase): for arg in unsupported_args: display.warning("ansible_winrm_{0} unsupported by pywinrm (is an up-to-date version of pywinrm installed?)".format(arg)) - # arg names we're going passing directly - internal_kwarg_mask = set(['self', 'endpoint', 'transport', 'username', 'password']) - # pass through matching kwargs, excluding the list we want to treat specially for arg in passed_winrm_args.difference(internal_kwarg_mask).intersection(supported_winrm_args): self._winrm_kwargs[arg] = hostvars['ansible_winrm_%s' % arg]