salt.modules.http

Module for making various web calls. Primarily designed for webhooks and the like, but also useful for basic http testing.

New in version 2015.5.0.

salt.modules.http.query(url, **kwargs)

Query a resource, and decode the return data

Passes through all the parameters described in the utils.http.query function:

salt.utils.http.query(url, method='GET', params=None, data=None, data_file=None, header_dict=None, header_list=None, header_file=None, username=None, password=None, auth=None, decode=False, decode_type='auto', status=False, headers=False, text=False, cookies=None, cookie_jar=None, cookie_format='lwp', persist_session=False, session_cookie_jar=None, data_render=False, data_renderer=None, header_render=False, header_renderer=None, template_dict=None, test=False, test_url=None, node='minion', port=80, opts=None, backend=None, ca_bundle=None, verify_ssl=None, cert=None, text_out=None, headers_out=None, decode_out=None, stream=False, streaming_callback=None, header_callback=None, handle=False, agent='Salt/2019.2.8', hide_fields=None, raise_error=True, **kwargs)

Query a resource, and decode the return data

CLI Example:

salt '*' http.query http://somelink.com/
salt '*' http.query http://somelink.com/ method=POST             params='key1=val1&key2=val2'
salt '*' http.query http://somelink.com/ method=POST             data='<xml>somecontent</xml>'
salt.modules.http.update_ca_bundle(target=None, source=None, merge_files=None)

Update the local CA bundle file from a URL

New in version 2015.5.0.

CLI Example:

salt '*' http.update_ca_bundle
salt '*' http.update_ca_bundle target=/path/to/cacerts.pem
salt '*' http.update_ca_bundle source=https://example.com/cacerts.pem

If the target is not specified, it will be pulled from the ca_cert configuration variable available to the minion. If it cannot be found there, it will be placed at <<FILE_ROOTS>>/cacerts.pem.

If the source is not specified, it will be pulled from the ca_cert_url configuration variable available to the minion. If it cannot be found, it will be downloaded from the cURL website, using an http (not https) URL. USING THE DEFAULT URL SHOULD BE AVOIDED!

merge_files may also be specified, which includes a string or list of strings representing a file or files to be appended to the end of the CA bundle, once it is downloaded.

CLI Example:

salt '*' http.update_ca_bundle merge_files=/path/to/mycert.pem
salt.modules.http.wait_for_successful_query(url, wait_for=300, **kwargs)

Query a resource until a successful response, and decode the return data

CLI Example:

salt '*' http.wait_for_successful_query http://somelink.com/ wait_for=160