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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5e4e3132faad2aa5e0b38f734bdd8c86c57d494ad182e4c60eeae9f5cfbdec19
4
- data.tar.gz: ca55a97be3f368735f991d932896774482c9f75836e495c2d82ebe0e71407c5b
3
+ metadata.gz: 745ee96b1f3f15a4318a625b4b28014d28078ea295319430b5711fe28083cb7d
4
+ data.tar.gz: cc04180b1d6ffab8b02e4e9c55989643eb9d1299bc39758c7d06be1164b4dc8a
5
5
  SHA512:
6
- metadata.gz: 1b51745821e36f5a5bc1a4bbedb37bfbccbf5349549351757c5fbb53926460f90b720eae3b6bd4de44854fc6cbdf1be4e5f7af0a80b3d18b9f649d1edd5e2496
7
- data.tar.gz: b8ce21033fa71eb558d62fa8b1cb8b77ad07320f171499dfee46067a0f723ee3b2e2cb01a4c349e44dad57d2c89026c447f30d5fb01b46fcba6c20040f24d9eb
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
- locals: { details: N_('Missing one of the required permissions: view_hosts'),
17
- missing_permissions: 'view_hosts' }
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 ::Helpers::JobHelper.correct_feature?(job_invocation, 'leapp_preupgrade') ||
12
- ::Helpers::JobHelper.correct_feature?(job_invocation, 'leapp_remediation_plan')
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 Helpers
4
- module JobHelper
5
- class << self
6
- def correct_feature?(job_invocation, feature)
7
- RemoteExecutionFeature.where(job_template_id: job_invocation.pattern_template_invocations
8
- .first
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
@@ -19,9 +19,6 @@ template_inputs:
19
19
  required: true
20
20
  options: "true\nfalse"
21
21
  default: "true"
22
- foreign_input_sets:
23
- - include_all: true
24
- template: Run preupgrade via Leapp
25
22
  %>
26
23
 
27
24
  <%= render_template 'Check Leapp' %>
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
- constraints: ApiConstraints.new( version: 2, default: true) do
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')].sort.each do |template|
17
+ 'job_templates/**/*.erb')].each do |template|
18
18
  template = JobTemplate.import_raw!(File.read(template),
19
19
  :default => true,
20
20
  :lock => true,
@@ -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
- ::Helpers::JobHelper.correct_feature?(subject, 'leapp_preupgrade') ||
40
- ::Helpers::JobHelper.correct_feature?(subject, 'leapp_remediation_plan')
42
+ ::JobHelper.correct_feature?(subject, 'leapp_preupgrade') ||
43
+ ::JobHelper.correct_feature?(subject, 'leapp_remediation_plan')
41
44
  }
42
45
  end
43
46
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ForemanLeapp
4
- VERSION = '1.2.2'
4
+ VERSION = '2.0.0'
5
5
  end
@@ -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
- detail: { remediations: [{ type: 'hint',
20
- context: 'meh.' }] })
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
- provider_type: 'SSH', name: 'Leapp preupgrade')
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) { ::Helpers::JobHelper }
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
- provider_type: 'SSH', name: 'Leapp preupgrade')
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: 1.2.2
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-04 00:00:00.000000000 Z
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.5.23
216
+ rubygems_version: 3.2.33
217
217
  signing_key:
218
218
  specification_version: 4
219
219
  summary: A Foreman plugin for Leapp utility.