Class: Actions::Katello::ContentView::ErrataMail
- Inherits:
-
EntryAction
- Object
- EntryAction
- Actions::Katello::ContentView::ErrataMail
- Defined in:
- app/lib/actions/katello/content_view/errata_mail.rb
Instance Method Summary collapse
- #finalize ⇒ Object
- #plan(content_view, environment) ⇒ Object
- #rescue_strategy_for_self ⇒ Object
- #run ⇒ Object
Instance Method Details
#finalize ⇒ Object
25 26 27 |
# File 'app/lib/actions/katello/content_view/errata_mail.rb', line 25 def finalize ::User.current = nil end |
#plan(content_view, environment) ⇒ Object
5 6 7 |
# File 'app/lib/actions/katello/content_view/errata_mail.rb', line 5 def plan(content_view, environment) plan_self(:content_view => content_view.id, :environment => environment.id) end |
#rescue_strategy_for_self ⇒ Object
29 30 31 32 33 |
# File 'app/lib/actions/katello/content_view/errata_mail.rb', line 29 def rescue_strategy_for_self # If sending mail fails do not cause any calling tasks to fail # but mark the task in a WARNING state with the error message. Dynflow::Action::Rescue::Skip end |
#run ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'app/lib/actions/katello/content_view/errata_mail.rb', line 9 def run ::User.current = ::User.anonymous_admin content_view = ::Katello::ContentView.find(input[:content_view]) environment = ::Katello::KTEnvironment.find(input[:environment]) users = ::User.select { |user| user.receives?(:katello_promote_errata) && user.can?(:view_content_views, content_view) } begin MailNotification[:katello_promote_errata].deliver(:users => users, :content_view => content_view, :environment => environment) unless users.blank? rescue => e = _('Unable to send errata e-mail notification: %{error}' % {:error => e}) Rails.logger.error() output[:result] = end end |