foreman_openscap 0.11.2 → 0.11.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
  SHA1:
3
- metadata.gz: 416e356bc2870ed24cb951ba6dcd4d82b8a5ccb3
4
- data.tar.gz: 53fc14379e71a0ff3ce51711a71974b33993c01d
3
+ metadata.gz: 3b91634164e03c056c272fef3a22a2f58f21b02e
4
+ data.tar.gz: 80c1aa22804f8f686704615a6182245c2ff31387
5
5
  SHA512:
6
- metadata.gz: 94376bb05a0efba455dbd86ee1044e065b357e43f76572ed78659056128da0c1f2a4cb5be0b241a0372d4d87cddc27665566f170a731adcc223807da8deab881
7
- data.tar.gz: 36ed74e3c3df1e3d46b47827c2af362c1a7744b5fdc7ec639713f56eace072994f64125a40bd6c141fa2261d1e999208a42a2b1750bcdc8e5b77559430f29480
6
+ metadata.gz: ad65329f24a0e80071520bc72051cf7e3f29a5f9ba28243d94eba2aeb616d190913e136903f8b80b9896334d036f538f5a98a93c2b66ac639aeae277d9666b47
7
+ data.tar.gz: d0296cbbcf9842d42728991a88ad2c30778c978b2a8b177d136be1519b1274c7592c35b39794d8f3db93ed307d7c1ba28be83a2de471b4632b97d616541bedf9
@@ -0,0 +1,23 @@
1
+ module ForemanOpenscap
2
+ module HostsAndHostgroupsControllerExtensions
3
+ extend ActiveSupport::Concern
4
+ included do
5
+ before_action :detect_proxy_without_scap, :only => :edit
6
+ end
7
+
8
+ def detect_proxy_without_scap
9
+ unless openscap_proxy_id.nil?
10
+ error = "The #{openscap_proxy_id[:name]} proxy does not have Openscap feature enabled. Either set correct OpenSCAP Proxy or unset it."
11
+ return error(error, :now => true) unless scap_enabled_proxy?(openscap_proxy_id)
12
+ end
13
+ end
14
+
15
+ def scap_enabled_proxy?(proxy_id)
16
+ SmartProxy.find_by!(id: proxy_id).feature_names.include?('Openscap')
17
+ end
18
+
19
+ def openscap_proxy_id
20
+ @host.try(:openscap_proxy) || @hostgroup.try(:openscap_proxy)
21
+ end
22
+ end
23
+ end
@@ -142,7 +142,7 @@ module ForemanOpenscap
142
142
 
143
143
  scoped_search :relation => :openscap_proxy, :on => :name, :complete_value => true, :only_explicit => true, :rename => :openscap_proxy
144
144
 
145
- scoped_search :relation => :sources, :on => :value, :complete_value => true, :rename => :xccdf_rule_name,
145
+ scoped_search :relation => :sources, :on => :value, :rename => :xccdf_rule_name,
146
146
  :only_explicit => true, :operators => ['= ']
147
147
 
148
148
  scoped_search :relation => :sources, :on => :value, :rename => :xccdf_rule_failed,
@@ -219,6 +219,8 @@ module ForemanOpenscap
219
219
  Hostgroup.send(:include, ForemanOpenscap::HostgroupExtensions)
220
220
  SmartProxy.send(:include, ForemanOpenscap::SmartProxyExtensions)
221
221
  HostsController.send(:prepend, ForemanOpenscap::HostsControllerExtensions)
222
+ HostsController.send(:include, ForemanOpenscap::HostsAndHostgroupsControllerExtensions)
223
+ HostgroupsController.send(:include, ForemanOpenscap::HostsAndHostgroupsControllerExtensions)
222
224
  Log.send(:include, ForemanOpenscap::LogExtensions)
223
225
  BookmarkControllerValidator.send(:prepend, ForemanOpenscap::BookmarkControllerValidatorExtensions)
224
226
  ProxyStatus.status_registry.add(ProxyStatus::OpenscapSpool)
@@ -1,3 +1,3 @@
1
1
  module ForemanOpenscap
2
- VERSION = "0.11.2".freeze
2
+ VERSION = "0.11.3".freeze
3
3
  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: 0.11.2
4
+ version: 0.11.3
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: 2018-11-28 00:00:00.000000000 Z
11
+ date: 2019-01-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: deface
@@ -54,6 +54,7 @@ files:
54
54
  - app/controllers/concerns/foreman/controller/parameters/tailoring_file.rb
55
55
  - app/controllers/concerns/foreman_openscap/arf_reports_controller_common_extensions.rb
56
56
  - app/controllers/concerns/foreman_openscap/body_log_extensions.rb
57
+ - app/controllers/concerns/foreman_openscap/hosts_and_hostgroups_controller_extensions.rb
57
58
  - app/controllers/concerns/foreman_openscap/hosts_controller_extensions.rb
58
59
  - app/controllers/openscap_proxies_controller.rb
59
60
  - app/controllers/policies_controller.rb