Commit 40e87162 authored by Maarten de Waard's avatar Maarten de Waard 👼
Browse files

really use hostname that is extracted for ping

parent 799a1fec
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -105,10 +105,10 @@ setup_mapping()
    notify_command="curl -X POST -H \"Authorization: Bearer $api_key\" -H \"Content-Type: application/json\" -d '{\"template\":\"ENCVMBOOTED\",\"HOSTNAME\":\"$(hostname)\",\"identifier\":\"instance-$instance_id\"}' $cosmos_url/api/v2/communication/sendmessage"

    timeout=6
    url=$(echo $url | sed -e 's/http[s]*:\/\/\([^:/]*\).*/\1/i')
    hostname=$(echo $cosmos_url | sed -e 's/http[s]*:\/\/\([^:/]*\).*/\1/i')

    # Wait until API is reachable (network interface = up)
    wait_for_connection $cosmos_url $timeout
    wait_for_connection $hostname $timeout

    # Start cryptops API even if API is not reachable, because the only problem
    # is the user would not get notified of startup.