foreman_openscap 9.0.2 → 9.0.4

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.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/api/v2/compliance/tailoring_files_controller.rb +0 -8
  3. data/app/models/concerns/foreman_openscap/host_extensions.rb +1 -3
  4. data/app/models/foreman_openscap/policy.rb +0 -4
  5. data/app/views/tailoring_files/welcome.html.erb +1 -8
  6. data/lib/foreman_openscap/version.rb +1 -1
  7. data/test/functional/api/v2/compliance/tailoring_files_controller_test.rb +0 -11
  8. data/test/unit/concerns/host_extensions_test.rb +0 -9
  9. data/webpack/components/OpenscapRemediationWizard/Footer.js +54 -0
  10. data/webpack/components/OpenscapRemediationWizard/constants.js +9 -0
  11. data/webpack/components/OpenscapRemediationWizard/index.js +11 -5
  12. metadata +7 -43
  13. data/app/helpers/tailoring_files_helper.rb +0 -5
  14. data/app/services/foreman_openscap/openscap_proxy_assigned_version_check.rb +0 -14
  15. data/app/services/foreman_openscap/openscap_proxy_version_check.rb +0 -62
  16. data/locale/cs_CZ/foreman_openscap.edit.po +0 -1455
  17. data/locale/cs_CZ/foreman_openscap.po.time_stamp +0 -0
  18. data/locale/de/foreman_openscap.edit.po +0 -1667
  19. data/locale/de/foreman_openscap.po.time_stamp +0 -0
  20. data/locale/en/foreman_openscap.edit.po +0 -1455
  21. data/locale/en/foreman_openscap.po.time_stamp +0 -0
  22. data/locale/en_GB/foreman_openscap.edit.po +0 -1467
  23. data/locale/en_GB/foreman_openscap.po.time_stamp +0 -0
  24. data/locale/es/foreman_openscap.edit.po +0 -1664
  25. data/locale/es/foreman_openscap.po.time_stamp +0 -0
  26. data/locale/fr/foreman_openscap.edit.po +0 -1676
  27. data/locale/fr/foreman_openscap.po.time_stamp +0 -0
  28. data/locale/gl/foreman_openscap.edit.po +0 -1455
  29. data/locale/gl/foreman_openscap.po.time_stamp +0 -0
  30. data/locale/it/foreman_openscap.edit.po +0 -1466
  31. data/locale/it/foreman_openscap.po.time_stamp +0 -0
  32. data/locale/ja/foreman_openscap.edit.po +0 -1659
  33. data/locale/ja/foreman_openscap.po.time_stamp +0 -0
  34. data/locale/ka/foreman_openscap.edit.po +0 -1654
  35. data/locale/ka/foreman_openscap.po.time_stamp +0 -0
  36. data/locale/ko/foreman_openscap.edit.po +0 -1470
  37. data/locale/ko/foreman_openscap.po.time_stamp +0 -0
  38. data/locale/pt_BR/foreman_openscap.edit.po +0 -1669
  39. data/locale/pt_BR/foreman_openscap.po.time_stamp +0 -0
  40. data/locale/ru/foreman_openscap.edit.po +0 -1474
  41. data/locale/ru/foreman_openscap.po.time_stamp +0 -0
  42. data/locale/sv_SE/foreman_openscap.edit.po +0 -1455
  43. data/locale/sv_SE/foreman_openscap.po.time_stamp +0 -0
  44. data/locale/zh_CN/foreman_openscap.edit.po +0 -1656
  45. data/locale/zh_CN/foreman_openscap.po.time_stamp +0 -0
  46. data/locale/zh_TW/foreman_openscap.edit.po +0 -1471
  47. data/locale/zh_TW/foreman_openscap.po.time_stamp +0 -0
  48. data/test/unit/services/tailoring_files_proxy_check_test.rb +0 -27
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 12a8280c09f6c28ea1fd3d1151451570d78cd6240cf08cea57e318fc2a41a1a8
4
- data.tar.gz: c52e418ee98781d49e02b3b7fda75efd5588e1e31db4e4fc40c1816761e00066
3
+ metadata.gz: db9d5beb1a4f3e676150bd6c7982feccee708f920dd68cb422b0736824a10cee
4
+ data.tar.gz: cb3c657f011aac5d73fc6595a5b9abed49033928223a53974c20f69cd8f97eed
5
5
  SHA512:
6
- metadata.gz: ae202672762b8b5482a8cba0d26262dc82e1c406e98f9dbdcc11552957f2deb74aa9f0f2b323a5be982cbdd11670ba639ec750a854b19d84641eb71325ec1432
7
- data.tar.gz: 3fbe7db48cdccd165299768aa7f4c3b4e00acc2661eed02ccca6f34a42569087886f06dd4d0d9ac9b37106fa68a78f9e6f72327f0fd3e09083ec593649a18097
6
+ metadata.gz: 4a7f09d5b4102cb8d1b95b2ed9e6b2005b84e5a28a9896411be2655bc073d5f4cb59b55096a42072e3450e685753534bdf0afcf7a91f4f567e412269092593a5
7
+ data.tar.gz: 9fddaa152d91a99f7efaa986ffdaf64926c56378f170ea2a82213648c10c163e97c081f122100f1cb823537f8ad540623dc1bfe54f355817f198948ba299dc17
@@ -6,7 +6,6 @@ module Api::V2
6
6
  include ForemanOpenscap::Api::V2::ScapApiControllerExtensions
7
7
 
8
8
  before_action :find_resource, :except => %w[index create]
9
- before_action :openscap_proxy_check, :only => %w[create]
10
9
 
11
10
  api :GET, '/compliance/tailoring_files', N_('List Tailoring files')
12
11
  param_group :search_and_pagination, ::Api::V2::BaseController
@@ -77,13 +76,6 @@ module Api::V2
77
76
  super
78
77
  end
79
78
  end
80
-
81
- def openscap_proxy_check
82
- unless ForemanOpenscap::TailoringFile.any?
83
- check = ForemanOpenscap::OpenscapProxyVersionCheck.new.run
84
- render_error :custom_error, :status => :unprocessable_entity, :locals => { :message => check.message } unless check.pass?
85
- end
86
- end
87
79
  end
88
80
  end
89
81
  end
@@ -102,9 +102,7 @@ module ForemanOpenscap
102
102
  end
103
103
 
104
104
  def policies_enc_raw
105
- check = ForemanOpenscap::OpenscapProxyAssignedVersionCheck.new(self).run
106
- method = check.pass? ? :to_enc : :to_enc_legacy
107
- combined_policies.map(&method)
105
+ combined_policies.map(&:to_enc)
108
106
  end
109
107
 
110
108
  def combined_policies
@@ -196,10 +196,6 @@ module ForemanOpenscap
196
196
  }.merge(period_enc)
197
197
  end
198
198
 
199
- def to_enc_legacy
200
- to_enc.tap { |hash| hash['download_path'] = "/compliance/policies/#{self.id}/content" }
201
- end
202
-
203
199
  def should_validate?(step_name)
204
200
  if new_record? && wizard_initiated?
205
201
  step_index > step_to_i(step_name)
@@ -8,14 +8,7 @@
8
8
  <%= (_('In Foreman, tailoring_files represent the custom modifications to default XCCDF profiles and they can be applied to hosts
9
9
  via %s') % link_to('compliance policies', policies_path)).html_safe %>
10
10
  </p>
11
- <% proxy_check = run_tailoring_proxy_check %>
12
11
  <div class="blank-slate-pf-main-action">
13
- <%= new_link(_('New Tailoring File'), {}, { :class => "btn-lg", :disabled => !proxy_check.pass? }) %>
12
+ <%= new_link(_('New Tailoring File'), {}, { :class => "btn-lg" }) %>
14
13
  </div>
15
-
16
- <p>
17
- <% unless proxy_check.pass? %>
18
- <%= alert :class => 'alert-warning', :header => '', :text => proxy_check.message.html_safe %>
19
- <% end %>
20
- </p>
21
14
  </div>
@@ -1,3 +1,3 @@
1
1
  module ForemanOpenscap
2
- VERSION = "9.0.2".freeze
2
+ VERSION = "9.0.4".freeze
3
3
  end
@@ -24,8 +24,6 @@ class Api::V2::Compliance::TailoringFilesControllerTest < ActionController::Test
24
24
  test "should create tailoring_file" do
25
25
  tf = FactoryBot.build(:tailoring_file)
26
26
  tf_params = { :name => tf.name, :original_filename => tf.original_filename, :scap_file => tf.scap_file }
27
- ForemanOpenscap::OpenscapProxyVersionCheck.any_instance.stubs(:openscap_proxy_versions)
28
- .returns({})
29
27
  post :create, :params => tf_params, :session => set_session_user
30
28
  assert_response :success
31
29
  end
@@ -50,13 +48,4 @@ class Api::V2::Compliance::TailoringFilesControllerTest < ActionController::Test
50
48
  assert_response :ok
51
49
  refute ForemanOpenscap::ScapContent.exists?(tailoring_file.id)
52
50
  end
53
-
54
- test "should not create tailoring file when there is outdated proxy version" do
55
- tf = FactoryBot.build(:tailoring_file)
56
- tf_params = { :name => tf.name, :original_filename => tf.original_filename, :scap_file => tf.scap_file }
57
- ForemanOpenscap::OpenscapProxyVersionCheck.any_instance.stubs(:openscap_proxy_versions)
58
- .returns('test-proxy' => '0.5.4')
59
- post :create, :params => tf_params, :session => set_session_user
60
- assert_response :unprocessable_entity
61
- end
62
51
  end
@@ -9,16 +9,7 @@ class HostExtensionsTest < ActiveSupport::TestCase
9
9
  @host = FactoryBot.create(:compliance_host, :policies => [@policy])
10
10
  end
11
11
 
12
- test "should have download_path in enc without digest" do
13
- ForemanOpenscap::OpenscapProxyAssignedVersionCheck.any_instance.stubs(:openscap_proxy_versions)
14
- .returns('test-proxy' => '0.5.4')
15
- enc_out = JSON.parse @host.policies_enc
16
- assert_equal 5, enc_out.first['download_path'].split('/').length
17
- end
18
-
19
12
  test "should have download_path in enc with digest" do
20
- ForemanOpenscap::OpenscapProxyAssignedVersionCheck.any_instance.stubs(:openscap_proxy_versions)
21
- .returns({})
22
13
  enc_out = JSON.parse @host.policies_enc
23
14
  assert_equal 6, enc_out.first['download_path'].split('/').length
24
15
  end
@@ -0,0 +1,54 @@
1
+ import React from 'react';
2
+ import {
3
+ Button,
4
+ WizardFooter,
5
+ WizardContextConsumer,
6
+ } from '@patternfly/react-core';
7
+ import { translate as __ } from 'foremanReact/common/I18n';
8
+ import { WIZARD_TITLES } from './constants';
9
+
10
+ export const Footer = () => (
11
+ <WizardFooter>
12
+ <WizardContextConsumer>
13
+ {({ activeStep, onNext, onBack, onClose, goToStepByName }) => {
14
+ const isValid =
15
+ activeStep && activeStep.enableNext !== undefined
16
+ ? activeStep.enableNext
17
+ : true;
18
+
19
+ return (
20
+ <>
21
+ {!activeStep.isFinishedStep ? (
22
+ <Button
23
+ ouiaId="oscap-rem-wiz-next-button"
24
+ variant="primary"
25
+ type="submit"
26
+ onClick={onNext}
27
+ isDisabled={!isValid}
28
+ >
29
+ {activeStep.name === WIZARD_TITLES.reviewRemediation
30
+ ? __('Run')
31
+ : __('Next')}
32
+ </Button>
33
+ ) : null}
34
+ <Button
35
+ ouiaId="oscap-rem-wiz-back-button"
36
+ variant="secondary"
37
+ onClick={onBack}
38
+ isDisabled={activeStep.name === WIZARD_TITLES.snippetSelect}
39
+ >
40
+ {__('Back')}
41
+ </Button>
42
+ <Button
43
+ ouiaId="oscap-rem-wiz-cancel-button"
44
+ variant="link"
45
+ onClick={onClose}
46
+ >
47
+ {__('Cancel')}
48
+ </Button>
49
+ </>
50
+ );
51
+ }}
52
+ </WizardContextConsumer>
53
+ </WizardFooter>
54
+ );
@@ -1,3 +1,5 @@
1
+ import { translate as __ } from 'foremanReact/common/I18n';
2
+
1
3
  export const OPENSCAP_REMEDIATION_MODAL_ID = 'openscapRemediationModal';
2
4
  export const HOSTS_PATH = '/hosts';
3
5
  export const FAIL_RULE_SEARCH = 'fails_xccdf_rule';
@@ -12,3 +14,10 @@ export const JOB_INVOCATION_API_REQUEST_KEY = 'OPENSCAP_REX_JOB_INVOCATIONS';
12
14
 
13
15
  export const SNIPPET_SH = 'urn:xccdf:fix:script:sh';
14
16
  export const SNIPPET_ANSIBLE = 'urn:xccdf:fix:script:ansible';
17
+
18
+ export const WIZARD_TITLES = {
19
+ snippetSelect: __('Select snippet'),
20
+ reviewHosts: __('Review hosts'),
21
+ reviewRemediation: __('Review remediation'),
22
+ finish: __('Done'),
23
+ };
@@ -7,12 +7,17 @@ import { sprintf, translate as __ } from 'foremanReact/common/I18n';
7
7
  import { API_OPERATIONS, get } from 'foremanReact/redux/API';
8
8
 
9
9
  import OpenscapRemediationWizardContext from './OpenscapRemediationWizardContext';
10
+ import { Footer } from './Footer';
10
11
  import {
11
12
  selectLogResponse,
12
13
  selectLogError,
13
14
  selectLogStatus,
14
15
  } from './OpenscapRemediationSelectors';
15
- import { REPORT_LOG_REQUEST_KEY, FAIL_RULE_SEARCH } from './constants';
16
+ import {
17
+ REPORT_LOG_REQUEST_KEY,
18
+ FAIL_RULE_SEARCH,
19
+ WIZARD_TITLES,
20
+ } from './constants';
16
21
  import { SnippetSelect, ReviewHosts, ReviewRemediation, Finish } from './steps';
17
22
 
18
23
  const OpenscapRemediationWizard = ({
@@ -66,7 +71,7 @@ const OpenscapRemediationWizard = ({
66
71
 
67
72
  const reviewHostsStep = {
68
73
  id: 2,
69
- name: __('Review hosts'),
74
+ name: WIZARD_TITLES.reviewHosts,
70
75
  component: <ReviewHosts />,
71
76
  canJumpTo: Boolean(snippet && method === 'job'),
72
77
  enableNext: Boolean(snippet && method),
@@ -74,7 +79,7 @@ const OpenscapRemediationWizard = ({
74
79
  const steps = [
75
80
  {
76
81
  id: 1,
77
- name: __('Select snippet'),
82
+ name: WIZARD_TITLES.snippetSelect,
78
83
  component: <SnippetSelect />,
79
84
  canJumpTo: true,
80
85
  enableNext: Boolean(snippet && method),
@@ -82,7 +87,7 @@ const OpenscapRemediationWizard = ({
82
87
  ...(snippet && method === 'job' ? [reviewHostsStep] : []),
83
88
  {
84
89
  id: 3,
85
- name: __('Review remediation'),
90
+ name: WIZARD_TITLES.reviewRemediation,
86
91
  component: <ReviewRemediation />,
87
92
  canJumpTo: Boolean(snippet && method),
88
93
  enableNext: method === 'job',
@@ -90,7 +95,7 @@ const OpenscapRemediationWizard = ({
90
95
  },
91
96
  {
92
97
  id: 4,
93
- name: __('Done'),
98
+ name: WIZARD_TITLES.finish,
94
99
  component: <Finish onClose={onWizardClose} />,
95
100
  isFinishedStep: true,
96
101
  },
@@ -128,6 +133,7 @@ const OpenscapRemediationWizard = ({
128
133
  isOpen={isRemediationWizardOpen}
129
134
  steps={steps}
130
135
  onClose={onWizardClose}
136
+ footer={<Footer />}
131
137
  />
132
138
  </OpenscapRemediationWizardContext.Provider>
133
139
  )}
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_openscap
3
3
  version: !ruby/object:Gem::Version
4
- version: 9.0.2
4
+ version: 9.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - slukasik@redhat.com
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-07-10 00:00:00.000000000 Z
11
+ date: 2024-07-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -91,7 +91,6 @@ files:
91
91
  - app/helpers/foreman_openscap_helper.rb
92
92
  - app/helpers/policies_helper.rb
93
93
  - app/helpers/policy_dashboard_helper.rb
94
- - app/helpers/tailoring_files_helper.rb
95
94
  - app/lib/proxy_api/migration.rb
96
95
  - app/lib/proxy_api/openscap.rb
97
96
  - app/mailers/foreman_openscap/policy_mailer.rb
@@ -127,8 +126,6 @@ files:
127
126
  - app/services/foreman_openscap/hostgroup_overrider_common.rb
128
127
  - app/services/foreman_openscap/lookup_key_overrider.rb
129
128
  - app/services/foreman_openscap/lookup_key_overrides_common.rb
130
- - app/services/foreman_openscap/openscap_proxy_assigned_version_check.rb
131
- - app/services/foreman_openscap/openscap_proxy_version_check.rb
132
129
  - app/services/foreman_openscap/policy_dashboard/data.rb
133
130
  - app/services/foreman_openscap/report_dashboard/data.rb
134
131
  - app/services/proxy_status/openscap_spool.rb
@@ -299,71 +296,39 @@ files:
299
296
  - locale/Makefile
300
297
  - locale/action_names.rb
301
298
  - locale/cs_CZ/LC_MESSAGES/foreman_openscap.mo
302
- - locale/cs_CZ/foreman_openscap.edit.po
303
299
  - locale/cs_CZ/foreman_openscap.po
304
- - locale/cs_CZ/foreman_openscap.po.time_stamp
305
300
  - locale/de/LC_MESSAGES/foreman_openscap.mo
306
- - locale/de/foreman_openscap.edit.po
307
301
  - locale/de/foreman_openscap.po
308
- - locale/de/foreman_openscap.po.time_stamp
309
302
  - locale/en/LC_MESSAGES/foreman_openscap.mo
310
- - locale/en/foreman_openscap.edit.po
311
303
  - locale/en/foreman_openscap.po
312
- - locale/en/foreman_openscap.po.time_stamp
313
304
  - locale/en_GB/LC_MESSAGES/foreman_openscap.mo
314
- - locale/en_GB/foreman_openscap.edit.po
315
305
  - locale/en_GB/foreman_openscap.po
316
- - locale/en_GB/foreman_openscap.po.time_stamp
317
306
  - locale/es/LC_MESSAGES/foreman_openscap.mo
318
- - locale/es/foreman_openscap.edit.po
319
307
  - locale/es/foreman_openscap.po
320
- - locale/es/foreman_openscap.po.time_stamp
321
308
  - locale/foreman_openscap.pot
322
309
  - locale/fr/LC_MESSAGES/foreman_openscap.mo
323
- - locale/fr/foreman_openscap.edit.po
324
310
  - locale/fr/foreman_openscap.po
325
- - locale/fr/foreman_openscap.po.time_stamp
326
311
  - locale/gl/LC_MESSAGES/foreman_openscap.mo
327
- - locale/gl/foreman_openscap.edit.po
328
312
  - locale/gl/foreman_openscap.po
329
- - locale/gl/foreman_openscap.po.time_stamp
330
313
  - locale/it/LC_MESSAGES/foreman_openscap.mo
331
- - locale/it/foreman_openscap.edit.po
332
314
  - locale/it/foreman_openscap.po
333
- - locale/it/foreman_openscap.po.time_stamp
334
315
  - locale/ja/LC_MESSAGES/foreman_openscap.mo
335
- - locale/ja/foreman_openscap.edit.po
336
316
  - locale/ja/foreman_openscap.po
337
- - locale/ja/foreman_openscap.po.time_stamp
338
317
  - locale/ka/LC_MESSAGES/foreman_openscap.mo
339
- - locale/ka/foreman_openscap.edit.po
340
318
  - locale/ka/foreman_openscap.po
341
- - locale/ka/foreman_openscap.po.time_stamp
342
319
  - locale/ko/LC_MESSAGES/foreman_openscap.mo
343
- - locale/ko/foreman_openscap.edit.po
344
320
  - locale/ko/foreman_openscap.po
345
- - locale/ko/foreman_openscap.po.time_stamp
346
321
  - locale/pt_BR/LC_MESSAGES/foreman_openscap.mo
347
- - locale/pt_BR/foreman_openscap.edit.po
348
322
  - locale/pt_BR/foreman_openscap.po
349
- - locale/pt_BR/foreman_openscap.po.time_stamp
350
323
  - locale/ru/LC_MESSAGES/foreman_openscap.mo
351
- - locale/ru/foreman_openscap.edit.po
352
324
  - locale/ru/foreman_openscap.po
353
- - locale/ru/foreman_openscap.po.time_stamp
354
325
  - locale/sv_SE/LC_MESSAGES/foreman_openscap.mo
355
- - locale/sv_SE/foreman_openscap.edit.po
356
326
  - locale/sv_SE/foreman_openscap.po
357
- - locale/sv_SE/foreman_openscap.po.time_stamp
358
327
  - locale/zanata.xml
359
328
  - locale/zh_CN/LC_MESSAGES/foreman_openscap.mo
360
- - locale/zh_CN/foreman_openscap.edit.po
361
329
  - locale/zh_CN/foreman_openscap.po
362
- - locale/zh_CN/foreman_openscap.po.time_stamp
363
330
  - locale/zh_TW/LC_MESSAGES/foreman_openscap.mo
364
- - locale/zh_TW/foreman_openscap.edit.po
365
331
  - locale/zh_TW/foreman_openscap.po
366
- - locale/zh_TW/foreman_openscap.po.time_stamp
367
332
  - package.json
368
333
  - test/factories/arf_report_factory.rb
369
334
  - test/factories/asset_factory.rb
@@ -409,7 +374,6 @@ files:
409
374
  - test/unit/services/hostgroup_overrider_test.rb
410
375
  - test/unit/services/lookup_key_overrider_test.rb
411
376
  - test/unit/services/report_dashboard/data_test.rb
412
- - test/unit/services/tailoring_files_proxy_check_test.rb
413
377
  - test/unit/tailoring_file_test.rb
414
378
  - webpack/components/ConfirmModal.js
415
379
  - webpack/components/ConfirmModal.scss
@@ -422,6 +386,7 @@ files:
422
386
  - webpack/components/IndexTable/IndexTableHelper.js
423
387
  - webpack/components/IndexTable/index.js
424
388
  - webpack/components/LinkButton.js
389
+ - webpack/components/OpenscapRemediationWizard/Footer.js
425
390
  - webpack/components/OpenscapRemediationWizard/OpenscapRemediationSelectors.js
426
391
  - webpack/components/OpenscapRemediationWizard/OpenscapRemediationWizardContext.js
427
392
  - webpack/components/OpenscapRemediationWizard/ViewSelectedHostsLink.js
@@ -461,7 +426,7 @@ homepage: https://github.com/theforeman/foreman_openscap
461
426
  licenses:
462
427
  - GPL-3.0
463
428
  metadata: {}
464
- post_install_message:
429
+ post_install_message:
465
430
  rdoc_options: []
466
431
  require_paths:
467
432
  - lib
@@ -476,8 +441,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
476
441
  - !ruby/object:Gem::Version
477
442
  version: '0'
478
443
  requirements: []
479
- rubygems_version: 3.2.33
480
- signing_key:
444
+ rubygems_version: 3.3.26
445
+ signing_key:
481
446
  specification_version: 4
482
447
  summary: Foreman plug-in for displaying OpenSCAP audit reports
483
448
  test_files:
@@ -525,5 +490,4 @@ test_files:
525
490
  - test/unit/services/hostgroup_overrider_test.rb
526
491
  - test/unit/services/lookup_key_overrider_test.rb
527
492
  - test/unit/services/report_dashboard/data_test.rb
528
- - test/unit/services/tailoring_files_proxy_check_test.rb
529
493
  - test/unit/tailoring_file_test.rb
@@ -1,5 +0,0 @@
1
- module TailoringFilesHelper
2
- def run_tailoring_proxy_check
3
- ForemanOpenscap::OpenscapProxyVersionCheck.new.run
4
- end
5
- end
@@ -1,14 +0,0 @@
1
- module ForemanOpenscap
2
- class OpenscapProxyAssignedVersionCheck < OpenscapProxyVersionCheck
3
- def initialize(host)
4
- @host = host
5
- super()
6
- end
7
-
8
- private
9
-
10
- def get_openscap_proxies
11
- @host.openscap_proxy ? [@host.openscap_proxy] : []
12
- end
13
- end
14
- end
@@ -1,62 +0,0 @@
1
- module ForemanOpenscap
2
- class OpenscapProxyVersionCheck
3
- def initialize
4
- @versions = {}
5
- @message = ''
6
- @down = []
7
- end
8
-
9
- def run
10
- @versions = openscap_proxy_versions.select do |key, value|
11
- Gem::Version.new(value) < Gem::Version.new("0.6.1")
12
- end
13
- self
14
- end
15
-
16
- def pass?
17
- !any_outdated? && !any_unreachable?
18
- end
19
-
20
- def any_outdated?
21
- !@versions.empty?
22
- end
23
-
24
- def any_unreachable?
25
- !@down.empty?
26
- end
27
-
28
- def message
29
- if pass?
30
- @message
31
- else
32
- build_message
33
- end
34
- end
35
-
36
- private
37
-
38
- def build_message
39
- @message = _('This feature is temporarily disabled. ')
40
- @message << _('The following Smart Proxies need to be updated to unlock the feature: %s. ') % @versions.keys.to_sentence if any_outdated?
41
- @message << _('The following proxies could not be reached: %s. Please make sure they are available so Foreman can check their versions.') % @down.to_sentence if any_unreachable?
42
- @message
43
- end
44
-
45
- def get_openscap_proxies
46
- SmartProxy.with_features "Openscap"
47
- end
48
-
49
- def openscap_proxy_versions
50
- get_openscap_proxies.inject({}) do |memo, proxy|
51
- begin
52
- status = ProxyStatus::Version.new(proxy).version
53
- openscap_version = status["modules"]["openscap"]
54
- memo[proxy.name] = openscap_version
55
- rescue Foreman::WrappedException
56
- @down << proxy.name
57
- end
58
- memo
59
- end
60
- end
61
- end
62
- end