mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge branch 'master' into issue56167
This commit is contained in:
commit
65b3f4c9a0
30 changed files with 3539 additions and 953 deletions
14
CHANGELOG.md
14
CHANGELOG.md
|
@ -6,7 +6,19 @@ This changelog follows [keepachangelog](https://keepachangelog.com/en/1.0.0/) fo
|
|||
This project versioning is _similar_ to [Semantic Versioning](https://semver.org), and is documented in [SEP 14](https://github.com/saltstack/salt-enhancement-proposals/pull/20/files).
|
||||
Versions are `MAJOR.PATCH`.
|
||||
|
||||
## Unreleased (Neon)
|
||||
### Unreleased (3000.1)
|
||||
|
||||
### Removed
|
||||
|
||||
### Deprecated
|
||||
|
||||
### Changed
|
||||
|
||||
### Fixed
|
||||
|
||||
### Added
|
||||
|
||||
## 3000 - Neon [2020-02-10]
|
||||
|
||||
### Removed
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
.\" Man page generated from reStructuredText.
|
||||
.
|
||||
.TH "SALT-API" "1" "Jan 15, 2020" "3000" "Salt"
|
||||
.TH "SALT-API" "1" "Mar 10, 2020" "3000.1" "Salt"
|
||||
.SH NAME
|
||||
salt-api \- salt-api Command
|
||||
.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
.\" Man page generated from reStructuredText.
|
||||
.
|
||||
.TH "SALT-CALL" "1" "Jan 15, 2020" "3000" "Salt"
|
||||
.TH "SALT-CALL" "1" "Mar 10, 2020" "3000.1" "Salt"
|
||||
.SH NAME
|
||||
salt-call \- salt-call Documentation
|
||||
.
|
||||
|
@ -198,17 +198,6 @@ Some outputters are formatted only for data returned from specific functions.
|
|||
If an outputter is used that does not support the data passed into it, then
|
||||
Salt will fall back on the \fBpprint\fP outputter and display the return data
|
||||
using the Python \fBpprint\fP standard library module.
|
||||
.sp
|
||||
\fBNOTE:\fP
|
||||
.INDENT 7.0
|
||||
.INDENT 3.5
|
||||
If using \fB\-\-out=json\fP, you will probably want \fB\-\-static\fP as well.
|
||||
Without the static option, you will get a separate JSON string per minion
|
||||
which makes JSON output invalid as a whole.
|
||||
This is due to using an iterative outputter. So if you want to feed it
|
||||
to a JSON parser, use \fB\-\-static\fP as well.
|
||||
.UNINDENT
|
||||
.UNINDENT
|
||||
.UNINDENT
|
||||
.INDENT 0.0
|
||||
.TP
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
.\" Man page generated from reStructuredText.
|
||||
.
|
||||
.TH "SALT-CLOUD" "1" "Jan 15, 2020" "3000" "Salt"
|
||||
.TH "SALT-CLOUD" "1" "Mar 10, 2020" "3000.1" "Salt"
|
||||
.SH NAME
|
||||
salt-cloud \- Salt Cloud Command
|
||||
.
|
||||
|
@ -247,17 +247,6 @@ Some outputters are formatted only for data returned from specific functions.
|
|||
If an outputter is used that does not support the data passed into it, then
|
||||
Salt will fall back on the \fBpprint\fP outputter and display the return data
|
||||
using the Python \fBpprint\fP standard library module.
|
||||
.sp
|
||||
\fBNOTE:\fP
|
||||
.INDENT 7.0
|
||||
.INDENT 3.5
|
||||
If using \fB\-\-out=json\fP, you will probably want \fB\-\-static\fP as well.
|
||||
Without the static option, you will get a separate JSON string per minion
|
||||
which makes JSON output invalid as a whole.
|
||||
This is due to using an iterative outputter. So if you want to feed it
|
||||
to a JSON parser, use \fB\-\-static\fP as well.
|
||||
.UNINDENT
|
||||
.UNINDENT
|
||||
.UNINDENT
|
||||
.INDENT 0.0
|
||||
.TP
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
.\" Man page generated from reStructuredText.
|
||||
.
|
||||
.TH "SALT-CP" "1" "Jan 15, 2020" "3000" "Salt"
|
||||
.TH "SALT-CP" "1" "Mar 10, 2020" "3000.1" "Salt"
|
||||
.SH NAME
|
||||
salt-cp \- salt-cp Documentation
|
||||
.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
.\" Man page generated from reStructuredText.
|
||||
.
|
||||
.TH "SALT-KEY" "1" "Jan 15, 2020" "3000" "Salt"
|
||||
.TH "SALT-KEY" "1" "Mar 10, 2020" "3000.1" "Salt"
|
||||
.SH NAME
|
||||
salt-key \- salt-key Documentation
|
||||
.
|
||||
|
@ -153,17 +153,6 @@ Some outputters are formatted only for data returned from specific functions.
|
|||
If an outputter is used that does not support the data passed into it, then
|
||||
Salt will fall back on the \fBpprint\fP outputter and display the return data
|
||||
using the Python \fBpprint\fP standard library module.
|
||||
.sp
|
||||
\fBNOTE:\fP
|
||||
.INDENT 7.0
|
||||
.INDENT 3.5
|
||||
If using \fB\-\-out=json\fP, you will probably want \fB\-\-static\fP as well.
|
||||
Without the static option, you will get a separate JSON string per minion
|
||||
which makes JSON output invalid as a whole.
|
||||
This is due to using an iterative outputter. So if you want to feed it
|
||||
to a JSON parser, use \fB\-\-static\fP as well.
|
||||
.UNINDENT
|
||||
.UNINDENT
|
||||
.UNINDENT
|
||||
.INDENT 0.0
|
||||
.TP
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
.\" Man page generated from reStructuredText.
|
||||
.
|
||||
.TH "SALT-MASTER" "1" "Jan 15, 2020" "3000" "Salt"
|
||||
.TH "SALT-MASTER" "1" "Mar 10, 2020" "3000.1" "Salt"
|
||||
.SH NAME
|
||||
salt-master \- salt-master Documentation
|
||||
.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
.\" Man page generated from reStructuredText.
|
||||
.
|
||||
.TH "SALT-MINION" "1" "Jan 15, 2020" "3000" "Salt"
|
||||
.TH "SALT-MINION" "1" "Mar 10, 2020" "3000.1" "Salt"
|
||||
.SH NAME
|
||||
salt-minion \- salt-minion Documentation
|
||||
.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
.\" Man page generated from reStructuredText.
|
||||
.
|
||||
.TH "SALT-PROXY" "1" "Jan 15, 2020" "3000" "Salt"
|
||||
.TH "SALT-PROXY" "1" "Mar 10, 2020" "3000.1" "Salt"
|
||||
.SH NAME
|
||||
salt-proxy \- salt-proxy Documentation
|
||||
.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
.\" Man page generated from reStructuredText.
|
||||
.
|
||||
.TH "SALT-RUN" "1" "Jan 15, 2020" "3000" "Salt"
|
||||
.TH "SALT-RUN" "1" "Mar 10, 2020" "3000.1" "Salt"
|
||||
.SH NAME
|
||||
salt-run \- salt-run Documentation
|
||||
.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
.\" Man page generated from reStructuredText.
|
||||
.
|
||||
.TH "SALT-SSH" "1" "Jan 15, 2020" "3000" "Salt"
|
||||
.TH "SALT-SSH" "1" "Mar 10, 2020" "3000.1" "Salt"
|
||||
.SH NAME
|
||||
salt-ssh \- salt-ssh Documentation
|
||||
.
|
||||
|
@ -286,17 +286,6 @@ Some outputters are formatted only for data returned from specific functions.
|
|||
If an outputter is used that does not support the data passed into it, then
|
||||
Salt will fall back on the \fBpprint\fP outputter and display the return data
|
||||
using the Python \fBpprint\fP standard library module.
|
||||
.sp
|
||||
\fBNOTE:\fP
|
||||
.INDENT 7.0
|
||||
.INDENT 3.5
|
||||
If using \fB\-\-out=json\fP, you will probably want \fB\-\-static\fP as well.
|
||||
Without the static option, you will get a separate JSON string per minion
|
||||
which makes JSON output invalid as a whole.
|
||||
This is due to using an iterative outputter. So if you want to feed it
|
||||
to a JSON parser, use \fB\-\-static\fP as well.
|
||||
.UNINDENT
|
||||
.UNINDENT
|
||||
.UNINDENT
|
||||
.INDENT 0.0
|
||||
.TP
|
||||
|
@ -348,6 +337,17 @@ output. One of \(aqfull\(aq, \(aqterse\(aq, \(aqmixed\(aq, \(aqchanges\(aq or
|
|||
Override the configured state_verbose value for minion
|
||||
output. Set to True or False. Default: none.
|
||||
.UNINDENT
|
||||
.sp
|
||||
\fBNOTE:\fP
|
||||
.INDENT 0.0
|
||||
.INDENT 3.5
|
||||
If using \fB\-\-out=json\fP, you will probably want \fB\-\-static\fP as well.
|
||||
Without the static option, you will get a separate JSON string per minion
|
||||
which makes JSON output invalid as a whole.
|
||||
This is due to using an iterative outputter. So if you want to feed it
|
||||
to a JSON parser, use \fB\-\-static\fP as well.
|
||||
.UNINDENT
|
||||
.UNINDENT
|
||||
.SH SEE ALSO
|
||||
.sp
|
||||
\fBsalt(7)\fP
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
.\" Man page generated from reStructuredText.
|
||||
.
|
||||
.TH "SALT-SYNDIC" "1" "Jan 15, 2020" "3000" "Salt"
|
||||
.TH "SALT-SYNDIC" "1" "Mar 10, 2020" "3000.1" "Salt"
|
||||
.SH NAME
|
||||
salt-syndic \- salt-syndic Documentation
|
||||
.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
.\" Man page generated from reStructuredText.
|
||||
.
|
||||
.TH "SALT-UNITY" "1" "Jan 15, 2020" "3000" "Salt"
|
||||
.TH "SALT-UNITY" "1" "Mar 10, 2020" "3000.1" "Salt"
|
||||
.SH NAME
|
||||
salt-unity \- salt-unity Command
|
||||
.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
.\" Man page generated from reStructuredText.
|
||||
.
|
||||
.TH "SALT" "1" "Jan 15, 2020" "3000" "Salt"
|
||||
.TH "SALT" "1" "Mar 10, 2020" "3000.1" "Salt"
|
||||
.SH NAME
|
||||
salt \- salt
|
||||
.
|
||||
|
@ -267,17 +267,6 @@ Some outputters are formatted only for data returned from specific functions.
|
|||
If an outputter is used that does not support the data passed into it, then
|
||||
Salt will fall back on the \fBpprint\fP outputter and display the return data
|
||||
using the Python \fBpprint\fP standard library module.
|
||||
.sp
|
||||
\fBNOTE:\fP
|
||||
.INDENT 7.0
|
||||
.INDENT 3.5
|
||||
If using \fB\-\-out=json\fP, you will probably want \fB\-\-static\fP as well.
|
||||
Without the static option, you will get a separate JSON string per minion
|
||||
which makes JSON output invalid as a whole.
|
||||
This is due to using an iterative outputter. So if you want to feed it
|
||||
to a JSON parser, use \fB\-\-static\fP as well.
|
||||
.UNINDENT
|
||||
.UNINDENT
|
||||
.UNINDENT
|
||||
.INDENT 0.0
|
||||
.TP
|
||||
|
@ -329,6 +318,17 @@ output. One of \(aqfull\(aq, \(aqterse\(aq, \(aqmixed\(aq, \(aqchanges\(aq or
|
|||
Override the configured state_verbose value for minion
|
||||
output. Set to True or False. Default: none.
|
||||
.UNINDENT
|
||||
.sp
|
||||
\fBNOTE:\fP
|
||||
.INDENT 0.0
|
||||
.INDENT 3.5
|
||||
If using \fB\-\-out=json\fP, you will probably want \fB\-\-static\fP as well.
|
||||
Without the static option, you will get a separate JSON string per minion
|
||||
which makes JSON output invalid as a whole.
|
||||
This is due to using an iterative outputter. So if you want to feed it
|
||||
to a JSON parser, use \fB\-\-static\fP as well.
|
||||
.UNINDENT
|
||||
.UNINDENT
|
||||
.SH SEE ALSO
|
||||
.sp
|
||||
\fBsalt(7)\fP
|
||||
|
|
4084
doc/man/salt.7
4084
doc/man/salt.7
File diff suppressed because it is too large
Load diff
|
@ -1,6 +1,6 @@
|
|||
.\" Man page generated from reStructuredText.
|
||||
.
|
||||
.TH "SPM" "1" "Jan 15, 2020" "3000" "Salt"
|
||||
.TH "SPM" "1" "Mar 10, 2020" "3000.1" "Salt"
|
||||
.SH NAME
|
||||
spm \- Salt Package Manager Command
|
||||
.
|
||||
|
|
|
@ -221,31 +221,32 @@ If ($NoPipDependencies -eq $false) {
|
|||
Start_Process_and_test_exitcode "cmd" "/c $($ini['Settings']['Python2Dir'])\python.exe -m pip --disable-pip-version-check --no-cache-dir install -r $($script_path)\req.txt" "pip install"
|
||||
}
|
||||
|
||||
|
||||
#==============================================================================
|
||||
# Cleaning Up PyWin32
|
||||
#==============================================================================
|
||||
Write-Output " ----------------------------------------------------------------"
|
||||
Write-Output " - $script_name :: Cleaning Up PyWin32 . . ."
|
||||
Write-Output " ----------------------------------------------------------------"
|
||||
If ( Test-Path "$($ini['Settings']['SitePkgs2Dir'])\pywin32_system32" -PathType Container ) {
|
||||
Write-Output " ----------------------------------------------------------------"
|
||||
Write-Output " - $script_name :: Cleaning Up PyWin32 . . ."
|
||||
Write-Output " ----------------------------------------------------------------"
|
||||
|
||||
# Move DLL's to Python Root
|
||||
Write-Output " - $script_name :: Moving PyWin32 DLLs . . ."
|
||||
# The dlls have to be in Python directory and the site-packages\win32 directory
|
||||
Copy-Item "$($ini['Settings']['SitePkgs2Dir'])\pywin32_system32\*.dll" "$($ini['Settings']['Python2Dir'])" -Force
|
||||
Move-Item "$($ini['Settings']['SitePkgs2Dir'])\pywin32_system32\*.dll" "$($ini['Settings']['SitePkgs2Dir'])\win32" -Force
|
||||
# Move DLL's to Python Root
|
||||
Write-Output " - $script_name :: Moving PyWin32 DLLs . . ."
|
||||
# The dlls have to be in Python directory and the site-packages\win32 directory
|
||||
Copy-Item "$( $ini['Settings']['SitePkgs2Dir'] )\pywin32_system32\*.dll" "$( $ini['Settings']['Python2Dir'] )" -Force
|
||||
Move-Item "$( $ini['Settings']['SitePkgs2Dir'] )\pywin32_system32\*.dll" "$( $ini['Settings']['SitePkgs2Dir'] )\win32" -Force
|
||||
|
||||
# Create gen_py directory
|
||||
Write-Output " - $script_name :: Creating gen_py Directory . . ."
|
||||
New-Item -Path "$($ini['Settings']['SitePkgs2Dir'])\win32com\gen_py" -ItemType Directory -Force | Out-Null
|
||||
# Create gen_py directory
|
||||
Write-Output " - $script_name :: Creating gen_py Directory . . ."
|
||||
New-Item -Path "$( $ini['Settings']['SitePkgs2Dir'] )\win32com\gen_py" -ItemType Directory -Force | Out-Null
|
||||
|
||||
# Remove pywin32_system32 directory
|
||||
Write-Output " - $script_name :: Removing pywin32_system32 Directory . . ."
|
||||
Remove-Item "$($ini['Settings']['SitePkgs2Dir'])\pywin32_system32"
|
||||
# Remove pywin32_system32 directory
|
||||
Write-Output " - $script_name :: Removing pywin32_system32 Directory . . ."
|
||||
Remove-Item "$( $ini['Settings']['SitePkgs2Dir'] )\pywin32_system32"
|
||||
|
||||
# Remove PyWin32 PostInstall and testall Scripts
|
||||
Write-Output " - $script_name :: Removing PyWin32 scripts . . ."
|
||||
Remove-Item "$($ini['Settings']['Scripts2Dir'])\pywin32_*" -Force -Recurse
|
||||
# Remove PyWin32 PostInstall and testall Scripts
|
||||
Write-Output " - $script_name :: Removing PyWin32 scripts . . ."
|
||||
Remove-Item "$( $ini['Settings']['Scripts2Dir'] )\pywin32_*" -Force -Recurse
|
||||
}
|
||||
|
||||
#==============================================================================
|
||||
# Copy DLLs to Python Directory
|
||||
|
|
|
@ -223,37 +223,28 @@ If ($NoPipDependencies -eq $false) {
|
|||
#==============================================================================
|
||||
# Cleaning Up PyWin32
|
||||
#==============================================================================
|
||||
Write-Output " ----------------------------------------------------------------"
|
||||
Write-Output " - $script_name :: Cleaning Up PyWin32 . . ."
|
||||
Write-Output " ----------------------------------------------------------------"
|
||||
If (Test-Path "$($ini['Settings']['SitePkgs3Dir'])\pywin32_system32" -PathType Container ) {
|
||||
Write-Output " ----------------------------------------------------------------"
|
||||
Write-Output " - $script_name :: Cleaning Up PyWin32 . . ."
|
||||
Write-Output " ----------------------------------------------------------------"
|
||||
|
||||
# Move DLL's to Python Root
|
||||
# The dlls have to be in Python directory and the site-packages\win32 directory
|
||||
Write-Output " - $script_name :: Moving PyWin32 DLLs . . ."
|
||||
Copy-Item "$($ini['Settings']['SitePkgs3Dir'])\pywin32_system32\*.dll" "$($ini['Settings']['Python3Dir'])" -Force
|
||||
Move-Item "$($ini['Settings']['SitePkgs3Dir'])\pywin32_system32\*.dll" "$($ini['Settings']['SitePkgs3Dir'])\win32" -Force
|
||||
# Move DLL's to Python Root
|
||||
# The dlls have to be in Python directory and the site-packages\win32 directory
|
||||
Write-Output " - $script_name :: Moving PyWin32 DLLs . . ."
|
||||
Copy-Item "$( $ini['Settings']['SitePkgs3Dir'] )\pywin32_system32\*.dll" "$( $ini['Settings']['Python3Dir'] )" -Force
|
||||
Move-Item "$( $ini['Settings']['SitePkgs3Dir'] )\pywin32_system32\*.dll" "$( $ini['Settings']['SitePkgs3Dir'] )\win32" -Force
|
||||
|
||||
# Create gen_py directory
|
||||
Write-Output " - $script_name :: Creating gen_py Directory . . ."
|
||||
New-Item -Path "$($ini['Settings']['SitePkgs3Dir'])\win32com\gen_py" -ItemType Directory -Force | Out-Null
|
||||
# Create gen_py directory
|
||||
Write-Output " - $script_name :: Creating gen_py Directory . . ."
|
||||
New-Item -Path "$( $ini['Settings']['SitePkgs3Dir'] )\win32com\gen_py" -ItemType Directory -Force | Out-Null
|
||||
|
||||
# Remove pywin32_system32 directory
|
||||
Write-Output " - $script_name :: Removing pywin32_system32 Directory . . ."
|
||||
Remove-Item "$($ini['Settings']['SitePkgs3Dir'])\pywin32_system32"
|
||||
# Remove pywin32_system32 directory
|
||||
Write-Output " - $script_name :: Removing pywin32_system32 Directory . . ."
|
||||
Remove-Item "$( $ini['Settings']['SitePkgs3Dir'] )\pywin32_system32"
|
||||
|
||||
# Remove PyWin32 PostInstall and testall Scripts
|
||||
Write-Output " - $script_name :: Removing PyWin32 scripts . . ."
|
||||
Remove-Item "$($ini['Settings']['Scripts3Dir'])\pywin32_*" -Force -Recurse
|
||||
|
||||
#==============================================================================
|
||||
# Fix PyCrypto
|
||||
#==============================================================================
|
||||
If ($NoPipDependencies -eq $false) {
|
||||
Write-Output " ----------------------------------------------------------------"
|
||||
Write-Output " - $script_name :: Fixing PyCrypto . . ."
|
||||
Write-Output " ----------------------------------------------------------------"
|
||||
$nt_file = "$($ini['Settings']['Python3Dir'])\Lib\site-packages\Crypto\Random\OSRNG\nt.py"
|
||||
(Get-Content $nt_file) | Foreach-Object {$_ -replace '^import winrandom$', 'from Crypto.Random.OSRNG import winrandom'} | Set-Content $nt_file
|
||||
# Remove PyWin32 PostInstall and testall Scripts
|
||||
Write-Output " - $script_name :: Removing PyWin32 scripts . . ."
|
||||
Remove-Item "$( $ini['Settings']['Scripts3Dir'] )\pywin32_*" -Force -Recurse
|
||||
}
|
||||
|
||||
#==============================================================================
|
||||
|
|
|
@ -15,7 +15,7 @@ Function Start_Process_and_test_exitcode {
|
|||
Begin { Write-Host "Executing Command: $fun $args" }
|
||||
|
||||
Process {
|
||||
$p = Start-Process "$fun" -ArgumentList "$args" -Wait -PassThru
|
||||
$p = Start-Process "$fun" -ArgumentList "$args" -Wait -NoNewWindow -PassThru
|
||||
If ($p.ExitCode -ne 0) {
|
||||
Write-Error "$descr returned exitcode $p.ExitCode."
|
||||
exit $p.ExitCode
|
||||
|
|
|
@ -344,7 +344,7 @@ def _run(cmd,
|
|||
# The last item in the list [-1] is the current method.
|
||||
# The third item[2] in each tuple is the name of that method.
|
||||
if stack[-2][2] == 'script':
|
||||
cmd = 'Powershell -NonInteractive -NoProfile -ExecutionPolicy Bypass -File ' + cmd
|
||||
cmd = 'Powershell -NonInteractive -NoProfile -ExecutionPolicy Bypass {0}'.format(cmd.replace('"', '\\"'))
|
||||
elif encoded_cmd:
|
||||
cmd = 'Powershell -NonInteractive -EncodedCommand {0}'.format(cmd)
|
||||
else:
|
||||
|
|
|
@ -11,6 +11,7 @@ Manage accounts in Samba's passdb using pdbedit
|
|||
from __future__ import absolute_import, print_function, unicode_literals
|
||||
|
||||
# Import Python libs
|
||||
import re
|
||||
import logging
|
||||
import hashlib
|
||||
import binascii
|
||||
|
@ -22,6 +23,7 @@ except ImportError:
|
|||
# Import Salt libs
|
||||
from salt.ext import six
|
||||
import salt.utils.path
|
||||
import salt.modules.cmdmod
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
@ -39,14 +41,21 @@ def __virtual__():
|
|||
'''
|
||||
Provides pdbedit if available
|
||||
'''
|
||||
if salt.utils.path.which('pdbedit'):
|
||||
return __virtualname__
|
||||
return (
|
||||
False,
|
||||
'{0} module can only be loaded when pdbedit is available'.format(
|
||||
__virtualname__
|
||||
)
|
||||
)
|
||||
# NOTE: check for pdbedit command
|
||||
if not salt.utils.path.which('pdbedit'):
|
||||
return (False, 'pdbedit command is not available')
|
||||
|
||||
# NOTE: check version is >= 4.8.x
|
||||
ver = salt.modules.cmdmod.run('pdbedit -V')
|
||||
ver_regex = re.compile(r'^Version\s(\d+)\.(\d+)\.(\d+)$')
|
||||
ver_match = ver_regex.match(ver)
|
||||
if not ver_match:
|
||||
return (False, 'pdbedit -V returned an unknown version format')
|
||||
|
||||
if not (int(ver_match.group(1)) >= 4 and int(ver_match.group(2)) >= 8):
|
||||
return (False, 'pdbedit is to old, 4.8.0 or newer is required')
|
||||
|
||||
return __virtualname__
|
||||
|
||||
|
||||
def generate_nt_hash(password):
|
||||
|
|
|
@ -246,6 +246,11 @@ def _parse_vmconfig(config, instances):
|
|||
## some property are lowercase
|
||||
if 'mac' in instance_config:
|
||||
instance_config['mac'] = instance_config['mac'].lower()
|
||||
## calculate mac from vrrp_vrid
|
||||
if 'vrrp_vrid' in instance_config:
|
||||
instance_config['mac'] = "00:00:5e:00:01:{0}".format(
|
||||
hex(int(instance_config['vrrp_vrid'])).split('x')[-1].zfill(2),
|
||||
)
|
||||
vmconfig[prop].append(instance_config)
|
||||
else:
|
||||
log.error('smartos.vm_present::parse_vmconfig - failed to parse')
|
||||
|
@ -768,7 +773,8 @@ def vm_present(name, vmconfig, config=None):
|
|||
'instance': {
|
||||
'nics': 'mac',
|
||||
'disks': 'path',
|
||||
'filesystems': 'target'
|
||||
'filesystems': 'target',
|
||||
'pci_devices': 'path',
|
||||
},
|
||||
'create_only': [
|
||||
'filesystems'
|
||||
|
|
|
@ -1019,7 +1019,7 @@ class Schedule(object):
|
|||
|
||||
if when < now - loop_interval and \
|
||||
not data.get('_run', False) and \
|
||||
not data.get('run', False) and \
|
||||
not run and \
|
||||
not data['_splay']:
|
||||
data['_next_fire_time'] = None
|
||||
data['_continue'] = True
|
||||
|
|
31
setup.py
31
setup.py
|
@ -74,8 +74,9 @@ BOOTSTRAP_SCRIPT_DISTRIBUTED_VERSION = os.environ.get(
|
|||
)
|
||||
|
||||
# Store a reference to the executing platform
|
||||
IS_OSX_PLATFORM = sys.platform.startswith('darwin')
|
||||
IS_WINDOWS_PLATFORM = sys.platform.startswith('win')
|
||||
if IS_WINDOWS_PLATFORM:
|
||||
if IS_WINDOWS_PLATFORM or IS_OSX_PLATFORM:
|
||||
IS_SMARTOS_PLATFORM = False
|
||||
else:
|
||||
# os.uname() not available on Windows.
|
||||
|
@ -100,8 +101,15 @@ SALT_SYSPATHS_HARDCODED = os.path.join(os.path.abspath(SETUP_DIRNAME), 'salt', '
|
|||
SALT_REQS = os.path.join(os.path.abspath(SETUP_DIRNAME), 'requirements', 'base.txt')
|
||||
SALT_CRYPTO_REQS = os.path.join(os.path.abspath(SETUP_DIRNAME), 'requirements', 'crypto.txt')
|
||||
SALT_ZEROMQ_REQS = os.path.join(os.path.abspath(SETUP_DIRNAME), 'requirements', 'zeromq.txt')
|
||||
SALT_WINDOWS_REQS = os.path.join(os.path.abspath(SETUP_DIRNAME), 'pkg', 'windows', 'req.txt')
|
||||
SALT_LONG_DESCRIPTION_FILE = os.path.join(os.path.abspath(SETUP_DIRNAME), 'README.rst')
|
||||
SALT_OSX_REQS = [
|
||||
os.path.join(os.path.abspath(SETUP_DIRNAME), 'pkg', 'osx', 'req.txt'),
|
||||
os.path.join(os.path.abspath(SETUP_DIRNAME), 'pkg', 'osx', 'req_ext.txt')
|
||||
]
|
||||
SALT_WINDOWS_REQS = [
|
||||
os.path.join(os.path.abspath(SETUP_DIRNAME), 'pkg', 'windows', 'req.txt'),
|
||||
os.path.join(os.path.abspath(SETUP_DIRNAME), 'pkg', 'windows', 'req_win.txt')
|
||||
]
|
||||
|
||||
# Salt SSH Packaging Detection
|
||||
PACKAGED_FOR_SALT_SSH_FILE = os.path.join(os.path.abspath(SETUP_DIRNAME), '.salt-ssh-package')
|
||||
|
@ -700,8 +708,7 @@ class Install(install):
|
|||
install.finalize_options(self)
|
||||
|
||||
def run(self):
|
||||
from distutils.version import StrictVersion
|
||||
if StrictVersion(setuptools.__version__) < StrictVersion('9.1'):
|
||||
if LooseVersion(setuptools.__version__) < LooseVersion('9.1'):
|
||||
sys.stderr.write(
|
||||
'\n\nInstalling Salt requires setuptools >= 9.1\n'
|
||||
'Available setuptools version is {}\n\n'.format(setuptools.__version__)
|
||||
|
@ -1019,14 +1026,24 @@ class SaltDistribution(distutils.dist.Distribution):
|
|||
|
||||
@property
|
||||
def _property_install_requires(self):
|
||||
|
||||
if IS_OSX_PLATFORM:
|
||||
install_requires = []
|
||||
for reqfile in SALT_OSX_REQS:
|
||||
install_requires += _parse_requirements_file(reqfile)
|
||||
return install_requires
|
||||
|
||||
if IS_WINDOWS_PLATFORM:
|
||||
install_requires = []
|
||||
for reqfile in SALT_WINDOWS_REQS:
|
||||
install_requires += _parse_requirements_file(reqfile)
|
||||
return install_requires
|
||||
|
||||
install_requires = _parse_requirements_file(SALT_REQS)
|
||||
|
||||
if self.salt_transport == 'zeromq':
|
||||
install_requires += _parse_requirements_file(SALT_CRYPTO_REQS)
|
||||
install_requires += _parse_requirements_file(SALT_ZEROMQ_REQS)
|
||||
|
||||
if IS_WINDOWS_PLATFORM:
|
||||
install_requires = _parse_requirements_file(SALT_WINDOWS_REQS)
|
||||
return install_requires
|
||||
|
||||
@property
|
||||
|
|
7
tests/integration/files/file/base/issue-56195/test.ps1
Normal file
7
tests/integration/files/file/base/issue-56195/test.ps1
Normal file
|
@ -0,0 +1,7 @@
|
|||
[CmdLetBinding()]
|
||||
Param(
|
||||
[SecureString] $SecureString
|
||||
)
|
||||
|
||||
$Credential = New-Object System.Net.NetworkCredential("DummyId", $SecureString)
|
||||
$Credential.Password
|
|
@ -491,3 +491,14 @@ class CMDModuleTest(ModuleCase):
|
|||
out = self.run_function('cmd.run', ['set'], env={"abc": "123", "ABC": "456"}).splitlines()
|
||||
self.assertIn('abc=123', out)
|
||||
self.assertIn('ABC=456', out)
|
||||
|
||||
@skipIf(not salt.utils.platform.is_windows(), 'minion is not windows')
|
||||
def test_windows_powershell_script_args(self):
|
||||
'''
|
||||
Ensure that powershell processes inline script in args
|
||||
'''
|
||||
val = 'i like cheese'
|
||||
args = '-SecureString (ConvertTo-SecureString -String "{0}" -AsPlainText -Force) -ErrorAction Stop'.format(val)
|
||||
script = 'salt://issue-56195/test.ps1'
|
||||
ret = self.run_function('cmd.script', [script], args=args, shell='powershell')
|
||||
self.assertEqual(ret['stdout'], val)
|
||||
|
|
|
@ -9,7 +9,12 @@ import os
|
|||
import random
|
||||
import time
|
||||
|
||||
import dateutil.parser as dateutil_parser
|
||||
try:
|
||||
import dateutil.parser as dateutil_parser
|
||||
HAS_DATEUTIL_PARSER = True
|
||||
except ImportError:
|
||||
HAS_DATEUTIL_PARSER = False
|
||||
|
||||
import datetime
|
||||
|
||||
# Import Salt Testing libs
|
||||
|
@ -43,6 +48,7 @@ DEFAULT_CONFIG['pki_dir'] = os.path.join(ROOT_DIR, 'pki')
|
|||
DEFAULT_CONFIG['cachedir'] = os.path.join(ROOT_DIR, 'cache')
|
||||
|
||||
|
||||
@skipIf(HAS_DATEUTIL_PARSER is False, 'The \'dateutil.parser\' library is not available')
|
||||
class SchedulerEvalTest(ModuleCase, SaltReturnAssertsMixin):
|
||||
'''
|
||||
Validate the pkg module
|
||||
|
@ -920,6 +926,7 @@ class SchedulerEvalTest(ModuleCase, SaltReturnAssertsMixin):
|
|||
}
|
||||
run_time1 = dateutil_parser.parse('11/29/2017 4:00pm')
|
||||
run_time2 = run_time1 + datetime.timedelta(seconds=splay)
|
||||
run_time3 = run_time2 + datetime.timedelta(seconds=1)
|
||||
|
||||
# Add the job to the scheduler
|
||||
self.schedule.opts.update(job)
|
||||
|
@ -940,6 +947,13 @@ class SchedulerEvalTest(ModuleCase, SaltReturnAssertsMixin):
|
|||
ret = self.schedule.job_status(job_name)
|
||||
self.assertEqual(ret['_last_run'], run_time2)
|
||||
|
||||
# Evaluate at expected runtime3, should not run
|
||||
# _next_fire_time should be None
|
||||
self.schedule.eval(now=run_time3)
|
||||
ret = self.schedule.job_status(job_name)
|
||||
self.assertEqual(ret['_last_run'], run_time2)
|
||||
self.assertEqual(ret['_next_fire_time'], None)
|
||||
|
||||
def test_eval_when_splay_in_past(self):
|
||||
'''
|
||||
verify that scheduled job runs
|
||||
|
|
|
@ -81,9 +81,10 @@ class VirtualenvTest(ModuleCase, SaltReturnAssertsMixin):
|
|||
' - requirements: salt://issue-2594-requirements.txt',
|
||||
]
|
||||
|
||||
reqs = ['pep8==1.3.3', 'zope.interface==4.7.1']
|
||||
# Let's populate the requirements file, just pep-8 for now
|
||||
with salt.utils.files.fopen(requirements_file_path, 'a') as fhw:
|
||||
fhw.write('pep8==1.3.3\n')
|
||||
fhw.write(reqs[0] + '\n')
|
||||
|
||||
# Let's run our state!!!
|
||||
try:
|
||||
|
@ -94,7 +95,7 @@ class VirtualenvTest(ModuleCase, SaltReturnAssertsMixin):
|
|||
self.assertSaltTrueReturn(ret)
|
||||
self.assertInSaltComment('Created new virtualenv', ret)
|
||||
self.assertSaltStateChangesEqual(
|
||||
ret, ['pep8==1.3.3'], keys=('packages', 'new')
|
||||
ret, [reqs[0]], keys=('packages', 'new')
|
||||
)
|
||||
except AssertionError:
|
||||
# Always clean up the tests temp files
|
||||
|
@ -106,12 +107,12 @@ class VirtualenvTest(ModuleCase, SaltReturnAssertsMixin):
|
|||
|
||||
# Let's make sure, it really got installed
|
||||
ret = self.run_function('pip.freeze', bin_env=venv_path)
|
||||
self.assertIn('pep8==1.3.3', ret)
|
||||
self.assertNotIn('zope.interface==4.0.1', ret)
|
||||
self.assertIn(reqs[0], ret)
|
||||
self.assertNotIn(reqs[1], ret)
|
||||
|
||||
# Now let's update the requirements file, which is now cached.
|
||||
with salt.utils.files.fopen(requirements_file_path, 'w') as fhw:
|
||||
fhw.write('zope.interface==4.0.1\n')
|
||||
fhw.write(reqs[1] + '\n')
|
||||
|
||||
# Let's run our state!!!
|
||||
try:
|
||||
|
@ -122,7 +123,7 @@ class VirtualenvTest(ModuleCase, SaltReturnAssertsMixin):
|
|||
self.assertSaltTrueReturn(ret)
|
||||
self.assertInSaltComment('virtualenv exists', ret)
|
||||
self.assertSaltStateChangesEqual(
|
||||
ret, ['zope.interface==4.0.1'], keys=('packages', 'new')
|
||||
ret, [reqs[1]], keys=('packages', 'new')
|
||||
)
|
||||
except AssertionError:
|
||||
# Always clean up the tests temp files
|
||||
|
@ -134,8 +135,8 @@ class VirtualenvTest(ModuleCase, SaltReturnAssertsMixin):
|
|||
|
||||
# Let's make sure, it really got installed
|
||||
ret = self.run_function('pip.freeze', bin_env=venv_path)
|
||||
self.assertIn('pep8==1.3.3', ret)
|
||||
self.assertIn('zope.interface==4.0.1', ret)
|
||||
self.assertIn(reqs[0], ret)
|
||||
self.assertIn(reqs[1], ret)
|
||||
|
||||
# If we reached this point no assertion failed, so, cleanup!
|
||||
if os.path.exists(venv_path):
|
||||
|
|
|
@ -9,6 +9,10 @@ import salt.modules.pdbedit as pdbedit
|
|||
# Import Salt Testing Libs
|
||||
from tests.support.mixins import LoaderModuleMockMixin
|
||||
from tests.support.unit import TestCase
|
||||
from tests.support.mock import (
|
||||
MagicMock,
|
||||
patch,
|
||||
)
|
||||
|
||||
|
||||
class PdbeditTestCase(TestCase, LoaderModuleMockMixin):
|
||||
|
@ -19,6 +23,44 @@ class PdbeditTestCase(TestCase, LoaderModuleMockMixin):
|
|||
def setup_loader_modules(self):
|
||||
return {pdbedit: {}}
|
||||
|
||||
def test_version(self):
|
||||
'''
|
||||
Test salt.modules.__virtual__'s handling of pdbedit versions
|
||||
'''
|
||||
mock_bad_ver = MagicMock(return_value='Ver 1.1a')
|
||||
mock_old_ver = MagicMock(return_value='Version 1.0.0')
|
||||
mock_exa_ver = MagicMock(return_value='Version 4.8.0')
|
||||
mock_new_ver = MagicMock(return_value='Version 4.9.2')
|
||||
|
||||
# NOTE: no pdbedit installed
|
||||
with patch('salt.utils.path.which', MagicMock(return_value=None)):
|
||||
ret = pdbedit.__virtual__()
|
||||
self.assertEqual(ret, (False, 'pdbedit command is not available'))
|
||||
|
||||
# NOTE: pdbedit is not returning a valid version
|
||||
with patch('salt.utils.path.which', MagicMock(return_value='/opt/local/bin/pdbedit')), \
|
||||
patch('salt.modules.cmdmod.run', mock_bad_ver):
|
||||
ret = pdbedit.__virtual__()
|
||||
self.assertEqual(ret, (False, 'pdbedit -V returned an unknown version format'))
|
||||
|
||||
# NOTE: pdbedit is too old
|
||||
with patch('salt.utils.path.which', MagicMock(return_value='/opt/local/bin/pdbedit')), \
|
||||
patch('salt.modules.cmdmod.run', mock_old_ver):
|
||||
ret = pdbedit.__virtual__()
|
||||
self.assertEqual(ret, (False, 'pdbedit is to old, 4.8.0 or newer is required'))
|
||||
|
||||
# NOTE: pdbedit is exactly 4.8.0
|
||||
with patch('salt.utils.path.which', MagicMock(return_value='/opt/local/bin/pdbedit')), \
|
||||
patch('salt.modules.cmdmod.run', mock_exa_ver):
|
||||
ret = pdbedit.__virtual__()
|
||||
self.assertEqual(ret, 'pdbedit')
|
||||
|
||||
# NOTE: pdbedit is newer than 4.8.0
|
||||
with patch('salt.utils.path.which', MagicMock(return_value='/opt/local/bin/pdbedit')), \
|
||||
patch('salt.modules.cmdmod.run', mock_new_ver):
|
||||
ret = pdbedit.__virtual__()
|
||||
self.assertEqual(ret, 'pdbedit')
|
||||
|
||||
def test_generate_nt_hash(self):
|
||||
'''
|
||||
Test salt.modules.pdbedit.generate_nt_hash
|
||||
|
|
|
@ -5,6 +5,7 @@ from __future__ import absolute_import, print_function, unicode_literals
|
|||
|
||||
# Import Salt Libs
|
||||
import salt.states.smartos as smartos
|
||||
from salt.utils.odict import OrderedDict
|
||||
|
||||
# Import Salt Testing Libs
|
||||
from tests.support.mixins import LoaderModuleMockMixin
|
||||
|
@ -34,3 +35,46 @@ class SmartOsTestCase(TestCase, LoaderModuleMockMixin):
|
|||
ret = smartos.config_present(name=name, value=value)
|
||||
assert not ret['result']
|
||||
assert ret['comment'] == 'Could not add property {0} with value "{1}" to config'.format(name, value)
|
||||
|
||||
def test_parse_vmconfig_vrrp(self):
|
||||
'''
|
||||
Test _parse_vmconfig's vrid -> mac convertor
|
||||
|
||||
SmartOS will always use a mac based on the vrrp_vrid,
|
||||
so we will replace the provided mac with the one based
|
||||
on this value.
|
||||
|
||||
Doing so ensures that 'old' nics are removed and 'new'
|
||||
nics get added as these actions are keyed on the mac
|
||||
property.
|
||||
'''
|
||||
# NOTE: vmconfig is not a full vmadm payload,
|
||||
# this is not an issue given we are only testing
|
||||
# the vrrp_vrid to mac conversions
|
||||
ret = smartos._parse_vmconfig(
|
||||
OrderedDict([
|
||||
('nics', OrderedDict([
|
||||
('00:00:5e:00:01:01', OrderedDict([
|
||||
('vrrp_vrid', 1),
|
||||
('vrrp_primary_ip', '12.34.5.6'),
|
||||
])),
|
||||
('00:00:5e:00:01:24', OrderedDict([
|
||||
('vrrp_vrid', 240),
|
||||
('vrrp_primary_ip', '12.34.5.6'),
|
||||
])),
|
||||
('00:22:06:00:00:01', OrderedDict([
|
||||
('ips', ['12.34.5.6/24']),
|
||||
]))
|
||||
]))
|
||||
]),
|
||||
{'nics': 'mac'},
|
||||
)
|
||||
|
||||
# NOTE: nics.0 is a vrrp nic with correct mac (check mac == vrid based -> unchanged)
|
||||
assert ret['nics'][0]['mac'] == '00:00:5e:00:01:01'
|
||||
|
||||
# NOTE: nics.1 is a vrrp nic with incorrect mac (check mac == vrid based -> changed)
|
||||
assert ret['nics'][1]['mac'] == '00:00:5e:00:01:f0'
|
||||
|
||||
# NOTE: nics.2 was not a vrrp nic (check mac was not changed)
|
||||
assert ret['nics'][2]['mac'] == '00:22:06:00:00:01'
|
||||
|
|
Loading…
Add table
Reference in a new issue