Sha256: 9813369dfd977b20ca89020ede542782eac9242ada00d7838f7b5c478dca4ac1

Contents?: true

Size: 764 Bytes

Versions: 70

Compression:

Stored size: 764 Bytes

Contents

module UINotifications
  module RemoteExecutionJobs
    class BaseJobFinish < ::UINotifications::Base
      def initialize(job_invocation)
        @subject = job_invocation
      end

      def deliver!
        ::Notification.create!(
          :audience => Notification::AUDIENCE_USER,
          :notification_blueprint => blueprint,
          :initiator => initiator,
          :message => message,
          :subject => subject
        )
      end

      def initiator
        User.anonymous_admin
      end

      def blueprint
        @blueprint ||= NotificationBlueprint.unscoped.find_by(:name => 'rex_job_succeeded')
      end

      def message
        UINotifications::StringParser.new(blueprint.message, { subject: subject })
      end
    end
  end
end

Version data entries

70 entries across 70 versions & 1 rubygems

Version Path
foreman_remote_execution-3.3.5 app/services/ui_notifications/remote_execution_jobs/base_job_finish.rb
foreman_remote_execution-3.3.4 app/services/ui_notifications/remote_execution_jobs/base_job_finish.rb
foreman_remote_execution-3.3.3 app/services/ui_notifications/remote_execution_jobs/base_job_finish.rb
foreman_remote_execution-3.2.2 app/services/ui_notifications/remote_execution_jobs/base_job_finish.rb
foreman_remote_execution-3.3.2 app/services/ui_notifications/remote_execution_jobs/base_job_finish.rb
foreman_remote_execution-3.3.1 app/services/ui_notifications/remote_execution_jobs/base_job_finish.rb
foreman_remote_execution-3.3.0 app/services/ui_notifications/remote_execution_jobs/base_job_finish.rb
foreman_remote_execution-3.2.1 app/services/ui_notifications/remote_execution_jobs/base_job_finish.rb
foreman_remote_execution-3.2.0 app/services/ui_notifications/remote_execution_jobs/base_job_finish.rb
foreman_remote_execution-3.1.0 app/services/ui_notifications/remote_execution_jobs/base_job_finish.rb
foreman_remote_execution-2.0.10 app/services/ui_notifications/remote_execution_jobs/base_job_finish.rb
foreman_remote_execution-2.0.9 app/services/ui_notifications/remote_execution_jobs/base_job_finish.rb
foreman_remote_execution-2.0.8 app/services/ui_notifications/remote_execution_jobs/base_job_finish.rb
foreman_remote_execution-3.0.3 app/services/ui_notifications/remote_execution_jobs/base_job_finish.rb
foreman_remote_execution-3.0.2 app/services/ui_notifications/remote_execution_jobs/base_job_finish.rb
foreman_remote_execution-2.0.7 app/services/ui_notifications/remote_execution_jobs/base_job_finish.rb
foreman_remote_execution-3.0.1 app/services/ui_notifications/remote_execution_jobs/base_job_finish.rb
foreman_remote_execution-3.0.0 app/services/ui_notifications/remote_execution_jobs/base_job_finish.rb
foreman_remote_execution-2.0.6 app/services/ui_notifications/remote_execution_jobs/base_job_finish.rb
foreman_remote_execution-2.0.5 app/services/ui_notifications/remote_execution_jobs/base_job_finish.rb