From 01d66d4431df065458b8fa0b270502a0f8b89778 Mon Sep 17 00:00:00 2001 From: Dag Wieers Date: Fri, 30 Nov 2018 03:18:18 +0100 Subject: [PATCH] WinRM: Improve default logging to ansible.log (#49308) --- lib/ansible/plugins/connection/winrm.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/ansible/plugins/connection/winrm.py b/lib/ansible/plugins/connection/winrm.py index d671b86c83e..e80d8f163c3 100644 --- a/lib/ansible/plugins/connection/winrm.py +++ b/lib/ansible/plugins/connection/winrm.py @@ -97,6 +97,7 @@ DOCUMENTATION = """ """ import base64 +import logging import os import re import traceback @@ -112,6 +113,7 @@ try: except ImportError: pass +from ansible import constants as C from ansible.errors import AnsibleError, AnsibleConnectionFailure from ansible.errors import AnsibleFileNotFound from ansible.module_utils.parsing.convert_bool import boolean @@ -191,6 +193,11 @@ class Connection(ConnectionBase): super(Connection, self).__init__(*args, **kwargs) + if not C.DEFAULT_DEBUG: + logging.getLogger('requests_credssp').setLevel(logging.INFO) + logging.getLogger('requests_kerberos').setLevel(logging.INFO) + logging.getLogger('urllib3').setLevel(logging.INFO) + def _build_winrm_kwargs(self): # this used to be in set_options, as win_reboot needs to be able to # override the conn timeout, we need to be able to build the args @@ -365,7 +372,7 @@ class Connection(ConnectionBase): winrm_host = self._winrm_host if HAS_IPADDRESS: - display.vvvv("checking if winrm_host %s is an IPv6 address" % winrm_host) + display.debug("checking if winrm_host %s is an IPv6 address" % winrm_host) try: ipaddress.IPv6Address(winrm_host) except ipaddress.AddressValueError: