foreman_leapp 1.2.2 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/api/v2/concerns/api_authorizer.rb +2 -2
- data/app/lib/actions/{preupgrade_job.rb → foreman_leapp/preupgrade_job.rb} +2 -2
- data/app/lib/helpers/job_helper.rb +6 -8
- data/app/views/foreman_leapp/job_templates/leapp_remediation.erb +0 -3
- data/config/routes.rb +1 -1
- data/db/seeds.d/10_leapp_preupgrade.rb +1 -1
- data/lib/foreman_leapp/engine.rb +5 -2
- data/lib/foreman_leapp/version.rb +1 -1
- data/test/helpers/template_helper_test.rb +2 -2
- data/test/unit/actions/preupgrade_job_test.rb +1 -1
- data/test/unit/helpers/job_helper_test.rb +2 -2
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 745ee96b1f3f15a4318a625b4b28014d28078ea295319430b5711fe28083cb7d
|
4
|
+
data.tar.gz: cc04180b1d6ffab8b02e4e9c55989643eb9d1299bc39758c7d06be1164b4dc8a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b4f56020c7a8eb952a83ec8c7a0e7e8933915b19b85bf51261f9c62f3f974c98e9db9dea4aea09113fb42814f9f14f107da43b488df5779fd4b4c43ea397766
|
7
|
+
data.tar.gz: 1883970a28fd7d929fb592419d2115d0a1fa433c63e8facd1b3df3f832d0daee6568f98f06d54a1450b4efc0385dfa28bf1ba9e5904e268abca9e4bf3a2e7e63
|
@@ -13,8 +13,8 @@ module ApiAuthorizer
|
|
13
13
|
return if User.current.can?('view_hosts')
|
14
14
|
|
15
15
|
render_error 'access_denied', status: :forbidden,
|
16
|
-
|
17
|
-
|
16
|
+
locals: { details: N_('Missing one of the required permissions: view_hosts'),
|
17
|
+
missing_permissions: 'view_hosts' }
|
18
18
|
end
|
19
19
|
|
20
20
|
def resource_scope(_options = {})
|
@@ -8,8 +8,8 @@ module Actions
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def plan(job_invocation, host, *_args)
|
11
|
-
return unless ::
|
12
|
-
::
|
11
|
+
return unless ::JobHelper.correct_feature?(job_invocation, 'leapp_preupgrade') ||
|
12
|
+
::JobHelper.correct_feature?(job_invocation, 'leapp_remediation_plan')
|
13
13
|
|
14
14
|
plan_self(host_id: host.id, job_invocation_id: job_invocation.id)
|
15
15
|
end
|
@@ -1,13 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
module
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
.template_id, label: feature).any?
|
10
|
-
end
|
3
|
+
module JobHelper
|
4
|
+
class << self
|
5
|
+
def correct_feature?(job_invocation, feature)
|
6
|
+
RemoteExecutionFeature.where(job_template_id: job_invocation.pattern_template_invocations
|
7
|
+
.first
|
8
|
+
.template_id, label: feature).any?
|
11
9
|
end
|
12
10
|
end
|
13
11
|
end
|
data/config/routes.rb
CHANGED
@@ -5,7 +5,7 @@ Rails.application.routes.draw do
|
|
5
5
|
|
6
6
|
namespace :api, defaults: { format: 'json' } do
|
7
7
|
scope '(:apiv)', module: :v2, defaults: { apiv: 'v2' }, apiv: /v2/,
|
8
|
-
|
8
|
+
constraints: ApiConstraints.new( version: 2, default: true) do
|
9
9
|
resources :preupgrade_reports, only: %i[index show]
|
10
10
|
get 'job_invocations/:id/preupgrade_reports', to: 'preupgrade_reports#job_invocation'
|
11
11
|
end
|
@@ -14,7 +14,7 @@ User.as_anonymous_admin do
|
|
14
14
|
end
|
15
15
|
JobTemplate.without_auditing do
|
16
16
|
Dir[File.join("#{ForemanLeapp::Engine.root}/app/views/foreman_leapp/"\
|
17
|
-
'job_templates/**/*.erb')].
|
17
|
+
'job_templates/**/*.erb')].each do |template|
|
18
18
|
template = JobTemplate.import_raw!(File.read(template),
|
19
19
|
:default => true,
|
20
20
|
:lock => true,
|
data/lib/foreman_leapp/engine.rb
CHANGED
@@ -7,6 +7,9 @@ module ForemanLeapp
|
|
7
7
|
class Engine < ::Rails::Engine
|
8
8
|
engine_name 'foreman_leapp'
|
9
9
|
|
10
|
+
config.eager_load_paths += Dir["#{config.root}/app/controllers/api/v2/concerns"]
|
11
|
+
config.eager_load_paths += Dir["#{config.root}/app/lib/helpers"]
|
12
|
+
|
10
13
|
config.autoload_paths += Dir["#{config.root}/app/controllers/concerns"]
|
11
14
|
config.autoload_paths += Dir["#{config.root}/app/controllers/api/v2/concerns"]
|
12
15
|
config.autoload_paths += Dir["#{config.root}/app/helpers/concerns"]
|
@@ -36,8 +39,8 @@ module ForemanLeapp
|
|
36
39
|
name: _('Leapp preupgrade report'),
|
37
40
|
id: 'leapp_preupgrade_report',
|
38
41
|
onlyif: proc { |subject|
|
39
|
-
::
|
40
|
-
::
|
42
|
+
::JobHelper.correct_feature?(subject, 'leapp_preupgrade') ||
|
43
|
+
::JobHelper.correct_feature?(subject, 'leapp_remediation_plan')
|
41
44
|
}
|
42
45
|
end
|
43
46
|
|
@@ -16,8 +16,8 @@ module ForemanLeapp
|
|
16
16
|
|
17
17
|
test 'without remediation commands' do
|
18
18
|
empty_entry = FactoryBot.create(:preupgrade_report_entry, host: host, preupgrade_report: report,
|
19
|
-
|
20
|
-
|
19
|
+
detail: { remediations: [{ type: 'hint',
|
20
|
+
context: 'meh.' }] })
|
21
21
|
template = build_remediation_plan([empty_entry.id], host)
|
22
22
|
assert_equal template, ''
|
23
23
|
end
|
@@ -9,7 +9,7 @@ module ForemanLeapp
|
|
9
9
|
let(:host) { FactoryBot.create(:host) }
|
10
10
|
let(:job_template) do
|
11
11
|
FactoryBot.create(:job_template, template: 'echo "1"', job_category: 'leapp',
|
12
|
-
|
12
|
+
provider_type: 'SSH', name: 'Leapp preupgrade')
|
13
13
|
end
|
14
14
|
let(:job_invocation) { FactoryBot.create(:job_invocation) }
|
15
15
|
let(:template_invocation) do
|
@@ -4,11 +4,11 @@ require 'test_plugin_helper'
|
|
4
4
|
|
5
5
|
module Helpers
|
6
6
|
class JobHelperTest < ActionView::TestCase
|
7
|
-
let(:helper) { ::
|
7
|
+
let(:helper) { ::JobHelper }
|
8
8
|
|
9
9
|
let(:job_template) do
|
10
10
|
FactoryBot.create(:job_template, template: 'echo "1"', job_category: 'leapp',
|
11
|
-
|
11
|
+
provider_type: 'SSH', name: 'Leapp preupgrade')
|
12
12
|
end
|
13
13
|
let(:job_invocation) { FactoryBot.create(:job_invocation) }
|
14
14
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman_leapp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Foreman Leapp team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-12
|
11
|
+
date: 2024-09-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: foreman_remote_execution
|
@@ -73,7 +73,7 @@ files:
|
|
73
73
|
- app/controllers/preupgrade_reports_controller.rb
|
74
74
|
- app/helpers/foreman_leapp/hosts_helper.rb
|
75
75
|
- app/helpers/foreman_leapp/template_helper.rb
|
76
|
-
- app/lib/actions/preupgrade_job.rb
|
76
|
+
- app/lib/actions/foreman_leapp/preupgrade_job.rb
|
77
77
|
- app/lib/helpers/job_helper.rb
|
78
78
|
- app/models/concerns/foreman_leapp/job_invocation_extensions.rb
|
79
79
|
- app/models/preupgrade_report.rb
|
@@ -213,7 +213,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
213
213
|
- !ruby/object:Gem::Version
|
214
214
|
version: '0'
|
215
215
|
requirements: []
|
216
|
-
rubygems_version: 3.
|
216
|
+
rubygems_version: 3.2.33
|
217
217
|
signing_key:
|
218
218
|
specification_version: 4
|
219
219
|
summary: A Foreman plugin for Leapp utility.
|