two_with_bash/lib/vpc.sh
GnomeZworc bb7dac65be
fix error in vpc creation
Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
2026-03-31 20:47:58 +02:00

36 lines
732 B
Bash

#!/bin/bash
. ./lib/db.sh
. ./lib/colors.sh
BINARY="/opt/two/bin/vpc"
function check_vpc_exist {
local vpc_name=${1}
/opt/two/bin/vpc -action "check" -name "${vpc_name}"
[ "$?" -eq "0" ] || return 1
return 0
}
function create_vpc {
local vpc_name="${1}"
check_vpc_exist "${vpc_name}"
[ "$?" -eq "0" ] && \
{
print_in_color "${COLOR_ORANGE}" "Would have create ${vpc_name}"
} || \
{
/opt/two/bin/vpc -action "check" -name "${vpc_name}"
print_in_color "${COLOR_GREEN}" "Create ${vpc_name}"
}
}
function delete_vpc {
local vpc_name="${1}"
print_in_color "${COLOR_RED}" "Delete ${vpc_name}"
/opt/two/bin/vpc -action "delete" -name "${vpc_name}"
}