This commit adds an option `--json` to the list and delete commands. When the
json flag is used the commands will print output as formatted JSON rather than
pretty printed strings.
This moves the instance of the logger class to a class variable in the
`FloatyLogger` class and provides three class methods to log with in the
rest of the project `FloatyLogger.info`, `FloatyLogger.warn`, and
`FloatyLogger.error`.
This commit adds support for provisioning instances on demand with
vmpooler. Additionally, this change adds a capability to detect on
demand pools available in ABS. Without this change vmfloaty does not
support provisioning instances via the vmpooler ondemand endpoints.
This option will return structured output from `floaty get`, which is
easier to parse in some cases.
Example output:
```json
{
"centos-7-x86_64": [
"hpfhhf5aqxowfd8.delivery.puppetlabs.net",
"k65euywltpz9fz0.delivery.puppetlabs.net"
],
"centos-6-x86_64": [
"oahunrurl7xis05.delivery.puppetlabs.net"
]
}
```
Instead of having a hardcoded version identifier in multiple
locations, we can leverage the Classname::VERSION pattern to have a
single canonical version number that everything can reference
programmatically.
Prior to this commit, a user could easily steam roll vmpooler by
accidentally adding an extra digit to their get request:
$ floaty get centos=100
Accidentially hitting enter on this would completely drain a centos
pool.
This commit updates that bevaior to force users to use the --force flag
if they really want to get more than 5 vms per template. 5 was choosen
because most vm pools at Puppet were in the 5-10 range.
Previously, `floaty status` would simply pretty-print the JSON output of
the status request to the pooler. That data requires additional
parsing, either human or machine, in order to be able to deduce any
meaningful information about the state of the pooler.
This commit updates `floaty status` to visually represent the state of
pools, indicating which pools have nodes missing or being built. It also
prints the status summary message returned by the pooler, providing an
easy way to tell if everything is okay.
By default, this command will only show the state of pools that aren't
full. If `--verbose` is passed, it will show all pools. If the complete
status information provided by the API is desired, the `--json` option
will print the raw JSON output, preserving the previous functionality.
This also updates the status command to exit non-zero if the status is
not ok.
Prior to this commit, you could only modify 1 host at a time with the
floaty modify command. This commit updates that command to allow users
to modify either all known token vms, or vms passed in as a comma
separated list.
Vmpooler works by generating a snapshot sha and queueing
the host for taking a snapshot. Depending on the load of
vmpooler, this could take quite a while to complete
making it a little confusing to users trying to use that
snapshot name right away. This commit adds a warning to
the snapshot command about taking snapshots.
Prior to this commit, the Pooler class would raise an exception if the
token provided was nil and it attempted to make a request with Faraday.
This fixes that by catching when nil tokens are provided and instead
raising a TokenError to be caught by the consumer.
This commit updates the Auth class to properly raise an error when
something goes wrong. It also updates the vmpooler command class to
handle when those errors get raised.
Prior this commit, some commands did not accept some options as an
argument and instead only worked through a flag. This commit updates
that behavior to allow users to specify some options through arguments,
while leaving the ability to continue to specify those options through
flags. Command line arguments take precedence over flags. It also fixes
an issue where if a snapshot sha was nil, it would submit a request to
take a snapshot to vmpooler.
This commit cleans up the Auth class so that it no longer system exits
if an error occurs. Instead it will return nil if it could not properly
make the request, and it's on the consumer of the class to handle
error cases.