Changes to Config File Logic
This commit is contained in:
parent
9bf653e876
commit
97d4a02555
@ -706,12 +706,9 @@ config_file() {
|
|||||||
msg_error "Invalid Container ID range. The first number must be smaller than the second number, was ${CT_ID}"
|
msg_error "Invalid Container ID range. The first number must be smaller than the second number, was ${CT_ID}"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
LIST_OF_IDS=""
|
|
||||||
OUTPUT=$(pvesh get /cluster/resources --type vm --output-format json 2>/dev/null) || true
|
LIST_OF_IDS=$(pvesh get /cluster/resources --type vm --output-format json 2>/dev/null | grep -oP '"vmid":\s*\K\d+') || true
|
||||||
if [[ -n "$OUTPUT" ]]; then
|
if [[ -n "$LIST_OF_IDS" ]]; then
|
||||||
LIST_OF_IDS=$(echo "$OUTPUT" | grep -oP '"vmid":\s*\K\d+')
|
|
||||||
fi
|
|
||||||
if [[ ! -z "$LIST_OF_IDS" ]]; then
|
|
||||||
for ((ID = MIN_ID; ID <= MAX_ID; ID++)); do
|
for ((ID = MIN_ID; ID <= MAX_ID; ID++)); do
|
||||||
if ! grep -q "^$ID$" <<<"$LIST_OF_IDS"; then
|
if ! grep -q "^$ID$" <<<"$LIST_OF_IDS"; then
|
||||||
CT_ID=$ID
|
CT_ID=$ID
|
||||||
@ -723,11 +720,7 @@ config_file() {
|
|||||||
|
|
||||||
elif [[ "$CT_ID" =~ ^[0-9]+$ ]]; then
|
elif [[ "$CT_ID" =~ ^[0-9]+$ ]]; then
|
||||||
echo "Befor LIST_OF_IDS"
|
echo "Befor LIST_OF_IDS"
|
||||||
LIST_OF_IDS=""
|
LIST_OF_IDS=$(pvesh get /cluster/resources --type vm --output-format json 2>/dev/null | grep -oP '"vmid":\s*\K\d+') || true
|
||||||
OUTPUT=$(pvesh get /cluster/resources --type vm --output-format json 2>/dev/null) || true
|
|
||||||
if [[ -n "$OUTPUT" ]]; then
|
|
||||||
LIST_OF_IDS=$(echo "$OUTPUT" | grep -oP '"vmid":\s*\K\d+')
|
|
||||||
fi
|
|
||||||
if [[ -n "$LIST_OF_IDS" ]]; then
|
if [[ -n "$LIST_OF_IDS" ]]; then
|
||||||
|
|
||||||
if ! grep -q "^$CT_ID$" <<<"$LIST_OF_IDS"; then
|
if ! grep -q "^$CT_ID$" <<<"$LIST_OF_IDS"; then
|
||||||
|
Loading…
x
Reference in New Issue
Block a user