CORD-471 fixed so that spaces in the messages are handled
Change-Id: I1c9b253e17862d3728b31f5c31ae32a026e36d5a
diff --git a/roles/head-node/files/commands/cord-prov b/roles/head-node/files/commands/cord-prov
index e45059c..42e6fc3 100755
--- a/roles/head-node/files/commands/cord-prov
+++ b/roles/head-node/files/commands/cord-prov
@@ -40,15 +40,15 @@
esac
shift
done
- if [ $DO_JSON -eq 1 ]; then
+ if [ $DO_JSON -eq 1 ]; then
if [ $DO_MAP -eq 1 ]; then
- curl -sSL http://$CORD_HEAD_NODE:4243/provision/ | jq -c -M 'def STATUS: ["Unknown","Processing","Complete","Error"]; [ .[] | . | .status|=STATUS[.] ]'
+ curl -sSL http://$CORD_HEAD_NODE:4243/provision/ | jq -c -M 'def STATUS: ["Unknown","Processing","Complete","Error"]; [ .[] | . | .status|=STATUS[.] ]'
else
curl -sSL http://$CORD_HEAD_NODE:4243/provision/
fi
else
- for LINE in "ID,NAME,MAC,IP,STATUS,MESSAGE" $(curl -sSL http://$CORD_HEAD_NODE:4243/provision/ | jq 'def STATUS: ["Unknown","Processing","Complete","Error"]; .[] | . | .status|=STATUS[.] | .request.Info.id+","+.request.Info.name+","+.request.Info.mac+","+.request.Info.ip+","+.status+","+.message'); do
- echo $LINE | sed -e 's/^"//;s/"$//'
+ for LINE in "ID,NAME,MAC,IP,STATUS,MESSAGE" $(curl -sSL http://$CORD_HEAD_NODE:4243/provision/ | jq 'def STATUS: ["Unknown","Processing","Complete","Error"]; .[] | . | .status|=STATUS[.] | .request.Info.id+","+.request.Info.name+","+.request.Info.mac+","+.request.Info.ip+","+.status+","+.message' | sed -e 's/ /__SPACE__/g'); do
+ echo $LINE | sed -e 's/__SPACE__/ /g' -e 's/^"//;s/"$//'
done | column -s , -t
fi
;;
@@ -99,7 +99,7 @@
if [ $? -ne 0 ]; then
echo "$i, , , ,Not Found"
else
- echo "$VALUE" | jq 'def STATUS: ["Unknown","Processing","Complete","Error"]; . | .status|=STATUS[.] | .request.Info.id+","+.request.Info.name+","+.request.Info.mac+","+.request.Info.ip+","+.status+","+.message'| sed -e 's/^"//;s/"$//'
+ echo "$VALUE" | jq 'def STATUS: ["Unknown","Processing","Complete","Error"]; . | .status|=STATUS[.] | .request.Info.id+","+.request.Info.name+","+.request.Info.mac+","+.request.Info.ip+","+.status+","+.message'| sed -e 's/^"//;s/"$//'
fi
fi
done | column -s , -t