From 8eb892971ffb6e04d68324875e294ddbe29019bc Mon Sep 17 00:00:00 2001 From: Maarten de Waard Date: Fri, 6 Oct 2017 14:33:48 +0200 Subject: [PATCH 1/3] add notify-command to cryptops-api call --- build/scripts/local-top/cryptroot-api | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/build/scripts/local-top/cryptroot-api b/build/scripts/local-top/cryptroot-api index 0e871b2..c796b26 100755 --- a/build/scripts/local-top/cryptroot-api +++ b/build/scripts/local-top/cryptroot-api @@ -87,7 +87,28 @@ setup_mapping() fifoPath="/tmp/cryptops-api-stop" mkfifo $fifoPath - cryptops-api "$rootdevice" "$crypttarget" + + for x in $(cat /proc/cmdline); do + case "$x" in + instance_id=*) + instance_id="${x#instance_id=}" + ;; + cosmos_url=*) + cosmos_url="${x#cosmos_url=}" + ;; + api_key=*) + api_key="${x#api_key=}" + ;; + esac + done + + 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" + + + cryptops-api "$rootdevice" "$crypttarget" --notify-command="$notify_command" #FSTYPE='' #eval $(fstype < "$NEWROOT") -- GitLab From ca021d95a73ff98e7221b01b4e648b6221f08013 Mon Sep 17 00:00:00 2001 From: Maarten de Waard Date: Fri, 6 Oct 2017 14:38:58 +0200 Subject: [PATCH 2/3] change variables to capitalized variables --- build/scripts/local-top/cryptroot-api | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/scripts/local-top/cryptroot-api b/build/scripts/local-top/cryptroot-api index c796b26..4fdafc0 100755 --- a/build/scripts/local-top/cryptroot-api +++ b/build/scripts/local-top/cryptroot-api @@ -104,7 +104,7 @@ 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\\\"}' + -d '{\\\"template\\\":\\\"ENCVMBOOTED\\\",\\\"HOSTNAME\\\":\\\"$(hostname)\\\",\\\"identifier\\\":\\\"instance-$instance_id\\\"}' ${cosmos_url}/api/v2/communication/sendmessage" -- GitLab From 6cb6f2461caee5ff8691a74647f287c67b1aba33 Mon Sep 17 00:00:00 2001 From: Maarten de Waard Date: Fri, 6 Oct 2017 15:39:09 +0200 Subject: [PATCH 3/3] uniform bracketing in cryptroot-api --- build/scripts/local-top/cryptroot-api | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/scripts/local-top/cryptroot-api b/build/scripts/local-top/cryptroot-api index 4fdafc0..f924550 100755 --- a/build/scripts/local-top/cryptroot-api +++ b/build/scripts/local-top/cryptroot-api @@ -105,7 +105,7 @@ 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" + $cosmos_url/api/v2/communication/sendmessage" cryptops-api "$rootdevice" "$crypttarget" --notify-command="$notify_command" -- GitLab