mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-18 19:00:22 -07:00
callback plugins: use f-strings (#9321)
* callback plugins: use f-strings * add changelog frag * manual change for few occurrences * manual change for few occurrences * adjustment from review * adjustment from review * adjustment from review * Update plugins/callback/splunk.py Co-authored-by: Felix Fontein <felix@fontein.de> * replace str templating with JSON templating --------- Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
6e84c1375e
commit
c3ed2144e2
22 changed files with 251 additions and 253 deletions
|
@ -153,15 +153,14 @@ class SplunkHTTPCollectorSource(object):
|
|||
data['ansible_result'] = result._result
|
||||
|
||||
# This wraps the json payload in and outer json event needed by Splunk
|
||||
jsondata = json.dumps(data, cls=AnsibleJSONEncoder, sort_keys=True)
|
||||
jsondata = '{"event":' + jsondata + "}"
|
||||
jsondata = json.dumps({"event": data}, cls=AnsibleJSONEncoder, sort_keys=True)
|
||||
|
||||
open_url(
|
||||
url,
|
||||
jsondata,
|
||||
headers={
|
||||
'Content-type': 'application/json',
|
||||
'Authorization': 'Splunk ' + authtoken
|
||||
'Authorization': f"Splunk {authtoken}"
|
||||
},
|
||||
method='POST',
|
||||
validate_certs=validate_certs
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue