Module: ExpireHostsNotifications
- Defined in:
- lib/expire_hosts_notifications.rb
Class Method Summary collapse
- .delete_expired_hosts ⇒ Object
-
.deliver_expiry_warning_notification(num = 1) ⇒ Object
notify1_days_before_expiry.
- .stop_expired_hosts ⇒ Object
Class Method Details
.delete_expired_hosts ⇒ Object
5 6 7 |
# File 'lib/expire_hosts_notifications.rb', line 5 def delete_expired_hosts ForemanExpireHosts::Action::DeleteExpiredHosts.new.engage end |
.deliver_expiry_warning_notification(num = 1) ⇒ Object
notify1_days_before_expiry
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/expire_hosts_notifications.rb', line 13 def deliver_expiry_warning_notification(num = 1) # notify1_days_before_expiry return unless [1, 2].include?(num) days_before_expiry = Setting["notify#{num}_days_before_host_expiry"].to_i expiry_date = (Date.today + days_before_expiry) notifiable_hosts = Host.with_expire_date(expiry_date).preload(:owner) ForemanExpireHosts::Notification::ExpiryWarning.new( :hosts => notifiable_hosts, :expiry_date => expiry_date ).deliver end |
.stop_expired_hosts ⇒ Object
9 10 11 |
# File 'lib/expire_hosts_notifications.rb', line 9 def stop_expired_hosts ForemanExpireHosts::Action::StopExpiredHosts.new.engage end |