Merge branch '2018.3' into merge-2018.3

This commit is contained in:
Gareth J. Greenaway 2019-01-07 09:46:43 -08:00 committed by GitHub
commit a20791b7c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 23 additions and 10 deletions

View File

@ -1945,7 +1945,7 @@ def get_repo_keys():
# The double usage of '--with-fingerprint' is necessary in order to
# retrieve the fingerprint of the subkey.
cmd = ['apt-key', 'adv', '--list-public-keys', '--with-fingerprint',
cmd = ['apt-key', 'adv', '--batch', '--list-public-keys', '--with-fingerprint',
'--with-fingerprint', '--with-colons', '--fixed-list-mode']
cmd_ret = __salt__['cmd.run_all'](cmd=cmd)
@ -2045,7 +2045,7 @@ def add_repo_key(path=None, text=None, keyserver=None, keyid=None, saltenv='base
error_msg = 'No keyid or keyid too short for keyserver: {0}'.format(keyserver)
raise SaltInvocationError(error_msg)
cmd.extend(['adv', '--keyserver', keyserver, '--recv', keyid])
cmd.extend(['adv', '--batch', '--keyserver', keyserver, '--recv', keyid])
elif keyid:
error_msg = 'No keyserver specified for keyid: {0}'.format(keyid)
raise SaltInvocationError(error_msg)
@ -2342,10 +2342,10 @@ def mod_repo(repo, saltenv='base', **kwargs):
if not imported:
http_proxy_url = _get_http_proxy_url()
if http_proxy_url:
cmd = ['apt-key', 'adv', '--keyserver-options', 'http-proxy={0}'.format(http_proxy_url),
cmd = ['apt-key', 'adv', '--batch', '--keyserver-options', 'http-proxy={0}'.format(http_proxy_url),
'--keyserver', keyserver, '--logger-fd', '1', '--recv-keys', keyid]
else:
cmd = ['apt-key', 'adv', '--keyserver', keyserver,
cmd = ['apt-key', 'adv', '--batch', '--keyserver', keyserver,
'--logger-fd', '1', '--recv-keys', keyid]
ret = __salt__['cmd.run_all'](cmd,
python_shell=False,

View File

@ -522,6 +522,10 @@ def _cmp_attrs(path, attrs):
'''
diff = [None, None]
# lsattr for AIX is not the same thing as lsattr for linux.
if salt.utils.platform.is_aix():
return None
try:
lattrs = lsattr(path).get(path, '')
except AttributeError:
@ -544,6 +548,9 @@ def lsattr(path):
.. versionadded:: 2018.3.0
.. versionchanged:: 2018.3.1
If ``lsattr`` is not installed on the system, ``None`` is returned.
.. versionchanged:: 2018.3.4
If on ``AIX``, ``None`` is returned even if in filesystem as lsattr on ``AIX``
is not the same thing as the linux version.
Obtain the modifiable attributes of the given file. If path
is to a directory, an empty list is returned.
@ -557,7 +564,7 @@ def lsattr(path):
salt '*' file.lsattr foo1.txt
'''
if not salt.utils.path.which('lsattr'):
if not salt.utils.path.which('lsattr') or salt.utils.platform.is_aix():
return None
if not os.path.exists(path):
@ -4471,7 +4478,9 @@ def check_perms(name, ret, user, group, mode, attrs=None, follow_symlinks=False)
is_dir = os.path.isdir(name)
is_link = os.path.islink(name)
if not salt.utils.platform.is_windows() and not is_dir and not is_link:
if attrs is not None \
and not salt.utils.platform.is_windows() \
and not is_dir and not is_link:
try:
lattrs = lsattr(name)
except SaltInvocationError:

View File

@ -349,8 +349,8 @@ def set_date(name, date):
salt '*' shadow.set_date username 0
'''
cmd = 'chage -d {0} {1}'.format(date, name)
return not __salt__['cmd.run'](cmd, python_shell=False)
cmd = ['chage', '-d', date, name]
return __salt__['cmd.retcode'](cmd, python_shell=False) == 0
def set_expire(name, expire):
@ -367,8 +367,8 @@ def set_expire(name, expire):
salt '*' shadow.set_expire username -1
'''
cmd = 'chage -E {0} {1}'.format(expire, name)
return not __salt__['cmd.run'](cmd, python_shell=False)
cmd = ['chage', '-E', expire, name]
return __salt__['cmd.retcode'](cmd, python_shell=False) == 0
def list_users():

View File

@ -126,6 +126,7 @@ SALT_REQS = os.path.join(os.path.abspath(SETUP_DIRNAME), 'requirements', 'base.t
SALT_ZEROMQ_REQS = os.path.join(os.path.abspath(SETUP_DIRNAME), 'requirements', 'zeromq.txt')
SALT_RAET_REQS = os.path.join(os.path.abspath(SETUP_DIRNAME), 'requirements', 'raet.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 SSH Packaging Detection
PACKAGED_FOR_SALT_SSH_FILE = os.path.join(os.path.abspath(SETUP_DIRNAME), '.salt-ssh-package')
@ -873,6 +874,9 @@ class SaltDistribution(distutils.dist.Distribution):
self.name = 'salt-ssh' if PACKAGED_FOR_SALT_SSH else 'salt'
self.salt_version = __version__ # pylint: disable=undefined-variable
self.description = 'Portable, distributed, remote execution and configuration management system'
with open(SALT_LONG_DESCRIPTION_FILE) as f:
self.long_description = f.read()
self.long_description_content_type = 'text/x-rst'
self.author = 'Thomas S Hatch'
self.author_email = 'thatch45@gmail.com'
self.url = 'http://saltstack.org'