summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorScott Moser <smoser@brickies.net>2017-05-18 13:19:14 -0400
committerScott Moser <smoser@brickies.net>2017-05-24 13:54:05 -0400
commit13673f8d2b815452aa22f8e3811e04481558a731 (patch)
tree38fe0b465904794309cde77d2e5345c98c96c799 /tools
parent6b5369be71054a677b89fa8080f7ddd029ce4986 (diff)
downloadvyos-cloud-init-13673f8d2b815452aa22f8e3811e04481558a731.tar.gz
vyos-cloud-init-13673f8d2b815452aa22f8e3811e04481558a731.zip
fix tools/ds-identify to not write None twice.
If the user configured: datasource_list: ["Ec2", "None"] then ds-identify would write datasource_list: ["Ec2", "None", "None"] which would break the logic to avoid warning.
Diffstat (limited to 'tools')
-rwxr-xr-xtools/ds-identify9
1 files changed, 5 insertions, 4 deletions
diff --git a/tools/ds-identify b/tools/ds-identify
index aff26eb6..74d26537 100755
--- a/tools/ds-identify
+++ b/tools/ds-identify
@@ -963,10 +963,11 @@ found() {
# do not pass an empty line through.
shift
fi
- # always write the None datasource last.
- if [ "$list" != "None" ]; then
- list="${list:+${list}, }None"
- fi
+ # if None is not already in the list, then add it last.
+ case " $list " in
+ *\ None,\ *|*\ None\ ) :;;
+ *) list=${list:+${list}, None};;
+ esac
write_result "datasource_list: [ $list ]" "$@"
return
}