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

Fix Service Retirement requests leaving the Service as 'retiring'. #530

Merged
merged 1 commit into from
May 23, 2019

Conversation

billfitzgerald0120
Copy link
Contributor

@billfitzgerald0120 billfitzgerald0120 commented Apr 30, 2019

This will fix the problem when someone uses the older api call and leaves the service in a 'retiring' state.
If there is no task, the process is aborted and the state is 'initializing'.

This will allow the retirement process will start again instead of being denied because the state is 'retiring'

fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1698480

@miq-bot add_label bug
@miq-bot assign @tinaafitz

Start_retirement is an old style method with no spec. I don't think it makes sense to build an old style spec for the old method. I would like to followup this PR with a PR that refactors the method and I will build a spec for that.

@coveralls
Copy link

Pull Request Test Coverage Report for Build 3018

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 96.909%

Totals Coverage Status
Change from base Build 3010: 0.0%
Covered Lines: 2884
Relevant Lines: 2976

💛 - Coveralls

@coveralls
Copy link

coveralls commented Apr 30, 2019

Pull Request Test Coverage Report for Build 3132

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.01%) to 96.94%

Totals Coverage Status
Change from base Build 3122: 0.01%
Covered Lines: 2915
Relevant Lines: 3007

💛 - Coveralls

@billfitzgerald0120 billfitzgerald0120 changed the title [WIP] Fix Service Retirement requests leaving the Service as 'retiring'. Fix Service Retirement requests leaving the Service as 'retiring'. May 9, 2019
@miq-bot miq-bot removed the wip label May 9, 2019
@billfitzgerald0120
Copy link
Contributor Author

billfitzgerald0120 commented May 10, 2019

Start_retirement is an old style method with no spec. I don't think it makes sense to build an old style spec for the old method. I'm going to followup with a PR to refactor the method and add a spec test.

@tinaafitz
Copy link
Member

@lfu @d-m-u Please review.

$evm.log(:error, "The old style retirement is incompatible with the new retirement state machine.")
exit(MIQ_ABORT)
end
end
Copy link
Member

Choose a reason for hiding this comment

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

Should this be:

unless $evm.root['service_retire_task']
  $evm.log(:error, "Service retire task not found")
  $evm.log(:error, "The old style retirement is incompatible with the new retirement state machine.")
  exit(MIQ_ABORT)
end

This check should be placed before $evm.create_notification(:type => :service_retiring, :subject => service)

@billfitzgerald0120
Copy link
Contributor Author

@lfu Made changes as you requested, please review.

@@ -20,6 +20,14 @@
exit MIQ_ABORT
end

$evm.root['service_retire_task'].tap do |task|
Copy link
Member

Choose a reason for hiding this comment

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

Is .tap necessary here?

…tiring'.

This will fix the problem when someone uses the older api call and leaves the service in a 'retiring' state.
If there is no task, the process is aborted and the state is 'initializing'.

This will allow the retirement process will start again instead of being denied because the state is 'retiring'

fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1698480

Updated update_service_retirement_status_spec
Moved check for service_retire_task before notification as requested.
Removed tap and changed code  as requested
Changed 'fred' to 'active' as requested
@miq-bot
Copy link
Member

miq-bot commented May 23, 2019

Checked commit billfitzgerald0120@8b95631 with ruby 2.3.3, rubocop 0.69.0, haml-lint 0.20.0, and yamllint 1.10.0
3 files checked, 0 offenses detected
Everything looks fine. 🍪

Copy link
Contributor

@d-m-u d-m-u left a comment

Choose a reason for hiding this comment

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

thanks!

@tinaafitz tinaafitz merged commit ac0a57a into ManageIQ:master May 23, 2019
@simaishi
Copy link
Contributor

@billfitzgerald0120 hammer/yes?

@tinaafitz
Copy link
Member

@miq-bot add_label hammer/yes

simaishi pushed a commit that referenced this pull request May 23, 2019
Fix Service Retirement requests leaving the Service as 'retiring'.

(cherry picked from commit ac0a57a)

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1713477
@simaishi
Copy link
Contributor

Hammer backport details:

$ git log -1
commit 329fa1ed9bbc2388d793ce6e2c59a6d40a11c193
Author: tina <[email protected]>
Date:   Thu May 23 14:19:34 2019 -0400

    Merge pull request #530 from billfitzgerald0120/retire_api
    
    Fix Service Retirement requests leaving the Service as 'retiring'.
    
    (cherry picked from commit ac0a57a8b535b4ce565beb5d51faca9acb5a50af)
    
    Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1713477

@tinaafitz tinaafitz added this to the Sprint 112 Ending May 27, 2019 milestone May 28, 2019
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.

7 participants