Sha256: 9b19cba60f3bf5fddb7ad4607824d7eb33a3e4e876364683f911803030eaad58

Contents?: true

Size: 847 Bytes

Versions: 27

Compression:

Stored size: 847 Bytes

Contents

# frozen_string_literal: true
module ForemanDiscovery
  module UINotifications
    # Adds notification upon failed discovery
    class FailedDiscovery < ::UINotifications::Base
      def initialize(message)
        @message = message
      end

      private

      def create
        add_notification if update_notifications.zero?
      end

      def update_notifications
        blueprint.mass_update_expiry
      end

      def add_notification
        Notification.create!(
          initiator: initiator,
          audience: ::Notification::AUDIENCE_ADMIN,
          message: _("One or more hosts with failed discovery due to error: #{@message}"),
          notification_blueprint: blueprint,
        )
      end

      def blueprint
        @blueprint ||= NotificationBlueprint.find_by(name: 'failed_discovery')
      end
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
foreman_discovery-22.0.4 app/services/foreman_discovery/ui_notifications/failed_discovery.rb
foreman_discovery-21.0.5 app/services/foreman_discovery/ui_notifications/failed_discovery.rb
foreman_discovery-22.0.2 app/services/foreman_discovery/ui_notifications/failed_discovery.rb
foreman_discovery-21.0.4 app/services/foreman_discovery/ui_notifications/failed_discovery.rb
foreman_discovery-21.0.3 app/services/foreman_discovery/ui_notifications/failed_discovery.rb
foreman_discovery-21.0.2 app/services/foreman_discovery/ui_notifications/failed_discovery.rb
foreman_discovery-19.0.5 app/services/foreman_discovery/ui_notifications/failed_discovery.rb
foreman_discovery-19.0.4 app/services/foreman_discovery/ui_notifications/failed_discovery.rb
foreman_discovery-21.0.1 app/services/foreman_discovery/ui_notifications/failed_discovery.rb
foreman_discovery-19.0.3 app/services/foreman_discovery/ui_notifications/failed_discovery.rb
foreman_discovery-21.0.0 app/services/foreman_discovery/ui_notifications/failed_discovery.rb
foreman_discovery-19.0.2 app/services/foreman_discovery/ui_notifications/failed_discovery.rb
foreman_discovery-20.0.1 app/services/foreman_discovery/ui_notifications/failed_discovery.rb
foreman_discovery-20.0.0 app/services/foreman_discovery/ui_notifications/failed_discovery.rb
foreman_discovery-19.0.1 app/services/foreman_discovery/ui_notifications/failed_discovery.rb
foreman_discovery-19.0.0 app/services/foreman_discovery/ui_notifications/failed_discovery.rb
foreman_discovery-18.0.5 app/services/foreman_discovery/ui_notifications/failed_discovery.rb
foreman_discovery-18.0.4 app/services/foreman_discovery/ui_notifications/failed_discovery.rb
foreman_discovery-18.0.3 app/services/foreman_discovery/ui_notifications/failed_discovery.rb
foreman_discovery-17.0.5 app/services/foreman_discovery/ui_notifications/failed_discovery.rb