foreman_expire_hosts 7.0.4 → 8.0.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
  SHA256:
3
- metadata.gz: b5afc13d619d302e3e05ae902ff90f65d5eefd05e03b00369c7e3ca538260555
4
- data.tar.gz: 9cdf5ad3a41cdc45a2fe0d4f5c0dc850e0a658abc72e20c83a436b5279a19268
3
+ metadata.gz: 7c1855fd3586ff4abdc25e11e58c006a503c83acc12628890ce4d307ebf113b9
4
+ data.tar.gz: c5ce62b9345649f1fd7365b0181ef83e53a93086f3b31435498b12eb6af0ce5c
5
5
  SHA512:
6
- metadata.gz: e65dddbebf6e2140e12fd05adf1b4584284c7e422a5399642eaf7e59e423b86561dbc9a7c0071835fbbffa50d3e34985ce31b1d1d3f955147e0849b2d8ea0d50
7
- data.tar.gz: 4786bb290163e8f868dbe81d377d3747143cd5bcf3e00194625ea7f1c88f2ef0f6840fb2ccce7f5561a005140cacd6ea625a98b1b9fb45da4bf3444387a6047e
6
+ metadata.gz: 15394668d731ba9c01b54e09ef5d13c1f6c3550938fd8fb4ee2188b696da77ad759a3df33ad80285aa378a2e463d496a92d80eb914b56a2af97655889060e23c
7
+ data.tar.gz: bf2fca5f36c7eee30374e413d1c80f482a6fcf13d833a19e57fe4de61f7a14b731742d3064cd870bbd86533d5a5377c8ebe2217c1a70c94a6ade8dafd5bb9a2e
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ class FixSettingsCategoryToDsl < ActiveRecord::Migration[6.0]
4
+ def up
5
+ Setting.where(category: 'Setting::ExpireHost').update_all(category: 'Setting')
6
+ end
7
+ end
@@ -19,13 +19,9 @@ module ForemanExpireHosts
19
19
  end
20
20
  end
21
21
 
22
- initializer 'foreman_expire_hosts.load_default_settings', :before => :load_config_initializers do
23
- require_dependency File.expand_path('../../app/models/setting/expire_hosts.rb', __dir__) if (Setting.table_exists? rescue(false))
24
- end
25
-
26
22
  initializer 'foreman_expire_hosts.register_plugin', :before => :finisher_hook do |_app|
27
23
  Foreman::Plugin.register :foreman_expire_hosts do
28
- requires_foreman '>= 1.24'
24
+ requires_foreman '>= 3.0.0'
29
25
  register_custom_status HostStatus::ExpirationStatus
30
26
 
31
27
  # strong parameters
@@ -43,6 +39,41 @@ module ForemanExpireHosts
43
39
  'hosts/update_multiple_expiration'
44
40
  ]
45
41
 
42
+ settings do
43
+ category(:expire_hosts, N_('Expire Hosts')) do
44
+ setting('is_host_expiry_date_mandatory',
45
+ type: :boolean,
46
+ description: N_('Make expiry date field mandatory on host creation/update'),
47
+ default: false,
48
+ full_name: N_('Require host expiry date'))
49
+ setting('can_owner_modify_host_expiry_date',
50
+ type: :boolean,
51
+ description: N_('Allow host owner to modify host expiry date field. If the field is false then admin only can edit expiry field'),
52
+ default: false,
53
+ full_name: N_('Host owner can modify host expiry date'))
54
+ setting('notify1_days_before_host_expiry',
55
+ type: :integer,
56
+ description: N_('Send first notification to owner of hosts about his hosts expiring in given days. Must be integer only'),
57
+ default: 7,
58
+ full_name: N_('First expiry notification'))
59
+ setting('notify2_days_before_host_expiry',
60
+ type: :integer,
61
+ description: N_('Send second notification to owner of hosts about his hosts expiring in given days. Must be integer only'),
62
+ default: 1,
63
+ full_name: N_('Second expiry notification'))
64
+ setting('days_to_delete_after_host_expiration',
65
+ type: :integer,
66
+ description: N_('Delete expired hosts after given days of hosts expiry date. Must be integer only'),
67
+ default: 3,
68
+ full_name: N_('Expiry grace period in days'))
69
+ setting('host_expiry_email_recipients',
70
+ type: :string,
71
+ description: N_('All notifications will be delivered to its owner. If any other users/admins need to receive those expiry warning notifications then those emails can be configured comma separated here.'),
72
+ default: nil,
73
+ full_name: N_('Expiry e-mail recipients'))
74
+ end
75
+ end
76
+
46
77
  extend_rabl_template 'api/v2/hosts/main', 'api/v2/hosts/expiration'
47
78
 
48
79
  describe_host do
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ForemanExpireHosts
4
- VERSION = '7.0.4'
4
+ VERSION = '8.0.0'
5
5
  end
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: 7.0.4
4
+ version: 8.0.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: 2021-02-02 00:00:00.000000000 Z
12
+ date: 2022-10-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: deface
@@ -116,7 +116,6 @@ files:
116
116
  - app/mailers/expire_hosts_mailer.rb
117
117
  - app/models/concerns/foreman_expire_hosts/host_ext.rb
118
118
  - app/models/host_status/expiration_status.rb
119
- - app/models/setting/expire_hosts.rb
120
119
  - app/overrides/add_expired_on_field_to_host_form.rb
121
120
  - app/overrides/add_expired_on_field_to_host_show.rb
122
121
  - app/overrides/deleted_expired_host_comment_in_audits.rb
@@ -146,6 +145,7 @@ files:
146
145
  - app/views/hosts/select_multiple_expiration.html.erb
147
146
  - config/routes.rb
148
147
  - db/migrate/20150427101516_add_expiry_on_to_hosts.rb
148
+ - db/migrate/20220923181700_fix_settings_category_to_dsl.rb
149
149
  - db/seeds.d/80_expire_hosts_ui_notification.rb
150
150
  - extra/foreman_expire_hosts.cron
151
151
  - lib/expire_hosts_notifications.rb
@@ -183,19 +183,19 @@ required_rubygems_version: !ruby/object:Gem::Requirement
183
183
  - !ruby/object:Gem::Version
184
184
  version: '0'
185
185
  requirements: []
186
- rubygems_version: 3.1.2
186
+ rubygems_version: 3.1.6
187
187
  signing_key:
188
188
  specification_version: 4
189
189
  summary: Foreman plugin for limiting host lifetime
190
190
  test_files:
191
- - test/unit/expire_hosts_mailer_test.rb
192
- - test/unit/host_status/expiration_status_test.rb
193
- - test/unit/safe_destroy_test.rb
194
- - test/unit/expiry_edit_authorizer_test.rb
195
- - test/unit/concerns/host_extensions_test.rb
196
191
  - test/factories/foreman_expire_hosts_factories.rb
197
- - test/lib/expire_hosts_notifications_test.rb
198
- - test/test_plugin_helper.rb
199
- - test/helpers/hosts_helper_test.rb
200
192
  - test/functional/api/v2/hosts_controller_test.rb
201
193
  - test/functional/concerns/hosts_controller_extensions_test.rb
194
+ - test/helpers/hosts_helper_test.rb
195
+ - test/lib/expire_hosts_notifications_test.rb
196
+ - test/test_plugin_helper.rb
197
+ - test/unit/concerns/host_extensions_test.rb
198
+ - test/unit/expire_hosts_mailer_test.rb
199
+ - test/unit/expiry_edit_authorizer_test.rb
200
+ - test/unit/host_status/expiration_status_test.rb
201
+ - test/unit/safe_destroy_test.rb
@@ -1,23 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class Setting::ExpireHosts < Setting
4
- Setting::BLANK_ATTRS.push('host_expiry_email_recipients')
5
-
6
- def self.load_defaults
7
- # Check the table exists
8
- return unless super
9
-
10
- self.transaction do
11
- [
12
- self.set('is_host_expiry_date_mandatory', N_('Make expiry date field mandatory on host creation/update'), false, N_('Require host expiry date')),
13
- self.set('can_owner_modify_host_expiry_date', N_('Allow host owner to modify host expiry date field. If the field is false then admin only can edit expiry field'), false, N_('Host owner can modify host expiry date')),
14
- self.set('notify1_days_before_host_expiry', N_('Send first notification to owner of hosts about his hosts expiring in given days. Must be integer only'), 7, N_('First expiry notification')),
15
- self.set('notify2_days_before_host_expiry', N_('Send second notification to owner of hosts about his hosts expiring in given days. Must be integer only'), 1, N_('Second expiry notification')),
16
- self.set('days_to_delete_after_host_expiration', N_('Delete expired hosts after given days of hosts expiry date. Must be integer only'), 3, N_('Expiry grace period in days')),
17
- self.set('host_expiry_email_recipients', N_('All notifications will be delivered to its owner. If any other users/admins need to receive those expiry warning notifications then those emails can be configured comma separated here.'), nil, N_('Expiry e-mail recipients'))
18
- ].each { |s| self.create! s.update(:category => 'Setting::ExpireHosts') }
19
- end
20
-
21
- true
22
- end
23
- end