WaitForKey
A simple loop to inspect the context for a specific key. If the key is not found after "iterations" loops, the script exits with a message.
python · xMatters
Details
| ID | WaitForKey |
|---|---|
| Language | python |
| From Version | 5.0.0 |
| Docker Image | demisto/python3:3.12.13.10116658 |
README
Waits for a context value to appear in the incident or 10 loops and exits.
Script Data
| Name | Description |
|---|---|
| Script Type | python |
| Tags | utility |
Dependencies
This script uses the following commands and scripts.
- sleep
Inputs
| Argument Name | Description |
|---|---|
| context_key | The incident context key to check for value |
| iterations | The maximum number of loops (and seconds) to wait before exiting if the context isn’t found. |
Outputs
There are no outputs for this script.
# Test runner for WaitForKey import demistomock as demisto from WaitForKey import main def test_main(mocker): """Tests WaitForKey script :param mocker: :return: """ mocker.patch.object(demisto, "args", return_value={"context_key": "XMatters.UserResponseOut", "iterations": "5"}) context1 = {"XMatters.UserResponseOut": "Ban Host"} mocker.patch.object(demisto, "context", return_value=context1) main() # If we got here we're good. assert True