Module: Actions::Helpers::Notifications
- Included in:
- Katello::Organization::ManifestDelete, Katello::Organization::ManifestImport, Katello::Organization::ManifestRefresh
- Defined in:
- app/lib/actions/helpers/notifications.rb
Class Method Summary collapse
Instance Method Summary collapse
- #failure_notification(plan) ⇒ Object
- #get_foreman_task(plan) ⇒ Object
- #plan_failed?(plan) ⇒ Boolean
- #send_notification(plan) ⇒ Object
- #subject_organization ⇒ Object
- #success_notification(plan) ⇒ Object
Class Method Details
.included(base) ⇒ Object
4 5 6 |
# File 'app/lib/actions/helpers/notifications.rb', line 4 def self.included(base) base.execution_plan_hooks.use :send_notification, :on => [:stopped] end |
Instance Method Details
#failure_notification(plan) ⇒ Object
19 20 |
# File 'app/lib/actions/helpers/notifications.rb', line 19 def failure_notification(plan) end |
#get_foreman_task(plan) ⇒ Object
30 31 32 |
# File 'app/lib/actions/helpers/notifications.rb', line 30 def get_foreman_task(plan) ::ForemanTasks::Task::DynflowTask.where(:external_id => plan.id).first end |
#plan_failed?(plan) ⇒ Boolean
22 23 24 |
# File 'app/lib/actions/helpers/notifications.rb', line 22 def plan_failed?(plan) [:error, :warning, :cancelled].include?(plan.result) end |
#send_notification(plan) ⇒ Object
8 9 10 11 12 13 14 |
# File 'app/lib/actions/helpers/notifications.rb', line 8 def send_notification(plan) if plan_failed?(plan) failure_notification(plan) else success_notification(plan) end end |
#subject_organization ⇒ Object
26 27 28 |
# File 'app/lib/actions/helpers/notifications.rb', line 26 def subject_organization @organization ||= ::Organization.find(input[:organization][:id]) end |
#success_notification(plan) ⇒ Object
16 17 |
# File 'app/lib/actions/helpers/notifications.rb', line 16 def success_notification(plan) end |