-
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
Automate - Refactoring infra vm check_powered_off method. #108
Automate - Refactoring infra vm check_powered_off method. #108
Conversation
6146550
to
48ef476
Compare
48ef476
to
ac6f674
Compare
@tinaafitz |
@miq-bot remove_label fine/yes |
@miq-bot add_label fine/no |
@billfitzgerald0120 Looks good. |
|
||
context "no vm" do | ||
let(:vm) { nil } | ||
it_behaves_like "#ae_result 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.
@billfitzgerald0120 Should this be raising an error if the @handle.root['vm'] is nil as opposed to checking ae_result = nil
|
||
def main | ||
# Get vm from root object | ||
vm = @handle.root['vm'] |
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.
@billfitzgerald0120
Can we write a function that returns the vm and raises an error if the vm is missing @handle.root[vm] is nil
Updated test to check error raised.
Checked commits billfitzgerald0120/manageiq-content@ac6f674~...2638af6 with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0 |
@mkanoor |
shared_examples_for "#vm power state" do | ||
it "check" do | ||
vm.update_attributes(:raw_power_state => raw_power_state) | ||
svc_model_vm |
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.
@billfitzgerald0120
What does this line do? Is it trying to reload the service vm object. Should this be happening after the method has run?
end | ||
|
||
let(:root_hash) do | ||
{ 'vm' => MiqAeMethodService::MiqAeServiceVm.find(vm.id) } |
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.
@billfitzgerald0120
This could be just
{'vm' => svc_model_vm }
Refactoring the check_powered_off method for the infrastructure Vm. This PR is based on the issue below.
Created tests.
ManageIQ/manageiq#12038
@miq-bot add_label refactoring, fine/yes