-
Notifications
You must be signed in to change notification settings - Fork 22
Open
Labels
Description
There needs to be a way to display unique attribute values based on an attribute lookup. For example if you have Device.model and Device.hw_type and want to lookup all unique device model values for a given hw_type.
This is not currently possible.
For single values it's as easy as nsot values list -r device -n model (all unique models).
This hard-coded one-liner solves the problem, but let's come up w/ a way to do it officially and not hard-codedly:
#!/bin/bash
SCRIPT_NAME=$0
HW_TYPE=$1
if [ $# -eq 0 ] ; then
echo -e "usage: ${SCRIPT_NAME} <hw_type>"
exit 1
fi
CMD="nsot devices list -a 'hw_type=${HW_TYPE}' -g | egrep ' model=' | awk '{print \$2}' | sort | uniq | awk -F'=' '{print \$2}'"
eval $CMD
# Example usage:
# ./models_by_type routerReactions are currently unavailable