mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge pull request #45722 from rallytime/merge-2017.7
[2017.7] Merge forward from 2016.11 to 2017.7
This commit is contained in:
commit
cdb21a0186
4 changed files with 54 additions and 24 deletions
|
@ -386,8 +386,8 @@ If Exist "%BinDir%\Lib\site-packages\salt\modules\solaris*"^
|
|||
del /Q "%BinDir%\Lib\site-packages\salt\modules\solaris*" 1>nul
|
||||
If Exist "%BinDir%\Lib\site-packages\salt\modules\solr.py"^
|
||||
del /Q "%BinDir%\Lib\site-packages\salt\modules\solr.*" 1>nul
|
||||
If Exist "%BinDir%\Lib\site-packages\salt\modules\ssh*"^
|
||||
del /Q "%BinDir%\Lib\site-packages\salt\modules\ssh*" 1>nul
|
||||
If Exist "%BinDir%\Lib\site-packages\salt\modules\ssh_*"^
|
||||
del /Q "%BinDir%\Lib\site-packages\salt\modules\ssh_*" 1>nul
|
||||
If Exist "%BinDir%\Lib\site-packages\salt\modules\supervisord.py"^
|
||||
del /Q "%BinDir%\Lib\site-packages\salt\modules\supervisord.*" 1>nul
|
||||
If Exist "%BinDir%\Lib\site-packages\salt\modules\sysbench.py"^
|
||||
|
@ -522,8 +522,8 @@ If Exist "%BinDir%\Lib\site-packages\salt\states\smartos.py"^
|
|||
del /Q "%BinDir%\Lib\site-packages\salt\states\smartos.*" 1>nul
|
||||
If Exist "%BinDir%\Lib\site-packages\salt\states\snapper.py"^
|
||||
del /Q "%BinDir%\Lib\site-packages\salt\states\snapper.*" 1>nul
|
||||
If Exist "%BinDir%\Lib\site-packages\salt\states\ssh*"^
|
||||
del /Q "%BinDir%\Lib\site-packages\salt\states\ssh*" 1>nul
|
||||
If Exist "%BinDir%\Lib\site-packages\salt\states\ssh_*"^
|
||||
del /Q "%BinDir%\Lib\site-packages\salt\states\ssh_*" 1>nul
|
||||
If Exist "%BinDir%\Lib\site-packages\salt\states\supervisord.py"^
|
||||
del /Q "%BinDir%\Lib\site-packages\salt\states\supervisord.*" 1>nul
|
||||
If Exist "%BinDir%\Lib\site-packages\salt\states\sysrc.py"^
|
||||
|
|
|
@ -6,6 +6,7 @@ from __future__ import absolute_import
|
|||
|
||||
# Import python libs
|
||||
import copy
|
||||
import glob
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
|
@ -238,13 +239,17 @@ def _git_run(command, cwd=None, user=None, password=None, identity=None,
|
|||
)
|
||||
tmp_ssh_wrapper = None
|
||||
if salt.utils.is_windows():
|
||||
for suffix in ('', ' (x86)'):
|
||||
ssh_exe = (
|
||||
'C:\\Program Files{0}\\Git\\bin\\ssh.exe'
|
||||
.format(suffix)
|
||||
)
|
||||
if os.path.isfile(ssh_exe):
|
||||
env['GIT_SSH_EXE'] = ssh_exe
|
||||
# Known locations for Git's ssh.exe in Windows
|
||||
globmasks = [os.path.join(os.getenv('SystemDrive'), os.sep,
|
||||
'Program Files*', 'Git', 'usr', 'bin',
|
||||
'ssh.exe'),
|
||||
os.path.join(os.getenv('SystemDrive'), os.sep,
|
||||
'Program Files*', 'Git', 'bin',
|
||||
'ssh.exe')]
|
||||
for globmask in globmasks:
|
||||
ssh_exe = glob.glob(globmask)
|
||||
if ssh_exe and os.path.isfile(ssh_exe[0]):
|
||||
env['GIT_SSH_EXE'] = ssh_exe[0]
|
||||
break
|
||||
else:
|
||||
raise CommandExecutionError(
|
||||
|
|
|
@ -95,9 +95,13 @@ class Registry(object): # pylint: disable=R0903
|
|||
'''
|
||||
def __init__(self):
|
||||
self.hkeys = {
|
||||
'HKEY_CURRENT_CONFIG': win32con.HKEY_CURRENT_CONFIG,
|
||||
'HKEY_CLASSES_ROOT': win32con.HKEY_CLASSES_ROOT,
|
||||
'HKEY_CURRENT_USER': win32con.HKEY_CURRENT_USER,
|
||||
'HKEY_LOCAL_MACHINE': win32con.HKEY_LOCAL_MACHINE,
|
||||
'HKEY_USERS': win32con.HKEY_USERS,
|
||||
'HKCC': win32con.HKEY_CURRENT_CONFIG,
|
||||
'HKCR': win32con.HKEY_CLASSES_ROOT,
|
||||
'HKCU': win32con.HKEY_CURRENT_USER,
|
||||
'HKLM': win32con.HKEY_LOCAL_MACHINE,
|
||||
'HKU': win32con.HKEY_USERS,
|
||||
|
@ -130,9 +134,11 @@ class Registry(object): # pylint: disable=R0903
|
|||
# delete_key_recursive uses this to check the subkey contains enough \
|
||||
# as we do not want to remove all or most of the registry
|
||||
self.subkey_slash_check = {
|
||||
win32con.HKEY_CURRENT_USER: 0,
|
||||
win32con.HKEY_LOCAL_MACHINE: 1,
|
||||
win32con.HKEY_USERS: 1
|
||||
win32con.HKEY_CURRENT_USER: 0,
|
||||
win32con.HKEY_LOCAL_MACHINE: 1,
|
||||
win32con.HKEY_USERS: 1,
|
||||
win32con.HKEY_CURRENT_CONFIG: 1,
|
||||
win32con.HKEY_CLASSES_ROOT: 1
|
||||
}
|
||||
|
||||
self.registry_32 = {
|
||||
|
@ -203,6 +209,8 @@ def list_keys(hive, key=None, use_32bit_registry=False):
|
|||
- HKEY_LOCAL_MACHINE or HKLM
|
||||
- HKEY_CURRENT_USER or HKCU
|
||||
- HKEY_USER or HKU
|
||||
- HKEY_CLASSES_ROOT or HKCR
|
||||
- HKEY_CURRENT_CONFIG or HKCC
|
||||
|
||||
:param str key: The key (looks like a path) to the value name. If a key is
|
||||
not passed, the keys under the hive will be returned.
|
||||
|
@ -257,6 +265,8 @@ def list_values(hive, key=None, use_32bit_registry=False, include_default=True):
|
|||
- HKEY_LOCAL_MACHINE or HKLM
|
||||
- HKEY_CURRENT_USER or HKCU
|
||||
- HKEY_USER or HKU
|
||||
- HKEY_CLASSES_ROOT or HKCR
|
||||
- HKEY_CURRENT_CONFIG or HKCC
|
||||
|
||||
:param str key: The key (looks like a path) to the value name. If a key is
|
||||
not passed, the values under the hive will be returned.
|
||||
|
@ -325,6 +335,8 @@ def read_value(hive, key, vname=None, use_32bit_registry=False):
|
|||
- HKEY_LOCAL_MACHINE or HKLM
|
||||
- HKEY_CURRENT_USER or HKCU
|
||||
- HKEY_USER or HKU
|
||||
- HKEY_CLASSES_ROOT or HKCR
|
||||
- HKEY_CURRENT_CONFIG or HKCC
|
||||
|
||||
:param str key: The key (looks like a path) to the value name.
|
||||
|
||||
|
@ -422,6 +434,8 @@ def set_value(hive,
|
|||
- HKEY_LOCAL_MACHINE or HKLM
|
||||
- HKEY_CURRENT_USER or HKCU
|
||||
- HKEY_USER or HKU
|
||||
- HKEY_CLASSES_ROOT or HKCR
|
||||
- HKEY_CURRENT_CONFIG or HKCC
|
||||
|
||||
:param str key: The key (looks like a path) to the value name.
|
||||
|
||||
|
@ -562,6 +576,8 @@ def delete_key_recursive(hive, key, use_32bit_registry=False):
|
|||
- HKEY_LOCAL_MACHINE or HKLM
|
||||
- HKEY_CURRENT_USER or HKCU
|
||||
- HKEY_USER or HKU
|
||||
- HKEY_CLASSES_ROOT or HKCR
|
||||
- HKEY_CURRENT_CONFIG or HKCC
|
||||
|
||||
:param key: The key to remove (looks like a path)
|
||||
|
||||
|
@ -656,6 +672,8 @@ def delete_value(hive, key, vname=None, use_32bit_registry=False):
|
|||
- HKEY_LOCAL_MACHINE or HKLM
|
||||
- HKEY_CURRENT_USER or HKCU
|
||||
- HKEY_USER or HKU
|
||||
- HKEY_CLASSES_ROOT or HKCR
|
||||
- HKEY_CURRENT_CONFIG or HKCC
|
||||
|
||||
:param str key: The key (looks like a path) to the value name.
|
||||
|
||||
|
|
|
@ -2315,6 +2315,7 @@ def detached(name,
|
|||
else:
|
||||
# Clone repository
|
||||
if os.path.isdir(target):
|
||||
target_contents = os.listdir(target)
|
||||
if force_clone:
|
||||
# Clone is required, and target directory exists, but the
|
||||
# ``force`` option is enabled, so we need to clear out its
|
||||
|
@ -2331,20 +2332,26 @@ def detached(name,
|
|||
'place (force_clone=True set in git.detached state)'
|
||||
.format(target, name)
|
||||
)
|
||||
try:
|
||||
if os.path.islink(target):
|
||||
os.unlink(target)
|
||||
else:
|
||||
salt.utils.rm_rf(target)
|
||||
except OSError as exc:
|
||||
removal_errors = {}
|
||||
for target_object in target_contents:
|
||||
target_path = os.path.join(target, target_object)
|
||||
try:
|
||||
salt.utils.rm_rf(target_path)
|
||||
except OSError as exc:
|
||||
if exc.errno != errno.ENOENT:
|
||||
removal_errors[target_path] = exc
|
||||
if removal_errors:
|
||||
err_strings = [
|
||||
' {0}\n {1}'.format(k, v)
|
||||
for k, v in six.iteritems(removal_errors)
|
||||
]
|
||||
return _fail(
|
||||
ret,
|
||||
'Unable to remove {0}: {1}'.format(target, exc),
|
||||
'Unable to remove\n{0}'.format('\n'.join(err_strings)),
|
||||
comments
|
||||
)
|
||||
else:
|
||||
ret['changes']['forced clone'] = True
|
||||
elif os.listdir(target):
|
||||
ret['changes']['forced clone'] = True
|
||||
elif target_contents:
|
||||
# Clone is required, but target dir exists and is non-empty. We
|
||||
# can't proceed.
|
||||
return _fail(
|
||||
|
|
Loading…
Add table
Reference in a new issue