foreman_openscap 1.0.5 → 1.0.6

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 (34) hide show
  1. checksums.yaml +4 -4
  2. data/app/models/foreman_openscap/policy.rb +3 -3
  3. data/app/views/job_templates/run_openscap_scans.erb +3 -1
  4. data/lib/foreman_openscap/version.rb +1 -1
  5. data/locale/de/foreman_openscap.edit.po +1 -1
  6. data/locale/de/foreman_openscap.po +2 -2
  7. data/locale/en_GB/foreman_openscap.edit.po +1 -1
  8. data/locale/en_GB/foreman_openscap.po +2 -2
  9. data/locale/es/foreman_openscap.edit.po +1 -1
  10. data/locale/es/foreman_openscap.po +2 -2
  11. data/locale/foreman_openscap.pot +5 -3
  12. data/locale/fr/foreman_openscap.edit.po +1 -1
  13. data/locale/fr/foreman_openscap.po +2 -2
  14. data/locale/gl/foreman_openscap.edit.po +1 -1
  15. data/locale/gl/foreman_openscap.po +2 -2
  16. data/locale/it/foreman_openscap.edit.po +1 -1
  17. data/locale/it/foreman_openscap.po +2 -2
  18. data/locale/ja/foreman_openscap.edit.po +1 -1
  19. data/locale/ja/foreman_openscap.po +2 -2
  20. data/locale/ko/foreman_openscap.edit.po +1 -1
  21. data/locale/ko/foreman_openscap.po +2 -2
  22. data/locale/pt_BR/foreman_openscap.edit.po +1 -1
  23. data/locale/pt_BR/foreman_openscap.po +2 -2
  24. data/locale/ru/foreman_openscap.edit.po +1 -1
  25. data/locale/ru/foreman_openscap.po +2 -2
  26. data/locale/sv_SE/foreman_openscap.edit.po +1 -1
  27. data/locale/sv_SE/foreman_openscap.po +2 -2
  28. data/locale/zh_CN/foreman_openscap.edit.po +1 -1
  29. data/locale/zh_CN/foreman_openscap.po +2 -2
  30. data/locale/zh_TW/foreman_openscap.edit.po +1 -1
  31. data/locale/zh_TW/foreman_openscap.po +2 -2
  32. data/test/factories/compliance_host_factory.rb +1 -1
  33. data/test/unit/policy_test.rb +28 -1
  34. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0b6304ecdc7fd28bb61ee2274acf8bf5a281bad437a67aa4b0fbe8214b438432
4
- data.tar.gz: e7545538f9f374458f0b1d3b365367bf21532971d2043068fd83b3b7afbe7db8
3
+ metadata.gz: '0895db81e437924a55b31bb9abe2f1a4f217d6e6108b1324fc52af3950aacd33'
4
+ data.tar.gz: 5031307c30cddd992d58e0cd4b855b3cdc7e43dfe766947df66adf8154d8a048
5
5
  SHA512:
6
- metadata.gz: 8206badfe4852a6a74ba2ced8aeb863f1fdb09383b4522c92604eb255fed2ee0fbe98bb3544b81be75969de2b581c2123ad5619f01f9e324e30f081a7224239f
7
- data.tar.gz: baf9118c0c690b4c446f565848848cd11368345c59bcd44b44b4e443f387ba26c631e173d352cdc5de150a2cd792bad3cadb55b292c325cd7c93642e88eaf47d
6
+ metadata.gz: fa6478fc462f96ca1ba815c8369476e58e253bb1ed01307e81895c28ed6e7684602029949233a7e7d89ba8cba6f73d197f5fef76746273120f94ab26aa3acec8
7
+ data.tar.gz: 0a97a049d86e101f303316b4b49d0b21864c207884fd1ca45b19456735159f8cb1e2b4d762057d078668dcfe7c729b50665d3f7290dab2c20e2b3995ee15128f
@@ -305,15 +305,15 @@ module ForemanOpenscap
305
305
  memo << assets.where(:assetable_type => class_name, :assetable_id => id).first_or_initialize
306
306
  end
307
307
  complimentary_class_name = class_name == 'Host::Base' ? 'Hostgroup' : 'Host::Base'
308
- existing_assets = self.assets.where(:assetable_type => complimentary_class_name)
308
+ existing_assets = self.assets.select { |assigned_asset| assigned_asset.assetable_type == complimentary_class_name }
309
309
  self.assets = existing_assets + new_assets
310
310
  end
311
311
 
312
312
  def no_mixed_deployments
313
313
  assets.each do |asset|
314
314
  assetable = asset.assetable
315
- unless assetable.policies.pluck(:deploy_by).all? { |deployed_by| deployed_by == deploy_by }
316
- errors.add(:base, _("cannot assign to %s, all assigned policies must be deployed in the same way") % assetable.name)
315
+ unless assetable.policies.where.not(:id => id).pluck(:deploy_by).all? { |deployed_by| deployed_by == deploy_by }
316
+ errors.add(:base, _("cannot assign to %s, all assigned policies must be deployed in the same way, check 'deploy by' for each assigned policy") % assetable.name)
317
317
  end
318
318
  end
319
319
  end
@@ -15,7 +15,9 @@ template_inputs:
15
15
  provider_type: SSH
16
16
  kind: job_template
17
17
  %>
18
- <% raise "Create and assign a policy to this host before proceeding" unless input('policies').respond_to? :map %>
18
+ <% raise 'Cannot detect values for policies input, please make sure your host is properly configured for openscap' unless input('policies').respond_to?(:map) %>
19
+
20
+ <% raise "Create and assign a policy to this host before proceeding" if input('policies').respond_to?(:empty?) && input('policies').empty? %>
19
21
 
20
22
  <% input('policies').map { |policy_config| policy_config['id'] }.each do |id| -%>
21
23
  /usr/bin/foreman_scap_client <%= id %>
@@ -1,3 +1,3 @@
1
1
  module ForemanOpenscap
2
- VERSION = "1.0.5".freeze
2
+ VERSION = "1.0.6".freeze
3
3
  end
@@ -597,7 +597,7 @@ msgid "does not have the selected SCAP content profile"
597
597
  msgstr ""
598
598
 
599
599
  #: ../app/models/foreman_openscap/policy.rb:316
600
- msgid "cannot assign to %s, all assigned policies must be deployed in the same way"
600
+ msgid "cannot assign to %s, all assigned policies must be deployed in the same way, check 'deploy by' for each assigned policy"
601
601
  msgstr ""
602
602
 
603
603
  #: ../app/services/foreman_openscap/arf_report_status_calculator.rb:30
@@ -5,7 +5,7 @@
5
5
  #
6
6
  msgid ""
7
7
  msgstr ""
8
- "Project-Id-Version: foreman_openscap 0.11.0\n"
8
+ "Project-Id-Version: foreman_openscap 1.0.4\n"
9
9
  "Report-Msgid-Bugs-To: \n"
10
10
  "PO-Revision-Date: 2016-02-09 16:41-0500\n"
11
11
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
@@ -888,7 +888,7 @@ msgstr ""
888
888
  msgid "You don't seem to have any ARF report. ARF report is a summary of a single scan occurrence on a particular host for a given Compliance Policy."
889
889
  msgstr ""
890
890
 
891
- msgid "cannot assign to %s, all assigned policies must be deployed in the same way"
891
+ msgid "cannot assign to %s, all assigned policies must be deployed in the same way, check 'deploy by' for each assigned policy"
892
892
  msgstr ""
893
893
 
894
894
  msgid "documentation"
@@ -597,7 +597,7 @@ msgid "does not have the selected SCAP content profile"
597
597
  msgstr ""
598
598
 
599
599
  #: ../app/models/foreman_openscap/policy.rb:316
600
- msgid "cannot assign to %s, all assigned policies must be deployed in the same way"
600
+ msgid "cannot assign to %s, all assigned policies must be deployed in the same way, check 'deploy by' for each assigned policy"
601
601
  msgstr ""
602
602
 
603
603
  #: ../app/services/foreman_openscap/arf_report_status_calculator.rb:30
@@ -5,7 +5,7 @@
5
5
  #
6
6
  msgid ""
7
7
  msgstr ""
8
- "Project-Id-Version: foreman_openscap 0.11.0\n"
8
+ "Project-Id-Version: foreman_openscap 1.0.4\n"
9
9
  "Report-Msgid-Bugs-To: \n"
10
10
  "PO-Revision-Date: 2016-02-09 16:41-0500\n"
11
11
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
@@ -888,7 +888,7 @@ msgstr ""
888
888
  msgid "You don't seem to have any ARF report. ARF report is a summary of a single scan occurrence on a particular host for a given Compliance Policy."
889
889
  msgstr ""
890
890
 
891
- msgid "cannot assign to %s, all assigned policies must be deployed in the same way"
891
+ msgid "cannot assign to %s, all assigned policies must be deployed in the same way, check 'deploy by' for each assigned policy"
892
892
  msgstr ""
893
893
 
894
894
  msgid "documentation"
@@ -597,7 +597,7 @@ msgid "does not have the selected SCAP content profile"
597
597
  msgstr ""
598
598
 
599
599
  #: ../app/models/foreman_openscap/policy.rb:316
600
- msgid "cannot assign to %s, all assigned policies must be deployed in the same way"
600
+ msgid "cannot assign to %s, all assigned policies must be deployed in the same way, check 'deploy by' for each assigned policy"
601
601
  msgstr ""
602
602
 
603
603
  #: ../app/services/foreman_openscap/arf_report_status_calculator.rb:30
@@ -5,7 +5,7 @@
5
5
  #
6
6
  msgid ""
7
7
  msgstr ""
8
- "Project-Id-Version: foreman_openscap 0.11.0\n"
8
+ "Project-Id-Version: foreman_openscap 1.0.4\n"
9
9
  "Report-Msgid-Bugs-To: \n"
10
10
  "PO-Revision-Date: 2016-02-09 16:41-0500\n"
11
11
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
@@ -888,7 +888,7 @@ msgstr ""
888
888
  msgid "You don't seem to have any ARF report. ARF report is a summary of a single scan occurrence on a particular host for a given Compliance Policy."
889
889
  msgstr ""
890
890
 
891
- msgid "cannot assign to %s, all assigned policies must be deployed in the same way"
891
+ msgid "cannot assign to %s, all assigned policies must be deployed in the same way, check 'deploy by' for each assigned policy"
892
892
  msgstr ""
893
893
 
894
894
  msgid "documentation"
@@ -8,8 +8,8 @@ msgid ""
8
8
  msgstr ""
9
9
  "Project-Id-Version: foreman_openscap 1.0.0\n"
10
10
  "Report-Msgid-Bugs-To: \n"
11
- "POT-Creation-Date: 2019-08-08 16:14+0200\n"
12
- "PO-Revision-Date: 2019-08-08 16:14+0200\n"
11
+ "POT-Creation-Date: 2019-09-05 16:51+0200\n"
12
+ "PO-Revision-Date: 2019-09-05 16:51+0200\n"
13
13
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
14
  "Language-Team: LANGUAGE <LL@li.org>\n"
15
15
  "Language: \n"
@@ -649,7 +649,9 @@ msgid "does not have the selected SCAP content profile"
649
649
  msgstr ""
650
650
 
651
651
  #: ../app/models/foreman_openscap/policy.rb:316
652
- msgid "cannot assign to %s, all assigned policies must be deployed in the same way"
652
+ msgid ""
653
+ "cannot assign to %s, all assigned policies must be deployed in the same way, c"
654
+ "heck 'deploy by' for each assigned policy"
653
655
  msgstr ""
654
656
 
655
657
  #: ../app/services/foreman_openscap/arf_report_status_calculator.rb:30
@@ -597,7 +597,7 @@ msgid "does not have the selected SCAP content profile"
597
597
  msgstr ""
598
598
 
599
599
  #: ../app/models/foreman_openscap/policy.rb:316
600
- msgid "cannot assign to %s, all assigned policies must be deployed in the same way"
600
+ msgid "cannot assign to %s, all assigned policies must be deployed in the same way, check 'deploy by' for each assigned policy"
601
601
  msgstr ""
602
602
 
603
603
  #: ../app/services/foreman_openscap/arf_report_status_calculator.rb:30
@@ -5,7 +5,7 @@
5
5
  #
6
6
  msgid ""
7
7
  msgstr ""
8
- "Project-Id-Version: foreman_openscap 0.11.0\n"
8
+ "Project-Id-Version: foreman_openscap 1.0.4\n"
9
9
  "Report-Msgid-Bugs-To: \n"
10
10
  "PO-Revision-Date: 2016-02-09 16:41-0500\n"
11
11
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
@@ -888,7 +888,7 @@ msgstr ""
888
888
  msgid "You don't seem to have any ARF report. ARF report is a summary of a single scan occurrence on a particular host for a given Compliance Policy."
889
889
  msgstr ""
890
890
 
891
- msgid "cannot assign to %s, all assigned policies must be deployed in the same way"
891
+ msgid "cannot assign to %s, all assigned policies must be deployed in the same way, check 'deploy by' for each assigned policy"
892
892
  msgstr ""
893
893
 
894
894
  msgid "documentation"
@@ -597,7 +597,7 @@ msgid "does not have the selected SCAP content profile"
597
597
  msgstr ""
598
598
 
599
599
  #: ../app/models/foreman_openscap/policy.rb:316
600
- msgid "cannot assign to %s, all assigned policies must be deployed in the same way"
600
+ msgid "cannot assign to %s, all assigned policies must be deployed in the same way, check 'deploy by' for each assigned policy"
601
601
  msgstr ""
602
602
 
603
603
  #: ../app/services/foreman_openscap/arf_report_status_calculator.rb:30
@@ -5,7 +5,7 @@
5
5
  #
6
6
  msgid ""
7
7
  msgstr ""
8
- "Project-Id-Version: foreman_openscap 0.11.0\n"
8
+ "Project-Id-Version: foreman_openscap 1.0.4\n"
9
9
  "Report-Msgid-Bugs-To: \n"
10
10
  "PO-Revision-Date: 2016-02-09 16:41-0500\n"
11
11
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
@@ -888,7 +888,7 @@ msgstr ""
888
888
  msgid "You don't seem to have any ARF report. ARF report is a summary of a single scan occurrence on a particular host for a given Compliance Policy."
889
889
  msgstr ""
890
890
 
891
- msgid "cannot assign to %s, all assigned policies must be deployed in the same way"
891
+ msgid "cannot assign to %s, all assigned policies must be deployed in the same way, check 'deploy by' for each assigned policy"
892
892
  msgstr ""
893
893
 
894
894
  msgid "documentation"
@@ -597,7 +597,7 @@ msgid "does not have the selected SCAP content profile"
597
597
  msgstr ""
598
598
 
599
599
  #: ../app/models/foreman_openscap/policy.rb:316
600
- msgid "cannot assign to %s, all assigned policies must be deployed in the same way"
600
+ msgid "cannot assign to %s, all assigned policies must be deployed in the same way, check 'deploy by' for each assigned policy"
601
601
  msgstr ""
602
602
 
603
603
  #: ../app/services/foreman_openscap/arf_report_status_calculator.rb:30
@@ -5,7 +5,7 @@
5
5
  #
6
6
  msgid ""
7
7
  msgstr ""
8
- "Project-Id-Version: foreman_openscap 0.11.0\n"
8
+ "Project-Id-Version: foreman_openscap 1.0.4\n"
9
9
  "Report-Msgid-Bugs-To: \n"
10
10
  "PO-Revision-Date: 2016-02-09 16:41-0500\n"
11
11
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
@@ -888,7 +888,7 @@ msgstr ""
888
888
  msgid "You don't seem to have any ARF report. ARF report is a summary of a single scan occurrence on a particular host for a given Compliance Policy."
889
889
  msgstr ""
890
890
 
891
- msgid "cannot assign to %s, all assigned policies must be deployed in the same way"
891
+ msgid "cannot assign to %s, all assigned policies must be deployed in the same way, check 'deploy by' for each assigned policy"
892
892
  msgstr ""
893
893
 
894
894
  msgid "documentation"
@@ -597,7 +597,7 @@ msgid "does not have the selected SCAP content profile"
597
597
  msgstr ""
598
598
 
599
599
  #: ../app/models/foreman_openscap/policy.rb:316
600
- msgid "cannot assign to %s, all assigned policies must be deployed in the same way"
600
+ msgid "cannot assign to %s, all assigned policies must be deployed in the same way, check 'deploy by' for each assigned policy"
601
601
  msgstr ""
602
602
 
603
603
  #: ../app/services/foreman_openscap/arf_report_status_calculator.rb:30
@@ -5,7 +5,7 @@
5
5
  #
6
6
  msgid ""
7
7
  msgstr ""
8
- "Project-Id-Version: foreman_openscap 0.11.0\n"
8
+ "Project-Id-Version: foreman_openscap 1.0.4\n"
9
9
  "Report-Msgid-Bugs-To: \n"
10
10
  "PO-Revision-Date: 2016-02-09 16:41-0500\n"
11
11
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
@@ -888,7 +888,7 @@ msgstr ""
888
888
  msgid "You don't seem to have any ARF report. ARF report is a summary of a single scan occurrence on a particular host for a given Compliance Policy."
889
889
  msgstr ""
890
890
 
891
- msgid "cannot assign to %s, all assigned policies must be deployed in the same way"
891
+ msgid "cannot assign to %s, all assigned policies must be deployed in the same way, check 'deploy by' for each assigned policy"
892
892
  msgstr ""
893
893
 
894
894
  msgid "documentation"
@@ -597,7 +597,7 @@ msgid "does not have the selected SCAP content profile"
597
597
  msgstr ""
598
598
 
599
599
  #: ../app/models/foreman_openscap/policy.rb:316
600
- msgid "cannot assign to %s, all assigned policies must be deployed in the same way"
600
+ msgid "cannot assign to %s, all assigned policies must be deployed in the same way, check 'deploy by' for each assigned policy"
601
601
  msgstr ""
602
602
 
603
603
  #: ../app/services/foreman_openscap/arf_report_status_calculator.rb:30
@@ -5,7 +5,7 @@
5
5
  #
6
6
  msgid ""
7
7
  msgstr ""
8
- "Project-Id-Version: foreman_openscap 0.11.0\n"
8
+ "Project-Id-Version: foreman_openscap 1.0.4\n"
9
9
  "Report-Msgid-Bugs-To: \n"
10
10
  "PO-Revision-Date: 2016-02-09 16:41-0500\n"
11
11
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
@@ -888,7 +888,7 @@ msgstr ""
888
888
  msgid "You don't seem to have any ARF report. ARF report is a summary of a single scan occurrence on a particular host for a given Compliance Policy."
889
889
  msgstr ""
890
890
 
891
- msgid "cannot assign to %s, all assigned policies must be deployed in the same way"
891
+ msgid "cannot assign to %s, all assigned policies must be deployed in the same way, check 'deploy by' for each assigned policy"
892
892
  msgstr ""
893
893
 
894
894
  msgid "documentation"
@@ -597,7 +597,7 @@ msgid "does not have the selected SCAP content profile"
597
597
  msgstr ""
598
598
 
599
599
  #: ../app/models/foreman_openscap/policy.rb:316
600
- msgid "cannot assign to %s, all assigned policies must be deployed in the same way"
600
+ msgid "cannot assign to %s, all assigned policies must be deployed in the same way, check 'deploy by' for each assigned policy"
601
601
  msgstr ""
602
602
 
603
603
  #: ../app/services/foreman_openscap/arf_report_status_calculator.rb:30
@@ -5,7 +5,7 @@
5
5
  #
6
6
  msgid ""
7
7
  msgstr ""
8
- "Project-Id-Version: foreman_openscap 0.11.0\n"
8
+ "Project-Id-Version: foreman_openscap 1.0.4\n"
9
9
  "Report-Msgid-Bugs-To: \n"
10
10
  "PO-Revision-Date: 2016-02-09 16:41-0500\n"
11
11
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
@@ -888,7 +888,7 @@ msgstr ""
888
888
  msgid "You don't seem to have any ARF report. ARF report is a summary of a single scan occurrence on a particular host for a given Compliance Policy."
889
889
  msgstr ""
890
890
 
891
- msgid "cannot assign to %s, all assigned policies must be deployed in the same way"
891
+ msgid "cannot assign to %s, all assigned policies must be deployed in the same way, check 'deploy by' for each assigned policy"
892
892
  msgstr ""
893
893
 
894
894
  msgid "documentation"
@@ -598,7 +598,7 @@ msgid "does not have the selected SCAP content profile"
598
598
  msgstr ""
599
599
 
600
600
  #: ../app/models/foreman_openscap/policy.rb:316
601
- msgid "cannot assign to %s, all assigned policies must be deployed in the same way"
601
+ msgid "cannot assign to %s, all assigned policies must be deployed in the same way, check 'deploy by' for each assigned policy"
602
602
  msgstr ""
603
603
 
604
604
  #: ../app/services/foreman_openscap/arf_report_status_calculator.rb:30
@@ -5,7 +5,7 @@
5
5
  #
6
6
  msgid ""
7
7
  msgstr ""
8
- "Project-Id-Version: foreman_openscap 0.11.0\n"
8
+ "Project-Id-Version: foreman_openscap 1.0.4\n"
9
9
  "Report-Msgid-Bugs-To: \n"
10
10
  "PO-Revision-Date: 2016-02-09 16:41-0500\n"
11
11
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
@@ -889,7 +889,7 @@ msgstr ""
889
889
  msgid "You don't seem to have any ARF report. ARF report is a summary of a single scan occurrence on a particular host for a given Compliance Policy."
890
890
  msgstr ""
891
891
 
892
- msgid "cannot assign to %s, all assigned policies must be deployed in the same way"
892
+ msgid "cannot assign to %s, all assigned policies must be deployed in the same way, check 'deploy by' for each assigned policy"
893
893
  msgstr ""
894
894
 
895
895
  msgid "documentation"
@@ -597,7 +597,7 @@ msgid "does not have the selected SCAP content profile"
597
597
  msgstr ""
598
598
 
599
599
  #: ../app/models/foreman_openscap/policy.rb:316
600
- msgid "cannot assign to %s, all assigned policies must be deployed in the same way"
600
+ msgid "cannot assign to %s, all assigned policies must be deployed in the same way, check 'deploy by' for each assigned policy"
601
601
  msgstr ""
602
602
 
603
603
  #: ../app/services/foreman_openscap/arf_report_status_calculator.rb:30
@@ -5,7 +5,7 @@
5
5
  #
6
6
  msgid ""
7
7
  msgstr ""
8
- "Project-Id-Version: foreman_openscap 0.11.0\n"
8
+ "Project-Id-Version: foreman_openscap 1.0.4\n"
9
9
  "Report-Msgid-Bugs-To: \n"
10
10
  "PO-Revision-Date: 2016-02-09 16:41-0500\n"
11
11
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
@@ -888,7 +888,7 @@ msgstr ""
888
888
  msgid "You don't seem to have any ARF report. ARF report is a summary of a single scan occurrence on a particular host for a given Compliance Policy."
889
889
  msgstr ""
890
890
 
891
- msgid "cannot assign to %s, all assigned policies must be deployed in the same way"
891
+ msgid "cannot assign to %s, all assigned policies must be deployed in the same way, check 'deploy by' for each assigned policy"
892
892
  msgstr ""
893
893
 
894
894
  msgid "documentation"
@@ -597,7 +597,7 @@ msgid "does not have the selected SCAP content profile"
597
597
  msgstr ""
598
598
 
599
599
  #: ../app/models/foreman_openscap/policy.rb:316
600
- msgid "cannot assign to %s, all assigned policies must be deployed in the same way"
600
+ msgid "cannot assign to %s, all assigned policies must be deployed in the same way, check 'deploy by' for each assigned policy"
601
601
  msgstr ""
602
602
 
603
603
  #: ../app/services/foreman_openscap/arf_report_status_calculator.rb:30
@@ -5,7 +5,7 @@
5
5
  #
6
6
  msgid ""
7
7
  msgstr ""
8
- "Project-Id-Version: foreman_openscap 0.11.0\n"
8
+ "Project-Id-Version: foreman_openscap 1.0.4\n"
9
9
  "Report-Msgid-Bugs-To: \n"
10
10
  "PO-Revision-Date: 2016-02-09 16:41-0500\n"
11
11
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
@@ -888,7 +888,7 @@ msgstr ""
888
888
  msgid "You don't seem to have any ARF report. ARF report is a summary of a single scan occurrence on a particular host for a given Compliance Policy."
889
889
  msgstr ""
890
890
 
891
- msgid "cannot assign to %s, all assigned policies must be deployed in the same way"
891
+ msgid "cannot assign to %s, all assigned policies must be deployed in the same way, check 'deploy by' for each assigned policy"
892
892
  msgstr ""
893
893
 
894
894
  msgid "documentation"
@@ -597,7 +597,7 @@ msgid "does not have the selected SCAP content profile"
597
597
  msgstr ""
598
598
 
599
599
  #: ../app/models/foreman_openscap/policy.rb:316
600
- msgid "cannot assign to %s, all assigned policies must be deployed in the same way"
600
+ msgid "cannot assign to %s, all assigned policies must be deployed in the same way, check 'deploy by' for each assigned policy"
601
601
  msgstr ""
602
602
 
603
603
  #: ../app/services/foreman_openscap/arf_report_status_calculator.rb:30
@@ -5,7 +5,7 @@
5
5
  #
6
6
  msgid ""
7
7
  msgstr ""
8
- "Project-Id-Version: foreman_openscap 0.11.0\n"
8
+ "Project-Id-Version: foreman_openscap 1.0.4\n"
9
9
  "Report-Msgid-Bugs-To: \n"
10
10
  "PO-Revision-Date: 2016-02-09 16:41-0500\n"
11
11
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
@@ -888,7 +888,7 @@ msgstr ""
888
888
  msgid "You don't seem to have any ARF report. ARF report is a summary of a single scan occurrence on a particular host for a given Compliance Policy."
889
889
  msgstr ""
890
890
 
891
- msgid "cannot assign to %s, all assigned policies must be deployed in the same way"
891
+ msgid "cannot assign to %s, all assigned policies must be deployed in the same way, check 'deploy by' for each assigned policy"
892
892
  msgstr ""
893
893
 
894
894
  msgid "documentation"
@@ -6,7 +6,7 @@ FactoryBot.define do
6
6
  factory :openscap_proxy, :class => SmartProxy do
7
7
  sequence(:name) { |n| "openscap_proxy#{n}" }
8
8
  sequence(:url) { |n| "https://anywhere#{n}.net:8443" }
9
- features { |sp| [sp.association(:openscap_feature)] }
9
+ features { [Feature.find_by(:name => 'Openscap') || FactoryBot.create(:openscap_feature)] }
10
10
  end
11
11
 
12
12
  factory :compliance_host, :class => Host::Managed do
@@ -250,6 +250,33 @@ class PolicyTest < ActiveSupport::TestCase
250
250
  puppet_policy = FactoryBot.create(:policy, :deploy_by => 'puppet')
251
251
  puppet_policy.host_ids = [host.id]
252
252
  refute puppet_policy.save
253
- assert_equal "cannot assign to #{host.name}, all assigned policies must be deployed in the same way", puppet_policy.errors[:base].first
253
+ assert_equal "cannot assign to #{host.name}, all assigned policies must be deployed in the same way, check 'deploy by' for each assigned policy", puppet_policy.errors[:base].first
254
+ end
255
+
256
+ test "should change deployment option when there is 1 policy assigned to hostgroup" do
257
+ hg = FactoryBot.create(:hostgroup)
258
+ asset = FactoryBot.create(:asset, :assetable_type => 'Hostgroup', :assetable_id => hg.id)
259
+ policy = FactoryBot.create(:policy, :assets => [asset], :deploy_by => 'manual')
260
+ policy.stubs(:assign_policy_to_hostgroups).returns(:true)
261
+ policy.deploy_by = 'puppet'
262
+ assert policy.save
263
+ end
264
+
265
+ test "should assign host and hostgroup at the same time" do
266
+ hostgroup = FactoryBot.create(:hostgroup)
267
+ host = FactoryBot.create(:host)
268
+ policy = ForemanOpenscap::Policy.create(
269
+ :name => 'random',
270
+ :scap_content_id => @scap_content.id,
271
+ :scap_content_profile_id => @scap_profile.id,
272
+ :period => 'custom',
273
+ :cron_line => '10 * * * *',
274
+ :deploy_by => 'manual',
275
+ :hostgroup_ids => [hostgroup.id],
276
+ :host_ids => [host.id]
277
+ )
278
+ assert policy.save
279
+ refute policy.hostgroups.empty?
280
+ refute policy.hosts.empty?
254
281
  end
255
282
  end
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: 1.0.5
4
+ version: 1.0.6
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-08-08 00:00:00.000000000 Z
11
+ date: 2019-09-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: deface