mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge pull request #34229 from rallytime/merge-2016.3
[2016.3] Merge forward from 2015.8 to 2016.3
This commit is contained in:
commit
4157f6fd39
6 changed files with 42 additions and 13 deletions
|
@ -19,7 +19,7 @@ option. This will give users a couple release cycles to modify their scripts,
|
|||
SLS files, etc. to use the new functionality, rather than forcing users to
|
||||
change everything immediately.
|
||||
|
||||
In the **Carbon** release of Salt (due in 2016), this execution module will
|
||||
In the **Nitrogen** release of Salt (due in 2017), this execution module will
|
||||
take the place of the default Docker execution module, and backwards-compatible
|
||||
naming will be maintained for a couple releases after that to allow users time
|
||||
to replace references to ``dockerng`` with ``docker``.
|
||||
|
|
|
@ -51,7 +51,12 @@ import salt.utils.minion
|
|||
import salt.utils.process
|
||||
import salt.utils.url
|
||||
import salt.wheel
|
||||
import salt.utils.psutil_compat as psutil
|
||||
|
||||
HAS_PSUTIL = True
|
||||
try:
|
||||
import salt.utils.psutil_compat
|
||||
except ImportError:
|
||||
HAS_PSUTIL = False
|
||||
|
||||
from salt.exceptions import (
|
||||
SaltReqTimeoutError, SaltRenderError, CommandExecutionError, SaltInvocationError
|
||||
|
@ -861,12 +866,20 @@ def signal_job(jid, sig):
|
|||
|
||||
salt '*' saltutil.signal_job <job id> 15
|
||||
'''
|
||||
if HAS_PSUTIL is False:
|
||||
log.warning('saltutil.signal job called, but psutil is not installed. '
|
||||
'Install psutil to ensure more reliable and accurate PID '
|
||||
'management.')
|
||||
for data in running():
|
||||
if data['jid'] == jid:
|
||||
try:
|
||||
for proc in psutil.Process(pid=data['pid']).children(recursive=True):
|
||||
proc.send_signal(sig)
|
||||
if HAS_PSUTIL:
|
||||
for proc in salt.utils.psutil_compat.Process(pid=data['pid']).children(recursive=True):
|
||||
proc.send_signal(sig)
|
||||
os.kill(int(data['pid']), sig)
|
||||
if HAS_PSUTIL is False and 'child_pids' in data:
|
||||
for pid in data['child_pids']:
|
||||
os.kill(int(pid), sig)
|
||||
return 'Signal {0} sent to job {1} at pid {2}'.format(
|
||||
int(sig),
|
||||
jid,
|
||||
|
|
|
@ -592,7 +592,11 @@ def list_repo_pkgs(*args, **kwargs):
|
|||
.. versionchanged:: 2014.7.0
|
||||
All available versions of each package are now returned. This required
|
||||
a slight modification to the structure of the return dict. The return
|
||||
data shown below reflects the updated return dict structure.
|
||||
data shown below reflects the updated return dict structure. Note that
|
||||
packages which are version-locked using :py:mod:`pkg.hold
|
||||
<salt.modules.yumpkg.hold>` will only show the currently-installed
|
||||
version, as locking a package will make other versions appear
|
||||
unavailable to yum/dnf.
|
||||
|
||||
Returns all available packages. Optionally, package names (and name globs)
|
||||
can be passed and the results will be filtered to packages matching those
|
||||
|
|
|
@ -23,7 +23,7 @@ option. This will give users a couple release cycles to modify their scripts,
|
|||
SLS files, etc. to use the new functionality, rather than forcing users to
|
||||
change everything immediately.
|
||||
|
||||
In the **Carbon** release of Salt (due in 2016), this execution module will
|
||||
In the **Nitrogen** release of Salt (due in 2017), this execution module will
|
||||
take the place of the default Docker execution module, and backwards-compatible
|
||||
naming will be maintained for a couple releases after that to allow users time
|
||||
to replace references to ``dockerng`` with ``docker``.
|
||||
|
|
|
@ -153,6 +153,17 @@ def is_empty(filename):
|
|||
return False
|
||||
|
||||
|
||||
def is_hex(value):
|
||||
'''
|
||||
Returns True if value is a hexidecimal string, otherwise returns False
|
||||
'''
|
||||
try:
|
||||
int(value, 16)
|
||||
return True
|
||||
except (TypeError, ValueError):
|
||||
return False
|
||||
|
||||
|
||||
def get_color_theme(theme):
|
||||
'''
|
||||
Return the color theme to use
|
||||
|
|
|
@ -1440,7 +1440,7 @@ class Pygit2(GitProvider):
|
|||
return None
|
||||
try:
|
||||
commit = self.repo.revparse_single(tgt_ref)
|
||||
except (KeyError, TypeError):
|
||||
except (KeyError, TypeError, ValueError):
|
||||
# Not a valid commit, likely not a commit SHA
|
||||
pass
|
||||
else:
|
||||
|
@ -1835,9 +1835,7 @@ class Dulwich(GitProvider): # pylint: disable=abstract-method
|
|||
# SHA-1 hashes.
|
||||
if not self.env_is_exposed(tgt_env):
|
||||
return None
|
||||
try:
|
||||
int(tgt_ref, 16)
|
||||
except ValueError:
|
||||
elif not salt.utils.is_hex(tgt_ref):
|
||||
# Not hexidecimal, likely just a non-matching environment
|
||||
return None
|
||||
|
||||
|
@ -2537,7 +2535,8 @@ class GitFS(GitBase):
|
|||
'''
|
||||
fnd = {'path': '',
|
||||
'rel': ''}
|
||||
if os.path.isabs(path) or tgt_env not in self.envs():
|
||||
if os.path.isabs(path) or \
|
||||
(not salt.utils.is_hex(tgt_env) and tgt_env not in self.envs()):
|
||||
return fnd
|
||||
|
||||
dest = os.path.join(self.cache_root, 'refs', tgt_env, path)
|
||||
|
@ -2717,7 +2716,8 @@ class GitFS(GitBase):
|
|||
return cache_match
|
||||
if refresh_cache:
|
||||
ret = {'files': set(), 'symlinks': {}, 'dirs': set()}
|
||||
if load['saltenv'] in self.envs():
|
||||
if salt.utils.is_hex(load['saltenv']) \
|
||||
or load['saltenv'] in self.envs():
|
||||
for repo in self.remotes:
|
||||
repo_files, repo_symlinks = repo.file_list(load['saltenv'])
|
||||
ret['files'].update(repo_files)
|
||||
|
@ -2763,7 +2763,8 @@ class GitFS(GitBase):
|
|||
)
|
||||
load['saltenv'] = load.pop('env')
|
||||
|
||||
if load['saltenv'] not in self.envs():
|
||||
if not salt.utils.is_hex(load['saltenv']) \
|
||||
and load['saltenv'] not in self.envs():
|
||||
return {}
|
||||
if 'prefix' in load:
|
||||
prefix = load['prefix'].strip('/')
|
||||
|
|
Loading…
Add table
Reference in a new issue