foreman_expire_hosts 7.0.2 → 8.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/db/migrate/20220923181700_fix_settings_category_to_dsl.rb +7 -0
- data/lib/foreman_expire_hosts/engine.rb +36 -5
- data/lib/foreman_expire_hosts/version.rb +1 -1
- metadata +5 -13
- data/.github/workflows/ci.yml +0 -78
- data/.gitignore +0 -15
- data/.rubocop.yml +0 -78
- data/.rubocop_todo.yml +0 -22
- data/Gemfile +0 -5
- data/app/models/setting/expire_hosts.rb +0 -23
- data/foreman_expire_hosts.gemspec +0 -33
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7c1855fd3586ff4abdc25e11e58c006a503c83acc12628890ce4d307ebf113b9
|
|
4
|
+
data.tar.gz: c5ce62b9345649f1fd7365b0181ef83e53a93086f3b31435498b12eb6af0ce5c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 15394668d731ba9c01b54e09ef5d13c1f6c3550938fd8fb4ee2188b696da77ad759a3df33ad80285aa378a2e463d496a92d80eb914b56a2af97655889060e23c
|
|
7
|
+
data.tar.gz: bf2fca5f36c7eee30374e413d1c80f482a6fcf13d833a19e57fe4de61f7a14b731742d3064cd870bbd86533d5a5377c8ebe2217c1a70c94a6ade8dafd5bb9a2e
|
|
@@ -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 '>=
|
|
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
|
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:
|
|
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:
|
|
12
|
+
date: 2022-10-24 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: deface
|
|
@@ -103,15 +103,8 @@ email:
|
|
|
103
103
|
- mail@timogoebel.name
|
|
104
104
|
executables: []
|
|
105
105
|
extensions: []
|
|
106
|
-
extra_rdoc_files:
|
|
107
|
-
- README.md
|
|
108
|
-
- LICENSE
|
|
106
|
+
extra_rdoc_files: []
|
|
109
107
|
files:
|
|
110
|
-
- ".github/workflows/ci.yml"
|
|
111
|
-
- ".gitignore"
|
|
112
|
-
- ".rubocop.yml"
|
|
113
|
-
- ".rubocop_todo.yml"
|
|
114
|
-
- Gemfile
|
|
115
108
|
- LICENSE
|
|
116
109
|
- README.md
|
|
117
110
|
- app/controllers/concerns/foreman_expire_hosts/api/v2/hosts_controller_extensions.rb
|
|
@@ -123,7 +116,6 @@ files:
|
|
|
123
116
|
- app/mailers/expire_hosts_mailer.rb
|
|
124
117
|
- app/models/concerns/foreman_expire_hosts/host_ext.rb
|
|
125
118
|
- app/models/host_status/expiration_status.rb
|
|
126
|
-
- app/models/setting/expire_hosts.rb
|
|
127
119
|
- app/overrides/add_expired_on_field_to_host_form.rb
|
|
128
120
|
- app/overrides/add_expired_on_field_to_host_show.rb
|
|
129
121
|
- app/overrides/deleted_expired_host_comment_in_audits.rb
|
|
@@ -153,9 +145,9 @@ files:
|
|
|
153
145
|
- app/views/hosts/select_multiple_expiration.html.erb
|
|
154
146
|
- config/routes.rb
|
|
155
147
|
- db/migrate/20150427101516_add_expiry_on_to_hosts.rb
|
|
148
|
+
- db/migrate/20220923181700_fix_settings_category_to_dsl.rb
|
|
156
149
|
- db/seeds.d/80_expire_hosts_ui_notification.rb
|
|
157
150
|
- extra/foreman_expire_hosts.cron
|
|
158
|
-
- foreman_expire_hosts.gemspec
|
|
159
151
|
- lib/expire_hosts_notifications.rb
|
|
160
152
|
- lib/foreman_expire_hosts.rb
|
|
161
153
|
- lib/foreman_expire_hosts/engine.rb
|
|
@@ -191,7 +183,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
191
183
|
- !ruby/object:Gem::Version
|
|
192
184
|
version: '0'
|
|
193
185
|
requirements: []
|
|
194
|
-
rubygems_version: 3.1.
|
|
186
|
+
rubygems_version: 3.1.6
|
|
195
187
|
signing_key:
|
|
196
188
|
specification_version: 4
|
|
197
189
|
summary: Foreman plugin for limiting host lifetime
|
data/.github/workflows/ci.yml
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
name: CI
|
|
2
|
-
on: [push, pull_request]
|
|
3
|
-
env:
|
|
4
|
-
RAILS_ENV: test
|
|
5
|
-
DATABASE_URL: postgresql://postgres:@localhost/test
|
|
6
|
-
DATABASE_CLEANER_ALLOW_REMOTE_DATABASE_URL: true
|
|
7
|
-
jobs:
|
|
8
|
-
rubocop:
|
|
9
|
-
runs-on: ubuntu-latest
|
|
10
|
-
steps:
|
|
11
|
-
- uses: actions/checkout@v2
|
|
12
|
-
- name: Setup Ruby
|
|
13
|
-
uses: ruby/setup-ruby@v1
|
|
14
|
-
with:
|
|
15
|
-
ruby-version: 2.3
|
|
16
|
-
- name: Setup
|
|
17
|
-
run: |
|
|
18
|
-
gem install bundler
|
|
19
|
-
bundle install --jobs=3 --retry=3
|
|
20
|
-
- name: Run rubocop
|
|
21
|
-
run: bundle exec rubocop
|
|
22
|
-
test:
|
|
23
|
-
runs-on: ubuntu-latest
|
|
24
|
-
needs: rubocop
|
|
25
|
-
services:
|
|
26
|
-
postgres:
|
|
27
|
-
image: postgres:12.1
|
|
28
|
-
ports: ['5432:5432']
|
|
29
|
-
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
|
|
30
|
-
strategy:
|
|
31
|
-
fail-fast: false
|
|
32
|
-
matrix:
|
|
33
|
-
foreman-core-branch: [1.24-stable, 2.0-stable, 2.1-stable, develop]
|
|
34
|
-
ruby-version: [2.3, 2.5, 2.6]
|
|
35
|
-
node-version: [10]
|
|
36
|
-
exclude:
|
|
37
|
-
- foreman-core-branch: 2.0-stable
|
|
38
|
-
ruby-version: 2.3
|
|
39
|
-
- foreman-core-branch: 2.1-stable
|
|
40
|
-
ruby-version: 2.3
|
|
41
|
-
- foreman-core-branch: develop
|
|
42
|
-
ruby-version: 2.3
|
|
43
|
-
steps:
|
|
44
|
-
- name: Install dependencies
|
|
45
|
-
run: |
|
|
46
|
-
sudo apt-get update
|
|
47
|
-
sudo apt-get install build-essential libcurl4-openssl-dev libvirt-dev ruby-libvirt zlib1g-dev libpq-dev
|
|
48
|
-
- uses: actions/checkout@v2
|
|
49
|
-
with:
|
|
50
|
-
repository: theforeman/foreman
|
|
51
|
-
ref: ${{ matrix.foreman-core-branch }}
|
|
52
|
-
- uses: actions/checkout@v2
|
|
53
|
-
with:
|
|
54
|
-
path: foreman_expire_hosts
|
|
55
|
-
- name: Setup Ruby
|
|
56
|
-
uses: ruby/setup-ruby@v1
|
|
57
|
-
with:
|
|
58
|
-
ruby-version: ${{ matrix.ruby-version }}
|
|
59
|
-
- name: Setup Node
|
|
60
|
-
uses: actions/setup-node@v1
|
|
61
|
-
with:
|
|
62
|
-
node-version: ${{ matrix.node-version }}
|
|
63
|
-
- name: Setup Plugin
|
|
64
|
-
run: |
|
|
65
|
-
echo "gem 'foreman_expire_hosts', path: './foreman_expire_hosts'" > bundler.d/foreman_expire_hosts.local.rb
|
|
66
|
-
gem install bundler
|
|
67
|
-
bundle config set without journald development console mysql2 sqlite
|
|
68
|
-
bundle install --jobs=3 --retry=3
|
|
69
|
-
bundle exec rake db:create
|
|
70
|
-
bundle exec rake db:migrate
|
|
71
|
-
npm install
|
|
72
|
-
bundle exec rake webpack:compile
|
|
73
|
-
- name: Run plugin tests
|
|
74
|
-
run: bundle exec rake test:foreman_expire_hosts
|
|
75
|
-
- name: Precompile plugin assets
|
|
76
|
-
run: bundle exec rake 'plugin:assets:precompile[foreman_expire_hosts]'
|
|
77
|
-
env:
|
|
78
|
-
RAILS_ENV: production
|
data/.gitignore
DELETED
data/.rubocop.yml
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
inherit_from:
|
|
2
|
-
- .rubocop_todo.yml
|
|
3
|
-
|
|
4
|
-
require:
|
|
5
|
-
- rubocop-minitest
|
|
6
|
-
- rubocop-performance
|
|
7
|
-
- rubocop-rails
|
|
8
|
-
|
|
9
|
-
AllCops:
|
|
10
|
-
TargetRubyVersion: 2.3
|
|
11
|
-
TargetRailsVersion: 5.1
|
|
12
|
-
Exclude:
|
|
13
|
-
- 'Rakefile'
|
|
14
|
-
|
|
15
|
-
Rails:
|
|
16
|
-
Enabled: true
|
|
17
|
-
|
|
18
|
-
Rails/Date:
|
|
19
|
-
Enabled: false
|
|
20
|
-
|
|
21
|
-
# Don't enforce documentation
|
|
22
|
-
Style/Documentation:
|
|
23
|
-
Enabled: false
|
|
24
|
-
|
|
25
|
-
Naming/AccessorMethodName:
|
|
26
|
-
Enabled: false
|
|
27
|
-
|
|
28
|
-
Style/RedundantSelf:
|
|
29
|
-
Enabled: false
|
|
30
|
-
|
|
31
|
-
Naming/FileName:
|
|
32
|
-
Exclude:
|
|
33
|
-
- 'db/seeds.d/*'
|
|
34
|
-
|
|
35
|
-
Style/WordArray:
|
|
36
|
-
Enabled: false
|
|
37
|
-
|
|
38
|
-
Style/RescueModifier:
|
|
39
|
-
Enabled: false
|
|
40
|
-
|
|
41
|
-
Style/ClassAndModuleChildren:
|
|
42
|
-
Enabled: false
|
|
43
|
-
|
|
44
|
-
Style/EachWithObject:
|
|
45
|
-
Enabled: false
|
|
46
|
-
|
|
47
|
-
Style/SymbolArray:
|
|
48
|
-
Enabled: false
|
|
49
|
-
|
|
50
|
-
Style/FormatString:
|
|
51
|
-
Enabled: false
|
|
52
|
-
|
|
53
|
-
Style/FormatStringToken:
|
|
54
|
-
Enabled: false
|
|
55
|
-
|
|
56
|
-
Style/HashSyntax:
|
|
57
|
-
Enabled: false
|
|
58
|
-
|
|
59
|
-
Rails/HasManyOrHasOneDependent:
|
|
60
|
-
Enabled: false
|
|
61
|
-
|
|
62
|
-
Style/CommentedKeyword:
|
|
63
|
-
Enabled: false
|
|
64
|
-
|
|
65
|
-
Rails/LexicallyScopedActionFilter:
|
|
66
|
-
Enabled: false
|
|
67
|
-
|
|
68
|
-
Rails/OutputSafety:
|
|
69
|
-
Enabled: false
|
|
70
|
-
|
|
71
|
-
Rails/SkipsModelValidations:
|
|
72
|
-
Enabled: false
|
|
73
|
-
|
|
74
|
-
Metrics:
|
|
75
|
-
Enabled: false
|
|
76
|
-
|
|
77
|
-
Layout/LineLength:
|
|
78
|
-
Enabled: false
|
data/.rubocop_todo.yml
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
# This configuration was generated by
|
|
2
|
-
# `rubocop --auto-gen-config`
|
|
3
|
-
# on 2019-12-04 09:30:58 +0100 using RuboCop version 0.75.0.
|
|
4
|
-
# The point is for the user to remove these configuration records
|
|
5
|
-
# one by one as the offenses are removed from the code base.
|
|
6
|
-
# Note that changes in the inspected code, or installation of new
|
|
7
|
-
# versions of RuboCop, may require this file to be generated again.
|
|
8
|
-
|
|
9
|
-
Minitest/RefuteFalse:
|
|
10
|
-
Enabled: false
|
|
11
|
-
|
|
12
|
-
Minitest/AssertTruthy:
|
|
13
|
-
Enabled: false
|
|
14
|
-
|
|
15
|
-
Style/HashEachMethods:
|
|
16
|
-
Enabled: false
|
|
17
|
-
|
|
18
|
-
Style/HashTransformKeys:
|
|
19
|
-
Enabled: false
|
|
20
|
-
|
|
21
|
-
Style/HashTransformValues:
|
|
22
|
-
Enabled: false
|
data/Gemfile
DELETED
|
@@ -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
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require File.expand_path('lib/foreman_expire_hosts/version', __dir__)
|
|
4
|
-
require 'date'
|
|
5
|
-
|
|
6
|
-
Gem::Specification.new do |s|
|
|
7
|
-
s.name = 'foreman_expire_hosts'
|
|
8
|
-
s.version = ForemanExpireHosts::VERSION
|
|
9
|
-
s.date = Date.today.to_s
|
|
10
|
-
s.authors = ['Nagarjuna Rachaneni', 'Timo Goebel']
|
|
11
|
-
s.email = ['nn.nagarjuna@gmail.com', 'mail@timogoebel.name']
|
|
12
|
-
s.summary = 'Foreman plugin for limiting host lifetime'
|
|
13
|
-
s.description = <<~DESC
|
|
14
|
-
A Foreman plugin that allows hosts to expire at a configurable date.
|
|
15
|
-
Hosts will be shut down and automatically deleted after a grace period.
|
|
16
|
-
DESC
|
|
17
|
-
s.homepage = 'https://github.com/theforeman/foreman_expire_hosts'
|
|
18
|
-
s.licenses = ['GPL-3.0']
|
|
19
|
-
|
|
20
|
-
s.files = `git ls-files`.split("\n")
|
|
21
|
-
s.test_files = `git ls-files test`.split("\n")
|
|
22
|
-
s.extra_rdoc_files = `git ls-files doc`.split("\n") + Dir['README*', 'LICENSE']
|
|
23
|
-
|
|
24
|
-
s.require_paths = ['lib']
|
|
25
|
-
|
|
26
|
-
s.add_dependency 'deface'
|
|
27
|
-
|
|
28
|
-
s.add_development_dependency 'rdoc'
|
|
29
|
-
s.add_development_dependency 'rubocop', '~> 0.80.0'
|
|
30
|
-
s.add_development_dependency 'rubocop-minitest', '~> 0.7.0'
|
|
31
|
-
s.add_development_dependency 'rubocop-performance', '~> 1.5.2'
|
|
32
|
-
s.add_development_dependency 'rubocop-rails', '~> 2.4.2'
|
|
33
|
-
end
|