#!/bin/bash

# Source the detector script and compatibility layer
. /opt/cisco/etc/cisco_hf_agent.env

# Source the runtime compatibility layer (included in package)
. /opt/cisco/share/tortuga/scripts/container_runtime_compat.sh

function usage() {
    echo "$0 takes no option to launch Hyperfabric agent's terminal that facilitates debugging and configuration."
}

CONTAINER_NAME="cisco_hf_agent"

if [ $# -ne 0 ]; then
    usage
    exit 1
fi

if ! runtime_is_running "$CONTAINER_NAME"; then
    echo "Hyperfabric agent container is not running. Please make sure it's started first."
    exit 1
fi

runtime_exec "$CONTAINER_NAME" /opt/cisco/bin/tortuga/craft-console/main.sh
