From 210d33692291423aaeefdbfc7b692f4d30dfa891 Mon Sep 17 00:00:00 2001
From: Pawel Wieczorek
Date: Mon, 18 Dec 2017 20:02:03 +0100
Subject: [PATCH] DEMO: tame c&p; show results
Change-Id: I05b5e95d1d494196f547840dfc60663389ffb62a
---
demo/demo.sh | 23 ++++++++++++++++++-----
1 file changed, 18 insertions(+), 5 deletions(-)
diff --git a/demo/demo.sh b/demo/demo.sh
index 06c9f33..9ab43fe 100644
--- a/demo/demo.sh
+++ b/demo/demo.sh
@@ -2,31 +2,43 @@
#doitlive commentecho: true
export TYPE='type=application/octet-stream'
+export WELES_DB='/tmp/weles'
+
+job {
+ local JOB_DEF="$1"
+ curl -sL localhost:5010/api/v1/jobs/ -F "uploadfile=@${JOB_DEF};${TYPE}"
+}
+
cd demo
echo 'next up:'
#minimal job definition
cat mini.yml
curl -sL localhost:5010/api/v1/jobs/ -F "uploadfile=@mini.yml;$TYPE"
+ID=$(job 'mini.yml')
+cat "$WELES_DB/$ID/TESTFILE/results*"
echo 'next up:'
#pull file from target
cat pull.yml
-curl -sL localhost:5010/api/v1/jobs/ -F "uploadfile=@pull.yml;$TYPE"
+ID=$(job 'pull.yml')
+cat "$WELES_DB/$ID/TESTFILE/*info.ini"
echo 'next up:'
#push file to target
cat push.yml
-curl -sL localhost:5010/api/v1/jobs/ -F "uploadfile=@push.yml;$TYPE"
+curl -sL localhost:9090/echo_foo.sh
+ID=$(job 'push.yml')
echo 'next up:'
#run pushed script on the target
colordiff push.yml script.yml
-curl -sL localhost:5010/api/v1/jobs/ -F "uploadfile=@script.yml;$TYPE"
+ID=$(job 'script.yml')
+cat "$WELES_DB/$ID/TESTFILE/results*"
echo 'next up:'
#run jobs in parallel
-for JOB in `seq 1 3`; do curl -sL localhost:5010/api/v1/jobs/ -F "uploadfile=@demo/parallel.yml;$TYPE" | jq '.jobid' | tee -a jobids; done
+for JOB in `seq 1 3`; do job 'parallel.yml' | jq '.jobid' | tee -a jobids; done
echo 'next up:'
#cancel no longer necessary jobs
@@ -35,4 +47,5 @@ while read JOBID; do curl -sL -X POST "localhost:5010/api/v1/jobs/${JOBID}/cance
echo 'next up:'
#flash only necessary partitions
colordiff mini.yml parts.yml
-curl -sL localhost:5010/api/v1/jobs/ -F "uploadfile=@parts.yml;$TYPE"
+ID=$(job 'parts.yml')
+cat "$WELES_DB/$ID/TESTFILE/results*"
--
2.7.4