mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-28 03:00:23 -07:00
Restore python3 fixups
This commit is contained in:
parent
8007829228
commit
ed2e6fc8fa
8 changed files with 19 additions and 5 deletions
|
@ -15,6 +15,9 @@
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
from __future__ import (absolute_import, division, print_function)
|
||||||
|
__metaclass__ = type
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import base64
|
import base64
|
||||||
|
@ -141,7 +144,7 @@ class Connection(object):
|
||||||
# shutdown, so we'll reconnect.
|
# shutdown, so we'll reconnect.
|
||||||
wrong_user = True
|
wrong_user = True
|
||||||
|
|
||||||
except AnsibleError, e:
|
except AnsibleError as e:
|
||||||
if allow_ssh:
|
if allow_ssh:
|
||||||
if "WRONG_USER" in e:
|
if "WRONG_USER" in e:
|
||||||
vvv("Switching users, waiting for the daemon on %s to shutdown completely..." % self.host)
|
vvv("Switching users, waiting for the daemon on %s to shutdown completely..." % self.host)
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
from __future__ import (absolute_import, division, print_function)
|
||||||
|
__metaclass__ = type
|
||||||
|
|
||||||
import distutils.spawn
|
import distutils.spawn
|
||||||
import traceback
|
import traceback
|
||||||
|
|
|
@ -21,6 +21,8 @@
|
||||||
# The func transport permit to use ansible over func. For people who have already setup
|
# The func transport permit to use ansible over func. For people who have already setup
|
||||||
# func and that wish to play with ansible, this permit to move gradually to ansible
|
# func and that wish to play with ansible, this permit to move gradually to ansible
|
||||||
# without having to redo completely the setup of the network.
|
# without having to redo completely the setup of the network.
|
||||||
|
from __future__ import (absolute_import, division, print_function)
|
||||||
|
__metaclass__ = type
|
||||||
|
|
||||||
HAVE_FUNC=False
|
HAVE_FUNC=False
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
from __future__ import (absolute_import, division, print_function)
|
||||||
|
__metaclass__ = type
|
||||||
|
|
||||||
import distutils.spawn
|
import distutils.spawn
|
||||||
import traceback
|
import traceback
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
from __future__ import (absolute_import, division, print_function)
|
||||||
|
__metaclass__ = type
|
||||||
|
|
||||||
import distutils.spawn
|
import distutils.spawn
|
||||||
import os
|
import os
|
||||||
|
|
|
@ -236,7 +236,7 @@ class Connection(ConnectionBase):
|
||||||
continue
|
continue
|
||||||
try:
|
try:
|
||||||
host_fh = open(hf)
|
host_fh = open(hf)
|
||||||
except IOError, e:
|
except IOError as e:
|
||||||
hfiles_not_found += 1
|
hfiles_not_found += 1
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -15,7 +15,8 @@
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
# 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 base64
|
||||||
import os
|
import os
|
||||||
|
@ -103,7 +104,7 @@ class Connection(ConnectionBase):
|
||||||
try:
|
try:
|
||||||
protocol.send_message('')
|
protocol.send_message('')
|
||||||
return protocol
|
return protocol
|
||||||
except WinRMTransportError, exc:
|
except WinRMTransportError as exc:
|
||||||
err_msg = str(exc)
|
err_msg = str(exc)
|
||||||
if re.search(r'Operation\s+?timed\s+?out', err_msg, re.I):
|
if re.search(r'Operation\s+?timed\s+?out', err_msg, re.I):
|
||||||
raise AnsibleError("the connection attempt timed out")
|
raise AnsibleError("the connection attempt timed out")
|
||||||
|
@ -164,7 +165,7 @@ class Connection(ConnectionBase):
|
||||||
cmd_parts = self._shell._encode_script(script, as_list=True)
|
cmd_parts = self._shell._encode_script(script, as_list=True)
|
||||||
try:
|
try:
|
||||||
result = self._winrm_exec(cmd_parts[0], cmd_parts[1:], from_exec=True)
|
result = self._winrm_exec(cmd_parts[0], cmd_parts[1:], from_exec=True)
|
||||||
except Exception, e:
|
except Exception as e:
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
raise AnsibleError("failed to exec cmd %s" % cmd)
|
raise AnsibleError("failed to exec cmd %s" % cmd)
|
||||||
return (result.status_code, '', result.std_out.encode('utf-8'), result.std_err.encode('utf-8'))
|
return (result.status_code, '', result.std_out.encode('utf-8'), result.std_err.encode('utf-8'))
|
||||||
|
|
|
@ -17,6 +17,8 @@
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
from __future__ import (absolute_import, division, print_function)
|
||||||
|
__metaclass__ = type
|
||||||
|
|
||||||
import distutils.spawn
|
import distutils.spawn
|
||||||
import traceback
|
import traceback
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue