Commit graph

1060 commits

Author SHA1 Message Date
Brandon High
367565a3ee
Switch from casting to_f to using fdiv dividing floats
This commit updates places where previously we were casting both terms
in a float division into floats in order to ensure that float division
occurs to use the `fdiv` method, which will always do float division and
is available on both `Floats` and `Integers` because they are
both `Numeric`.
2020-03-05 16:56:06 -08:00
Brandon High
532ca96131
Ignore set_linked_clone for Naming/AccessorMethodName
This commit ignores the `set_linked_clone` method, which doesn't obey
the Rubocop recommended method naming convention.
2020-03-05 16:56:06 -08:00
Brandon High
f1f173ddb6
Fix alignment of end keywords 2020-03-05 16:56:06 -08:00
Brandon High
a839af2710
Use URI.parse.open/File.open instead of open
This commit updates the dashboard to use `URI.parse` instead of `Kernel#open`
because open can potentially open files on the server and has other
possible security issues.

Also updated the logger to use `File.open` as it is more explicit and
doesn't have the extra potential for abuse like `Kernel#open`

https://rubocop.readthedocs.io/en/latest/cops_security/#securityopen
2020-03-05 16:56:06 -08:00
Brandon High
f90ef4839e
Remove unused assignment
As far as I can tell, this variable doesn't exist before this assignment
and is immediately overwritten with the result of the method call so I
don't think it needs to be here?
2020-03-05 16:56:05 -08:00
Brandon High
0b841d63fd
Do not save exception in a variable if it isn't referenced
Prior to this commit there were a couple locations where exceptions were
saved to `_e` but weren't used in the handler except to re-raise the
exception, which simply calling the `raise` keyword will do without a
provided argument.
This commit removes the unnecessary assignment of the exception to a
variable and simply uses `raise` instead.
2020-03-05 16:56:05 -08:00
Brandon High
7657ec127c
Rubocop rule updates
This commit:
* explicitly defines some short variable names that
generally make sense in the codebase.
* set numeric comparisons to be enforced instead of the predicate style
2020-03-05 16:53:07 -08:00
Brandon High
a5a2740762
Consistent Style/FormatStringToken
This commit fixes the various calls to `format` to consistently use the
keyword token style. Hopefully this is more understandable and explicit?
2020-03-05 16:53:06 -08:00
Brandon High
b4f42cd4b1
Disable Naming/VariableName for propSpecs
I assume `propSpecs` is a reference to the VMWare API so using camelCase
is intentional.
2020-03-05 16:23:43 -08:00
mattkirby
f85f5126e8
Merge pull request #360 from highb/2020-03-05_unsafe_rubocop_fixes
"Unsafe" rubocop fixes
2020-03-05 16:03:21 -08:00
mattkirby
91edbb0fcd
Merge pull request #359 from highb/2020-03-05_rubocop_fixes
Fix Rubocop "safe" auto-corrections
2020-03-05 16:03:04 -08:00
Brandon High
f22a84f26f
"Unsafe" rubocop fixes
Adds the remaining "unsafe" fixes that aren't included in #359
2020-03-05 11:23:37 -08:00
Brandon High
29519006fa
Fix Rubocop "safe" auto-corrections
Generated using `bundle exec rubocop --safe --auto-correct`
2020-03-05 10:32:11 -08:00
mattkirby
252a2c2344
Merge pull request #358 from highb/duplicate_version_in_changelog_0_10_2
Remove duplicate of 0.10.2 from CHANGELOG
2020-03-05 08:52:21 -08:00
Brandon High
0314357cb9
Remove duplicate of 0.10.2 from CHANGELOG 2020-03-05 08:43:10 -08:00
Brandon High
a8fb406c22
Merge pull request #357 from mattkirby/provider_config
(POOLER-157) Add extra_config option to vmpooler
2020-03-05 08:39:10 -08:00
kirby@puppetlabs.com
8bb89b604d (POOLER-157) Add extra_config option to vmpooler
This commit adds the extra_config option to vmpooler to allow specifying additional configuration files to load from. Without this change vmpooler does not offer a mechanism to provide additional configuration files for the application.
2020-03-04 17:19:24 -08:00
Jenkins
dfa2f8620a (GEM) update vmpooler version to 0.10.3 2020-03-04 20:47:38 +00:00
Brandon High
6929377132
Decrement version in version.rb
I always forget that the job both bumps this version and tags, so
undoing the bump I did previously.
2020-03-04 12:46:13 -08:00
Brandon High
824df3e8a7
Merge pull request #356 from highb/release_0.10.3
Release 0.10.3
2020-03-04 12:38:35 -08:00
Brandon High
b613a2dc07
Update CHANGELOG for 0.10.3 (again) 2020-03-04 12:14:23 -08:00
Brandon High
9201a0befb
Rubocop 0.80 updates to rubocop configs
Arbitrary annoying name changes to cops and new cops that I don't think
we would care about:
https://rubocop.readthedocs.io/en/latest/cops_style/#stylehasheachmethods
https://rubocop.readthedocs.io/en/latest/cops_style/#stylehashtransformkeys
https://rubocop.readthedocs.io/en/latest/cops_style/#stylehashtransformvalues
2020-03-04 12:06:54 -08:00
Brandon High
cec7183fdc
Release 0.10.3
Updates for release 0.10.3, tagging will be handled by the job.
2020-03-04 11:44:36 -08:00
Brandon High
f1d6ddec9b
Merge pull request #355 from highb/pooler-154_delay_vm_host_update_until_after_migration
(POOLER-154) Delay vm host update until after migration completes
2020-03-03 16:09:29 -08:00
Brandon High
1fe80194e3
(POOLER-154) Delay vm host update until after migration completes
Prior to this commit the vsphere migration code updated the redis value
for where the VM is running (`vmpooler__vm__#{vm_name}/host`) before
attempting the migration. This meant that if the migration failed, there
was no record of what the original host for the VM was. Additionally,
the VM was marked as migrated before the migration happened which
didn't reflect reality if the migration failed.

This commit moves the redis update during migration to after the
migration has completed. This means that if an exception is thrown in
the migration code, the original host won't be lost and the host won't
be considered as migrated when it was not.
2020-03-03 14:00:00 -08:00
Jenkins
7ac03c6c94 (GEM) update vmpooler version to 0.10.2 2020-02-14 18:24:38 +00:00
Brandon High
81db9fb515
Bump version.rb and CHANGELOG.md to 0.10.1
This commit is to fix a mistake made the in the tagging and release
process.
2020-02-14 10:15:42 -08:00
Brandon High
39dd692db1
Bump version.rb to 0.10.0
I probably should have been using some automation so that I didn't tag
before bumping this version. Whoops!
2020-02-14 10:09:53 -08:00
Brandon High
0c8a595257
Merge pull request #354 from mattkirby/pooler_153_changelog
Update changelog for 0.10.0 release
2020-02-14 10:07:19 -08:00
kirby@puppetlabs.com
6f30d7b973 Update changelog for 0.10.0 release 2020-02-14 10:04:38 -08:00
Brandon High
82dae7d04c
Merge pull request #353 from mattkirby/vmpooler_flush
(POOLER-153) Add endpoint for resetting a pool
2020-02-14 09:53:47 -08:00
kirby@puppetlabs.com
0a21ac563d Update travis tests to use latest ruby versions
This commit updates travis to use ruby 2.4.9, 2.5.7, and jruby 9.2.9.0
for tests.
Test with latest z releases of ruby versions
2020-02-13 12:00:09 -08:00
kirby@puppetlabs.com
52b60b074c (POOLER-153) Add endpoint for resetting a pool
This commit adds a capability to vmpooler to reset a pool, deleting its ready and pending instances and replacing them with fresh ones. Without this change vmpooler does not offer a mechanism to reset a pool without also changing its template.
2020-02-13 11:59:44 -08:00
Jenkins
1407dd5575 (GEM) update vmpooler version to 0.9.1 2020-01-28 01:14:59 +00:00
Brandon High
9ce2ac3211
Merge pull request #351 from nicklewis/randomer-names
Generate a wider set of legal names
2020-01-27 17:06:08 -08:00
Nick Lewis
c4f3a49782 Generate a wider set of legal names
Previously, we restricted the adjective and noun portion of the name
each to 7 characters to ensure that the final name would not be more
than 15 after adding a hyphen. Given that the _total_ length is what
matters, we can generate a noun up to 11 characters (to ensure we leave
room for a hyphen and a 3 letter adjective) and adjust our acceptable
adjective size accordingly. This lets many more names be generated than
would otherwise, while still respecting the 15 character limit.

Due to the limited set of 11 letter nouns and corresponding 3 letter
adjectives, as well as some complex combinatorics, setting the noun
length to 11 causes a net increase in conflicts. We therefore actually
set it to 10, which causes a net decrease in conflicts.

We favor generating longer nouns rather than longer adjectives (by
selecting the noun first) because longer adjectives tend to be more
unwieldy words, and thus more awkward to say and generally less fun.
2020-01-27 16:11:13 -08:00
Jenkins
94eacdd7af (GEM) update vmpooler version to 0.9.0 2019-12-12 22:24:58 +00:00
mattkirby
d0257e39f7
Merge pull request #348 from Secure-24/issue_205
Support nested host folders in find_cluster()
2019-12-12 11:15:26 -08:00
Brandon High
0d8628d144
Merge pull request #350 from jcoconnor/QENG-7531-Stat-Mark-As-Failed
(QENG-7531) Add Marked as Failed Stat
2019-12-12 08:45:17 -08:00
John O'Connor
f581d065ae (QENG-7531) Add Marked as Failed Stat
This is a useful measure for monitoring the health of pools that we
don't capture yet.
2019-12-11 15:24:57 +00:00
Samuel
ae10bd4e22 (POOLER-123) Implement a max TTL (#349)
* (POOLER-123) Implement a max TTL

Before this change, we could checkout a vm and set the lifetime to a
very high number which would esssentially keep the vm running forever.
Now implementing a config setting max_lifetime_upper_limit which enforces
a maximum lifetime in hours both for initial checkout and extending a
running vm

* (POOLER-123) Improve PUT vm endpoint error messaging

Prior to this commit the PUT vm endpoint didn't give any useful
information about why a user's request failed.

This commit updates PUT to output a more helpful set of error messages
in the `failure` key that gets returned in the JSON response.

* (POOLER-123) Update max_lifetime_upper_limit key

This commit switches the max_lifetime_upper_limit key from being a
symbol to being a string, which is what the config hash seems to contain.

* (maint) Add option to disable Redis persistence in docker-compose

This commit is just a handy little command override to the redis
container to prevent persistence.
2019-12-05 09:35:30 -07:00
Sean Millichamp
f6fdfe42d7 Support nested host folders in find_cluster()
Search the root and any subfolders for cluster or host resources.
2019-11-26 13:48:53 -05:00
mattkirby
114cb9f398
Merge pull request #347 from highb/update_changlog_0.8.2
Update CHANGELOG for 0.8.2
2019-11-11 15:34:13 -08:00
Brandon High
86dbc783ef
Update CHANGELOG for 0.8.2
This commit updates the CHANGELOG, and fixes some Markdown linter issues
with the CHANGELOG.
2019-11-11 15:28:13 -08:00
Jenkins
8a17c5fa37 (GEM) update vmpooler version to 0.8.2 2019-11-06 20:34:28 +00:00
mattkirby
8c2ddf3604
Merge pull request #345 from highb/imp/master/QENG-7530_add_hostname_uniqueness_check
(QENG-7530) Add check for unique hostnames
2019-11-06 12:14:53 -08:00
mattkirby
e53d27afab
Merge pull request #346 from highb/ci/master/fix_rubocop_config
Update rubocop configs
2019-11-06 09:18:05 -08:00
Brandon High
019ed021b0
(QENG-7530) Add check for unique hostnames
Prior to this commit the pooler had no awareness of the complete set of
hostnames that are currently in use. This meant that it was possible to
allocate the same hostname twice, which would result in the original
host with that hostname becoming unreachable.

This commit adds a check for the existence of the
`vmpooler__vm__<hostname>` key before attempting to  clone the vm.
This should prevent duplicate hostnames.

If the hostname is already taken, `_clone_vm` will retry with a new
random hostname multiple times before raising an exception.
2019-11-04 15:53:05 -08:00
Brandon High
35475546ef
Update rubocop configs
Previously, there were some rubocop rule names that were causing rubocop
to fail to run entirely.
This commit updates the rubocop configs to match the new rubocop rule
names so that we can see all the issues that need correcting.
2019-11-04 14:57:53 -08:00
mattkirby
1df13e4974
Merge pull request #344 from highb/imp/master/QENG-7530_update_hostname_handling_for_human_hostnames
(QENG-7530) Fix hostname_shorten regex
2019-11-01 15:22:54 -07:00