mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Add a format payload function to the payload module
This commit is contained in:
parent
2a12f05b1c
commit
6833289132
1 changed files with 12 additions and 0 deletions
|
@ -20,3 +20,15 @@ def unpackage(package):
|
|||
'''
|
||||
return pickle.loads(package)
|
||||
|
||||
def format_payload(enc, cmd, **kwargs):
|
||||
'''
|
||||
Pass in the required arguments for a payload, the enc type and the cmd,
|
||||
then a list of keyword args to generate the body of the load dict.
|
||||
'''
|
||||
payload = {'enc': enc}
|
||||
load = {'cmd': cmd}
|
||||
for key in kwargs:
|
||||
load[key: kwargs[key]]
|
||||
payload['load'] = load
|
||||
return payload
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue