Basic commandline tool to query foreman

I have finally had a little time to get back to my foreman CLI tool that can
query a Foreman server. If anyone is running Foreman, I would appreciate
comments.

At this point it supports the following features:

  • Can list any foreman collection
  • Can filter on the following
    collections: hosts, puppetclasses, fact_values, environments, hostgroups
  • Works with https and http (server url is a mandatory option)
  • Works with and without basic auth
  • has a verbose mode that shows the actual query string being sent to the
    foreman server
  • has an option to output the results in formatted JSON (defaults to
    non-JSON)

You can grab the script here: https://gist.github.com/1271734

Please all comments are welcome and ecouraged, as I'm trying to get it into
shape for submitting upstream. Mostly I want to get a sense if this is
useful to people, and if not what would make it useful. (In any case as it
is, it's a working example of ruby code that uses the foreman API). Please
note, that I know people want a commandline tool that can "write" data into
foreman and trigger provisioning tasks.

Here is the output of --help to give you an idea of what it does:

Usage: foreman-cli3 [options] …
-v, --verbose Output more information
-u, --user USER Foreman user
-p, --pass PASSWORD Foreman password
-s, --server URL Foreman Server URL
–json JSON output
–hosts [filter] Retreive a list of hosts
–puppetclasses [filter] Retreive a list of puppetclasses
–fact_values [filter] Retreive a list of fact_values
–environments [filter] Retreive a list of environments
–hostgroups [filter] Retreive a list of hostgroups
–architectures Retreive a list of architectures
–auth_source_ldaps Retreive a list of auth_source_ldaps
–common_parameters Retreive a list of common_parameters
–config_templates Retreive a list of config_templates
–domains Retreive a list of domains
–hypervisors Retreive a list of hypervisors
–lookup_keys Retreive a list of lookup_keys
–media Retreive a list of media
–operatingsystems Retreive a list of operatingsystems
–ptables Retreive a list of ptables
–reports Retreive a list of reports
–smart_proxies Retreive a list of smart_proxies
–subnets Retreive a list of subnets
–usergroups Retreive a list of usergroups
–users Retreive a list of users
–dashboard Not implemented
–status Not implemented
-h, --help Show this message

Thanks,
Brian

··· --