Floatyhelper
A CLI app for manipulating groups of VMs provisioned with vmpooler. Works on top of https://github.com/briancain/vmfloaty
This was written to aid the installer and management team with testing various configurations of Puppet Enterprise. 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.
NOTE: This requires that you have already set up your .vmfloaty file with the appropriate token. The app currently does not check that this is the case.
This tool could use some specs and linting, probably.
Installation
Add this line to your application's Gemfile:
gem 'floatyhelper'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install floatyhelper
Usage
floatyhelper <command> <options>
The following commands are currently available:
floatyhelper tags - List all currently tracked tags that specify groups of hosts
floatyhelper list - List all VMs and their associated tags, and checks the remaining lifetime for each VM. If --nocheck is passed, lifetime checking will not occur.
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 lsit of hosts from log/latest/sut.log. If --hosts is specified, it will add the given comma-separated list of hosts.
floatyhelper appendhosts <tag> [--hosts HOST1,HOST2,...] [--file sutfile] - Similar to the addhosts command, but adds the given hosts to the list of hosts tracked under a given tag.
floatyhelper destroy <tag> [--all] [--hosts HOSTS] - Calls floaty delete on the vmpooler hosts with the given tag.
floatyhelper increaselife <tag> [options] - Increases the lifetime of the given host or tagged hosts. Defaults to 100 hours.
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.
floatyhelper movehost <host> <tag> - Moves the given host from its existing tag to the given tag
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/nmburgan/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.
License
The gem is available as open source under the terms of the MIT License.
Changelog
0.9
- First release
1.0
- Added refresh command
- Added getvm command
- Added movehost command
- Added functionality to check for remaining VM lifetime with the list command
- Added --nocheck option for list command to prevent checking VM lifetime
- Tag automatically added if appendhosts is used with a tag that doesn't exist