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

Refactoring cloud vm retirement remove_from_provider method #257

Merged
merged 2 commits into from
Jun 13, 2018
Merged

Refactoring cloud vm retirement remove_from_provider method #257

merged 2 commits into from
Jun 13, 2018

Conversation

pkomanek
Copy link
Contributor

@pkomanek pkomanek commented Mar 6, 2018

Purpose or Intent

Refactoring Cloud/VM/Retirement/StateMachines/Methods.class/methods/remove_from_provider.rb method with spec. This PR is based on the issue bellow.

Links

#8

@miq-bot add_label refactoring

unregister
else
@handle.log('info', "Unknown retirement type for VM:<#{@vm.name}> from provider:<#{@ems.name}>")
exit MIQ_ABORT
Copy link
Contributor

Choose a reason for hiding this comment

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

@pkomanek
Can this be a raise, we tend to discourage exits from inside of method since it makes rspec to exit and difficult to debug. When these methods run as part of the Engine we fork a process and there the exit doesn't hurt but when we test it using the mocks and outside of the engine the exit has different behavior since its running directly under rspec.

$evm.log('info', "Skipping remove from provider for Instance:<#{vm.try(:name)}> on provider:<#{ems.try(:name)}>")
exit MIQ_OK
end
if @vm.nil? || @ems.nil?
Copy link
Contributor

Choose a reason for hiding this comment

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

@pkomanek
Can we drop the exit MIQ_OK in favor of

if @vm && @ems
   remove_vm
else
@handle.log('info', "Skipping remove from provider for Instance:<#{@vm.try(:name)}> on provider:<{@ems.try(:name)}>")
end

@miq-bot
Copy link
Member

miq-bot commented Jun 6, 2018

Checked commits pkomanek/manageiq-content@9980cc5~...1b76d5e with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0
2 files checked, 0 offenses detected
Everything looks fine. 🏆

@mkanoor mkanoor merged commit 0d7b72a into ManageIQ:master Jun 13, 2018
@mkanoor mkanoor added this to the Sprint 88 Ending Jun 18, 2018 milestone Jun 13, 2018
@pkomanek pkomanek deleted the refactoring_cloud_vm_retirement_statemachines_methods_RemoveFromProvider_method branch June 14, 2018 10:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants