mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge branch '2015.8' into '2016.3'
Conflicts: - tests/unit/modules/mount_test.py - tests/unit/states/file_test.py
This commit is contained in:
commit
f603757b55
6 changed files with 63 additions and 17 deletions
|
@ -323,10 +323,11 @@ class Fileserver(object):
|
|||
if not back:
|
||||
back = self.opts['fileserver_backend']
|
||||
else:
|
||||
try:
|
||||
back = back.split(',')
|
||||
except AttributeError:
|
||||
back = six.text_type(back).split(',')
|
||||
if not isinstance(back, list):
|
||||
try:
|
||||
back = back.split(',')
|
||||
except AttributeError:
|
||||
back = six.text_type(back).split(',')
|
||||
|
||||
ret = []
|
||||
if not isinstance(back, list):
|
||||
|
|
|
@ -294,7 +294,8 @@ def _file_lists(load, form):
|
|||
dir_rel_fn = dir_rel_fn.replace('\\', '/')
|
||||
ret['dirs'].append(dir_rel_fn)
|
||||
if len(dirs) == 0 and len(files) == 0:
|
||||
if not salt.fileserver.is_file_ignored(__opts__, dir_rel_fn):
|
||||
if dir_rel_fn not in ('.', '..') \
|
||||
and not salt.fileserver.is_file_ignored(__opts__, dir_rel_fn):
|
||||
ret['empty_dirs'].append(dir_rel_fn)
|
||||
for fname in files:
|
||||
is_link = os.path.islink(os.path.join(root, fname))
|
||||
|
|
|
@ -57,6 +57,7 @@ log = logging.getLogger(__name__)
|
|||
# Import third party libs
|
||||
try:
|
||||
import boto
|
||||
import boto.ec2 # pylint: enable=unused-import
|
||||
# connection settings were added in 2.33.0
|
||||
required_boto_version = '2.33.0'
|
||||
if (_LooseVersion(boto.__version__) <
|
||||
|
@ -64,7 +65,6 @@ try:
|
|||
msg = 'boto_elb requires boto {0}.'.format(required_boto_version)
|
||||
logging.debug(msg)
|
||||
raise ImportError()
|
||||
import boto.ec2
|
||||
from boto.ec2.elb import HealthCheck
|
||||
from boto.ec2.elb.attributes import AccessLogAttribute
|
||||
from boto.ec2.elb.attributes import ConnectionDrainingAttribute
|
||||
|
|
63
setup.py
63
setup.py
|
@ -316,6 +316,11 @@ if WITH_SETUPTOOLS:
|
|||
self.run_command('install-pycrypto-windows')
|
||||
self.distribution.salt_installing_pycrypto_windows = None
|
||||
|
||||
# Install PyYAML
|
||||
self.distribution.salt_installing_pyyaml_windows = True
|
||||
self.run_command('install-pyyaml-windows')
|
||||
self.distribution.salt_installing_pyyaml_windows = None
|
||||
|
||||
# Download the required DLLs
|
||||
self.distribution.salt_download_windows_dlls = True
|
||||
self.run_command('download-windows-dlls')
|
||||
|
@ -389,6 +394,37 @@ class InstallPyCryptoWindowsWheel(Command):
|
|||
call_subprocess(call_arguments)
|
||||
|
||||
|
||||
class InstallCompiledPyYaml(Command):
|
||||
|
||||
description = 'Install PyYAML on Windows'
|
||||
|
||||
def initialize_options(self):
|
||||
pass
|
||||
|
||||
def finalize_options(self):
|
||||
pass
|
||||
|
||||
def run(self):
|
||||
if getattr(self.distribution, 'salt_installing_pyyaml_windows', None) is None:
|
||||
print('This command is not meant to be called on it\'s own')
|
||||
exit(1)
|
||||
import platform
|
||||
from pip.utils import call_subprocess
|
||||
from pip.utils.logging import indent_log
|
||||
platform_bits, _ = platform.architecture()
|
||||
call_arguments = ['easy_install', '-Z']
|
||||
if platform_bits == '64bit':
|
||||
call_arguments.append(
|
||||
'http://repo.saltstack.com/windows/dependencies/64/PyYAML-3.11.win-amd64-py2.7.exe'
|
||||
)
|
||||
else:
|
||||
call_arguments.append(
|
||||
'http://repo.saltstack.com/windows/dependencies/32/PyYAML-3.11.win-amd64-py2.7.exe'
|
||||
)
|
||||
with indent_log():
|
||||
call_subprocess(call_arguments)
|
||||
|
||||
|
||||
class DownloadWindowsDlls(Command):
|
||||
|
||||
description = 'Download required DLL\'s for windows'
|
||||
|
@ -406,14 +442,14 @@ class DownloadWindowsDlls(Command):
|
|||
import platform
|
||||
from pip.utils.logging import indent_log
|
||||
platform_bits, _ = platform.architecture()
|
||||
url = 'https://repo.saltstack.com/windows/dependencies/{bits}/{fname}32.dll'
|
||||
dest = os.path.join(os.path.dirname(sys.executable), '{fname}32.dll')
|
||||
url = 'http://repo.saltstack.com/windows/dependencies/{bits}/{fname}.dll'
|
||||
dest = os.path.join(os.path.dirname(sys.executable), '{fname}.dll')
|
||||
with indent_log():
|
||||
for fname in ('libeay', 'ssleay'):
|
||||
for fname in ('libeay32', 'ssleay32', 'libsodium', 'msvcr120'):
|
||||
furl = url.format(bits=platform_bits[:2], fname=fname)
|
||||
fdest = dest.format(fname=fname)
|
||||
if not os.path.exists(fdest):
|
||||
log.info('Downloading {0}32.dll to {1} from {2}'.format(fname, fdest, furl))
|
||||
log.info('Downloading {0}.dll to {1} from {2}'.format(fname, fdest, furl))
|
||||
try:
|
||||
import requests
|
||||
from contextlib import closing
|
||||
|
@ -426,7 +462,7 @@ class DownloadWindowsDlls(Command):
|
|||
wfh.flush()
|
||||
else:
|
||||
log.error(
|
||||
'Failed to download {0}32.dll to {1} from {2}'.format(
|
||||
'Failed to download {0}.dll to {1} from {2}'.format(
|
||||
fname, fdest, furl
|
||||
)
|
||||
)
|
||||
|
@ -436,14 +472,14 @@ class DownloadWindowsDlls(Command):
|
|||
if req.getcode() == 200:
|
||||
with open(fdest, 'wb') as wfh:
|
||||
while True:
|
||||
for chunk in req.read(4096):
|
||||
if not chunk:
|
||||
break
|
||||
wfh.write(chunk)
|
||||
wfh.flush()
|
||||
chunk = req.read(4096)
|
||||
if not chunk:
|
||||
break
|
||||
wfh.write(chunk)
|
||||
wfh.flush()
|
||||
else:
|
||||
log.error(
|
||||
'Failed to download {0}32.dll to {1} from {2}'.format(
|
||||
'Failed to download {0}.dll to {1} from {2}'.format(
|
||||
fname, fdest, furl
|
||||
)
|
||||
)
|
||||
|
@ -767,6 +803,10 @@ class Install(install):
|
|||
self.distribution.salt_installing_pycrypto_windows = True
|
||||
self.run_command('install-pycrypto-windows')
|
||||
self.distribution.salt_installing_pycrypto_windows = None
|
||||
# Install PyYAML
|
||||
self.distribution.salt_installing_pyyaml_windows = True
|
||||
self.run_command('install-pyyaml-windows')
|
||||
self.distribution.salt_installing_pyyaml_windows = None
|
||||
# Download the required DLLs
|
||||
self.distribution.salt_download_windows_dlls = True
|
||||
self.run_command('download-windows-dlls')
|
||||
|
@ -899,6 +939,7 @@ class SaltDistribution(distutils.dist.Distribution):
|
|||
'install_lib': InstallLib})
|
||||
if IS_WINDOWS_PLATFORM:
|
||||
self.cmdclass.update({'install-pycrypto-windows': InstallPyCryptoWindowsWheel,
|
||||
'install-pyyaml-windows': InstallCompiledPyYaml,
|
||||
'download-windows-dlls': DownloadWindowsDlls})
|
||||
if __saltstack_version__.info < (2015, 8): # pylint: disable=undefined-variable
|
||||
self.cmdclass.update({'install-m2crypto-windows': InstallM2CryptoWindows})
|
||||
|
|
|
@ -23,6 +23,7 @@ import salt.loader
|
|||
from salt.ext.six.moves import range # pylint: disable=redefined-builtin
|
||||
try:
|
||||
import boto
|
||||
import boto.ec2 # pylint: enable=unused-import
|
||||
HAS_BOTO = True
|
||||
except ImportError:
|
||||
HAS_BOTO = False
|
||||
|
|
|
@ -969,6 +969,7 @@ class FileTestCase(TestCase):
|
|||
# 'comment' function tests: 1
|
||||
|
||||
@destructiveTest
|
||||
@patch.object(os.path, 'exists', MagicMock(return_value=True))
|
||||
def test_comment(self):
|
||||
'''
|
||||
Test to comment out specified lines in a file.
|
||||
|
@ -1027,6 +1028,7 @@ class FileTestCase(TestCase):
|
|||
# 'uncomment' function tests: 1
|
||||
|
||||
@destructiveTest
|
||||
@patch.object(os.path, 'exists', MagicMock(return_value=True))
|
||||
def test_uncomment(self):
|
||||
'''
|
||||
Test to uncomment specified commented lines in a file
|
||||
|
|
Loading…
Add table
Reference in a new issue