mirror of
https://github.com/valitydev/salt.git
synced 2024-11-06 16:45:27 +00:00
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:
commit
618b6985ca
@ -44,7 +44,8 @@ AUTH_INTERNAL_KEYWORDS = frozenset([
|
||||
'eauth',
|
||||
'fun',
|
||||
'kwarg',
|
||||
'match'
|
||||
'match',
|
||||
'print_event'
|
||||
])
|
||||
|
||||
|
||||
|
@ -49,7 +49,9 @@ CLIENT_INTERNAL_KEYWORDS = frozenset([
|
||||
'__tag__',
|
||||
'__user__',
|
||||
'username',
|
||||
'password'
|
||||
'password',
|
||||
'full_return',
|
||||
'print_event'
|
||||
])
|
||||
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
@ -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'))
|
||||
|
Loading…
Reference in New Issue
Block a user