foreman_dlm 3.0.0 → 4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cbea781adcb410612c6d6fde4e13f116f31f50f393ac518c55cdf8ff0bc0ab22
4
- data.tar.gz: 201b1a484408da1971ebd7b33285d5738a1a707bd84ec06a04ed05510c85d065
3
+ metadata.gz: 3b80fdd6f962a1cb1ab338f061bea43d0ea641f7b34f647c225bf6abc2a366f4
4
+ data.tar.gz: b7860026fa2dd1c7885011297483b79de657678123e1b25960c974ee4505e9cc
5
5
  SHA512:
6
- metadata.gz: 961720c5a51b86f720e61f1463bc9b413419be9876d93d36070053d14961db07b9f42f0a82c99c0b917f621296b401da1caf49f123882402e943d8994228f734
7
- data.tar.gz: c9cab6e1b37b3321ce4d862dc8599f9af2d8b9b5ce911eaa4141f28816364cfed1d29e372cbe5a1583df2876d47681b7c4c66c70c11dc5ef3164611965ccd99b
6
+ metadata.gz: d647bbeaeaefac4d7eb91396e68815348da49713d149b000b30619ef8b808ca86b9f0a90bb2b5409454023286399136d847d15aab1c54785c0430a455b1d480c
7
+ data.tar.gz: dc5b9bd8d089fbbecaae290e501aa7536f689cd0c8af96f154cff9fef449c8d68dea560e7051e967180c9457aa29dffd7e9bba388406e82d7a605011ef9f06e9
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Foreman Distributed Lock Manager
2
2
 
3
- [<img src="https://opensourcelogos.aws.dmtech.cloud/dmTECH_opensource_logo%401x.svg" height="21" width="130">](https://www.dmtech.de/)
3
+ [<img src="https://raw.githubusercontent.com/dm-drogeriemarkt/.github/refs/heads/main/assets/dmtech-open-source-badge.svg">](https://www.dmtech.de/)
4
4
 
5
5
  This is a plugin for Foreman that allows Foreman to act as a distributed lock manager.
6
6
  Updates are key to security, but updates of an operating system are hard to apply and existing tools are hard to manage at scale. This might lead to a large drift between important security updates becoming available and all your hosts being successfully patched. Security experts recommend to install updates as soon as they come available. The ability to easily update software is the most effective way to improve server security. Automation is key to ensure this goal is reached.
@@ -16,6 +16,7 @@ With this plugin servers can acquire a lock in Foreman to ensure only one server
16
16
  | >= 1.17 | ~> 1.0 |
17
17
  | >= 3.0 | ~> 2.0 |
18
18
  | >= 3.9 | ~> 3.0 |
19
+ | >= 3.13 | ~> 4.0 |
19
20
 
20
21
  ## Installation
21
22
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class RenameDlmlockStiModels < ActiveRecord::Migration[5.1]
3
+ class RenameDlmlockSTIModels < ActiveRecord::Migration[5.1]
4
4
  def up
5
5
  execute "UPDATE dlmlocks set type='ForemanDlm::Dlmlock::Update' where type='Dlmlock::Update';"
6
6
  end
@@ -4,10 +4,6 @@ module ForemanDlm
4
4
  class Engine < ::Rails::Engine
5
5
  engine_name 'foreman_dlm'
6
6
 
7
- config.autoload_paths += Dir["#{config.root}/app/controllers/concerns"]
8
- config.autoload_paths += Dir["#{config.root}/app/models/concerns"]
9
- config.autoload_paths += Dir["#{config.root}/app/jobs"]
10
-
11
7
  # Add any db migrations
12
8
  initializer 'foreman_dlm.load_app_instance_data' do |app|
13
9
  ForemanDlm::Engine.paths['db/migrate'].existent.each do |path|
@@ -15,77 +11,79 @@ module ForemanDlm
15
11
  end
16
12
  end
17
13
 
18
- initializer 'foreman_dlm.register_plugin', :before => :finisher_hook do |_app|
19
- Foreman::Plugin.register :foreman_dlm do
20
- requires_foreman '>= 3.0'
21
-
22
- apipie_documented_controllers ["#{ForemanDlm::Engine.root}/app/controllers/api/v2/*.rb"]
23
-
24
- settings do
25
- category(:general) do
26
- setting('dlm_stale_time',
27
- type: :integer,
28
- default: 4,
29
- description: N_('Number of hours after which locked Distributed Lock is stale'),
30
- full_name: N_('Distributed Lock stale time'),
31
- validate: { numericality: { greater_than: 0 } })
14
+ initializer 'foreman_dlm.register_plugin', :before => :finisher_hook do |app|
15
+ app.reloader.to_prepare do
16
+ Foreman::Plugin.register :foreman_dlm do
17
+ requires_foreman '>= 3.13'
18
+
19
+ apipie_documented_controllers ["#{ForemanDlm::Engine.root}/app/controllers/api/v2/*.rb"]
20
+
21
+ settings do
22
+ category(:general) do
23
+ setting('dlm_stale_time',
24
+ type: :integer,
25
+ default: 4,
26
+ description: N_('Number of hours after which locked Distributed Lock is stale'),
27
+ full_name: N_('Distributed Lock stale time'),
28
+ validate: { numericality: { greater_than: 0 } })
29
+ end
32
30
  end
33
- end
34
31
 
35
- # Add permissions
36
- security_block :foreman_dlm do
37
- permission :view_dlmlocks, {
38
- :'foreman_dlm/dlmlocks' => [:index, :show, :auto_complete_search],
39
- :'api/v2/dlmlocks' => [:index, :show],
40
- }, :resource_type => 'ForemanDlm::Dlmlock'
41
-
42
- permission :create_dlmlocks, {
43
- :'api/v2/dlmlocks' => [:create],
44
- }, :resource_type => 'ForemanDlm::Dlmlock'
45
-
46
- permission :edit_dlmlocks, {
47
- :'foreman_dlm/dlmlocks' => [:release, :enable, :disable],
48
- :'api/v2/dlmlocks' => [:update, :acquire, :release],
49
- }, :resource_type => 'ForemanDlm::Dlmlock'
50
-
51
- permission :destroy_dlmlocks, {
52
- :'foreman_dlm/dlmlocks' => [:destroy],
53
- :'api/v2/dlmlocks' => [:destroy],
54
- }, :resource_type => 'ForemanDlm::Dlmlock'
55
-
56
- permission :view_dlmlock_events, {
57
- :'api/v2/dlmlock_events' => [:index],
58
- }, :resource_type => 'ForemanDlm::DlmlockEvent'
59
- end
32
+ # Add permissions
33
+ security_block :foreman_dlm do
34
+ permission :view_dlmlocks, {
35
+ :'foreman_dlm/dlmlocks' => [:index, :show, :auto_complete_search],
36
+ :'api/v2/dlmlocks' => [:index, :show],
37
+ }, :resource_type => 'ForemanDlm::Dlmlock'
38
+
39
+ permission :create_dlmlocks, {
40
+ :'api/v2/dlmlocks' => [:create],
41
+ }, :resource_type => 'ForemanDlm::Dlmlock'
42
+
43
+ permission :edit_dlmlocks, {
44
+ :'foreman_dlm/dlmlocks' => [:release, :enable, :disable],
45
+ :'api/v2/dlmlocks' => [:update, :acquire, :release],
46
+ }, :resource_type => 'ForemanDlm::Dlmlock'
47
+
48
+ permission :destroy_dlmlocks, {
49
+ :'foreman_dlm/dlmlocks' => [:destroy],
50
+ :'api/v2/dlmlocks' => [:destroy],
51
+ }, :resource_type => 'ForemanDlm::Dlmlock'
52
+
53
+ permission :view_dlmlock_events, {
54
+ :'api/v2/dlmlock_events' => [:index],
55
+ }, :resource_type => 'ForemanDlm::DlmlockEvent'
56
+ end
60
57
 
61
- # Add a new role called 'Distributed Lock Manager' if it doesn't exist
62
- role 'Distributed Lock Manager', [:view_dlmlocks,
63
- :create_dlmlocks,
64
- :edit_dlmlocks,
65
- :destroy_dlmlocks,
66
- :view_dlmlock_events],
67
- 'Role granting full access permissions to distributed locks'
68
-
69
- # add menu entry
70
- menu :top_menu, :foreman_dlm_dlmlocks,
71
- url_hash: { controller: :'foreman_dlm/dlmlocks', action: :index },
72
- caption: N_('Distributed Locks'),
73
- parent: :monitor_menu,
74
- after: :audits
75
-
76
- # Dlm Facet
77
- register_facet(ForemanDlm::DlmFacet, :dlm_facet) do
78
- api_view list: 'foreman_dlm/api/v2/dlm_facets/base_with_root', single: 'foreman_dlm/api/v2/dlm_facets/show'
79
- end
58
+ # Add a new role called 'Distributed Lock Manager' if it doesn't exist
59
+ role 'Distributed Lock Manager', [:view_dlmlocks,
60
+ :create_dlmlocks,
61
+ :edit_dlmlocks,
62
+ :destroy_dlmlocks,
63
+ :view_dlmlock_events],
64
+ 'Role granting full access permissions to distributed locks'
65
+
66
+ # add menu entry
67
+ menu :top_menu, :foreman_dlm_dlmlocks,
68
+ url_hash: { controller: :'foreman_dlm/dlmlocks', action: :index },
69
+ caption: N_('Distributed Locks'),
70
+ parent: :monitor_menu,
71
+ after: :audits
72
+
73
+ # Dlm Facet
74
+ register_facet(ForemanDlm::DlmFacet, :dlm_facet) do
75
+ api_view list: 'foreman_dlm/api/v2/dlm_facets/base_with_root', single: 'foreman_dlm/api/v2/dlm_facets/show'
76
+ end
80
77
 
81
- register_custom_status HostStatus::DlmlockStatus
78
+ register_custom_status HostStatus::DlmlockStatus
82
79
 
83
- # extend host show page
84
- extend_page('hosts/show') do |context|
85
- context.add_pagelet :main_tabs,
86
- :name => N_('Locks'),
87
- :partial => 'hosts/dlmlocks_tab',
88
- :onlyif => proc { |host| host.dlm_facet }
80
+ # extend host show page
81
+ extend_page('hosts/show') do |context|
82
+ context.add_pagelet :main_tabs,
83
+ :name => N_('Locks'),
84
+ :partial => 'hosts/dlmlocks_tab',
85
+ :onlyif => proc { |host| host.dlm_facet }
86
+ end
89
87
  end
90
88
  end
91
89
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ForemanDlm
4
- VERSION = '3.0.0'
4
+ VERSION = '4.0.0'
5
5
  end
@@ -22,7 +22,12 @@ class DlmlocksTest < IntegrationTestWithJavascript
22
22
  search_bar.first('input').set('ho')
23
23
 
24
24
  autocomplete_list = page.first('div[data-ouia-component-id="search-autocomplete-menu"]')
25
- list = autocomplete_list.find_all('span.pf-c-menu__item-text').map(&:text)
25
+ version = Foreman::Version.new
26
+ list = if version.major.to_i == 3 && version.minor.to_i <= 14
27
+ autocomplete_list.find_all('span.pf-c-menu__item-text').map(&:text)
28
+ else
29
+ autocomplete_list.find_all('span.pf-v5-c-menu__item-text').map(&:text)
30
+ end
26
31
 
27
32
  assert_includes list, 'host'
28
33
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_dlm
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 4.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Timo Goebel
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-05-14 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: rdoc
@@ -133,7 +132,6 @@ licenses:
133
132
  metadata:
134
133
  rubygems_mfa_required: 'true'
135
134
  is_foreman_plugin: 'true'
136
- post_install_message:
137
135
  rdoc_options: []
138
136
  require_paths:
139
137
  - lib
@@ -151,8 +149,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
151
149
  - !ruby/object:Gem::Version
152
150
  version: '0'
153
151
  requirements: []
154
- rubygems_version: 3.4.1
155
- signing_key:
152
+ rubygems_version: 3.6.7
156
153
  specification_version: 4
157
154
  summary: Distributed Lock Manager for Foreman.
158
155
  test_files: