[API] Add API to vms (#2021)

* add API to debian-vm.sh

* [API] Add API calls to VMs

* [API] Add API calls to VMs

* [API] Add API calls to VMs

* [API] Add API calls to VMs

* [API] Add API calls to VMs

* debian-vm.sh

Co-authored-by: bvdberg01 <74251551+bvdberg01@users.noreply.github.com>

* updates

---------

Co-authored-by: bvdberg01 <74251551+bvdberg01@users.noreply.github.com>
Co-authored-by: Rögl-Brunner Michel <Michel.Roegl-brunner@htl-braunau.int>
This commit is contained in:
Michel Roegl-Brunner
2025-02-10 09:13:09 +01:00
committed by GitHub
parent b9094e306e
commit a481e89cad
13 changed files with 215 additions and 17 deletions

View File

@ -46,6 +46,9 @@ EOF
post_to_api_vm() {
if [[ ! -f /usr/local/community-scripts/diagnostics ]]; then
return
fi
DIAGNOSTICS=$(grep -i "^DIAGNOSTICS=" /usr/local/community-scripts/diagnostics | awk -F'=' '{print $2}')
if ! command -v curl &> /dev/null; then
return
@ -55,7 +58,6 @@ post_to_api_vm() {
return
fi
if [ -z "$RANDOM_UUID" ]; then
return
fi
@ -114,8 +116,8 @@ EOF
)
RESPONSE=$(curl -s -o response.txt -w "%{http_code}" -L -X POST "$API_URL" --post301 --post302 \
-H "Content-Type: application/json" \
-d "$JSON_PAYLOAD") || true
-H "Content-Type: application/json" \
-d "$JSON_PAYLOAD") || true
POST_UPDATE_DONE=true
}