do-community/do-ansible-inventory

Unable to set region/tag grouping to FALSE

Closed this issue · 3 comments

Environment: Ubuntu 18.04 LTS

do-ansible-inventory doesn't like being run with --group-by-region=FALSE and/or --group-by-tag=FALSE as per the docs here and the help text.

derek@host:~/ansible$ ./do-ansible-inventory --help
usage: do-ansible-inventory [<flags>]

Flags:
      --help               Show context-sensitive help (also try --help-long and --help-man).
  -t, --access-token=ACCESS-TOKEN
                           DigitalOcean API Token - if unset, attempts to use doctl's stored token of its current default context. env var:
                           DIGITALOCEAN_ACCESS_TOKEN
      --ssh-user=SSH-USER  default ssh user
      --ssh-port=SSH-PORT  default ssh port
      --tag=TAG            filter droplets by tag
      --ignore=IGNORE ...  ignore a Droplet by name, can be specified multiple times
      --group-by-region    group hosts by region, defaults to true
      --group-by-tag       group hosts by their Droplet tags, defaults to true
      --out=OUT            write the ansible inventory to this file
derek@host:~/ansible$ ./do-ansible-inventory --group-by-region=false
do-ansible-inventory: error: unexpected false, try --help
derek@host:~/ansible$ ./do-ansible-inventory --group-by-tag=false
do-ansible-inventory: error: unexpected false, try --help
derek@host:~/ansible$ ./do-ansible-inventory --group-by-region=FALSE --group-by-tag=FALSE
do-ansible-inventory: error: unexpected FALSE, try --help

Other args work fine, like tag:

derek@host:~/ansible$ ./do-ansible-inventory --tag north
   • no access token provided, attempting to look up doctl's access token
   • using doctl access token  context=default
   • only selecting tagged Droplets tag=north
   • processing                droplet=...

Note this behaves as expected when passed the complement --no-group-by-..., per Kingpin docs on bools

derek@host:~/ansible$ ./do-ansible-inventory --no-group-by-region --no-group-by-tag
   • no access token provided, attempting to look up doctl's access token
   • using doctl access token  context=default
   • processing                droplet=...

Good catch, thank you! 😄

Merged #2 which corrects the documentation.