Module: Katello::Concerns::OrganizationsControllerExtensions

Extended by:
ActiveSupport::Concern
Includes:
ForemanTasks::Triggers
Defined in:
app/controllers/katello/concerns/organizations_controller_extensions.rb

Instance Method Summary collapse

Instance Method Details

#create_with_dynflowObject



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'app/controllers/katello/concerns/organizations_controller_extensions.rb', line 26

def create_with_dynflow
  if taxonomy_class == Organization
    begin
      @taxonomy = Organization.new(params[:organization])
      sync_task(::Actions::Katello::Organization::Create, @taxonomy)
      @taxonomy.reload
      if @count_nil_hosts > 0
        redirect_to send("step2_#{taxonomy_single}_path",   @taxonomy)
      else
        process_success(:object => @taxonomy, :success_redirect => send("edit_#{taxonomy_single}_path", @taxonomy))
      end
    rescue ActiveRecord::RecordInvalid
      process_error(:render => "taxonomies/new", :object => @taxonomy)
    rescue StandardError => ex
      process_error(:render => "taxonomies/new", :object => @taxonomy, :error_msg => ex.message)
    end
  else
    create_without_dynflow
  end
end

#destroy_with_dynflowObject



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/controllers/katello/concerns/organizations_controller_extensions.rb', line 12

def destroy_with_dynflow
  if @taxonomy.is_a?(Organization)
    begin
      async_task(::Actions::Katello::Organization::Destroy, @taxonomy,
                 ::Organization.current)
      process_success :success_msg => _("Organization %s is being deleted.") % @taxonomy.name
    rescue ::Katello::Errors::OrganizationDestroyException => ex
      process_error(:error_msg => ex.message)
    end
  else
    destroy_without_dynflow
  end
end