foreman_openscap 0.3.1 → 0.3.2

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: fdfe8a8e22b3b2215996af3ce7f9c120a2fcd34b
4
- data.tar.gz: 68fa725ae1e957719df783588a1f5037a4608750
3
+ metadata.gz: e0b2635b4110d762e082b3b0deea79656f308712
4
+ data.tar.gz: 6488a4c319870ff0347bfedf2d1ad27659dab5a9
5
5
  SHA512:
6
- metadata.gz: 87be9f111dc4b9bee30fe09f113839d159da3c5eeb7590892bc4746ad4d4aa7d3fb2c62029959224da41265f3a45e1492871288d2b448b275c2ce3b81f5ac84d
7
- data.tar.gz: f2c48e5d2a5d1902c141b964428f5f255f65239796249bb200e62d77bcb40d6cae45c0b9b8773ed73996747534a99e6e6752afda7b992f2a6673aaa30b6317ca
6
+ metadata.gz: 257acb224a1ffaeed43d9cba4216038920357ea2fed6c493d52b8d0efa0b639f58021cd159681d4eef6970de6067bfdbc358cd5cebf8d60af5b28c6627269797
7
+ data.tar.gz: 351b39d8450200c2884d63a419741a93900600b229c7fa492db305b74c9bfd7b74701ed206705472842490d17b0d1932925e34a1c718e0dd6403a99a47042e0b
@@ -8,7 +8,9 @@ function scap_content_selected(element){
8
8
  url: url,
9
9
  complete: function() { $(element).indicator_hide();},
10
10
  success: function(request) {
11
+ $('#file-location').remove();
11
12
  $('#scap_content_profile_select').html(request);
13
+ $('#scap_content .alert-info').append($('#file-location'));
12
14
  }
13
15
  })
14
16
  }
@@ -33,8 +33,8 @@ module ForemanOpenscap
33
33
 
34
34
  def assign_locations_organizations
35
35
  if host
36
- self.location_ids = [host.location] if SETTINGS[:locations_enabled]
37
- self.organization_ids = [host.organization] if SETTINGS[:organizations_enabled]
36
+ self.location_ids = [host.location_id] if SETTINGS[:locations_enabled]
37
+ self.organization_ids = [host.organization_id] if SETTINGS[:organizations_enabled]
38
38
  end
39
39
  end
40
40
 
@@ -22,6 +22,7 @@ module ForemanOpenscap
22
22
  SCAP_PUPPET_CLASS = 'foreman_scap_client'
23
23
  POLICIES_CLASS_PARAMETER = 'policies'
24
24
  SERVER_CLASS_PARAMETER = 'server'
25
+ PORT_CLASS_PARAMETER = 'port'
25
26
 
26
27
  validates :name, :presence => true, :uniqueness => true, :format => { without: /\s/ }
27
28
  validate :ensure_needed_puppetclasses
@@ -50,9 +51,11 @@ module ForemanOpenscap
50
51
  end
51
52
 
52
53
  def hostgroup_ids=(ids)
54
+ hostgroup_assets = []
53
55
  ids.reject(&:empty?).map do |id|
54
- self.assets << assets.where(:assetable_type => 'Hostgroup', :assetable_id => id).first_or_create!
56
+ hostgroup_assets << assets.where(:assetable_type => 'Hostgroup', :assetable_id => id).first_or_create!
55
57
  end
58
+ self.assets = hostgroup_assets
56
59
  end
57
60
 
58
61
  def hostgroups
@@ -221,11 +224,18 @@ module ForemanOpenscap
221
224
  end
222
225
 
223
226
  def populate_overrides(puppetclass, hostgroup)
224
- puppetclass.class_params.where(:override => true, :key => SERVER_CLASS_PARAMETER).each do |override|
227
+ puppetclass.class_params.where(:override => true).each do |override|
225
228
  if hostgroup.puppet_proxy && (url = hostgroup.puppet_proxy.url).present?
226
- lookup_value = LookupValue.where(:match => "hostgroup=#{hostgroup.to_label}", :lookup_key_id => override.id).first_or_initialize
227
- puppet_proxy_fqdn = URI.parse(url).host
228
- lookup_value.update_attribute(:value, puppet_proxy_fqdn)
229
+ case override.key
230
+ when SERVER_CLASS_PARAMETER
231
+ lookup_value = LookupValue.where(:match => "hostgroup=#{hostgroup.to_label}", :lookup_key_id => override.id).first_or_initialize
232
+ puppet_proxy_fqdn = URI.parse(url).host
233
+ lookup_value.update_attribute(:value, puppet_proxy_fqdn)
234
+ when PORT_CLASS_PARAMETER
235
+ lookup_value = LookupValue.where(:match => "hostgroup=#{hostgroup.to_label}", :lookup_key_id => override.id).first_or_initialize
236
+ puppet_proxy_port = URI.parse(url).port
237
+ lookup_value.update_attribute(:value, puppet_proxy_port)
238
+ end
229
239
  end
230
240
  end
231
241
  end
@@ -24,8 +24,14 @@
24
24
  <div class="tab-pane" id="scap_content">
25
25
  <%= scap_content_selector(f) %>
26
26
  <span id="scap_content_profile_select">
27
- <%= scap_content_profile_selector(f) %>
28
- </span>
27
+ <%= scap_content_profile_selector(f) %>
28
+ </span>
29
+ <div class="alert alert-info">
30
+ <%= icon_text("info-sign", _('Notice: Ensure the selected SCAP content exists on your hosts.')) %>
31
+ <div id="file-location">
32
+ <b><%= _('SCAP content file should be /var/lib/openscap/content/%s.xml on your clients.') % @policy.scap_content.digest %></b>
33
+ </div>
34
+ </div>
29
35
  </div>
30
36
  <div class="tab-pane" id="scap_schedule">
31
37
  <%= select_f(f, :period, %w[Weekly Monthly Custom], :downcase, :to_s,
@@ -2,3 +2,6 @@
2
2
  <%= scap_content_profile_selector(f) %>
3
3
  <% end %>
4
4
 
5
+ <div id="file-location">
6
+ <b><%= _('SCAP content file should be /var/lib/openscap/content/%s.xml on your clients.') % @scap_content.digest %></b>
7
+ </div>
@@ -5,6 +5,8 @@
5
5
  <span id="scap_content_profile_select">
6
6
  <%= scap_content_profile_selector(f) %>
7
7
  </span>
8
- <p class="alert alert-info"><%= _('Notice: Ensure the selected SCAP content exists on your hosts.') %></p>
8
+ <div class="alert alert-info">
9
+ <%= icon_text("info-sign", _('Notice: Ensure the selected SCAP content exists on your hosts.')) %>
10
+ </div>
9
11
  </div>
10
12
 
@@ -1,3 +1,3 @@
1
1
  module ForemanOpenscap
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.2"
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.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - "Šimon Lukašík"
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-12 00:00:00.000000000 Z
11
+ date: 2015-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: deface
@@ -143,3 +143,4 @@ test_files:
143
143
  - test/unit/foreman_openscap_test.rb
144
144
  - test/test_plugin_helper.rb
145
145
  - test/factories/foreman_openscap_factories.rb
146
+ has_rdoc: