foreman_expire_hosts 2.0.2 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4a6df2938b1dd23bcc51ceeec5b038f7b4cbbb86
4
- data.tar.gz: 5d0d5c9d10dc61ca98425b68eb012bc06f4dea3d
3
+ metadata.gz: dff569ea01095e51ec33f834ac418f0727562f74
4
+ data.tar.gz: 0ee7ddb292e6c9939363cbc11d1e824b137b30af
5
5
  SHA512:
6
- metadata.gz: 473e5e92b4df667cd758a6abb628cbf8d47a4521e8de5b184b792a41110a91c0c402a5e27876598d9e7c15e317a0b1e06637d6eda2ba219627a327ebadf3a9b0
7
- data.tar.gz: 4070af0f6b9ab0703edba57c4fe6c086496c62abce17386906f122ae6f929557b28c1f1907579016e8cc6a69e7975a489f415c1bf44026c78870050a56efeae5
6
+ metadata.gz: 6ec7cc032b18d3f485060ecad97a57a2de20355b9ed719380f7a9b425155f18b0aa4f276649bb06e138822fcc3f7a8eb3604180f2b8d4b61dd69564ee0b3ea66
7
+ data.tar.gz: 6c62884427e54bc0900810558e346534685ae53942799138e0f97c65353b594ee8a2e4e9fe6d8baac42e4f16324d5aa9886f973e9351828585351e545e2b05ee
data/README.md CHANGED
@@ -13,6 +13,7 @@ This plugin will send two warning notification before host expiry (see Settings)
13
13
  | Foreman Version | Plugin Version |
14
14
  | --------------- | -------------- |
15
15
  | >= 1.11 | ~> 2.0 |
16
+ | >= 1.13 | ~> 2.1 |
16
17
 
17
18
  # Screenshots
18
19
  ![Expiry date field in host form](https://raw.githubusercontent.com/ingenico-group/screenshots/master/foreman_host_expiry/expiry-date-field-in-host-form.png)
@@ -4,7 +4,6 @@ module ForemanExpireHosts
4
4
 
5
5
  included do
6
6
  after_validation :validate_expired_on
7
- attr_accessible :expired_on
8
7
 
9
8
  validates :expired_on, :presence => true, :if => -> { Setting[:is_host_expiry_date_mandatory] }
10
9
 
@@ -33,13 +33,13 @@ module ExpireHostsNotifications
33
33
  unless deleted_hosts.empty?
34
34
  ExpireHostsNotifications.hosts_by_user(deleted_hosts).each do |user_id, hosts_hash|
35
35
  catch_delivery_errors(_('Failed to deliver deleted hosts notification'), deleted_hosts) do
36
- ExpireHostsMailer.deleted_hosts_notification(hosts_hash['email'], hosts_hash['hosts']).deliver
36
+ ExpireHostsMailer.deleted_hosts_notification(hosts_hash['email'], hosts_hash['hosts']).deliver_now
37
37
  end
38
38
  end
39
39
  end
40
40
  return if failed_delete_hosts.empty?
41
41
  catch_delivery_errors(_('Failed to deliver deleted hosts notification failed status'), failed_delete_hosts) do
42
- ExpireHostsMailer.failed_to_delete_hosts_notification(self.admin_email, failed_delete_hosts).deliver
42
+ ExpireHostsMailer.failed_to_delete_hosts_notification(self.admin_email, failed_delete_hosts).deliver_now
43
43
  end
44
44
  end
45
45
 
@@ -65,13 +65,13 @@ module ExpireHostsNotifications
65
65
  delete_date = (Date.today + self.days_to_delete_after_expired.to_i)
66
66
  hosts_by_user(stopped_hosts).each do |user_id, hosts_hash|
67
67
  catch_delivery_errors(_('Failed to deliver stopped hosts notification'), stopped_hosts) do
68
- ExpireHostsMailer.stopped_hosts_notification(hosts_hash['email'], delete_date, hosts_hash['hosts']).deliver
68
+ ExpireHostsMailer.stopped_hosts_notification(hosts_hash['email'], delete_date, hosts_hash['hosts']).deliver_now
69
69
  end
70
70
  end
71
71
  end
72
72
  return if failed_stop_hosts.empty?
73
73
  catch_delivery_errors(_('Failed to deliver stopped hosts notification failed status'), failed_stop_hosts) do
74
- ExpireHostsMailer.failed_to_stop_hosts_notification(self.admin_email, failed_stop_hosts).deliver
74
+ ExpireHostsMailer.failed_to_stop_hosts_notification(self.admin_email, failed_stop_hosts).deliver_now
75
75
  end
76
76
  end
77
77
 
@@ -83,7 +83,7 @@ module ExpireHostsNotifications
83
83
  unless notifiable_hosts.empty?
84
84
  hosts_by_user(notifiable_hosts).each do |user_id, hosts_hash|
85
85
  catch_delivery_errors(_('Failed to deliver expiring hosts notification'), notifiable_hosts) do
86
- ExpireHostsMailer.expiry_warning_notification(hosts_hash['email'], expiry_date, hosts_hash['hosts']).deliver
86
+ ExpireHostsMailer.expiry_warning_notification(hosts_hash['email'], expiry_date, hosts_hash['hosts']).deliver_now
87
87
  end
88
88
  end
89
89
  end
@@ -23,9 +23,12 @@ module ForemanExpireHosts
23
23
 
24
24
  initializer 'foreman_expire_hosts.register_plugin', :before => :finisher_hook do |app|
25
25
  Foreman::Plugin.register :foreman_expire_hosts do
26
- requires_foreman '>= 1.10'
26
+ requires_foreman '>= 1.13'
27
27
  register_custom_status HostStatus::ExpirationStatus
28
28
 
29
+ # strong parameters
30
+ parameter_filter Host::Managed, :expires_on
31
+
29
32
  security_block :hosts do
30
33
  permission :edit_hosts, {:hosts => [:select_multiple_expiration, :update_multiple_expiration]}
31
34
  end
@@ -1,3 +1,3 @@
1
1
  module ForemanExpireHosts
2
- VERSION = '2.0.2'.freeze
2
+ VERSION = '2.1.0'.freeze
3
3
  end
@@ -9,7 +9,7 @@ class ExpireHostMailerTest < ActionMailer::TestCase
9
9
 
10
10
  context 'deleted hosts notification' do
11
11
  setup do
12
- @mail = ExpireHostsMailer.deleted_hosts_notification(@emails, @hosts).deliver
12
+ @mail = ExpireHostsMailer.deleted_hosts_notification(@emails, @hosts).deliver_now
13
13
  end
14
14
 
15
15
  test 'subject should be set' do
@@ -20,7 +20,7 @@ class ExpireHostMailerTest < ActionMailer::TestCase
20
20
 
21
21
  context 'failed to delete hosts notification' do
22
22
  setup do
23
- @mail = ExpireHostsMailer.failed_to_delete_hosts_notification(@emails, @hosts).deliver
23
+ @mail = ExpireHostsMailer.failed_to_delete_hosts_notification(@emails, @hosts).deliver_now
24
24
  end
25
25
 
26
26
  test 'subject should be set' do
@@ -31,7 +31,7 @@ class ExpireHostMailerTest < ActionMailer::TestCase
31
31
 
32
32
  context 'stopped hosts notification' do
33
33
  setup do
34
- @mail = ExpireHostsMailer.stopped_hosts_notification(@emails, Date.today, @hosts).deliver
34
+ @mail = ExpireHostsMailer.stopped_hosts_notification(@emails, Date.today, @hosts).deliver_now
35
35
  end
36
36
 
37
37
  test 'subject should be set' do
@@ -42,7 +42,7 @@ class ExpireHostMailerTest < ActionMailer::TestCase
42
42
 
43
43
  context 'failed to stop hosts notification' do
44
44
  setup do
45
- @mail = ExpireHostsMailer.failed_to_stop_hosts_notification(@emails, @hosts).deliver
45
+ @mail = ExpireHostsMailer.failed_to_stop_hosts_notification(@emails, @hosts).deliver_now
46
46
  end
47
47
 
48
48
  test 'subject should be set' do
@@ -53,7 +53,7 @@ class ExpireHostMailerTest < ActionMailer::TestCase
53
53
 
54
54
  context 'expiry warning notification' do
55
55
  setup do
56
- @mail = ExpireHostsMailer.expiry_warning_notification(@emails, Date.today, @hosts).deliver
56
+ @mail = ExpireHostsMailer.expiry_warning_notification(@emails, Date.today, @hosts).deliver_now
57
57
  end
58
58
 
59
59
  test 'subject should be set' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_expire_hosts
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.2
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nagarjuna Rachaneni
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-07-07 00:00:00.000000000 Z
12
+ date: 2016-10-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: deface
@@ -143,7 +143,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
143
143
  version: '0'
144
144
  requirements: []
145
145
  rubyforge_project:
146
- rubygems_version: 2.4.5
146
+ rubygems_version: 2.5.1
147
147
  signing_key:
148
148
  specification_version: 4
149
149
  summary: Foreman plugin for limiting host lifetime
@@ -155,4 +155,3 @@ test_files:
155
155
  - test/unit/concerns/host_extensions_test.rb
156
156
  - test/unit/expire_hosts_mailer_test.rb
157
157
  - test/unit/host_status/expiration_status_test.rb
158
- has_rdoc: