Merge pull request #46175 from garethgreenaway/35777_properly_deprecate_template_context_data_in_fluorine

[develop] Properly deprecate template context data
This commit is contained in:
Nicole Thomas 2018-04-26 11:00:57 -04:00 committed by GitHub
commit 618b6985ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 8 additions and 32 deletions

View File

@ -44,7 +44,8 @@ AUTH_INTERNAL_KEYWORDS = frozenset([
'eauth',
'fun',
'kwarg',
'match'
'match',
'print_event'
])

View File

@ -49,7 +49,9 @@ CLIENT_INTERNAL_KEYWORDS = frozenset([
'__tag__',
'__user__',
'username',
'password'
'password',
'full_return',
'print_event'
])

View File

@ -698,6 +698,7 @@ def start(uri=None,
exit_loop = False
while not exit_loop:
exit_loop = libvirt.virEventRunDefaultImpl() < 0
log.debug('=== in the loop exit_loop %s ===', exit_loop)
except Exception as err: # pylint: disable=broad-except
log.exception(err)

View File

@ -472,17 +472,6 @@ def format_call(fun,
continue
extra[key] = copy.deepcopy(value)
# We'll be showing errors to the users until Salt Fluorine comes out, after
# which, errors will be raised instead.
salt.utils.versions.warn_until(
'Fluorine',
'It\'s time to start raising `SaltInvocationError` instead of '
'returning warnings',
# Let's not show the deprecation warning on the console, there's no
# need.
_dont_call_warnings=True
)
if extra:
# Found unexpected keyword arguments, raise an error to the user
if len(extra) == 1:
@ -507,19 +496,7 @@ def format_call(fun,
)
)
# Return a warning to the user explaining what's going on
ret.setdefault('warnings', []).append(
'{0}. If you were trying to pass additional data to be used '
'in a template context, please populate \'context\' with '
'\'key: value\' pairs. Your approach will work until Salt '
'Fluorine is out.{1}'.format(
msg,
'' if 'full' not in ret else ' Please update your state files.'
)
)
# Lets pack the current extra kwargs as template context
ret.setdefault('context', {}).update(extra)
raise SaltInvocationError(msg)
return ret

View File

@ -493,7 +493,6 @@ class DockerContainerTestCase(ModuleCase, SaltReturnAssertsMixin):
ret = self.run_state(
'docker_container.absent',
name=name,
shutdown_timeout=1,
)
self.assertSaltTrueReturn(ret)
# Discard the outer dict with the state compiler data to make below
@ -506,7 +505,6 @@ class DockerContainerTestCase(ModuleCase, SaltReturnAssertsMixin):
ret = self.run_state(
'docker_container.absent',
name=name,
shutdown_timeout=1,
)
self.assertSaltTrueReturn(ret)
# Discard the outer dict with the state compiler data to make below
@ -540,7 +538,6 @@ class DockerContainerTestCase(ModuleCase, SaltReturnAssertsMixin):
ret = self.run_state(
'docker_container.absent',
name=name,
shutdown_timeout=1,
)
self.assertSaltFalseReturn(ret)
# Discard the outer dict with the state compiler data to make below
@ -558,7 +555,6 @@ class DockerContainerTestCase(ModuleCase, SaltReturnAssertsMixin):
ret = self.run_state('docker_container.absent',
name=name,
force=True,
shutdown_timeout=1,
)
self.assertSaltTrueReturn(ret)
# Discard the outer dict with the state compiler data to make below

View File

@ -81,8 +81,7 @@ class ArgsTestCase(TestCase):
self.assertRaises(SaltInvocationError, salt.utils.args.format_call, dummy_func, {'1': 2})
# Make sure we warn on invalid kwargs
ret = salt.utils.args.format_call(dummy_func, {'first': 2, 'second': 2, 'third': 3})
self.assertGreaterEqual(len(ret['warnings']), 1)
self.assertRaises(SaltInvocationError, salt.utils.args.format_call, dummy_func, {'first': 2, 'seconds': 2, 'third': 3})
ret = salt.utils.args.format_call(dummy_func, {'first': 2, 'second': 2, 'third': 3},
expected_extra_kws=('first', 'second', 'third'))