1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

WinRM: Improve default logging to ansible.log (#49308)

This commit is contained in:
Dag Wieers 2018-11-30 03:18:18 +01:00 committed by Matt Davis
parent 434c421675
commit 01d66d4431

View file

@ -97,6 +97,7 @@ DOCUMENTATION = """
""" """
import base64 import base64
import logging
import os import os
import re import re
import traceback import traceback
@ -112,6 +113,7 @@ try:
except ImportError: except ImportError:
pass pass
from ansible import constants as C
from ansible.errors import AnsibleError, AnsibleConnectionFailure from ansible.errors import AnsibleError, AnsibleConnectionFailure
from ansible.errors import AnsibleFileNotFound from ansible.errors import AnsibleFileNotFound
from ansible.module_utils.parsing.convert_bool import boolean from ansible.module_utils.parsing.convert_bool import boolean
@ -191,6 +193,11 @@ class Connection(ConnectionBase):
super(Connection, self).__init__(*args, **kwargs) 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): def _build_winrm_kwargs(self):
# this used to be in set_options, as win_reboot needs to be able to # 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 # 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 winrm_host = self._winrm_host
if HAS_IPADDRESS: 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: try:
ipaddress.IPv6Address(winrm_host) ipaddress.IPv6Address(winrm_host)
except ipaddress.AddressValueError: except ipaddress.AddressValueError: