From 0755fa30b2118d9d4ddd9a0d23069d4a4474398c Mon Sep 17 00:00:00 2001 From: Andrea Lora Date: Mon, 8 Jul 2019 11:40:05 +0100 Subject: [PATCH] Update set_fact.sh to support multiple network Currently the role will fail to regather fact if $network_count > 1 That's because without the quotes echo will suppress the \n writing everything in one line. Thus wc -l will return `1`, confusing the file_content function that will lead to an incorrect json being produced --- files/set_facts.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/set_facts.sh b/files/set_facts.sh index 2b7ffe0..a111d59 100644 --- a/files/set_facts.sh +++ b/files/set_facts.sh @@ -6,7 +6,7 @@ NETWORKS=$(zerotier-cli listnetworks | tail -n+2) function file_content { if [ ! -z "$NETWORKS" ]; then - network_count=$(echo $NETWORKS |wc -l) + network_count=$(echo "$NETWORKS" |wc -l) counter=1 echo "{"