mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge pull request #48529 from rallytime/merge-2018.3
[2018.3] Merge forward from 2017.7 to 2018.3
This commit is contained in:
commit
5b5a930449
11 changed files with 2605 additions and 26 deletions
1
.ci/docs
1
.ci/docs
|
@ -22,7 +22,6 @@ pipeline {
|
|||
stage('build') {
|
||||
steps {
|
||||
sh 'eval "$(pyenv init -)"; make -C doc clean html'
|
||||
archiveArtifacts artifacts: 'doc/_build/html/'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
2
.ci/lint
2
.ci/lint
|
@ -44,7 +44,7 @@ pipeline {
|
|||
parserName: 'PyLint',
|
||||
pattern: 'pylint-report*.xml'
|
||||
]],
|
||||
unstableTotalAll: '999',
|
||||
failedTotalAll: '1',
|
||||
usePreviousBuildAsReference: true
|
||||
])
|
||||
cleanWs()
|
||||
|
|
2549
doc/man/salt.7
2549
doc/man/salt.7
File diff suppressed because it is too large
Load diff
|
@ -24,7 +24,7 @@ pycrypto==2.6.1
|
|||
pycurl==7.43.0
|
||||
PyMySQL==0.7.11
|
||||
pyOpenSSL==17.5.0
|
||||
python-certifi-win32==1.2
|
||||
#python-certifi-win32==1.2
|
||||
python-dateutil==2.6.1
|
||||
python-gnupg==0.4.1
|
||||
pythonnet==2.3.0
|
||||
|
|
|
@ -29,15 +29,16 @@ def __virtual__():
|
|||
return (False, 'glusterfs server is not installed')
|
||||
|
||||
|
||||
def _get_minor_version():
|
||||
# Set default version to 6 for tests
|
||||
version = 6
|
||||
def _get_version():
|
||||
# Set the default minor version to 6 for tests
|
||||
version = [3, 6]
|
||||
cmd = 'gluster --version'
|
||||
result = __salt__['cmd.run'](cmd).splitlines()
|
||||
for line in result:
|
||||
if line.startswith('glusterfs'):
|
||||
version = int(line.split()[1].split('.')[1])
|
||||
return version
|
||||
version = line.split()[-1].split('.')
|
||||
version = [int(i) for i in version]
|
||||
return tuple(version)
|
||||
|
||||
|
||||
def _gluster_ok(xml_data):
|
||||
|
@ -70,7 +71,7 @@ def _gluster_xml(cmd):
|
|||
# We will pass the command string as stdin to allow for much longer
|
||||
# command strings. This is especially useful for creating large volumes
|
||||
# where the list of bricks exceeds 128 characters.
|
||||
if _get_minor_version() < 6:
|
||||
if _get_version() < (3, 6,):
|
||||
result = __salt__['cmd.run'](
|
||||
'script -q -c "gluster --xml --mode=script"', stdin="{0}\n\004".format(cmd)
|
||||
)
|
||||
|
|
|
@ -5779,7 +5779,7 @@ def copy(
|
|||
if not os.path.isdir(dname):
|
||||
if makedirs:
|
||||
try:
|
||||
_makedirs(name=name)
|
||||
_makedirs(name=name, user=user, group=group, dir_mode=mode)
|
||||
except CommandExecutionError as exc:
|
||||
return _error(ret, 'Drive {0} is not mapped'.format(exc.message))
|
||||
else:
|
||||
|
|
|
@ -72,9 +72,16 @@ def _changes(name,
|
|||
delusers = [salt.utils.win_functions.get_sam_name(user).lower() for user in delusers]
|
||||
|
||||
change = {}
|
||||
ret = {}
|
||||
if gid:
|
||||
if lgrp['gid'] != gid:
|
||||
change['gid'] = gid
|
||||
try:
|
||||
gid = int(gid)
|
||||
if lgrp['gid'] != gid:
|
||||
change['gid'] = gid
|
||||
except (TypeError, ValueError):
|
||||
ret['result'] = False
|
||||
ret['comment'] = 'Invalid gid'
|
||||
return ret
|
||||
|
||||
if members:
|
||||
# -- if new member list if different than the current
|
||||
|
|
|
@ -14,7 +14,6 @@ import tempfile
|
|||
import time
|
||||
import textwrap
|
||||
import threading
|
||||
from salt.ext.six.moves import queue
|
||||
|
||||
# Import Salt Testing Libs
|
||||
from tests.support.case import ShellCase
|
||||
|
@ -24,6 +23,7 @@ from tests.support.helpers import flaky, expensiveTest
|
|||
from tests.support.mock import MagicMock, patch
|
||||
|
||||
# Import Salt Libs
|
||||
import salt.exceptions
|
||||
import salt.utils.platform
|
||||
import salt.utils.event
|
||||
import salt.utils.files
|
||||
|
@ -33,6 +33,7 @@ import salt.utils.yaml
|
|||
|
||||
# Import 3rd-party libs
|
||||
from salt.ext import six
|
||||
from salt.ext.six.moves import queue
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
@ -62,7 +63,6 @@ class StateRunnerTest(ShellCase):
|
|||
Also test against some sample "good" output that would be included in a correct
|
||||
orchestrate run.
|
||||
'''
|
||||
#ret_output = self.run_run_plus('state.orchestrate', 'orch.simple')['out']
|
||||
ret_output = self.run_run('state.orchestrate orch.simple')
|
||||
bad_out = ['outputter:', ' highstate']
|
||||
good_out = [' Function: salt.state',
|
||||
|
@ -212,8 +212,8 @@ class StateRunnerTest(ShellCase):
|
|||
' Result: False']
|
||||
|
||||
second = [' ID: test-state',
|
||||
' Function: salt.state',
|
||||
' Result: True']
|
||||
' Function: salt.state',
|
||||
' Result: True']
|
||||
|
||||
third = [' ID: cmd.run',
|
||||
' Function: salt.function',
|
||||
|
@ -558,7 +558,7 @@ class OrchEventTest(ShellCase):
|
|||
})
|
||||
|
||||
orch_sls = os.path.join(self.base_env, 'main.sls')
|
||||
with salt.utils.fopen(orch_sls, 'w') as fp_:
|
||||
with salt.utils.files.fopen(orch_sls, 'w') as fp_:
|
||||
fp_.write(textwrap.dedent('''
|
||||
include:
|
||||
- one
|
||||
|
@ -567,7 +567,7 @@ class OrchEventTest(ShellCase):
|
|||
'''))
|
||||
|
||||
orch_sls = os.path.join(self.base_env, 'one.sls')
|
||||
with salt.utils.fopen(orch_sls, 'w') as fp_:
|
||||
with salt.utils.files.fopen(orch_sls, 'w') as fp_:
|
||||
fp_.write(textwrap.dedent('''
|
||||
{%- set foo = salt['saltutil.runner']('pillar.show_pillar') %}
|
||||
placeholder_one:
|
||||
|
@ -575,14 +575,14 @@ class OrchEventTest(ShellCase):
|
|||
'''))
|
||||
|
||||
orch_sls = os.path.join(self.base_env, 'two.sls')
|
||||
with salt.utils.fopen(orch_sls, 'w') as fp_:
|
||||
with salt.utils.files.fopen(orch_sls, 'w') as fp_:
|
||||
fp_.write(textwrap.dedent('''
|
||||
placeholder_two:
|
||||
test.succeed_without_changes
|
||||
'''))
|
||||
|
||||
orch_sls = os.path.join(self.base_env, 'three.sls')
|
||||
with salt.utils.fopen(orch_sls, 'w') as fp_:
|
||||
with salt.utils.files.fopen(orch_sls, 'w') as fp_:
|
||||
fp_.write(textwrap.dedent('''
|
||||
placeholder_three:
|
||||
test.succeed_without_changes
|
||||
|
|
|
@ -24,6 +24,7 @@ from tests.support.case import ModuleCase
|
|||
from tests.support.unit import skipIf
|
||||
from tests.support.paths import FILES, TMP, TMP_STATE_TREE
|
||||
from tests.support.helpers import (
|
||||
destructiveTest,
|
||||
skip_if_not_root,
|
||||
with_system_user_and_group,
|
||||
with_tempdir,
|
||||
|
@ -143,6 +144,10 @@ class FileTest(ModuleCase, SaltReturnAssertsMixin):
|
|||
'''
|
||||
remove files created in previous tests
|
||||
'''
|
||||
user = 'salt'
|
||||
if user in str(self.run_function('user.list_users', [user])):
|
||||
self.run_function('user.delete', [user])
|
||||
|
||||
for path in (FILEPILLAR, FILEPILLARDEF, FILEPILLARGIT):
|
||||
try:
|
||||
os.remove(path)
|
||||
|
@ -2295,6 +2300,30 @@ class FileTest(ModuleCase, SaltReturnAssertsMixin):
|
|||
self.assertTrue(os.path.exists(dest))
|
||||
self.assertTrue(filecmp.cmp(source, dest))
|
||||
|
||||
os.remove(source)
|
||||
os.remove(dest)
|
||||
|
||||
@destructiveTest
|
||||
@with_tempfile()
|
||||
def test_file_copy_make_dirs(self, source):
|
||||
'''
|
||||
ensure make_dirs creates correct user perms
|
||||
'''
|
||||
shutil.copyfile(os.path.join(FILES, 'hosts'), source)
|
||||
dest = os.path.join(TMP, 'dir1', 'dir2', 'copied_file.txt')
|
||||
|
||||
user = 'salt'
|
||||
mode = '0644'
|
||||
self.run_function('user.add', [user])
|
||||
ret = self.run_state('file.copy', name=dest, source=source, user=user,
|
||||
makedirs=True, mode=mode)
|
||||
file_checks = [dest, os.path.join(TMP, 'dir1'), os.path.join(TMP, 'dir1', 'dir2')]
|
||||
for check in file_checks:
|
||||
user_check = self.run_function('file.get_user', [check])
|
||||
mode_check = self.run_function('file.get_mode', [check])
|
||||
assert user_check == user
|
||||
assert salt.utils.files.normalize_mode(mode_check) == mode
|
||||
|
||||
def test_contents_pillar_with_pillar_list(self):
|
||||
'''
|
||||
This tests for any regressions for this issue:
|
||||
|
|
|
@ -33,7 +33,7 @@ class NpmStateTest(ModuleCase, SaltReturnAssertsMixin):
|
|||
Basic test to determine if NPM module was successfully installed and
|
||||
removed.
|
||||
'''
|
||||
ret = self.run_state('npm.installed', name='pm2', registry="http://registry.npmjs.org/")
|
||||
ret = self.run_state('npm.installed', name='pm2@2.10.4', registry="http://registry.npmjs.org/")
|
||||
self.assertSaltTrueReturn(ret)
|
||||
ret = self.run_state('npm.removed', name='pm2')
|
||||
self.assertSaltTrueReturn(ret)
|
||||
|
@ -69,7 +69,7 @@ class NpmStateTest(ModuleCase, SaltReturnAssertsMixin):
|
|||
Basic test to determine if NPM module successfully installs multiple
|
||||
packages.
|
||||
'''
|
||||
ret = self.run_state('npm.installed', name='unused', pkgs=['pm2', 'grunt'], registry="http://registry.npmjs.org/")
|
||||
ret = self.run_state('npm.installed', name='unused', pkgs=['pm2@2.10.4', 'grunt@1.0.2'], registry="http://registry.npmjs.org/")
|
||||
self.assertSaltTrueReturn(ret)
|
||||
|
||||
@skipIf(salt.utils.path.which('npm') and LooseVersion(cmd.run('npm -v')) >= LooseVersion(MAX_NPM_VERSION),
|
||||
|
|
2
tox.ini
2
tox.ini
|
@ -4,7 +4,7 @@ skip_missing_interpreters = True
|
|||
skipsdist = True
|
||||
|
||||
[testenv]
|
||||
deps = -r{toxinidir}/requirements/tests.txt
|
||||
deps = -Ur{toxinidir}/requirements/tests.txt
|
||||
commands = pytest --rootdir {toxinidir} {posargs}
|
||||
passenv = LANG HOME
|
||||
sitepackages = True
|
||||
|
|
Loading…
Add table
Reference in a new issue