From bc481c25006912cedf2f9f1bc07e18fa3cb2eb5e Mon Sep 17 00:00:00 2001 From: Dag Wieers Date: Fri, 30 Nov 2018 03:18:39 +0100 Subject: [PATCH] PSRP: Improve default logging to ansible.log (#47645) --- lib/ansible/plugins/connection/psrp.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/ansible/plugins/connection/psrp.py b/lib/ansible/plugins/connection/psrp.py index a4456d1003d..2c55bdd74ec 100644 --- a/lib/ansible/plugins/connection/psrp.py +++ b/lib/ansible/plugins/connection/psrp.py @@ -156,8 +156,10 @@ options: import base64 import json +import logging import os +from ansible import constants as C from ansible.errors import AnsibleConnectionFailure, AnsibleError from ansible.errors import AnsibleFileNotFound from ansible.module_utils.parsing.convert_bool import boolean @@ -204,6 +206,11 @@ class Connection(ConnectionBase): self._shell_type = 'powershell' super(Connection, self).__init__(*args, **kwargs) + if not C.DEFAULT_DEBUG: + logging.getLogger('pypsrp').setLevel(logging.INFO) + logging.getLogger('requests_credssp').setLevel(logging.INFO) + logging.getLogger('urllib3').setLevel(logging.INFO) + def _connect(self): if not HAS_PYPSRP: raise AnsibleError("pypsrp or dependencies are not installed: %s"