Start raising SaltInvocationError

This commit is contained in:
Pedro Algarvio 2015-01-10 12:15:38 +00:00
parent 01ee8613e6
commit f2276afac9

View File

@ -742,17 +742,6 @@ def format_call(fun,
continue continue
extra[key] = copy.deepcopy(value) extra[key] = copy.deepcopy(value)
# We'll be showing errors to the users until Salt Lithium comes out, after
# which, errors will be raised instead.
warn_until(
'Lithium',
'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: if extra:
# Found unexpected keyword arguments, raise an error to the user # Found unexpected keyword arguments, raise an error to the user
if len(extra) == 1: if len(extra) == 1:
@ -776,20 +765,14 @@ def format_call(fun,
'{0}.{1}'.format(fun.__module__, fun.__name__) '{0}.{1}'.format(fun.__module__, fun.__name__)
) )
) )
raise SaltInvocationError(
# 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 ' '{0}. If you were trying to pass additional data to be used '
'in a template context, please populate \'context\' with ' 'in a template context, please populate \'context\' with '
'\'key: value\' pairs. Your approach will work until Salt Lithium ' '\'key: value\' pairs.{1}'.format(
'is out.{1}'.format(
msg, msg,
'' if 'full' not in ret else ' Please update your state files.' '' 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)
return ret return ret