dropbox / dropbox/pynsot

Allow for display of unique values by attribute lookups

Open
#116 0 comments 1 reaction 0 assignees View on GitHub
enhancement
Dominant language
Python
Stars
46
Forks
22
PR merge metrics
No merged PRs in 30d

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:

``` bash
#!/bin/bash

SCRIPT_NAME=$0
HW_TYPE=$1

if [ $# -eq 0 ] ; then
echo -e "usage: ${SCRIPT_NAME} "
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 router
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.