-
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 retirement start_retirement method #258
Refactoring cloud vm retirement start_retirement method #258
Conversation
def vm_validation | ||
if @vm.nil? | ||
@handle.log('error', "VM Object not found") | ||
exit MIQ_ABORT |
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
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 |
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
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 |
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 Raise exception
|
||
it "with retiring vm" do | ||
svc_vm.start_retirement | ||
expect { described_class.new(ae_service).main }.to raise_error(SystemExit) |
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 Change this to catch the exception
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 |
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 tested this using an Openstack instance. Looks Good.
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.
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