def verify_rsp(rsp: platform.ShellServiceResponse,
expected_rsp_statuscodes: list[int] = [200],
expected_rsp_returncodes: list[int] = [0],
contains_stderr_ok: bool = True) -> None
Utility method to verify the ShellServieResponse is in the desired state and raise exceptions if not.
Arguments:
rsp
platform.ShellServiceResponse - the rsp to verifyexpected_rsp_statuscodes
list[int], optional - the http response code returned by the process/shell service API, not the same as the bash return code. Defaults to [200].expected_rsp_returncodes
list[int], optional - the shell return code. Defaults to [0].contains_stderr_ok
bool, optional - if the presence of stderr is considered to be OK. This is expect for many CLI tools. Defaults to True.
Raises:
ValueError
- indicates the presence of an undesired value in the response object
def from_json(json_str: str)
Wrapper keyword for json loads
Arguments:
json_str
str - json string blob
Returns:
any
- the loaded json object
def to_json(json_data: any)
Wrapper keyword for json dumps
Arguments:
json_data
any - json data
Returns:
str
- the str representation of the json blob
def filter_by_time(list_data: list,
field_name: str,
operand: str = "filter_older_than",
duration_str: str = "30m")
Utility keyword to iterate through a list of dictionaries and remove list entries where the specified key datetime is older than the given duration string.
Arguments:
list_data
list - list of dictionaries to filterfield_name
str - what key to use for comparisonsoperand
str, optional - Defaults to "filter_older_than".duration_str
str, optional - Duration string in the form of 3d2h1s. Defaults to "30m".
Returns:
_type_
- description
def escape_str_for_exec(string: str, escapes: int = 1) -> str
Simple helper method to escape specific characters that cause issues in the pod exec passthrough
Arguments:
string
str - original string for exec passthrough
Returns:
str
- string with triple escaped quotes for passthrough
@dataclass
class IssueCheckResults()
Used to keep function signatures from getting too busy when passing issue data around.