mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 17:09:03 +00:00
Just import the top-level six package and not attributes of it
This commit is contained in:
parent
622e87dfb5
commit
a1fdd471b2
@ -21,6 +21,9 @@ try:
|
||||
except ImportError:
|
||||
from pipes import quote as _quote
|
||||
|
||||
# Import third party libs
|
||||
import salt.ext.six as six
|
||||
from salt.ext.six.moves.urllib.parse import urlparse as _urlparse # pylint: disable=no-name-in-module
|
||||
try:
|
||||
import rarfile
|
||||
HAS_RARFILE = True
|
||||
@ -29,8 +32,6 @@ except ImportError:
|
||||
|
||||
# Import salt libs
|
||||
from salt.exceptions import SaltInvocationError, CommandExecutionError
|
||||
from salt.ext.six import string_types, integer_types
|
||||
from salt.ext.six.moves.urllib.parse import urlparse as _urlparse # pylint: disable=no-name-in-module
|
||||
import salt.utils
|
||||
import salt.utils.files
|
||||
import salt.utils.itertools
|
||||
@ -436,9 +437,9 @@ def _expand_sources(sources):
|
||||
'''
|
||||
if sources is None:
|
||||
return []
|
||||
if isinstance(sources, string_types):
|
||||
if isinstance(sources, six.string_types):
|
||||
sources = [x.strip() for x in sources.split(',')]
|
||||
elif isinstance(sources, (float, integer_types)):
|
||||
elif isinstance(sources, (float, six.integer_types)):
|
||||
sources = [str(sources)]
|
||||
return [path
|
||||
for source in sources
|
||||
@ -897,9 +898,9 @@ def cmd_unzip(zip_file,
|
||||
|
||||
salt '*' archive.cmd_unzip /tmp/zipfile.zip /home/strongbad/ excludes=file_1,file_2
|
||||
'''
|
||||
if isinstance(excludes, string_types):
|
||||
if isinstance(excludes, six.string_types):
|
||||
excludes = [x.strip() for x in excludes.split(',')]
|
||||
elif isinstance(excludes, (float, integer_types)):
|
||||
elif isinstance(excludes, (float, six.integer_types)):
|
||||
excludes = [str(excludes)]
|
||||
|
||||
cmd = ['unzip']
|
||||
@ -1042,9 +1043,9 @@ def unzip(zip_file,
|
||||
with contextlib.closing(zipfile.ZipFile(zip_file, "r")) as zfile:
|
||||
files = zfile.namelist()
|
||||
|
||||
if isinstance(excludes, string_types):
|
||||
if isinstance(excludes, six.string_types):
|
||||
excludes = [x.strip() for x in excludes.split(',')]
|
||||
elif isinstance(excludes, (float, integer_types)):
|
||||
elif isinstance(excludes, (float, six.integer_types)):
|
||||
excludes = [str(excludes)]
|
||||
|
||||
cleaned_files.extend([x for x in files if x not in excludes])
|
||||
@ -1224,7 +1225,7 @@ def unrar(rarfile, dest, excludes=None, template=None, runas=None, trim_output=F
|
||||
salt '*' archive.unrar /tmp/rarfile.rar /home/strongbad/ excludes=file_1,file_2
|
||||
|
||||
'''
|
||||
if isinstance(excludes, string_types):
|
||||
if isinstance(excludes, six.string_types):
|
||||
excludes = [entry.strip() for entry in excludes.split(',')]
|
||||
|
||||
cmd = [salt.utils.which_bin(('unrar', 'rar')),
|
||||
|
Loading…
Reference in New Issue
Block a user