Skip to content

freifunkh/resolve.py

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 

Repository files navigation

resolve.py

A nodes.json command line data tool

usage: resolve [-h] [-f MAC/IPv6/HOSTNAME/BRANCH/FW_VERSION] [-m MODEL] [-q QUERY]
               [-c] [-i NAME] [--gen-bat-hosts]

options:
  -h, --help            show this help message and exit
  -f MAC/IPv6/HOSTNAME/BRANCH/FW_VERSION
                        filter for specific nodes
  -m MODEL              filter for specific nodes by hardware model
  -q QUERY              filter nodes by querying for specific information. e.g.
                        specify -q "hostname=foobar" to query for hosts named
                        "foobar" or -q "hostname~foo" to query hosts whose name
                        contains "foo". You can query for all information, that is
                        available (hostname, model, secondary-mac, autoupdater_en,
                        ...). Negating queries is possible using "!=" or "!~".
  -c                    try to use cached nodes json (from previous run of this
                        tool)
  -i NAME               display only a single information machine readable
  --gen-bat-hosts       generate a /etc/bat-hosts file

A relatively interesting query would be:

lemoer@orange ~/d/f/g/resolve (master)> resolve -q "firmware_rel~wg-pr" -q "autoupdater_en=true" -q autoupdater_br=stable -i firmware_rel | sort | uniq -c
Downloading data from https://harvester.ffh.zone/api/nodes.json...
      2 vH21.10-wg-pr_freeze_week
      1 vH21.11-wg-pr
      7 vH21.12-wg-pr
      1 vH21.14-wg-pr
     47 vH21.15-wg-pr
      1 vH21.1-wg-pr
      2 vH21.8-wg-pr-resp

It fetches all nodes which

  • have a firmware release containing the string "wg-pr"
  • and have the autoupdater enabled
  • and have the autoupdater branch set to stable and returns the firmware release of all those nodes. The | sort | uniq -c is then used to count them.

Releases

No releases published

Packages

No packages published

Languages