Bug 1569395

Summary: [Satellite 6] Adding search for lifecycle_environment or lifecycle_environment_id in role host fiter with permission view_hosts does not construct SQL querry when API is used
Product: Red Hat Satellite Reporter: Stefan Nemeth <snemeth>
Component: Content ViewsAssignee: Shimon Shtein <sshtein>
Status: CLOSED NEXTRELEASE QA Contact: Lai <ltran>
Severity: high Docs Contact:
Priority: high    
Version: 6.3.1CC: ahumbe, andrew.schofield, bbuckingham, bkearney, dhlavacd, ehelms, inecas, jjansky, jschilen, kabbott, mhulan, mlinden, mmccune, nsamant, paji, pcreech, rankumar, rbertolj, sshtein, sthirugn, swadeley, tasander
Target Milestone: 6.5.0Keywords: FieldEngineering, PrioBumpField, PrioBumpQA, Regression, Reopened
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: foreman-1.18.0.35-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1646755 (view as bug list) Environment:
Last Closed: 2021-04-05 14:16:18 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Stefan Nemeth 2018-04-19 08:19:38 UTC
Description of problem:

When search for lifecycle_environment or lifecycle_environment_id in roles -> select role -> filters is defined, sql querry is not constructed and api call fails in 

curl -s -u 'apiuser:redhat' -k https://satellite.stefan.test/api/v2/hosts/3/facts?

{
  "error": {"message":"Association named 'content_facet' was not found on Host::Base; perhaps you misspelled it?"}
}


Problem is, that when following ansible itegration guide, those filters are defined and worked in 6.2
>>https://www.youtube.com/watch?v=SXhfgJjeaGc

Workaround by leaving search option for Host -> view_hosts empty, is possible.

However this is not applicable if you want to limit ansible for just one lifecycle environment.
https://access.redhat.com/articles/3359731 

Version-Release number of selected component (if applicable):

6.3.1

How reproducible:

100%

Steps to Reproduce:
1. Create apiser user with roles and filters for ansible api as is described in article https://access.redhat.com/articles/3359731 
2. add search for Lifecycle_environment in  Host filter with permission	view_hosts	
3. execute api call 
#curl -s -u 'apiuser:redhat' -k https://satellite.stefan.test/api/v2/hosts/3/facts?

Actual results:

curl -s -u 'apiuser:redhat' -k https://satellite.stefan.test/api/v2/hosts/3/facts?
{
  "error": {"message":"Association named 'lifecycle_environment' was not found on Host::Base; perhaps you misspelled it?"}
}

Action failed
 | ActiveRecord::ConfigurationError: Association named 'lifecycle_environment' was not found on Host::Base; perhaps you misspelled it?
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/associations/join_dependency.rb:219:in `find_reflection'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/associations/join_dependency.rb:224:in `block in build'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/associations/join_dependency.rb:223:in `each'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/associations/join_dependency.rb:223:in `map'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/associations/join_dependency.rb:223:in `build'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/associations/join_dependency.rb:232:in `block in build'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/associations/join_dependency.rb:223:in `each'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/associations/join_dependency.rb:223:in `map'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/associations/join_dependency.rb:223:in `build'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/associations/join_dependency.rb:99:in `initialize'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/relation/query_methods.rb:1039:in `new'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/relation/query_methods.rb:1039:in `build_joins'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/relation/query_methods.rb:866:in `build_arel'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/relation/query_methods.rb:858:in `arel'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/relation/delegation.rb:95:in `method_missing'
 | /usr/share/foreman/app/models/fact_value.rb:81:in `build_facts_hash'
 | /usr/share/foreman/app/controllers/api/v2/fact_values_controller.rb:17:in `index'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/actionpack-4.2.6/lib/action_controller/metal/implicit_render.rb:4:in `send_action'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/actionpack-4.2.6/lib/abstract_controller/base.rb:198:in `process_action'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/actionpack-4.2.6/lib/action_controller/metal/rendering.rb:10:in `process_action'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/actionpack-4.2.6/lib/abstract_controller/callbacks.rb:20:in `block in process_action'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:117:in `call'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:555:in `block (2 levels) in compile'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:505:in `call'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:498:in `block (2 levels) in around'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:313:in `block (2 levels) in halting'
 | /usr/share/foreman/app/controllers/api/v2/base_controller.rb:152:in `disable_json_root'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:432:in `block in make_lambda'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:312:in `block in halting'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:497:in `block in around'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:505:in `call'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:498:in `block (2 levels) in around'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:313:in `block (2 levels) in halting'
 | /usr/share/foreman/app/controllers/concerns/application_shared.rb:15:in `set_timezone'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:432:in `block in make_lambda'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:312:in `block in halting'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:497:in `block in around'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:505:in `call'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:498:in `block (2 levels) in around'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:313:in `block (2 levels) in halting'
 | /usr/share/foreman/app/models/concerns/foreman/thread_session.rb:32:in `clear_thread'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:432:in `block in make_lambda'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:312:in `block in halting'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:497:in `block in around'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:505:in `call'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:498:in `block (2 levels) in around'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:313:in `block (2 levels) in halting'
 | /usr/share/foreman/app/controllers/concerns/foreman/controller/topbar_sweeper.rb:12:in `set_topbar_sweeper_controller'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:432:in `block in make_lambda'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:312:in `block in halting'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:497:in `block in around'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:505:in `call'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:498:in `block (2 levels) in around'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:313:in `block (2 levels) in halting'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/audited-4.4.1/lib/audited/sweeper.rb:14:in `around'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:455:in `public_send'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:455:in `block in make_lambda'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:312:in `block in halting'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:497:in `block in around'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:505:in `call'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:92:in `__run_callbacks__'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:778:in `_run_process_action_callbacks'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:81:in `run_callbacks'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/actionpack-4.2.6/lib/abstract_controller/callbacks.rb:19:in `process_action'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/actionpack-4.2.6/lib/action_controller/metal/rescue.rb:29:in `process_action'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/actionpack-4.2.6/lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activesupport-4.2.6/lib/active_support/notifications.rb:164:in `block in instrument'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activesupport-4.2.6/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activesupport-4.2.6/lib/active_support/notifications.rb:164:in `instrument'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/actionpack-4.2.6/lib/action_controller/metal/instrumentation.rb:30:in `process_action'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/actionpack-4.2.6/lib/action_controller/metal/params_wrapper.rb:250:in `process_action'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/railties/controller_runtime.rb:18:in `process_action'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/actionpack-4.2.6/lib/abstract_controller/base.rb:137:in `process'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/actionview-4.2.6/lib/action_view/rendering.rb:30:in `process'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/actionpack-4.2.6/lib/action_controller/metal.rb:196:in `dispatch'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/actionpack-4.2.6/lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/actionpack-4.2.6/lib/action_controller/metal.rb:237:in `block in action'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/actionpack-4.2.6/lib/action_dispatch/routing/route_set.rb:74:in `dispatch'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/actionpack-4.2.6/lib/action_dispatch/routing/route_set.rb:43:in `serve'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/actionpack-4.2.6/lib/action_dispatch/routing/mapper.rb:49:in `serve'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/actionpack-4.2.6/lib/action_dispatch/journey/router.rb:43:in `block in serve'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/actionpack-4.2.6/lib/action_dispatch/journey/router.rb:30:in `each'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/actionpack-4.2.6/lib/action_dispatch/journey/router.rb:30:in `serve'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/actionpack-4.2.6/lib/action_dispatch/routing/route_set.rb:817:in `call'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/actionpack-4.2.6/lib/action_dispatch/middleware/static.rb:120:in `call'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/actionpack-4.2.6/lib/action_dispatch/middleware/static.rb:120:in `call'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-rails-0.5.6/lib/apipie/static_dispatcher.rb:65:in `call'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-rails-0.5.6/lib/apipie/extractor/recorder.rb:136:in `call'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/actionpack-4.2.6/lib/action_dispatch/middleware/static.rb:120:in `call'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/actionpack-4.2.6/lib/action_dispatch/middleware/static.rb:120:in `call'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/actionpack-4.2.6/lib/action_dispatch/middleware/static.rb:120:in `call'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/actionpack-4.2.6/lib/action_dispatch/middleware/static.rb:120:in `call'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/actionpack-4.2.6/lib/action_dispatch/middleware/static.rb:120:in `call'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/actionpack-4.2.6/lib/action_dispatch/middleware/static.rb:120:in `call'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/actionpack-4.2.6/lib/action_dispatch/middleware/static.rb:120:in `call'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/actionpack-4.2.6/lib/action_dispatch/middleware/static.rb:120:in `call'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/actionpack-4.2.6/lib/action_dispatch/middleware/static.rb:120:in `call'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/actionpack-4.2.6/lib/action_dispatch/middleware/static.rb:120:in `call'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-rails-0.5.6/lib/apipie/middleware/checksum_in_headers.rb:27:in `call'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/rack-1.6.2/lib/rack/etag.rb:24:in `call'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/rack-1.6.2/lib/rack/conditionalget.rb:25:in `call'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/rack-1.6.2/lib/rack/head.rb:13:in `call'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/actionpack-4.2.6/lib/action_dispatch/middleware/params_parser.rb:27:in `call'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.5.58/lib/katello/params_parser_wrapper.rb:12:in `call'
 | /usr/share/foreman/lib/middleware/catch_json_parse_errors.rb:8:in `call'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/actionpack-4.2.6/lib/action_dispatch/middleware/flash.rb:260:in `call'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/rack-1.6.2/lib/rack/session/abstract/id.rb:225:in `context'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/rack-1.6.2/lib/rack/session/abstract/id.rb:220:in `call'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/actionpack-4.2.6/lib/action_dispatch/middleware/cookies.rb:560:in `call'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/query_cache.rb:36:in `call'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:653:in `call'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/actionpack-4.2.6/lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:88:in `__run_callbacks__'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:778:in `_run_call_callbacks'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:81:in `run_callbacks'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/actionpack-4.2.6/lib/action_dispatch/middleware/callbacks.rb:27:in `call'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/actionpack-4.2.6/lib/action_dispatch/middleware/remote_ip.rb:78:in `call'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/actionpack-4.2.6/lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/actionpack-4.2.6/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/railties-4.2.6/lib/rails/rack/logger.rb:38:in `call_app'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/railties-4.2.6/lib/rails/rack/logger.rb:22:in `call'
 | /usr/share/foreman/lib/middleware/tagged_logging.rb:18:in `call'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/actionpack-4.2.6/lib/action_dispatch/middleware/request_id.rb:21:in `call'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/rack-1.6.2/lib/rack/methodoverride.rb:22:in `call'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/rack-1.6.2/lib/rack/runtime.rb:18:in `call'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activesupport-4.2.6/lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/actionpack-4.2.6/lib/action_dispatch/middleware/static.rb:120:in `call'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/actionpack-4.2.6/lib/action_dispatch/middleware/static.rb:120:in `call'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/rack-1.6.2/lib/rack/sendfile.rb:113:in `call'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/secure_headers-3.4.1/lib/secure_headers/middleware.rb:12:in `call'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/railties-4.2.6/lib/rails/engine.rb:518:in `call'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/railties-4.2.6/lib/rails/application.rb:165:in `call'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/railties-4.2.6/lib/rails/railtie.rb:194:in `public_send'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/railties-4.2.6/lib/rails/railtie.rb:194:in `method_missing'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/rack-1.6.2/lib/rack/urlmap.rb:66:in `block in call'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/rack-1.6.2/lib/rack/urlmap.rb:50:in `each'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/rack-1.6.2/lib/rack/urlmap.rb:50:in `call'
 | /usr/share/gems/gems/passenger-4.0.18/lib/phusion_passenger/rack/thread_handler_extension.rb:77:in `process_request'
 | /usr/share/gems/gems/passenger-4.0.18/lib/phusion_passenger/request_handler/thread_handler.rb:140:in `accept_and_process_next_request'
 | /usr/share/gems/gems/passenger-4.0.18/lib/phusion_passenger/request_handler/thread_handler.rb:108:in `main_loop'
 | /usr/share/gems/gems/passenger-4.0.18/lib/phusion_passenger/request_handler.rb:441:in `block (3 levels) in start_threads'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/logging-1.8.2/lib/logging/diagnostic_context.rb:323:in `block in create_with_logging_context'
2018-04-11 14:56:12 9363c89a [app] [I]   Rendered api/v2/errors/standard_error.json.rabl within api/v2/layouts/error_layout (0.6ms)

changed filter search to lifecycle enviroment id

[root@satellite ~]# curl -s -u 'apiuser:redhat' -k https://satellite.stefan.test/api/v2/hosts/3/facts?
{
  "error": {"message":"Association named 'content_facet' was not found on Host::Base; perhaps you misspelled it?"}
}

Action failed
 | ActiveRecord::ConfigurationError: Association named 'content_facet' was not found on Host::Base; perhaps you misspelled it?
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/associations/join_dependency.rb:219:in `find_reflection'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/associations/join_dependency.rb:224:in `block in build'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/associations/join_dependency.rb:223:in `each'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/associations/join_dependency.rb:223:in `map'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/associations/join_dependency.rb:223:in `build'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/associations/join_dependency.rb:232:in `block in build'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/associations/join_dependency.rb:223:in `each'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/associations/join_dependency.rb:223:in `map'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/associations/join_dependency.rb:223:in `build'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/associations/join_dependency.rb:99:in `initialize'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/relation/query_methods.rb:1039:in `new'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/relation/query_methods.rb:1039:in `build_joins'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/relation/query_methods.rb:866:in `build_arel'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/relation/query_methods.rb:858:in `arel'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/relation/delegation.rb:95:in `method_missing'
 | /usr/share/foreman/app/models/fact_value.rb:81:in `build_facts_hash'

Expected results:

Working api call

Additional info:

It was supposed to be working in 6.2  SQL query does not get constructed 
When logged in as apiuser to satellite webui you will get the same error in Satellite when you try to access the facts of a host

Comment 2 Marek Hulan 2018-04-26 08:36:50 UTC
This is not related to permissions but rather the search engine. For some reason, the lifecycle and content view searching on host no longer works, perhaps it was caused by host merge, the search definitions were dropped. Moving to Content View component, I think new search definitions needs to be added.

Comment 5 Partha Aji 2018-06-25 03:39:24 UTC
Connecting redmine issue https://projects.theforeman.org/issues/24056 from this bug

Comment 9 Satellite Program 2018-09-14 12:10:06 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue https://projects.theforeman.org/issues/24056 has been resolved.

Comment 10 Patrick Creech 2018-09-19 13:52:47 UTC
Shimon,

This failed cherry-pick downstream, can you take a look?

Comment 15 Shimon Shtein 2018-10-11 08:27:46 UTC
Connecting redmine issue https://projects.theforeman.org/issues/25174 from this bug

Comment 26 errata-xmlrpc 2019-05-14 12:37:13 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2019:1222

Comment 27 Bryan Kearney 2020-02-07 13:43:01 UTC
*** Bug 1699607 has been marked as a duplicate of this bug. ***

Comment 33 Brad Buckingham 2021-04-05 14:17:14 UTC
The behavior described by this bugzilla has been verified to no longer exist on Satellite 6.9; therefore, it has been closed:nextrelease.