The asset "host_checkbox.js" is not present in the asset pipeline


several discovery develop tests fail with the following error:

DiscoveredHostsTest::Multiple host Autoprovision#test_0001_converts all discovered to managed hosts:
ActionView::Template::Error: DEPRECATION WARNING: The asset "host_checkbox.js" is not present in the asset pipeline.Falling back to an asset that may be in the public folder.
This behavior is deprecated and will be removed.
To bypass the asset pipeline and preserve this behavior,
use the `skip_pipeline: true` option.
 (called from block in javascript at /home/lzap/work/foreman/app/helpers/layout_helper.rb:96)
    app/helpers/layout_helper.rb:96:in `block in javascript'
    app/helpers/layout_helper.rb:96:in `javascript'
    /home/lzap/work/foreman_discovery/app/views/discovered_hosts/_discovered_hosts_list.html.erb:1:in `__home_lzap_work_foreman_discovery_app_views_discovered_hosts__discovered_hosts_list_html_erb__3955161461847065164_70368181430520'
    /home/lzap/work/foreman_discovery/app/views/discovered_hosts/index.html.erb:2:in `__home_lzap_work_foreman_discovery_app_views_discovered_hosts_index_html_erb__1760550579528718449_70368181204120'
    app/controllers/concerns/foreman/controller/timezone.rb:10:in `set_timezone'
    app/models/concerns/foreman/thread_session.rb:32:in `clear_thread'
    app/controllers/concerns/foreman/controller/topbar_sweeper.rb:12:in `set_topbar_sweeper_controller'
    lib/foreman/middleware/telemetry.rb:10:in `call'
    lib/foreman/middleware/catch_json_parse_errors.rb:9:in `call'
    lib/foreman/middleware/logging_context_session.rb:22:in `call'
    lib/foreman/middleware/logging_context_request.rb:11:in `call'

Can someone explain me what is wrong? I think the deprecated warning is causing the tests to fail so I might need to add it to config/as_deprecation_whitelist.yaml but unsure about this one. Can’t even find it in the codebase.

You can simply remove the <%= javascript “host_checkbox” %> from the list
as its now included in the webpack build.

I’ll send a PR shortly.

1 Like

Thanks a bunch.

1 Like

Thanks that would do it. One more if you have a clue:

DiscoveredHostsTest::Delete hosts#test_0001_it removes all hosts:
Capybara::Poltergeist::JavascriptError: One or more errors were raised in the Javascript code on the page. If you don't care about these errors, you can ignore them by setting js_errors: false in your Poltergeist configuration (see documentation for details).

ReferenceError: Can't find variable: resetSelection
ReferenceError: Can't find variable: resetSelection
    at in onsubmit
    at in trigger
    at in each
    at in each
    at in trigger
    at in submitModalForm
    at in onclick
    at :0 in sendEvent
    at phantomjs://code/web_page.js:64
    at phantomjs://code/web_page.js:626 in mouseEvent
    at phantomjs://code/node.js:94 in mouseEvent
    at phantomjs://code/browser.js:445 in mouse_event
    at phantomjs://code/browser.js:465 in click
    at phantomjs://code/browser.js:97 in runCommand
    at phantomjs://code/cmd.js:35 in run
    at phantomjs://code/connection.js:17 in runCommand
    at phantomjs://code/connection.js:17 in commandReceived
    at phantomjs://code/connection.js:1
    /home/lzap/work/foreman_discovery/test/integration/discovered_hosts_test.rb:52:in `block (2 levels) in <class:DiscoveredHostsTest>'

Ok grepped this one: tfm.hosts.table.resetSelection()


TypeError: undefined is not a function (evaluating ‘tfm.hosts.table.resetSelection.resetSelection()’)


Eh. Friday evenings…