Project

General

Profile

« Previous | Next » 

Revision 35c14172

Added by Ivan Necas over 7 years ago

Refs #15779 - make background processing unavailable for now (#4217)

The original PR got vetted in the packaging phase and including
foreman-task as dependency of Foreman was refused. We need to rethink
our approach for getting the foreman-tasks functionality available
inside the core and take less obtrusive approach by making the
transition in several steps, until the foreman core will get on
future-parity with foreman-tasks which would effectively mean tasks in
core.

To clean the tasks that were created while using the original changes,
you can run:

rake foreman_tasks:cleanup\
TASK_SEARCH="label = Actions::Foreman::Report::Import
OR label = Actions::Foreman::PuppetClass::Import"\
VERBOSE=true

This reverts commits

eb371ca33dcdd7a4f71d3cda0cfcad701cd3ae7e,
69c34cd691aea4c7f21613f3859ae92a5f403529,
3a1cd1dbeb74c60a482d7c47fc290c185d7c707a,
0cf8ea6780c24954ccbe2cc33ca02e1f6010ffed,
1538b8d2addb12f04da36a2c34224cd821e77acc,
33709ef2813d0128f64905c6597616f44abad28e.

View differences:

test/controllers/api/v2/reports_controller_test.rb
require 'controllers/shared/report_host_permissions_test'
class Api::V2::ReportsControllerTest < ActionController::TestCase
include ForemanTasks::TestHelpers::WithInThreadExecutor
include ::ReportHostPermissionsTest
setup do
......
def test_create_valid
User.current=nil
post :create, {:report => create_a_puppet_transaction_report }, set_session_user
assert_response :accepted
assert_response :success
end
def test_create_invalid
User.current=nil
post :create, {:report => ["not a hash", "throw an error"] }, set_session_user
assert_response :accepted
assert_response :unprocessable_entity
end
def test_create_duplicate
User.current=nil
post :create, {:report => create_a_puppet_transaction_report }, set_session_user
assert_response :accepted
assert_response :success
Foreman::Deprecation.expects(:api_deprecation_warning)
post :create, {:report => create_a_puppet_transaction_report }, set_session_user
assert_response :accepted
assert_response :unprocessable_entity
end
test 'when ":restrict_registered_smart_proxies" is false, HTTP requests should be able to create a report' do
......
Resolv.any_instance.stubs(:getnames).returns(['else.where'])
post :create, {:report => create_a_puppet_transaction_report }
assert_nil @controller.detected_proxy
assert_response :accepted
assert_response :created
end
test 'hosts with a registered smart proxy on should create a report successfully' do
......
Resolv.any_instance.stubs(:getnames).returns([host])
post :create, {:report => create_a_puppet_transaction_report }
assert_equal proxy, @controller.detected_proxy
assert_response :accepted
assert_response :created
end
test 'hosts without a registered smart proxy on should not be able to create a report' do
......
@request.env['SSL_CLIENT_S_DN'] = 'CN=else.where'
@request.env['SSL_CLIENT_VERIFY'] = 'SUCCESS'
post :create, {:report => create_a_puppet_transaction_report }
assert_response :accepted
assert_response :created
end
test 'hosts without a registered smart proxy but with an SSL cert should not be able to create a report' do
......
Resolv.any_instance.stubs(:getnames).returns(['else.where'])
post :create, {:report => create_a_puppet_transaction_report }
assert_response :accepted
assert_response :created
end
end

Also available in: Unified diff