-
Notifications
You must be signed in to change notification settings - Fork 120
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
Refactoring cloud vm provisioning placement best fit methods #353
Refactoring cloud vm provisioning placement best fit methods #353
Conversation
|
||
if prov.get_option(:cloud_network).nil? | ||
cloud_network = prov.eligible_cloud_networks.first | ||
set_cloud_network if @prov.get_option(:cloud_network).nil? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pkomanek would this work
prov.get_option(:cloud_network) || set_cloud_network
prov.get_option(:cloud_subnet) || set_cloud_subnet
prov.get_option(:resource_group) || set_resource_group
If the user has not provided values we are providing a default maybe the method names could also be changed to default_cloud_network, default_cloud_subnet, default_resource_group where we pick the first element from an array of choices.
end | ||
end | ||
|
||
if $PROGRAM_NAME == __FILE__ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
end | ||
end | ||
|
||
if $PROGRAM_NAME == __FILE__ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pkomanek only need line number 53
end | ||
end | ||
|
||
if $PROGRAM_NAME == __FILE__ | ||
ManageIQ::Automate::Cloud::VM::Provisioning::Placement::BestFitOpenStack.new.main |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pkomanek Only need line number 44
$evm.log("info", "Selected Cloud Network: #{cloud_network.name}") | ||
end | ||
end | ||
private |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
end | ||
|
||
def main | ||
@prov = @handle.root["miq_provision"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pkomanek
I think we should by using a prov method which can check for missing field raise an error similar to what you have in the other file in this PR
image = prov.vm_template | ||
raise "Image not specified" if image.nil? | ||
def main | ||
@prov = @handle.root["miq_provision"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pkomanek Use prov method
Checked commits pkomanek/manageiq-content@7e7c7b8~...a86d5c2 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0 |
Purpose or Intent
Cloud/VM/Provisioning/Placement.class/__methods__/best_fit_*.rb
methods and adding the specs for these methods._spec
suffix into the best_fit_amazon spec name.This PR is based on the issue bellow.
Links
Issue: #8
@miq-bot add_label refactoring