Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[2018.3] Merge forward from 2017.7 to 2018.3 #50383

Merged
merged 30 commits into from Nov 6, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
253ab11
Workaround for py2 builtin, =<3.3 imp and >=3.4 libimport quirks, sol…
mgomersbach Oct 19, 2018
37ab1f8
Update workaround to root of file
mgomersbach Oct 19, 2018
ab8b5b4
Update workaround to root of file
mgomersbach Oct 19, 2018
eb13407
capture some extra info
damon-atkins Oct 24, 2018
59ac284
Do not allow age to be a negative number
dwoz Oct 17, 2018
0a1e607
When the minion key is denied by the master then exit status 77 (perm…
May 26, 2017
e535b38
Merge pull request #50252 from dwoz/backport_fs_fix
Oct 30, 2018
cf5fb04
Check WinRM port before initiating connection
twangboy Oct 31, 2018
ab8e845
Merge pull request #50329 from twangboy/fix_cloud_winrm
Nov 1, 2018
95174e6
Merge branch '2017.7' into fix-py3-reload-compat
mgomersbach Nov 1, 2018
05c598c
Fix import error by utilizing six and strict version spec
mgomersbach Nov 1, 2018
4725acd
Merge pull request #50195 from damon-atkins/jenkins_pylint
Nov 1, 2018
b947a18
Merge pull request #50274 from rallytime/bp-41472
Nov 1, 2018
8899832
Configure logging for ZMQ PubServer daemon
dwoz Nov 1, 2018
346a831
Updating the AMI's and sizes for the test run.
Nov 2, 2018
5e1db3c
Fix ZMQ PubServer daemon logging works on winndows
dwoz Nov 2, 2018
fd58523
Fix linter warnings
dwoz Nov 2, 2018
44f7af4
Merge pull request #50350 from dubb-b/2017.7
Nov 2, 2018
0621f7d
Add a few more feature release codenames to the version_numbers doc
Nov 2, 2018
a2838db
Satisfy pylint checks
mgomersbach Nov 2, 2018
99c8f35
Merge pull request #50345 from dwoz/pub_d_logging
dwoz Nov 2, 2018
18b5d43
Increase cli batch test timeout for increased reliablity
dwoz Nov 2, 2018
48c6a4f
Merge branch '2017.7' into fix-py3-reload-compat
mgomersbach Nov 3, 2018
5cd9741
Satisfy pylint
mgomersbach Nov 3, 2018
d20581c
Merge branch 'fix-py3-reload-compat' of github.com:mgomersbach/salt i…
mgomersbach Nov 3, 2018
e453e82
Satisfy pylint, use naming instead of W or E classification
mgomersbach Nov 3, 2018
6472100
Merge pull request #50359 from dwoz/clitest
Nov 5, 2018
aa6b149
Merge pull request #50354 from rallytime/version_num_docs
Nov 5, 2018
cd7c95f
Merge pull request #50128 from mgomersbach/fix-py3-reload-compat
Nov 5, 2018
e993692
Merge branch '2017.7' into '2018.3'
Nov 5, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion .ci/lint
Expand Up @@ -28,6 +28,7 @@ pipeline {
# the -l increase the search limit, lets use awk so we do not need to repeat the search above.
gawk 'BEGIN {FS="\\t"} {if ($1 != "D") {print $NF}}' file-list-status.log > file-list-changed.log
gawk 'BEGIN {FS="\\t"} {if ($1 == "D") {print $NF}}' file-list-status.log > file-list-deleted.log
(git diff --name-status -l99999 -C "origin/$CHANGE_TARGET";echo "---";git diff --name-status -l99999 -C "origin/$BRANCH_NAME";printenv|grep -E '=[0-9a-z]{40,}+$|COMMIT=|BRANCH') > file-list-experiment.log
touch pylint-report-salt.log pylint-report-tests.log
eval "$(pyenv init -)"
pyenv --version
Expand All @@ -37,7 +38,7 @@ pipeline {
python --version
pip install tox
'''
archiveArtifacts artifacts: 'file-list-status.log,file-list-changed.log,file-list-deleted.log'
archiveArtifacts artifacts: 'file-list-status.log,file-list-changed.log,file-list-deleted.log,file-list-experiment.log'
}
}
stage('linting') {
Expand Down
2 changes: 2 additions & 0 deletions doc/topics/releases/version_numbers.rst
Expand Up @@ -36,6 +36,8 @@ Assigned codenames:
- Nitrogen: ``2017.7.0``
- Oxygen: ``2018.3.0``
- Fluorine: ``TBD``
- Neon: ``TBD``
- Sodium: ``TBD``

Example
-------
Expand Down
5 changes: 3 additions & 2 deletions salt/master.py
Expand Up @@ -660,9 +660,10 @@ def start(self):
self.process_manager = salt.utils.process.ProcessManager(wait_for_kill=5)
pub_channels = []
log.info('Creating master publisher process')
log_queue = salt.log.setup.get_multiprocessing_logging_queue()
for transport, opts in iter_transport_opts(self.opts):
chan = salt.transport.server.PubServerChannel.factory(opts)
chan.pre_fork(self.process_manager)
chan.pre_fork(self.process_manager, kwargs={'log_queue': log_queue})
pub_channels.append(chan)

log.info('Creating master event publisher process')
Expand Down Expand Up @@ -719,7 +720,7 @@ def start(self):
log.info('Creating master request server process')
kwargs = {}
if salt.utils.platform.is_windows():
kwargs['log_queue'] = salt.log.setup.get_multiprocessing_logging_queue()
kwargs['log_queue'] = log_queue
kwargs['secrets'] = SMaster.secrets

self.process_manager.add_process(
Expand Down
5 changes: 5 additions & 0 deletions salt/modules/ebuild.py
Expand Up @@ -31,6 +31,10 @@
from salt.exceptions import CommandExecutionError, MinionError
from salt.ext import six

# Workaround for 'reload' builtin of py2.7
if six.PY3:
from importlib import reload # pylint: disable=no-name-in-module

# Import third party libs
HAS_PORTAGE = False
try:
Expand Down Expand Up @@ -274,6 +278,7 @@ def latest_version(*names, **kwargs):
return ret[names[0]]
return ret


# available_version is being deprecated
available_version = salt.utils.functools.alias_function(latest_version, 'available_version')

Expand Down
2 changes: 1 addition & 1 deletion salt/transport/server.py
Expand Up @@ -92,7 +92,7 @@ def factory(opts, **kwargs):
raise Exception('Channels are only defined for ZeroMQ and raet')
# return NewKindOfChannel(opts, **kwargs)

def pre_fork(self, process_manager):
def pre_fork(self, process_manager, kwargs=None):
'''
Do anything necessary pre-fork. Since this is on the master side this will
primarily be used to create IPC channels and create our daemon process to
Expand Down
8 changes: 1 addition & 7 deletions salt/transport/tcp.py
Expand Up @@ -1409,18 +1409,12 @@ def _publish_daemon(self, log_queue=None):
except (KeyboardInterrupt, SystemExit):
salt.log.setup.shutdown_multiprocessing_logging()

def pre_fork(self, process_manager):
def pre_fork(self, process_manager, kwargs=None):
'''
Do anything necessary pre-fork. Since this is on the master side this will
primarily be used to create IPC channels and create our daemon process to
do the actual publishing
'''
kwargs = {}
if salt.utils.platform.is_windows():
kwargs['log_queue'] = (
salt.log.setup.get_multiprocessing_logging_queue()
)

process_manager.add_process(self._publish_daemon, kwargs=kwargs)

def publish(self, load):
Expand Down
11 changes: 8 additions & 3 deletions salt/transport/zeromq.py
Expand Up @@ -18,6 +18,7 @@
# Import Salt Libs
import salt.auth
import salt.crypt
import salt.log.setup
import salt.utils.event
import salt.utils.files
import salt.utils.minions
Expand Down Expand Up @@ -767,11 +768,15 @@ def __init__(self, opts):
def connect(self):
return tornado.gen.sleep(5)

def _publish_daemon(self):
def _publish_daemon(self, log_queue=None):
'''
Bind to the interface specified in the configuration file
'''
salt.utils.process.appendproctitle(self.__class__.__name__)
if log_queue:
salt.log.setup.set_multiprocessing_logging_queue(log_queue)
salt.log.setup.setup_multiprocessing_logging(log_queue)

# Set up the context
context = zmq.Context(1)
# Prepare minion publish socket
Expand Down Expand Up @@ -863,15 +868,15 @@ def _publish_daemon(self):
if context.closed is False:
context.term()

def pre_fork(self, process_manager):
def pre_fork(self, process_manager, kwargs=None):
'''
Do anything necessary pre-fork. Since this is on the master side this will
primarily be used to create IPC channels and create our daemon process to
do the actual publishing

:param func process_manager: A ProcessManager, from salt.utils.process.ProcessManager
'''
process_manager.add_process(self._publish_daemon)
process_manager.add_process(self._publish_daemon, kwargs=kwargs)

def publish(self, load):
'''
Expand Down
3 changes: 3 additions & 0 deletions salt/utils/cloud.py
Expand Up @@ -828,6 +828,9 @@ def wait_for_winrm(host, port, username, password, timeout=900, use_ssl=True, ve
'''
Wait until WinRM connection can be established.
'''
# Ensure the winrm service is listening before attempting to connect
wait_for_port(host=host, port=port, timeout=timeout)

start = time.time()
log.debug(
'Attempting WinRM connection to host %s on port %s',
Expand Down
12 changes: 5 additions & 7 deletions salt/utils/virtualbox.py
Expand Up @@ -16,6 +16,11 @@
# Import salt libs
import salt.utils.data
from salt.utils.timeout import wait_for
import salt.ext.six as six

# Workaround for 'reload' builtin of py2.7
if six.PY3:
from importlib import reload # pylint: disable=no-name-in-module

log = logging.getLogger(__name__)

Expand Down Expand Up @@ -135,13 +140,6 @@ def vb_get_manager():
'''
global _virtualboxManager
if _virtualboxManager is None and HAS_LIBS:
try:
from importlib import reload
except ImportError:
# If we get here, we are in py2 and reload is a built-in.
pass

# Reloading the API extends sys.paths for subprocesses of multiprocessing, since they seem to share contexts
reload(vboxapi)
_virtualboxManager = vboxapi.VirtualBoxManager(None, None)

Expand Down
28 changes: 24 additions & 4 deletions tests/integration/cli/test_batch.py
Expand Up @@ -8,18 +8,28 @@
# Import Salt Testing Libs
from tests.support.case import ShellCase

# Import Salt libs
import salt.utils.platform


class BatchTest(ShellCase):
'''
Integration tests for the salt.cli.batch module
'''
if salt.utils.platform.is_windows():
run_timeout = 90
else:
run_timeout = 30

def test_batch_run(self):
'''
Tests executing a simple batch command to help catch regressions
'''
ret = 'Executing run on [{0}]'.format(repr('sub_minion'))
cmd = self.run_salt('"*minion" test.echo "batch testing" -b 50%')
cmd = self.run_salt(
'"*minion" test.echo "batch testing" -b 50%',
timeout=self.run_timeout,
)
self.assertIn(ret, cmd)

def test_batch_run_number(self):
Expand All @@ -28,7 +38,10 @@ def test_batch_run_number(self):
a percentage with full batch CLI call.
'''
ret = "Executing run on [{0}, {1}]".format(repr('minion'), repr('sub_minion'))
cmd = self.run_salt('"*minion" test.ping --batch-size 2')
cmd = self.run_salt(
'"*minion" test.ping --batch-size 2',
timeout=self.run_timeout,
)
self.assertIn(ret, cmd)

def test_batch_run_grains_targeting(self):
Expand All @@ -45,13 +58,20 @@ def test_batch_run_grains_targeting(self):
os_grain = item

os_grain = os_grain.strip()
cmd = self.run_salt('-C "G@os:{0} and not localhost" -b 25% test.ping'.format(os_grain))
cmd = self.run_salt(
'-C "G@os:{0} and not localhost" -b 25% test.ping'.format(os_grain),
timeout=self.run_timeout,
)
self.assertIn(sub_min_ret, cmd)
self.assertIn(min_ret, cmd)

def test_batch_exit_code(self):
'''
Test that a failed state returns a non-zero exit code in batch mode
'''
cmd = self.run_salt(' "*minion" state.single test.fail_without_changes name=test_me -b 33%', with_retcode=True)
cmd = self.run_salt(
' "*" state.single test.fail_without_changes name=test_me -b 25%',
with_retcode=True,
timeout=self.run_timeout,
)
self.assertEqual(cmd[-1], 2)
14 changes: 7 additions & 7 deletions tests/integration/files/conf/cloud.profiles.d/ec2.conf
@@ -1,13 +1,13 @@
ec2-test:
provider: ec2-config
image: ami-98aa1cf0
size: m1.large
sh_username: ec2-user
image: ami-3ecc8f46
size: c5.large
sh_username: centos
script_args: '-P'
ec2-win2012r2-test:
provider: ec2-config
size: m1.large
image: ami-eb1ecd96
size: c5.large
image: ami-02e27664434db6def
smb_port: 445
win_installer: ''
win_username: Administrator
Expand All @@ -19,8 +19,8 @@ ec2-win2012r2-test:
deploy: True
ec2-win2016-test:
provider: ec2-config
size: m1.large
image: ami-ed14c790
size: c5.large
image: ami-017bf00eb0d4c7182
smb_port: 445
win_installer: ''
win_username: Administrator
Expand Down