Merge pull request #49316 from rallytime/merge-2018.3

[2018.3] Merge forward from 2018.3.3 to 2018.3
This commit is contained in:
Daniel Wallace 2018-08-25 14:53:04 -05:00 committed by GitHub
commit 6b2eba7381
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 174 additions and 29 deletions

View file

@ -6,6 +6,7 @@ cffi==1.11.2
CherryPy==13.0.0
click==6.7
enum34==1.1.6
futures==3.1.1
gitdb==0.6.4
GitPython==2.1.7
idna==2.6

View file

@ -68,11 +68,11 @@ If not Exist "%PyDir%\python.exe" (
)
Set "CurDir=%~dp0"
Set "BldDir=%CurDir%\buildenv"
Set "BinDir=%CurDir%\buildenv\bin"
Set "CnfDir=%CurDir%\buildenv\conf"
Set "InsDir=%CurDir%\installer"
Set "PreDir=%CurDir%\prereqs"
Set "BldDir=%CurDir%buildenv"
Set "BinDir=%CurDir%buildenv\bin"
Set "CnfDir=%CurDir%buildenv\conf"
Set "InsDir=%CurDir%installer"
Set "PreDir=%CurDir%prereqs"
for /f "delims=" %%a in ('git rev-parse --show-toplevel') do @set "SrcDir=%%a"
:: Find the NSIS Installer
@ -113,10 +113,8 @@ xcopy /Q /Y "%SrcDir%\conf\master" "%CnfDir%\"
xcopy /Q /Y "%SrcDir%\conf\minion" "%CnfDir%\"
@echo.
@echo Copying NSSM to buildenv
@echo Copying SSM to buildenv
@echo ----------------------------------------------------------------------
:: Make sure the "prereq" directory exists
If NOT Exist "%PreDir%" mkdir "%PreDir%"
:: Set the location of the ssm to download
Set Url64="https://repo.saltstack.com/windows/dependencies/64/ssm-2.24-103-gdee49fc.exe"
@ -130,12 +128,62 @@ If Defined ProgramFiles(x86) (
)
@echo.
:: Make sure the "prereq" directory exists
If NOT Exist "%PreDir%" mkdir "%PreDir%"
:: Make sure the "prereq" directory exists and is empty
If Exist "%PreDir%" rd /s /q "%PreDir%"
mkdir "%PreDir%"
:: Don't include the vcredist for Py3 installations
If %Python%==3 goto :vcredist_end
:: Skip KB2999226 if on Py3
If %Python%==2 goto get_vcredist
:: For PY 3, include KB2999226
@echo Copying KB2999226 to Prerequisites
@echo ----------------------------------------------------------------------
:: 64 bit binaries required for AMD64 and x86
:: Copy down the 64 bit binaries
set Url60=http://repo.saltstack.com/windows/dependencies/64/ucrt/Windows6.0-KB2999226-x64.msu
set Name60=Windows6.0-KB2999226-x64.msu
set Url61=http://repo.saltstack.com/windows/dependencies/64/ucrt/Windows6.1-KB2999226-x64.msu
set Name61=Windows6.1-KB2999226-x64.msu
set Url80=http://repo.saltstack.com/windows/dependencies/64/ucrt/Windows8-RT-KB2999226-x64.msu
set Name80=Windows8-RT-KB2999226-x64.msu
set Url81=http://repo.saltstack.com/windows/dependencies/64/ucrt/Windows8.1-KB2999226-x64.msu
set Name81=Windows8.1-KB2999226-x64.msu
@echo - Downloading %Name60%
powershell -ExecutionPolicy RemoteSigned -File download_url_file.ps1 -url %Url60% -file "%PreDir%\%Name60%"
@echo - Downloading %Name61%
powershell -ExecutionPolicy RemoteSigned -File download_url_file.ps1 -url %Url61% -file "%PreDir%\%Name61%"
@echo - Downloading %Name80%
powershell -ExecutionPolicy RemoteSigned -File download_url_file.ps1 -url %Url80% -file "%PreDir%\%Name80%"
@echo - Downloading %Name81%
powershell -ExecutionPolicy RemoteSigned -File download_url_file.ps1 -url %Url81% -file "%PreDir%\%Name81%"
:: 32 bit binaries only needed for x86 installer
:: ProgramFiles(x86) is defined on AMD64 systems
:: If it's defined, skip the x86 binaries
If Defined ProgramFiles(x86) goto prereq_end
:: Copy down the 32 bit binaries
set Url60=http://repo.saltstack.com/windows/dependencies/32/ucrt/Windows6.0-KB2999226-x86.msu
set Name60=Windows6.0-KB2999226-x86.msu
set Url61=http://repo.saltstack.com/windows/dependencies/32/ucrt/Windows6.1-KB2999226-x86.msu
set Name61=Windows6.1-KB2999226-x86.msu
set Url80=http://repo.saltstack.com/windows/dependencies/32/ucrt/Windows8-RT-KB2999226-x86.msu
set Name80=Windows8-RT-KB2999226-x86.msu
set Url81=http://repo.saltstack.com/windows/dependencies/32/ucrt/Windows8.1-KB2999226-x86.msu
set Name81=Windows8.1-KB2999226-x86.msu
@echo - Downloading %Name60%
powershell -ExecutionPolicy RemoteSigned -File download_url_file.ps1 -url %Url60% -file "%PreDir%\%Name60%"
@echo - Downloading %Name61%
powershell -ExecutionPolicy RemoteSigned -File download_url_file.ps1 -url %Url61% -file "%PreDir%\%Name61%"
@echo - Downloading %Name80%
powershell -ExecutionPolicy RemoteSigned -File download_url_file.ps1 -url %Url80% -file "%PreDir%\%Name80%"
@echo - Downloading %Name81%
powershell -ExecutionPolicy RemoteSigned -File download_url_file.ps1 -url %Url81% -file "%PreDir%\%Name81%"
goto prereq_end
:: For PY 2, include VCRedist
:get_vcredist
@echo Copying VCRedist to Prerequisites
@echo ----------------------------------------------------------------------
@ -151,7 +199,7 @@ If Defined ProgramFiles(x86) (
)
@echo.
:vcredist_end
:prereq_end
:: Remove the fixed path in .exe files
@echo Removing fixed path from .exe files

View file

@ -404,15 +404,117 @@ InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
ShowInstDetails show
ShowUnInstDetails show
Section -copy_prereqs
# Copy prereqs to the Plugins Directory
# These files will be vcredist 2008 and KB2999226 for Win8.1 and below
# These files are downloaded by build_pkg.bat
# This directory gets removed upon completion
SetOutPath "$PLUGINSDIR\"
File /r "..\prereqs\"
SectionEnd
# Check and install the Windows 10 Universal C Runtime (KB2999226)
# ucrt is needed on Windows 8.1 and lower
# They are installed as a Microsoft Update package (.msu)
# ucrt for Windows 8.1 RT is only available via Windows Update
Section -install_ucrt
Var /GLOBAL MsuPrefix
Var /GLOBAL MsuFileName
# UCRT only needs to be installed for Python 3
StrCmp ${PYTHON_VERSION} 2 lbl_done
# Get the Major.Minor version Number
# Windows 10 introduced CurrentMajorVersionNumber
ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" \
CurrentMajorVersionNumber
# Windows 10/2016 will return a value here, skip to the end if returned
StrCmp $R0 '' lbl_needs_ucrt 0
# Found Windows 10
detailPrint "KB2999226 does not apply to this machine"
goto lbl_done
lbl_needs_ucrt:
# UCRT only needed on Windows Server 2012R2/Windows 8.1 and below
# The first ReadRegStr command above should have skipped to lbl_done if on
# Windows 10 box
# Is the update already installed
ClearErrors
# Use WMI to check if it's installed
detailPrint "Checking for existing KB2999226 installation"
nsExec::ExecToStack 'cmd /q /c wmic qfe get hotfixid | findstr "^KB2999226"'
# Clean up the stack
Pop $R0 # Gets the ErrorCode
Pop $R1 # Gets the stdout, which should be KB2999226 if it's installed
# If it returned KB2999226 it's already installed
StrCmp $R1 'KB2999226' lbl_done
detailPrint "KB2999226 not found"
# All lower versions of Windows
ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" \
CurrentVersion
# Get the name of the .msu file based on the value of $R0
${Switch} "$R0"
${Case} "6.3"
StrCpy $MsuPrefix "Windows8.1"
${break}
${Case} "6.2"
StrCpy $MsuPrefix "Windows8-RT"
${break}
${Case} "6.1"
StrCpy $MsuPrefix "Windows6.1"
${break}
${Case} "6.0"
StrCpy $MsuPrefix "Windows6.0"
${break}
${EndSwitch}
# Use RunningX64 here to get the Architecture for the system running the installer
# CPUARCH is defined when the installer is built and is based on the machine that
# built the installer, not the target system as we need here.
${If} ${RunningX64}
StrCpy $MsuFileName "$MsuPrefix-KB2999226-x64.msu"
${Else}
StrCpy $MsuFileName "$MsuPrefix-KB2999226-x86.msu"
${EndIf}
ClearErrors
detailPrint "Installing KB2999226 using file $MsuFileName"
nsExec::ExecToStack 'cmd /c wusa "$PLUGINSDIR\$MsuFileName" /quiet /norestart'
# Clean up the stack
Pop $R0 # Get Error
Pop $R1 # Get stdout
${IfNot} $R0 == 0
detailPrint "error: $R0"
detailPrint "output: $R2"
Sleep 3000
${Else}
detailPrint "KB2999226 installed successfully"
${EndIf}
lbl_done:
SectionEnd
# Check and install Visual C++ redist packages
# See http://blogs.msdn.com/b/astebner/archive/2009/01/29/9384143.aspx for more info
Section -Prerequisites
# Hidden section (-) to install VCRedist
Section -install_vcredist
Var /GLOBAL VcRedistName
Var /GLOBAL VcRedistGuid
Var /GLOBAL NeedVcRedist
Var /Global CheckVcRedist
Var /GLOBAL CheckVcRedist
StrCpy $CheckVcRedist "False"
# Visual C++ 2008 SP1 MFC Security Update redist packages
@ -446,19 +548,13 @@ Section -Prerequisites
"$VcRedistName is currently not installed. Would you like to install?" \
/SD IDYES IDNO endVcRedist
# The Correct version of VCRedist is copied over by "build_pkg.bat"
SetOutPath "$INSTDIR\"
File "..\prereqs\vcredist.exe"
# If an output variable is specified ($0 in the case below),
# ExecWait sets the variable with the exit code (and only sets the
# error flag if an error occurs; if an error occurs, the contents
# of the user variable are undefined).
# http://nsis.sourceforge.net/Reference/ExecWait
# /passive used by 2015 installer
# /qb! used by 2008 installer
# It just ignores the unrecognized switches...
ClearErrors
ExecWait '"$INSTDIR\vcredist.exe" /qb! /quiet /norestart' $0
ExecWait '"$PLUGINSDIR\vcredist.exe" /q' $0
IfErrors 0 CheckVcRedistErrorCode
MessageBox MB_OK \
"$VcRedistName failed to install. Try installing the package manually." \
@ -658,8 +754,6 @@ Section -Post
Push "C:\salt"
Call AddToPath
Delete "$INSTDIR\vcredist.exe"
SectionEnd

View file

@ -339,7 +339,7 @@ __usage() {
with -c and -k
-C Only run the configuration function. Implies -F (forced overwrite).
To overwrite Master or Syndic configs, -M or -S, respectively, must
also be specified. Salt installation will be omitted, but some of the
also be specified. Salt installation will be ommitted, but some of the
dependencies could be installed to write configuration with -j or -J.
-A Pass the salt-master DNS name or IP. This will be stored under
\${BS_SALT_ETC_DIR}/minion.d/99-master-address.conf

View file

@ -2948,9 +2948,9 @@ class SyndicManager(MinionBase):
if auth_wait < self.max_auth_wait:
auth_wait += self.auth_wait
yield tornado.gen.sleep(auth_wait) # TODO: log?
except KeyboardInterrupt:
except (KeyboardInterrupt, SystemExit):
raise
except: # pylint: disable=W0702
except Exception:
failed = True
log.critical(
'Unexpected error while connecting to %s',

View file

@ -742,6 +742,7 @@ class TestDaemon(object):
master_opts['config_dir'] = RUNTIME_VARS.TMP_CONF_DIR
master_opts['root_dir'] = os.path.join(TMP, 'rootdir')
master_opts['pki_dir'] = os.path.join(TMP, 'rootdir', 'pki', 'master')
master_opts['syndic_master'] = 'localhost'
# This is the syndic for master
# Let's start with a copy of the syndic master configuration

View file

@ -12,6 +12,7 @@ import yaml
from salt.config import cloud_providers_config
import salt.utils.cloud
import salt.utils.files
import salt.utils.yaml
# Import Salt Testing Libs
from tests.support.case import ShellCase
@ -121,7 +122,7 @@ class EC2Test(ShellCase):
conf = yaml.safe_load(fp)
conf[name].update(data)
with salt.utils.files.fopen(conf_path, 'w') as fp:
yaml.dump(conf, fp)
salt.utils.yaml.safe_dump(conf, fp)
def copy_file(self, name):
'''

View file

@ -31,12 +31,12 @@ class ShadowModuleTest(ModuleCase):
super(self.__class__, self).__init__(arg)
self._test_user = self.__random_string()
self._no_user = self.__random_string()
self._password = self.run_function('shadow.gen_password', ['Password1234'])
def setUp(self):
'''
Get current settings
'''
self._password = self.run_function('shadow.gen_password', ['Password1234'])
if 'ERROR' in self._password:
self.fail('Failed to generate password: {0}'.format(self._password))
super(ShadowModuleTest, self).setUp()