#!/bin/bash
# Copyright (C) 2023 Rusbitech-Astra <support@rusbitech.ru>

if [[ $# -lt 1 ]]; then
    echo "Usage:
    brest-kub-ctl <command> [arguments]

    Sends command to Brest-Kub socket server.
    See:
        brest-kub-ctl help
        to list available commands
    cluster - is a configuration name for a particular cluster, 'default' selected if not set.

    files:
        inventory.ini - configuration for ansible playbooks
        sources.list - reprository config which will be applied for all hosts
        hosts.env - configuration layer for service scripts"
    exit 0
fi

if [[ -z $KUB_LIB ]]; then
    export KUB_LIB="/var/lib/brest-kub"
fi

source "${KUB_LIB}/scripts/init-user-env.sh"

send_command_to_server $*
