Revision 35c14172
Added by Ivan Necas over 7 years ago
app/controllers/concerns/api/import_puppetclasses_common_controller.rb | ||
---|---|---|
param :smart_proxy_id, String, :required => false
|
||
param :environment_id, String, :required => false
|
||
param :dryrun, :bool, :required => false
|
||
param :background, :bool, :required => false
|
||
param :except, String, :required => false, :desc => N_("Optional comma-delimited string containing either 'new', 'updated', or 'obsolete' that is used to limit the imported Puppet classes")
|
||
|
||
def import_puppetclasses
|
||
... | ... | |
end
|
||
|
||
# RUN PuppetClassImporter
|
||
background = params.key?(:background) && !['false', false].include?(params[:background])
|
||
begin
|
||
task = ForemanTasks.trigger_task(background, ::Actions::Foreman::PuppetClass::Import, :changed => @changed)
|
||
if background
|
||
process_success task
|
||
else
|
||
render("api/v#{api_version}/import_puppetclasses/#{rabl_template}", :layout => "api/layouts/import_puppetclasses_layout")
|
||
end
|
||
rescue ForemanTasks::TaskError => e
|
||
render :json => { :message => _("Failed to update the environments and Puppet classes from the on-disk puppet installation: %s") % e.to_s }, :status => :internal_server_error
|
||
if (errors = ::PuppetClassImporter.new.obsolete_and_new(@changed)).empty?
|
||
render("api/v#{api_version}/import_puppetclasses/#{rabl_template}", :layout => "api/layouts/import_puppetclasses_layout")
|
||
else
|
||
render :json => {:message => _("Failed to update the environments and Puppet classes from the on-disk puppet installation: %s") % errors.join(", ")}, :status => :internal_server_error
|
||
end
|
||
end
|
||
|
Also available in: Unified diff
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:
This reverts commits