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 +4 -4
- data/README.md +1 -0
- data/app/models/concerns/foreman_expire_hosts/host_ext.rb +0 -1
- data/lib/expire_hosts_notifications.rb +5 -5
- data/lib/foreman_expire_hosts/engine.rb +4 -1
- data/lib/foreman_expire_hosts/version.rb +1 -1
- data/test/unit/expire_hosts_mailer_test.rb +5 -5
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dff569ea01095e51ec33f834ac418f0727562f74
|
4
|
+
data.tar.gz: 0ee7ddb292e6c9939363cbc11d1e824b137b30af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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)
|
@@ -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']).
|
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).
|
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']).
|
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).
|
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']).
|
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.
|
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
|
@@ -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).
|
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).
|
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).
|
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).
|
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).
|
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
|
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-
|
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.
|
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:
|