mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 01:18:58 +00:00
Add type-checking for defaults
and context
in cmd.script
This commit is contained in:
parent
e3a5758679
commit
0354128484
@ -1017,13 +1017,22 @@ def script(name,
|
||||
'documentation.')
|
||||
return ret
|
||||
|
||||
if HAS_GRP:
|
||||
pgid = os.getegid()
|
||||
if context and not isinstance(context, dict):
|
||||
ret['comment'] = ('Invalidly-formatted \'context\' parameter. Must '
|
||||
'be formed as a dict.')
|
||||
return ret
|
||||
if defaults and not isinstance(defaults, dict):
|
||||
ret['comment'] = ('Invalidly-formatted \'defaults\' parameter. Must '
|
||||
'be formed as a dict.')
|
||||
return ret
|
||||
|
||||
tmpctx = defaults if defaults else {}
|
||||
if context:
|
||||
tmpctx.update(context)
|
||||
|
||||
if HAS_GRP:
|
||||
pgid = os.getegid()
|
||||
|
||||
cmd_kwargs = copy.deepcopy(kwargs)
|
||||
cmd_kwargs.update({'runas': user,
|
||||
'shell': shell or __grains__['shell'],
|
||||
|
Loading…
Reference in New Issue
Block a user