Floatyhelper

A CLI app for manipulating groups of VMs provisioned with vmpooler. Works on top of https://github.com/puppetlabs/vmfloaty

This was written to aid Puppet development teams with testing various configurations of Puppet Enterprise or other Puppet products. Groups of hosts can be added (either directly from a Beaker run from inside the pe_acceptance_tests folder it was run with, or manually with the --hosts flag) and given a "tag" to refer to the group of hosts by. These hosts can be snapshotted together, with these snapshots given a "snaptag" that can then be reverted to if needed.

The app will install vmfloaty for you and ensure your .vmfloaty.yml config file is correct. If no tokens are present in the file, it will request new tokens for you.

Installation

This app lives on RubyGems, so to install, simply run gem install floatyhelper

Usage

floatyhelper <command> <options>

The following commands are currently available:

floatyhelper config - Lists, gets, or sets floatyhelper configuration settings.

floatyhelper tags - List all currently tracked tags that specify groups of hosts.

floatyhelper list - List all VMs and their associated tags, and optionally checks the type and remaining lifetime for each VM.

floatyhelper check - Same as floatyhelper list --check.

floatyhelper snaplist <tag> - List all of the snaptags associated with the given VM group tag.

floatyhelper showconfig - Dumps the .floatyhelper.yaml file. Primarily used for debug purposes.

floatyhelper addhosts <tag> [--hosts HOST1,HOST2,...] [--file sutfile] - Takes all hosts defined in a beaker sut.log file and adds them to the list of hosts floatyhelper is tracking. These hosts will be grouped under the given tag, so that this tag can be used to operate on the whole set of hosts at once. If --file is not specified, this assumes you are inside a pe_acceptance_tests folder and grabs the list of hosts from log/latest/sut.log. If --hosts is specified, it will add the given comma-separated list of hosts.

floatyhelper movehost <host> <tag> - Moves a host between two different tags.

floatyhelper destroy <tag> [--all] [--hosts HOSTS] - Calls floaty delete on the vmpooler hosts with the given tag, or the given hosts, or all hosts managed by floatyhelper.

floatyhelper destroy_from_token - This destroys all hosts tied to your vmpooler token. Note that this does not currently remove the hosts from floatyhelper management. This is mostly a helper for when you have been using floaty directly to request VMs and you have some that are not managed by floatyhelper.

floatyhelper increaselife <tag> [options] - Increases the lifetime of the given host or tagged hosts. Defaults to the increaselife config setting value.

floatyhelper snapshot <host|tag> <snaptag> - Snapshots the given VM or group of tagged hosts, and defines a string to use as a snaptag to refer to this group of snapshots.

floatyhelper revert <host|tag> <snaptag> - Reverts the given VM or host group to the given snaptag.

floatyhelper refresh - Removes tags that contain only expired VMs. You may pass the -y argument to run non-interactively.

floatyhelper getvm [platform] [tag] - Request a VM from floaty, and add the host to the given tag. Defaults to centos-7-x86_64 if no platform is given, and defaults to "Unassigned" tag. If requesting a platform that is currently pooled, it will request it from vmpooler. Otherwise, it will request it from ABS (or if the --abs flag is used).

floatyhelper checktokens - Checks the tokens in .vmfloaty.yml and requests new ones if needed.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/puppetlabs/floatyhelper.

To build locally,

bundle install
bundle exec rake build

This will create the gem in the pkg directory. You can then install it locally with gem install.

Run specs with bundle exec rake spec and Rubocop with bundle exec rake rubocop. These will be run automatically by Travis on all PRs.

To release a new version, update lib/version.rb, then run bundle exec build release.

License

The gem is available as open source under the terms of the MIT License.