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
Fixes #10782 - global host status #2580
Conversation
Could you fix the commit messages, so as not to fight the system? Thanks. I'll also reset the review label as I don't believe it's been reviewed yet. |
I fixed messages. I removed |
Hah. No, probably a misclick. |
@@ -0,0 +1,32 @@ | |||
class CreateHostStatus < ActiveRecord::Migration | |||
def self.up |
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.
No "self." on these methods any more.
098caf5
to
2da9a27
Compare
Removed a.txt (sorry I needed to inject some commit during squashing and forgot to remove it) and introduced a new relation to configuration_status which is now used in scoped search queries. |
1a8229d
to
df74227
Compare
The tests are red, a page is failing with internal server errors. |
@domcleal I'm working on that, I hoped you won't notice before I fix it (rebase issue after stabby lamda change...) |
df74227
to
5e56870
Compare
🍏 |
|
||
module ClassMethods | ||
def scoped_search_status(status, options) | ||
options.merge({ :offset => Report::METRIC.index(status.to_s), :word_size => Report::BIT_NUM }) |
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.
merge!
else it doesn't work at all.
Introduce new global host status that is composed of host substatuses. Each substatus defines a mapping to the global one which can result in three values * OK * WARN * ERROR Plugins can add their own substatuses. These are automatically propagated also to API. Thanks to Tomas Strachota who wrote the original code.
5e56870
to
25e8d00
Compare
Thanks @ares and @tstrachota, merged as e54016d. Could you add a section to http://projects.theforeman.org/projects/foreman/wiki/How_to_Create_a_Plugin about how to create your own substatus? This could be useful for a variety of plugins. |
For the reference, the section was added here |
Keeping my commits separately for easier reviewing. There are two things I didn't refactor in this PR, if we agree it's a good direction I'll create redmine issues.
app/models/report.rb line 66
it would be very nice to refactor this behaviour and ensure the status setter always gets integer number from the importer
app/services/report_status_calculator.rb line 56
replace dynamic define_method and use something like status_of('applied') everywhere instead (I don't think this is highly important)