|
|
|
|
@ -15,7 +15,8 @@
|
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
|
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
|
|
from __future__ import absolute_import
|
|
|
|
|
from __future__ import (absolute_import, division, print_function)
|
|
|
|
|
__metaclass__ = type
|
|
|
|
|
|
|
|
|
|
import base64
|
|
|
|
|
import os
|
|
|
|
|
@ -103,7 +104,7 @@ class Connection(ConnectionBase):
|
|
|
|
|
try:
|
|
|
|
|
protocol.send_message('')
|
|
|
|
|
return protocol
|
|
|
|
|
except WinRMTransportError, exc:
|
|
|
|
|
except WinRMTransportError as exc:
|
|
|
|
|
err_msg = str(exc)
|
|
|
|
|
if re.search(r'Operation\s+?timed\s+?out', err_msg, re.I):
|
|
|
|
|
raise AnsibleError("the connection attempt timed out")
|
|
|
|
|
@ -164,7 +165,7 @@ class Connection(ConnectionBase):
|
|
|
|
|
cmd_parts = self._shell._encode_script(script, as_list=True)
|
|
|
|
|
try:
|
|
|
|
|
result = self._winrm_exec(cmd_parts[0], cmd_parts[1:], from_exec=True)
|
|
|
|
|
except Exception, e:
|
|
|
|
|
except Exception as e:
|
|
|
|
|
traceback.print_exc()
|
|
|
|
|
raise AnsibleError("failed to exec cmd %s" % cmd)
|
|
|
|
|
return (result.status_code, '', result.std_out.encode('utf-8'), result.std_err.encode('utf-8'))
|
|
|
|
|
|