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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 20a8b95728d37a13354b85aad5ab0c27dd6ec96ac248f30f7786ffeb769047c1
4
- data.tar.gz: f87a224721de93faa6923cb9db3e4a92dae7bb6e4813c4b8f7c9b515bfb789b0
3
+ metadata.gz: de5248403683c119d2f8c4b7b331bbf5bc7125e408f8c5a0be2449191861926d
4
+ data.tar.gz: 4a08a8dc04d0e2d78fc76124b1cf5c2bc3c2cbb716f12bc376609d3d1e96ef9c
5
5
  SHA512:
6
- metadata.gz: d3bc726e4aa2c21789ecb7d615e1de19df419501f04e141a4a8de60f951902fa6ce76f665428a5b2c564c32fa7e094260b99fa0528dd9dccc6dd55216e68becf
7
- data.tar.gz: 2d76583bdc24a72b8faf91da3ecd9f04475135af429fab8e2505ac4d3dcc206bcd40b51a3ee6486b196581b011722e7c9f39e4f5eff17aa25793005aafa2ad3b
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.job_category == ::ForemanLeapp::JOB_CATEGORY &&
8
- RemoteExecutionFeature.find_by(job_template_id: job_invocation.pattern_template_invocations
9
- .pluck(:template_id)
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
@@ -5,6 +5,7 @@ kind: job_template
5
5
  job_category: Leapp
6
6
  provider_type: SSH
7
7
  snippet: true
8
+ model: JobTemplate
8
9
  %>
9
10
 
10
11
  if ! command -v leapp > /dev/null
@@ -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: Remediation plan
4
- job_category: Leapp
5
- description_format: 'Run Remediation plan with Leapp'
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: Ansible Playbook
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
- <% if input('Reboot') == "true" %>
22
+ <%- if input('Reboot') == "true" -%>
22
23
  - name: Reboot the machine
23
24
  reboot:
24
25
  reboot_timeout: 1800
25
- <% end %>
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
- :locked => true,
12
+ :lock => true,
13
13
  :update => true)
14
14
  template.organizations = organizations if template.present?
15
15
  template.locations = locations if template.present?
@@ -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
- Host::JobInvocation.include ForemanLeapp::JobInvocationExtensions
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ForemanLeapp
4
- VERSION = '0.1.2'
4
+ VERSION = '0.1.3'
5
5
  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, job_category: ::ForemanLeapp::JOB_CATEGORY) }
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
- # let(:host) { FactoryBot.create(:host) }
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, job_category: ::ForemanLeapp::JOB_CATEGORY) }
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 category & feature' do
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: __('Severity') },
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') },
@@ -41,7 +41,7 @@ exports[`EntriresFilter should render for host filter 1`] = `
41
41
  key="severity"
42
42
  onClick={[Function]}
43
43
  >
44
- Severity
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="Severity"
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
- Severity
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
- Severity
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: __('Severity'), value: 'severity' },
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 Severity"
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 Severity"
119
+ alt="Low Risk Factor"
120
120
  className="severity-img"
121
121
  key="5-7-sv5"
122
122
  src={[Function]}
@@ -36,7 +36,7 @@ exports[`PreupgradeReportsListHeader should render 1`] = `
36
36
  "order": "asc",
37
37
  }
38
38
  }
39
- title="Severity"
39
+ title="Risk Factor"
40
40
  value="severity"
41
41
  />
42
42
  </strong>
@@ -92,7 +92,7 @@ exports[`PreupgradeReportList/helpers should return severity 1`] = `
92
92
  md={8}
93
93
  >
94
94
  <img
95
- alt="High Severity"
95
+ alt="High Risk Factor"
96
96
  className="severity-img"
97
97
  src={[Function]}
98
98
  />
@@ -24,7 +24,7 @@ export const getSeverityImg = entry => {
24
24
  <img
25
25
  key={key}
26
26
  src={SeverityLow}
27
- alt="Low Severity"
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 Severity"
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 Severity"
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 Severity"
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.2
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-05-12 00:00:00.000000000 Z
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/check.erb
97
- - app/views/foreman_leapp/job_templates/preupgrade.erb
98
- - app/views/foreman_leapp/job_templates/remediation.erb
99
- - app/views/foreman_leapp/job_templates/upgrade.erb
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