Update set_fact.sh to support multiple network #31
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently the role will fail to regather fact if there is more than 1 zerotier network configured
NETWORKS=$(zerotier-cli listnetworks | tail -n+2) will rightly contain the data with
\n
But without the quotes echo will suppress the
\n
writing everything in one line.Thus
wc -l
will return1
, confusing the file_content function that will lead to an incorrect json being producedHow to reproduce?
Without the fix, try to setup a second zerotier network - You will see that the regather fact step will fail, leading to no authorization of the node (as it cannot get the right fact)
If you inspect
/etc/ansible/facts.d/zerotier.fact
you will see that the json is malformed, the first network will fulfillansible-role-zerotier/files/set_facts.sh
Line 21 in c7aae63
ansible-role-zerotier/files/set_facts.sh
Line 23 in c7aae63