Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for vmpooler on demand provisioning #67

Merged
merged 2 commits into from
Aug 4, 2020
Merged

Add support for vmpooler on demand provisioning #67

merged 2 commits into from
Aug 4, 2020

Conversation

mattkirby
Copy link
Contributor

@mattkirby mattkirby commented Jun 30, 2020

Status

Ready for Merge

Description

Add support for on demand provisioning via pooler. Add a capability to list ondemand pools in ABS. Add a dockerfile to improve local development.

Related Issues

https://tickets.puppetlabs.com/browse/POOLER-158

Todos

  • Documentation

Reviewers

@highb
@briancain

@highb
Copy link
Contributor

highb commented Jul 1, 2020

@mattkirby Looks like there's some linter issues that need fixing:

$ bundle exec rake rubocop spec
Running RuboCop...
.rubocop_todo.yml: Metrics/LineLength has the wrong namespace - should be Layout
The following cops were added to RuboCop, but are not configured. Please set Enabled to either `true` or `false` in your `.rubocop.yml` file:
 - Layout/EmptyLinesAroundAttributeAccessor (0.83)
 - Layout/SpaceAroundMethodCallOperator (0.82)
 - Lint/DeprecatedOpenSSLConstant (0.84)
 - Lint/MixedRegexpCaptureTypes (0.85)
 - Lint/RaiseException (0.81)
 - Lint/StructNewOverride (0.81)
 - Style/ExponentialNotation (0.82)
 - Style/HashEachMethods (0.80)
 - Style/HashTransformKeys (0.80)
 - Style/HashTransformValues (0.80)
 - Style/RedundantFetchBlock (0.86)
 - Style/RedundantRegexpCharacterClass (0.85)
 - Style/RedundantRegexpEscape (0.85)
 - Style/SlicingWithRange (0.83)
For more information: https://docs.rubocop.org/rubocop/versioning.html
Inspecting 26 files
...C......C..C............
Offenses:
lib/vmfloaty.rb:17:1: C: Metrics/ClassLength: Class has too many lines. [396/394]
class Vmfloaty ...
^^^^^^^^^^^^^^
lib/vmfloaty.rb:20:3: C: Metrics/CyclomaticComplexity: Cyclomatic complexity for run is too high. [65/55]
  def run # rubocop:disable Metrics/AbcSize ...
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/vmfloaty.rb:20:3: C: Metrics/MethodLength: Method has too many lines. [393/391]
  def run # rubocop:disable Metrics/AbcSize ...
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/vmfloaty.rb:20:3: C: Metrics/PerceivedComplexity: Perceived complexity for run is too high. [66/63]
  def run # rubocop:disable Metrics/AbcSize ...
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/vmfloaty/pooler.rb:53:7: C: Layout/EmptyLineAfterGuardClause: Add empty line after guard clause.
      raise "HTTP #{response.status}: Failed to obtain VMs from the pooler at #{url}/vm/#{os_string}. #{res_body}" unless ondemand
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/vmfloaty/pooler.rb:66:17: C: Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
    STDOUT.puts "The request has been fulfilled"
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/vmfloaty/utils.rb:49:62: C: Style/MultipleComparison: Avoid comparing a variable with multiple items in a conditional, use Array#include? instead.
    filtered_response_body = response_body.reject { |key, _| key == 'request_id' || key == 'ready' }
                                                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
26 files inspected, 7 offenses detected
RuboCop failed!
The command "bundle exec rake rubocop spec" exited with 1.
Done. Your build exited with 1.

lib/vmfloaty.rb Show resolved Hide resolved
lib/vmfloaty/abs.rb Show resolved Hide resolved
@briancain
Copy link
Contributor

@mattkirby - Since I believe @highb 's last day at Puppet is today...it would be good to find some internal maintainer at puppet that's not me for this, since I have no access to test any of the changes :D Currently the repo is setup with github actions to release gems on merge, so at least that part is automated away. I'm happy to add you or someone else that makes sense for reviewing PRs.

@briancain
Copy link
Contributor

Actually, it looks like I was finally able to transfer ownership of this repo to puppetlabs!

@briancain
Copy link
Contributor

Thanks @codyclements @highb for making that happen.

@highb
Copy link
Contributor

highb commented Jul 1, 2020

Making sure to add myself as a maintainer so I can help out in the future, as well. 😉

@mattkirby
Copy link
Contributor Author

I have updated this to address the feedback. Please let me know if this needs further changes.

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.
@mattkirby mattkirby requested a review from a team as a code owner August 4, 2020 18:26
@mattkirby mattkirby closed this Aug 4, 2020
@mattkirby mattkirby reopened this Aug 4, 2020
Copy link
Contributor

@highb highb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👋 Looks good to me!

@highb
Copy link
Contributor

highb commented Aug 4, 2020

Look at my approval above, it looks like I no longer have write access on the repo? That's unfortunate.

@mattkirby mattkirby dismissed briancain’s stale review August 4, 2020 21:46

Need to add the feature to vmfloaty to meet a timeilne for a vmpooler application change. Will make the requested change in a subsequent PR if requested.

@mattkirby
Copy link
Contributor Author

Look at my approval above, it looks like I no longer have write access on the repo? That's unfortunate.

@highb not sure why, but I have updated it to add you as a maintainer on the repo. I think you should have an invite. Let me know if it does not work for some reason.

@highb
Copy link
Contributor

highb commented Aug 4, 2020

Yep, that worked! Thank you.

@mattkirby mattkirby merged commit d1fc70f into puppetlabs:master Aug 4, 2020
@mattkirby mattkirby deleted the pooler_158 branch August 4, 2020 22:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants