This change creates the `floaty service` command with two valid
arguemnts: types and examples
- `floaty service types` prints out a list of valid types for use in a
service definition in ~/.vmfloaty.yml
- `floaty service examples` prints out example configuration files for
both a single service and multiple services.
the service is set to ABS. Since ABS does not implement all the services, it
fallsback on vmpooler when needed (example increasing the lifetime value)
- Validating JSON can be parsed before parsing, as it used to throw uncaught errors
- self.list_active is returning hosts for both nspooler and vmpooler but was returning
job_ids for abs. Now standardized the returned values for use in the "modify" cli,
and created a separate list_active_job_ids for the cases where a job_id list is expected
- added a way to change the service in place for methods that do not make sense
for ABS, and instead fallback on using vmpooler in those cases:
1. summary
2. modify
3. snapshot
4. revert
5. disk
For those methods in the class itself, raising a NoMethodError, in case it is used directly
- query now returns the queue info. For information on VMs, users should use --service vmpooler
- pretty_print_hosts (used in list, and delete scenarios) will now print the job_id
ABS information and indent each VM within and print it's metadata. Useful for
knowing the running time and extending it.
- added a new utility method to get the config for the vmpooler service, used for the fallback
- added a passthrough for the vmpooler token to use when running ABS. This enables
vmpooler to track the VMs used by each token (user). Also aligns the list between
both ABS and vmpooler. Fixes the bit-bar issue where the VMs do not appear when created
via ABS
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.