Migrate basestring to a python3 compatible type (#17199)

This commit is contained in:
Toshio Kuratomi 2016-08-23 13:13:44 -07:00 committed by GitHub
parent a695e18615
commit a22909c226
28 changed files with 137 additions and 101 deletions

View file

@ -34,6 +34,8 @@ import select
import subprocess
import json
from ansible.module_utils.six import text_type, binary_type
class Service(object):
"""
This is the generic Service manipulation class that is subclassed based on system.
@ -112,7 +114,7 @@ class Service(object):
os._exit(0)
# Start the command
if isinstance(cmd, basestring):
if isinstance(cmd, (text_type, binary_type)):
cmd = shlex.split(cmd)
p = subprocess.Popen(cmd, shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE, preexec_fn=lambda: os.close(pipe[1]))
stdout = ""