foreman_openscap 1.0.10 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/api/v2/compliance/policies_controller.rb +1 -1
  3. data/app/controllers/policies_controller.rb +1 -1
  4. data/app/helpers/compliance_hosts_helper.rb +23 -0
  5. data/app/helpers/concerns/foreman_openscap/hosts_helper_extensions.rb +0 -6
  6. data/app/helpers/foreman_openscap_helper.rb +2 -10
  7. data/app/models/concerns/foreman_openscap/host_extensions.rb +1 -1
  8. data/app/models/foreman_openscap/policy.rb +12 -0
  9. data/lib/foreman_openscap/engine.rb +6 -4
  10. data/lib/foreman_openscap/version.rb +1 -1
  11. data/locale/de/LC_MESSAGES/foreman_openscap.mo +0 -0
  12. data/locale/de/foreman_openscap.po +401 -228
  13. data/locale/en_GB/LC_MESSAGES/foreman_openscap.mo +0 -0
  14. data/locale/en_GB/foreman_openscap.po +214 -43
  15. data/locale/es/LC_MESSAGES/foreman_openscap.mo +0 -0
  16. data/locale/es/foreman_openscap.po +446 -273
  17. data/locale/foreman_openscap.pot +275 -51
  18. data/locale/fr/LC_MESSAGES/foreman_openscap.mo +0 -0
  19. data/locale/fr/foreman_openscap.po +453 -274
  20. data/locale/gl/LC_MESSAGES/foreman_openscap.mo +0 -0
  21. data/locale/gl/foreman_openscap.po +227 -56
  22. data/locale/it/LC_MESSAGES/foreman_openscap.mo +0 -0
  23. data/locale/it/foreman_openscap.po +250 -78
  24. data/locale/ja/LC_MESSAGES/foreman_openscap.mo +0 -0
  25. data/locale/ja/foreman_openscap.po +445 -272
  26. data/locale/ko/LC_MESSAGES/foreman_openscap.mo +0 -0
  27. data/locale/ko/foreman_openscap.po +321 -150
  28. data/locale/pt_BR/LC_MESSAGES/foreman_openscap.mo +0 -0
  29. data/locale/pt_BR/foreman_openscap.po +448 -270
  30. data/locale/ru/LC_MESSAGES/foreman_openscap.mo +0 -0
  31. data/locale/ru/foreman_openscap.po +329 -155
  32. data/locale/sv_SE/LC_MESSAGES/foreman_openscap.mo +0 -0
  33. data/locale/sv_SE/foreman_openscap.po +227 -56
  34. data/locale/zh_CN/LC_MESSAGES/foreman_openscap.mo +0 -0
  35. data/locale/zh_CN/foreman_openscap.po +445 -271
  36. data/locale/zh_TW/LC_MESSAGES/foreman_openscap.mo +0 -0
  37. data/locale/zh_TW/foreman_openscap.po +318 -146
  38. data/test/unit/concerns/host_extensions_test.rb +7 -0
  39. data/test/unit/policy_test.rb +19 -0
  40. metadata +8 -23
  41. data/app/overrides/hosts/overview/host_compliance_status.rb +0 -4
  42. data/app/views/compliance_hosts/_compliance_status.erb +0 -6
  43. data/locale/de/foreman_openscap.edit.po +0 -0
  44. data/locale/en_GB/foreman_openscap.edit.po +0 -0
  45. data/locale/es/foreman_openscap.edit.po +0 -0
  46. data/locale/fr/foreman_openscap.edit.po +0 -0
  47. data/locale/gl/foreman_openscap.edit.po +0 -0
  48. data/locale/it/foreman_openscap.edit.po +0 -0
  49. data/locale/ja/foreman_openscap.edit.po +0 -0
  50. data/locale/ko/foreman_openscap.edit.po +0 -0
  51. data/locale/pt_BR/foreman_openscap.edit.po +0 -0
  52. data/locale/ru/foreman_openscap.edit.po +0 -0
  53. data/locale/sv_SE/foreman_openscap.edit.po +0 -0
  54. data/locale/zh_CN/foreman_openscap.edit.po +0 -0
  55. data/locale/zh_TW/foreman_openscap.edit.po +0 -0
@@ -164,6 +164,13 @@ class HostExtensionsTest < ActiveSupport::TestCase
164
164
  assert_equal host.errors.full_messages.first, "Openscap proxy with id #{proxy.id} doesn't exist or is not assigned to proper organization and/or location"
165
165
  end
166
166
 
167
+ test 'should delete asset together with host' do
168
+ host = FactoryBot.create(:compliance_host)
169
+ FactoryBot.create(:asset_policy, :asset => host.asset, :policy => @policy)
170
+ assert host.destroy
171
+ assert_empty ForemanOpenscap::Asset.where(:assetable_id => host.id, :assetable_type => 'Host::Base')
172
+ end
173
+
167
174
  private
168
175
 
169
176
  def setup_hosts_with_policy
@@ -279,4 +279,23 @@ class PolicyTest < ActiveSupport::TestCase
279
279
  refute policy.hostgroups.empty?
280
280
  refute policy.hosts.empty?
281
281
  end
282
+
283
+ test "should change deploy type" do
284
+ policy = FactoryBot.create(:policy, :scap_content => @scap_content, :scap_content_profile => @scap_profile)
285
+ setup_puppet_class
286
+ policy.change_deploy_type({ :deploy_by => 'puppet' })
287
+ refute policy.errors.any?
288
+ policy.reload
289
+ assert 'puppet', policy.deploy_by
290
+ end
291
+
292
+ test 'should not change any attributes when cannot change deploy_by' do
293
+ name = 'my-policy'
294
+ policy = FactoryBot.create(:policy, :name => name, :scap_content => @scap_content, :scap_content_profile => @scap_profile)
295
+ policy.change_deploy_type({ :name => 'salty policy', :deploy_by => 'salt' })
296
+ assert policy.errors.any?
297
+ policy.reload
298
+ assert_equal policy.deploy_by, 'manual'
299
+ assert_equal policy.name, name
300
+ end
282
301
  end
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_openscap
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.10
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - slukasik@redhat.com
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-11-13 00:00:00.000000000 Z
11
+ date: 2019-10-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: deface
14
+ name: rake
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "<"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '2.0'
20
- type: :runtime
19
+ version: '0'
20
+ type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "<"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '2.0'
26
+ version: '0'
27
27
  description: Foreman plug-in for managing security compliance reports
28
28
  email:
29
29
  - slukasik@redhat.com
@@ -96,7 +96,6 @@ files:
96
96
  - app/models/foreman_openscap/scap_content.rb
97
97
  - app/models/foreman_openscap/scap_content_profile.rb
98
98
  - app/models/foreman_openscap/tailoring_file.rb
99
- - app/overrides/hosts/overview/host_compliance_status.rb
100
99
  - app/services/foreman_openscap/arf_report_status_calculator.rb
101
100
  - app/services/foreman_openscap/client_config/ansible.rb
102
101
  - app/services/foreman_openscap/client_config/base.rb
@@ -146,7 +145,6 @@ files:
146
145
  - app/views/arf_reports/show.html.erb
147
146
  - app/views/arf_reports/show_html.html.erb
148
147
  - app/views/arf_reports/welcome.html.erb
149
- - app/views/compliance_hosts/_compliance_status.erb
150
148
  - app/views/compliance_hosts/show.html.erb
151
149
  - app/views/dashboard/_compliance_host_reports_widget.html.erb
152
150
  - app/views/dashboard/_compliance_reports_breakdown_widget.html.erb
@@ -254,45 +252,32 @@ files:
254
252
  - locale/Makefile
255
253
  - locale/action_names.rb
256
254
  - locale/de/LC_MESSAGES/foreman_openscap.mo
257
- - locale/de/foreman_openscap.edit.po
258
255
  - locale/de/foreman_openscap.po
259
256
  - locale/en_GB/LC_MESSAGES/foreman_openscap.mo
260
- - locale/en_GB/foreman_openscap.edit.po
261
257
  - locale/en_GB/foreman_openscap.po
262
258
  - locale/es/LC_MESSAGES/foreman_openscap.mo
263
- - locale/es/foreman_openscap.edit.po
264
259
  - locale/es/foreman_openscap.po
265
260
  - locale/foreman_openscap.pot
266
261
  - locale/fr/LC_MESSAGES/foreman_openscap.mo
267
- - locale/fr/foreman_openscap.edit.po
268
262
  - locale/fr/foreman_openscap.po
269
263
  - locale/gl/LC_MESSAGES/foreman_openscap.mo
270
- - locale/gl/foreman_openscap.edit.po
271
264
  - locale/gl/foreman_openscap.po
272
265
  - locale/it/LC_MESSAGES/foreman_openscap.mo
273
- - locale/it/foreman_openscap.edit.po
274
266
  - locale/it/foreman_openscap.po
275
267
  - locale/ja/LC_MESSAGES/foreman_openscap.mo
276
- - locale/ja/foreman_openscap.edit.po
277
268
  - locale/ja/foreman_openscap.po
278
269
  - locale/ko/LC_MESSAGES/foreman_openscap.mo
279
- - locale/ko/foreman_openscap.edit.po
280
270
  - locale/ko/foreman_openscap.po
281
271
  - locale/pt_BR/LC_MESSAGES/foreman_openscap.mo
282
- - locale/pt_BR/foreman_openscap.edit.po
283
272
  - locale/pt_BR/foreman_openscap.po
284
273
  - locale/ru/LC_MESSAGES/foreman_openscap.mo
285
- - locale/ru/foreman_openscap.edit.po
286
274
  - locale/ru/foreman_openscap.po
287
275
  - locale/sv_SE/LC_MESSAGES/foreman_openscap.mo
288
- - locale/sv_SE/foreman_openscap.edit.po
289
276
  - locale/sv_SE/foreman_openscap.po
290
277
  - locale/zanata.xml
291
278
  - locale/zh_CN/LC_MESSAGES/foreman_openscap.mo
292
- - locale/zh_CN/foreman_openscap.edit.po
293
279
  - locale/zh_CN/foreman_openscap.po
294
280
  - locale/zh_TW/LC_MESSAGES/foreman_openscap.mo
295
- - locale/zh_TW/foreman_openscap.edit.po
296
281
  - locale/zh_TW/foreman_openscap.po
297
282
  - test/factories/arf_report_factory.rb
298
283
  - test/factories/asset_factory.rb
@@ -1,4 +0,0 @@
1
- Deface::Override.new(:virtual_path => "hosts/show",
2
- :name => "add_compliance_link_to_host",
3
- :insert_bottom => 'td:last',
4
- :partial => 'compliance_hosts/compliance_status')
@@ -1,6 +0,0 @@
1
- <%= link_to(
2
- _('Compliance'),
3
- compliance_host_path(@host.id),
4
- :title => _("Host compliance details"),
5
- :class => 'btn btn-default') if @host.arf_reports.any?
6
- %>
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes