foreman_leapp 0.1.2 → 0.1.3
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/app/lib/helpers/job_helper.rb +3 -4
- data/app/views/foreman_leapp/job_templates/{check.erb → leapp_check.erb} +1 -0
- data/app/views/foreman_leapp/job_templates/{preupgrade.erb → leapp_preupgrade.erb} +3 -2
- data/app/views/foreman_leapp/job_templates/{remediation.erb → leapp_remediation.erb} +4 -3
- data/app/views/foreman_leapp/job_templates/{upgrade.erb → leapp_upgrade.erb} +4 -3
- data/db/seeds.d/10_leapp_preupgrade.rb +1 -1
- data/lib/foreman_leapp/engine.rb +2 -4
- data/lib/foreman_leapp/version.rb +1 -1
- data/test/unit/actions/preupgrade_job_test.rb +1 -1
- data/test/unit/helpers/job_helper_test.rb +3 -10
- data/webpack/components/PreupgradeReports/components/EntriesFilter.js +1 -1
- data/webpack/components/PreupgradeReports/components/__snapshots__/EntriesFilter.test.js.snap +4 -4
- data/webpack/components/PreupgradeReportsList/components/PreupgradeReportsListHeader.js +1 -1
- data/webpack/components/PreupgradeReportsList/components/__tests__/__snapshots__/PreupgradeReportEntry.test.js.snap +2 -2
- data/webpack/components/PreupgradeReportsList/components/__tests__/__snapshots__/PreupgradeReportsListHeader.test.js.snap +1 -1
- data/webpack/components/PreupgradeReportsList/components/__tests__/__snapshots__/helpers.test.js.snap +1 -1
- data/webpack/components/PreupgradeReportsList/components/helpers.js +4 -4
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: de5248403683c119d2f8c4b7b331bbf5bc7125e408f8c5a0be2449191861926d
|
4
|
+
data.tar.gz: 4a08a8dc04d0e2d78fc76124b1cf5c2bc3c2cbb716f12bc376609d3d1e96ef9c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3a2781a3d87d9b0b2dc94e8deb61f0a5ae3ca62c10d3a3d2a36efdab31edbca9a959c45dfd85b1e050061fc5af552d95bf4b85dddf7dba18731f55c3e9040bb1
|
7
|
+
data.tar.gz: 78f6881ddbb87523c898375bb5ba7d61bb0e9912deb50739f94a07035c77585ea0be585374e298bd41719baf1026ebed4e9b2e3137ce9efd300ae69408582312
|
@@ -4,10 +4,9 @@ module Helpers
|
|
4
4
|
module JobHelper
|
5
5
|
class << self
|
6
6
|
def correct_feature?(job_invocation, feature)
|
7
|
-
job_invocation.
|
8
|
-
|
9
|
-
|
10
|
-
.first)&.label == feature
|
7
|
+
RemoteExecutionFeature.where(job_template_id: job_invocation.pattern_template_invocations
|
8
|
+
.first
|
9
|
+
.template_id, label: feature).any?
|
11
10
|
end
|
12
11
|
end
|
13
12
|
end
|
@@ -1,16 +1,17 @@
|
|
1
1
|
<%#
|
2
2
|
kind: job_template
|
3
3
|
name: Run preupgrade via Leapp
|
4
|
-
job_category: Leapp
|
4
|
+
job_category: Leapp - Preupgrade
|
5
5
|
description_format: 'Upgradeability check for RHEL 7 host'
|
6
6
|
provider_type: SSH
|
7
7
|
feature: leapp_preupgrade
|
8
|
+
model: JobTemplate
|
8
9
|
%>
|
9
10
|
|
10
11
|
<%= render_template 'Check Leapp' %>
|
11
12
|
|
13
|
+
rm -f /var/log/leapp/leapp-report.json
|
12
14
|
leapp preupgrade
|
13
15
|
|
14
16
|
echo "===leap_upgrade_report_start==="
|
15
17
|
cat /var/log/leapp/leapp-report.json
|
16
|
-
rm -f /var/log/leapp/leapp-report.json
|
@@ -1,10 +1,11 @@
|
|
1
1
|
<%#
|
2
2
|
kind: job_template
|
3
|
-
name:
|
4
|
-
job_category:
|
5
|
-
description_format: 'Run
|
3
|
+
name: Run remediation plan via Leapp
|
4
|
+
job_category: Other
|
5
|
+
description_format: 'Run remediation plan via Leapp'
|
6
6
|
provider_type: SSH
|
7
7
|
feature: leapp_remediation_plan
|
8
|
+
model: JobTemplate
|
8
9
|
template_inputs:
|
9
10
|
- name: remediation_ids
|
10
11
|
required: true
|
@@ -1,10 +1,11 @@
|
|
1
1
|
<%#
|
2
2
|
kind: job_template
|
3
3
|
name: Run upgrade via Leapp
|
4
|
-
job_category:
|
4
|
+
job_category: Leapp - Upgrade
|
5
5
|
description_format: 'Upgrade RHEL 7 host'
|
6
6
|
provider_type: Ansible
|
7
7
|
feature: leapp_upgrade
|
8
|
+
model: JobTemplate
|
8
9
|
template_inputs:
|
9
10
|
- name: Reboot
|
10
11
|
description: Reboot the host automaticaly to continue with the upgrade
|
@@ -18,8 +19,8 @@ template_inputs:
|
|
18
19
|
tasks:
|
19
20
|
- name: Run Leapp Upgrade
|
20
21
|
command: leapp upgrade
|
21
|
-
|
22
|
+
<%- if input('Reboot') == "true" -%>
|
22
23
|
- name: Reboot the machine
|
23
24
|
reboot:
|
24
25
|
reboot_timeout: 1800
|
25
|
-
|
26
|
+
<%- end -%>
|
@@ -9,7 +9,7 @@ User.as_anonymous_admin do
|
|
9
9
|
'job_templates/**/*.erb')].each do |template|
|
10
10
|
template = JobTemplate.import_raw!(File.read(template),
|
11
11
|
:default => true,
|
12
|
-
:
|
12
|
+
:lock => true,
|
13
13
|
:update => true)
|
14
14
|
template.organizations = organizations if template.present?
|
15
15
|
template.locations = locations if template.present?
|
data/lib/foreman_leapp/engine.rb
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module ForemanLeapp
|
4
|
-
JOB_CATEGORY = 'Leapp'
|
5
|
-
|
6
4
|
class Engine < ::Rails::Engine
|
7
5
|
engine_name 'foreman_leapp'
|
8
6
|
|
@@ -44,8 +42,8 @@ module ForemanLeapp
|
|
44
42
|
# Include concerns in this config.to_prepare block
|
45
43
|
config.to_prepare do
|
46
44
|
begin
|
47
|
-
HostsHelper.prepend ForemanLeapp::HostsHelperExtensions
|
48
|
-
|
45
|
+
::HostsHelper.prepend ForemanLeapp::HostsHelperExtensions
|
46
|
+
::JobInvocation.include ForemanLeapp::JobInvocationExtensions
|
49
47
|
rescue StandardError => e
|
50
48
|
Rails.logger.warn "ForemanLeapp: skipping engine hook (#{e})"
|
51
49
|
end
|
@@ -11,7 +11,7 @@ module ForemanLeapp
|
|
11
11
|
FactoryBot.create(:job_template, template: 'echo "1"', job_category: 'leapp',
|
12
12
|
provider_type: 'SSH', name: 'Leapp preupgrade')
|
13
13
|
end
|
14
|
-
let(:job_invocation) { FactoryBot.create(:job_invocation
|
14
|
+
let(:job_invocation) { FactoryBot.create(:job_invocation) }
|
15
15
|
let(:template_invocation) do
|
16
16
|
FactoryBot.create(:template_invocation, template: job_template, job_invocation: job_invocation)
|
17
17
|
end
|
@@ -5,12 +5,12 @@ require 'test_plugin_helper'
|
|
5
5
|
module Helpers
|
6
6
|
class JobHelperTest < ActionView::TestCase
|
7
7
|
let(:helper) { ::Helpers::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
|
-
let(:job_invocation) { FactoryBot.create(:job_invocation
|
13
|
+
let(:job_invocation) { FactoryBot.create(:job_invocation) }
|
14
14
|
|
15
15
|
describe 'correct_feature?' do
|
16
16
|
setup do
|
@@ -18,17 +18,10 @@ module Helpers
|
|
18
18
|
FactoryBot.create(:template_invocation, template: job_template, job_invocation: job_invocation)
|
19
19
|
end
|
20
20
|
|
21
|
-
it 'correct
|
21
|
+
it 'correct feature' do
|
22
22
|
assert helper.correct_feature?(job_invocation, 'leapp_preupgrade')
|
23
23
|
end
|
24
24
|
|
25
|
-
it 'wrong category' do
|
26
|
-
job_invocation = FactoryBot.create(:job_invocation, job_category: 'NOPE')
|
27
|
-
FactoryBot.create(:template_invocation, template: job_template, job_invocation: job_invocation)
|
28
|
-
|
29
|
-
assert_not helper.correct_feature?(job_invocation, 'leapp_preupgrade')
|
30
|
-
end
|
31
|
-
|
32
25
|
it 'wrong feature' do
|
33
26
|
assert_not helper.correct_feature?(job_invocation, 'leapp_preupgrade2')
|
34
27
|
end
|
@@ -17,7 +17,7 @@ const EntriesFilter = ({
|
|
17
17
|
|
18
18
|
const filterTypes = [
|
19
19
|
{ value: 'title', label: __('Title') },
|
20
|
-
{ value: 'severity', label: __('
|
20
|
+
{ value: 'severity', label: __('Risk Factor') },
|
21
21
|
{ value: 'hostname', label: __('Host') },
|
22
22
|
{ value: 'fix', label: __('Fix Type') },
|
23
23
|
{ value: 'inhibitor', label: __('Inhibitor') },
|
data/webpack/components/PreupgradeReports/components/__snapshots__/EntriesFilter.test.js.snap
CHANGED
@@ -41,7 +41,7 @@ exports[`EntriresFilter should render for host filter 1`] = `
|
|
41
41
|
key="severity"
|
42
42
|
onClick={[Function]}
|
43
43
|
>
|
44
|
-
|
44
|
+
Risk Factor
|
45
45
|
</MenuItem>
|
46
46
|
<MenuItem
|
47
47
|
active={true}
|
@@ -112,7 +112,7 @@ exports[`EntriresFilter should render for severity filter 1`] = `
|
|
112
112
|
<DropdownButton
|
113
113
|
componentClass={[Function]}
|
114
114
|
id="entry-filter"
|
115
|
-
title="
|
115
|
+
title="Risk Factor"
|
116
116
|
>
|
117
117
|
<MenuItem
|
118
118
|
active={false}
|
@@ -134,7 +134,7 @@ exports[`EntriresFilter should render for severity filter 1`] = `
|
|
134
134
|
key="severity"
|
135
135
|
onClick={[Function]}
|
136
136
|
>
|
137
|
-
|
137
|
+
Risk Factor
|
138
138
|
</MenuItem>
|
139
139
|
<MenuItem
|
140
140
|
active={false}
|
@@ -277,7 +277,7 @@ exports[`EntriresFilter should render for title filter 1`] = `
|
|
277
277
|
key="severity"
|
278
278
|
onClick={[Function]}
|
279
279
|
>
|
280
|
-
|
280
|
+
Risk Factor
|
281
281
|
</MenuItem>
|
282
282
|
<MenuItem
|
283
283
|
active={false}
|
@@ -10,7 +10,7 @@ import SortableHeaderItem from './SortableHeaderItem';
|
|
10
10
|
const PreupgradeReportsListHeader = ({ sort, changeSort, toggleSelectAll }) => {
|
11
11
|
const additionalInfoColumns = [
|
12
12
|
{ label: __('Host'), value: 'hostname' },
|
13
|
-
{ label: __('
|
13
|
+
{ label: __('Risk Factor'), value: 'severity' },
|
14
14
|
{ label: __('Has Remediation?'), value: 'fix' },
|
15
15
|
{ label: __('Inhibitor?'), value: 'inhibitor' },
|
16
16
|
];
|
@@ -20,7 +20,7 @@ exports[`PreupgradeReportEntry should render 1`] = `
|
|
20
20
|
stacked={false}
|
21
21
|
>
|
22
22
|
<img
|
23
|
-
alt="Low
|
23
|
+
alt="Low Risk Factor"
|
24
24
|
className="severity-img"
|
25
25
|
src={[Function]}
|
26
26
|
/>
|
@@ -116,7 +116,7 @@ exports[`PreupgradeReportEntry should render 1`] = `
|
|
116
116
|
md={8}
|
117
117
|
>
|
118
118
|
<img
|
119
|
-
alt="Low
|
119
|
+
alt="Low Risk Factor"
|
120
120
|
className="severity-img"
|
121
121
|
key="5-7-sv5"
|
122
122
|
src={[Function]}
|
@@ -24,7 +24,7 @@ export const getSeverityImg = entry => {
|
|
24
24
|
<img
|
25
25
|
key={key}
|
26
26
|
src={SeverityLow}
|
27
|
-
alt="Low
|
27
|
+
alt="Low Risk Factor"
|
28
28
|
className="severity-img"
|
29
29
|
/>
|
30
30
|
);
|
@@ -33,7 +33,7 @@ export const getSeverityImg = entry => {
|
|
33
33
|
<img
|
34
34
|
key={key}
|
35
35
|
src={SeverityMedium}
|
36
|
-
alt="Medium
|
36
|
+
alt="Medium Risk Factor"
|
37
37
|
className="severity-img"
|
38
38
|
/>
|
39
39
|
);
|
@@ -42,7 +42,7 @@ export const getSeverityImg = entry => {
|
|
42
42
|
<img
|
43
43
|
key={key}
|
44
44
|
src={SeverityHigh}
|
45
|
-
alt="High
|
45
|
+
alt="High Risk Factor"
|
46
46
|
className="severity-img"
|
47
47
|
/>
|
48
48
|
);
|
@@ -51,7 +51,7 @@ export const getSeverityImg = entry => {
|
|
51
51
|
<img
|
52
52
|
key={key}
|
53
53
|
src={SeverityLow}
|
54
|
-
alt="Low
|
54
|
+
alt="Low Risk Factor"
|
55
55
|
className="severity-img"
|
56
56
|
/>
|
57
57
|
);
|
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: 0.1.
|
4
|
+
version: 0.1.3
|
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: 2020-
|
11
|
+
date: 2020-06-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: foreman_remote_execution
|
@@ -93,10 +93,10 @@ files:
|
|
93
93
|
- app/views/api/v2/preupgrade_reports/index.json.rabl
|
94
94
|
- app/views/api/v2/preupgrade_reports/job_invocation.json.rabl
|
95
95
|
- app/views/api/v2/preupgrade_reports/show.json.rabl
|
96
|
-
- app/views/foreman_leapp/job_templates/
|
97
|
-
- app/views/foreman_leapp/job_templates/
|
98
|
-
- app/views/foreman_leapp/job_templates/
|
99
|
-
- app/views/foreman_leapp/job_templates/
|
96
|
+
- app/views/foreman_leapp/job_templates/leapp_check.erb
|
97
|
+
- app/views/foreman_leapp/job_templates/leapp_preupgrade.erb
|
98
|
+
- app/views/foreman_leapp/job_templates/leapp_remediation.erb
|
99
|
+
- app/views/foreman_leapp/job_templates/leapp_upgrade.erb
|
100
100
|
- app/views/job_invocations/_leapp_preupgrade_report.html.erb
|
101
101
|
- app/views/preupgrade_report_entries/base.json.rabl
|
102
102
|
- app/views/preupgrade_reports/index.json.rabl
|