Skip to content

Add ability for kathara exec to return same status code as executed command #292

@Thomas-McKanna

Description

@Thomas-McKanna

Related Bug

No response

Feature Description

I've been starting to use Kathara to build out labs for some training seminars, and I love the tool. One problem I have encountered is grading/checking student environments. It would be nice if there was a simple way that students could check if their changes to the Kathara configuration are correct. I was hoping to use kathara exec to run commands on various devices to do the checking, using the exit code of the command to determine whether or not the check passed. But it seems that kathara exec always returns a status code of 0, even if the command executed on the device did not return a status code of 0.

My feature suggestion is to add a flag or make it the default behavior such that kathara exec returns the same status code as the command which was executed on the device.

As an example, I'd like to writer a checker script that looks something like this:

#!/bin/bash

katahara exec mydevice "ping -c 1 10.10.1.1"

if [ $? -eq 0 ]; then
    echo "Problem 1: Passed"
else
    echo "Problem 1: Failed"
    exit 1
fi

If there is another preferred way to check lab configurations, this would be good to put in the wiki. But I wasn't able to find any content about it.

Solution

No response

Alternative Solutions

No response

Additional Context

No response

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions