-
Notifications
You must be signed in to change notification settings - Fork 987
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 #31213 - hostgroup API facets extension point #8115
Fixes #31213 - hostgroup API facets extension point #8115
Conversation
Issues: #31213 |
8b10ef7
to
a7e4423
Compare
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.
Do we have the usage counterpart for this?
Sorry not to include it right away, this is the counterpart: |
a7e4423
to
76459ac
Compare
76459ac
to
e27b97b
Compare
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.
Unfortunately, katello test failures are related.
Log from local run:
2020-11-22T10:42:54 [I|app|] Backtrace for 'Action failed' error (ActionView::Template::Error): undefined method `content_view_version' for #<Katello::Hostgroup::ContentFace
t:0x0000000018f6fd70>
| /home/vagrant/foreman/.vendor/ruby/2.5.0/gems/activemodel-6.0.3.4/lib/active_model/attribute_methods.rb:432:in `method_missing'
| /home/vagrant/foreman/.vendor/ruby/2.5.0/gems/audited-4.9.0/lib/audited/auditor.rb:99:in `method_missing'
| /home/vagrant/katello/app/views/katello/api/v2/content_facet/show.json.rabl:6:in `block (2 levels) in cached_source_3397887158937366876'
| /home/vagrant/foreman/.vendor/ruby/2.5.0/gems/rabl-0.14.3/lib/rabl/builder.rb:157:in `node'
| /home/vagrant/foreman/.vendor/ruby/2.5.0/gems/rabl-0.14.3/lib/rabl/builder.rb:116:in `block in compile_settings'
...
| /home/vagrant/foreman/.vendor/ruby/2.5.0/gems/rabl-0.14.3/lib/rabl/engine.rb:287:in `partial'
| /home/vagrant/foreman/app/views/api/v2/hostgroups/show.json.rabl:25:in `block (2 levels) in cached_source_1252319207728911631'
| /home/vagrant/foreman/.vendor/ruby/2.5.0/gems/rabl-0.14.3/lib/rabl/builder.rb:157:in `node'
| /home/vagrant/foreman/.vendor/ruby/2.5.0/gems/rabl-0.14.3/lib/rabl/builder.rb:116:in `block in compile_settings'
...
| /home/vagrant/foreman/.vendor/ruby/2.5.0/gems/rabl-0.14.3/lib/rabl/engine.rb:49:in `render'
| /home/vagrant/foreman/config/initializers/rabl_init.rb:49:in `render'
| /home/vagrant/foreman/app/views/api/v2/hostgroups/update.json.rabl:3:in `_40ee894962f6d73f981bdbae3abcc910'
e27b97b
to
d4bf69f
Compare
526f1de
to
b9bfb6c
Compare
I think it's because of initialization of the association being done twice. Rails are not handling it that well. |
@@ -41,16 +41,20 @@ def refresh_facet_relations | |||
# host.foo # => will call Host.my_facet.foo | |||
def register_facet_relation(facet_config) |
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.
this method is now not being called IIRC, but not sure about that.
b9bfb6c
to
85b0c66
Compare
I've extracted the refresh / register to #8151 |
05bfb01
to
2b5a18c
Compare
2b5a18c
to
b9b703e
Compare
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.
Still failing on katello content hosts
page:
15:36:05 rails.1 | 2020-11-23T15:36:05 [W|app|da21f3e1] Action failed
15:36:05 rails.1 | 2020-11-23T15:36:05 [I|app|da21f3e1] Backtrace for 'Action failed' error (ActionView::Template::Error): undefined local variable or method `hostgroup' for #<Rabl::Engine:0x0000000014698b10>
15:36:05 rails.1 | da21f3e1 | /home/vagrant/foreman/.vendor/ruby/2.5.0/gems/rabl-0.14.3/lib/rabl/engine.rb:359:in `method_missing'
15:36:05 rails.1 | da21f3e1 | /home/vagrant/foreman/app/views/api/v2/hosts/main.json.rabl:61:in `block in cached_source_3230678856672812020'
15:36:05 rails.1 | da21f3e1 | /home/vagrant/foreman/app/views/api/v2/hosts/main.json.rabl:59:in `each'
15:36:05 rails.1 | da21f3e1 | /home/vagrant/foreman/app/views/api/v2/hosts/main.json.rabl:59:in `cached_source_3230678856672812020'
...
15:36:05 rails.1 | da21f3e1 | /home/vagrant/foreman/config/initializers/rabl_init.rb:49:in `render'
15:36:05 rails.1 | da21f3e1 | /home/vagrant/foreman/app/views/api/v2/hosts/index.json.rabl:3:in `_d400f40cad14669013188f1e28fe919e'
b9b703e
to
711a1a8
Compare
[test katello] |
1 similar comment
[test katello] |
Adds Facet extension points for Hostgroup API responses. Refactor refresh for facets, to ensure all run just once. Now the already registered entries are being run once the facet entry point is configured. The hook is registered also on the entry point registration. It should give us more clear API of the new facet entry poin registration.
fixes an issue with an Model having access to general facet definitions (entries) rather than it's own (model based entries) definitions.
711a1a8
to
663fddd
Compare
663fddd
to
371123d
Compare
[test katello] https://ci.theforeman.org/job/test_develop_pr_katello/6695 passed, it could be a node host that makes the difference or the test concurrency |
371123d
to
0053393
Compare
0053393
to
1bfb711
Compare
I've added tests and we are 🍏 |
ping @ShimShtein what's the status here? |
Merged, thanks @ezr-ondrej! |
* Fixes #31213 - hostgroup API facets extension point Adds Facet extension points for Hostgroup API responses. Refactor refresh for facets, to ensure all run just once. Now the already registered entries are being run once the facet entry point is configured. The hook is registered also on the entry point registration. It should give us more clear API of the new facet entry poin registration. * Refs #31213 - model specific definition iterrable fixes an issue with an Model having access to general facet definitions (entries) rather than it's own (model based entries) definitions. * Refs #31213 - Add tests for API response with facets
Adds Facet extension points for Hostgroup API responses.
Adds forgotten refresh for existing entires on hostgroup.
EDIT: This is needed by foreman_puppet_enc plugin since theforeman/foreman_puppet@40cfb9b#diff-8dc4b7b4116cb63c7a7b1b3c40a25c515f61ccceff63bb4b387eda1f10607988R102-R104