Sha256: 4083201b91f7f0a2d8ff1348401e726b80ef6cb044507e95a1fb5f56858a572e

Contents?: true

Size: 1.57 KB

Versions: 13

Compression:

Stored size: 1.57 KB

Contents

module Katello
  module Concerns
    module OrganizationsControllerExtensions
      extend ActiveSupport::Concern
      include ForemanTasks::Triggers

      included do
        alias_method_chain :destroy, :dynflow
        alias_method_chain :create, :dynflow
      end

      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

      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)
            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
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
katello-2.4.5 app/controllers/katello/concerns/organizations_controller_extensions.rb
katello-2.4.4 app/controllers/katello/concerns/organizations_controller_extensions.rb
katello-2.4.3 app/controllers/katello/concerns/organizations_controller_extensions.rb
katello-2.4.2 app/controllers/katello/concerns/organizations_controller_extensions.rb
katello-3.0.0.rc4 app/controllers/katello/concerns/organizations_controller_extensions.rb
katello-3.0.0.rc3 app/controllers/katello/concerns/organizations_controller_extensions.rb
katello-3.0.0.rc2 app/controllers/katello/concerns/organizations_controller_extensions.rb
katello-3.0.0.rc1 app/controllers/katello/concerns/organizations_controller_extensions.rb
katello-2.4.1 app/controllers/katello/concerns/organizations_controller_extensions.rb
katello-2.4.0 app/controllers/katello/concerns/organizations_controller_extensions.rb
katello-2.4.0.rc3 app/controllers/katello/concerns/organizations_controller_extensions.rb
katello-2.4.0.rc2 app/controllers/katello/concerns/organizations_controller_extensions.rb
katello-2.4.0.rc1 app/controllers/katello/concerns/organizations_controller_extensions.rb