Commit graph

116 commits

Author SHA1 Message Date
Samuel Beaulieu
a3d8484124 (DIO-908) Floaty can now report the status of ABS requests
- If ABS queries returns a body for 200 or 202, floaty will print it
this is useful in the new version of ABS, since it shows the progress
for ondemand requests (AWS or vmpooler)
- removed the queue_place and querying the queue for a 'get' request
this queue_place number was misleading since it was just a redis index
and did not represent well where the request was in the queue
- Also added a flag option --continue to be used when the cli was
interrupted for example with ctrl-c
2021-02-09 11:29:19 -06:00
Jesse Scott
b31f44fb40
Add --hostnameonly option to floaty list --active
Adds an option to the `floaty list` subcommand so that, when listing
active hosts, floaty will output just the hostnames, without any
additional information or formatting. Hostnames will be separated by a
newline.

This functionality is primarily intended for consuming by tooling (such
as the tab completion scripts).
2020-09-21 16:55:07 -07:00
9e61247cfe
Add service command
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.
2020-09-16 12:55:42 -04:00
Samuel Beaulieu
dbf6c54173 The main goal for this PR is to enable using all of the vmfloaty scenarios when
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
2020-09-11 13:38:24 -05:00
Nate Wolfe
9a44cc480e
(maint) Add --user CLI option on delete and list subcommands
To support usage without a configuration file.
2020-08-24 12:11:06 -07:00
Nate Wolfe
8341a5f45d
(maint) Mention configuration file in CLI help text description
So users can be aware of the configuration file since it will no
longer be emitted as a warning during CLI invocation.
2020-08-21 15:45:10 -07:00
Sean P. McDonald
d22e2b4194
(new-feature) Add json option to list/delete command
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.
2020-08-12 16:13:58 -05:00
Austin Blatt
35faeab6be Move logger instance to class var in FloatyLogger
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`.
2020-08-12 09:57:18 -07:00
barriserloth
8ec90007ca Use Logger for non-result output
This adds the Logger class for log output, all of which goes to STDERR,
and uses puts to send only the command result to STDOUT.
2020-08-11 12:41:22 -07:00
Austin Blatt
4755343df2 Print all non-success output to STDERR 2020-08-10 16:20:25 -07:00
kirby@puppetlabs.com
05a133fc72 Add support for ondemand provisioning to vmfloaty
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.
2020-08-04 11:24:11 -07:00
28fb9290d4
Update docs
This chane updates docs to reflect that ownership has moved to the DIO
team at Puppet. It also includes some formatting changes.
2020-07-02 12:52:32 -04:00
Brandon High
51a7eb809e
(QENG-7604) Add support for Job IDs to ABS delete
This commit adds support for passing in a JobID when deleting with ABS.
2020-01-27 14:17:06 -08:00
Brandon High
1e67715e2c
Fix rubocop issues 2019-12-04 16:40:57 -08:00
Mikker Gimenez-Peterson
d963e357d3 Adding delete and get active requests 2019-12-04 11:37:17 -08:00
Mikker Gimenez-Peterson
a77ea84092 Rebasing fixed tests 2019-10-31 14:25:47 -07:00
Tim Sharpe
6e1f626d7b (rubocop) Fix Style/IfUnlessModifier 2019-02-03 15:40:17 +11:00
Tim Sharpe
e50d4b3259 (rubocop) Fix Naming/HeredocDelimiterNaming 2019-02-03 13:27:25 +11:00
Tim Sharpe
2a05f0d976 (rubocop) Fix Lint/ScriptPermission 2019-02-03 13:18:24 +11:00
Tim Sharpe
851009b1f6 (rubocop) Fix Layout/AlignHash & Layout/IndentHash 2019-02-03 13:08:00 +11:00
Tim Sharpe
f2167f8be7 (rubocop) Fix Layout/CaseIndentation 2019-02-03 12:59:34 +11:00
Tim Sharpe
9afae18ee2 (rubocop) Fix Layout/SpaceAfterComma 2019-02-03 12:48:04 +11:00
Tim Sharpe
cecea8bc05 (rubocop) Fix Layout/SpaceAfterNot 2019-02-03 12:47:16 +11:00
Tim Sharpe
fd753ba188 (rubocop) Fix Layout/SpaceBeforeBlockBraces 2019-02-03 12:34:24 +11:00
Tim Sharpe
7cd0256a97 (rubocop) Fix Layout/SpaceInsideBlockBraces 2019-02-03 12:28:17 +11:00
Tim Sharpe
58f64b2843 (rubocop) Fix Style/TrailingCommaInHashLiteral 2019-02-03 12:22:41 +11:00
Tim Sharpe
7bafee35a7 (rubocop) Fix Style/IfUnlessModifier 2019-02-03 12:22:41 +11:00
Tim Sharpe
79f764560d (rubocop) Fix Style/AndOr 2019-02-03 12:22:41 +11:00
Tim Sharpe
fcf7154a8b (rubocop) Style/HashSyntax to use hash_rockets for consistency 2019-02-03 12:22:41 +11:00
Tim Sharpe
e0cbf89b8f (rubocop) Fix Style/FrozenStringLiteralComment 2019-02-03 12:22:41 +11:00
Tim Sharpe
1272343cdd (rubocop) Fix Style/StringLiterals 2019-02-03 10:42:28 +11:00
Nick Lewis
50eeb8f265 Add --json option for floaty get
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"
  ]
}
```
2018-01-02 10:23:54 -08:00
Casey Williams
ca5b0f5e8b Integrate nonstandard pooler service into vmfloaty 2017-10-12 12:53:04 -07:00
Casey Williams
e78bcc6216 Allow configuration of multiple services 2017-09-25 15:23:10 -07:00
Jesse Scott
6d57a1b5df Add basic bash completion script and framework for others 2017-07-27 11:27:16 -07:00
Brian Cain
5fa65b6400 Merge branch 'master' of github.com:briancain/vmfloaty 2017-03-14 08:58:51 -07:00
Brian Cain
cfbad921ce (maint) Be clearer about which password to use 2017-03-14 08:58:28 -07:00
Ryan McKern
5c794cd2b0 Use the Classname::VERSION pattern
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.
2017-03-01 14:02:58 -08:00
Brian Cain
313742ebfd Use actual hostname when creating snapshots in warn msg 2016-12-16 11:21:20 -08:00
Brian Cain
82afa94b6e Properly check for large pool size requests 2016-12-14 11:04:51 -08:00
Brian Cain
c9b718b379 (#40) Require a --force flag when users request large pools
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.
2016-12-08 21:26:14 -08:00
Brian Cain
345300f58a (#41) Improve help text for vmfloaty
General clean up of the text around the --help flag for all vmfloaty
commands.
2016-12-08 21:15:01 -08:00
Brian Cain
b023339516 Move pretty status printing to Utils namespace and out of commands 2016-12-06 11:21:21 -08:00
Nick Lewis
7ee73083fd Show the status of pools with floaty status
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.
2016-12-02 13:47:58 -08:00
Brian Cain
a6ff0515d3 Raise TokenError if none provided to Pooler.delete 2016-11-14 09:49:23 -08:00
Brian Cain
97e188cf6d (#36) Update floaty modify command to work with multiple hosts
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.
2016-11-12 14:25:08 -08:00
Brian Cain
586f4f5c05 Abstract out getting all active token vms into Utils 2016-11-12 13:59:26 -08:00
Brian Cain
414ac22f40 (#37) floaty snapshot warns users about snapshots pending
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.
2016-11-12 13:39:16 -08:00
Brian Cain
b51a549fe5 (#34) Raise TokenError on operations that require tokens
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.
2016-10-07 18:10:52 -07:00
Brian Cain
c9e582c24a (maint) Catch TokenError from Auth class 2016-09-24 13:34:28 -07:00