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 start_retirement method #258

Merged
merged 2 commits into from
Apr 20, 2018
Merged

Refactoring cloud vm retirement start_retirement method #258

merged 2 commits into from
Apr 20, 2018

Conversation

pkomanek
Copy link
Contributor

@pkomanek pkomanek commented Mar 6, 2018

Purpose or Intent

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

Links

#8

@miq-bot add_label refactoring

def vm_validation
if @vm.nil?
@handle.log('error', "VM Object not found")
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
Raise exception instead of exiting

$evm.create_notification(:type => :vm_retiring, :subject => vm)
if @vm.retired?
@handle.log('error', "VM is already retired. Aborting current State Machine.")
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
Raise exception

vm.start_retirement
if @vm.retiring?
@handle.log('error', "VM is in the process of being retired. Aborting current State Machine.")
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 Raise exception


it "with retiring vm" do
svc_vm.start_retirement
expect { described_class.new(ae_service).main }.to raise_error(SystemExit)
Copy link
Contributor

Choose a reason for hiding this comment

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

@pkomanek Change this to catch the exception

@miq-bot
Copy link
Member

miq-bot commented Mar 14, 2018

Checked commits pkomanek/manageiq-content@4e69fdf~...049abed 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. 🏆

Copy link
Contributor

@billfitzgerald0120 billfitzgerald0120 left a comment

Choose a reason for hiding this comment

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

@pkomanek I tested this using an Openstack instance. Looks Good.

Copy link
Member

@tinaafitz tinaafitz left a comment

Choose a reason for hiding this comment

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

@pkomanek Looks good.
@mkanoor Please review.

@mkanoor mkanoor merged commit bceb8c1 into ManageIQ:master Apr 20, 2018
@mkanoor mkanoor added this to the Sprint 84 Ending Apr 23, 2018 milestone Apr 20, 2018
@pkomanek pkomanek deleted the refactoring_cloud_vm_retirement_statemachines_methods_StartRetirement_method branch June 5, 2018 08:30
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.

5 participants