foreman_openscap 0.7.11 → 0.7.12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a6c747f39e8243bed36344936a0bbe366c810561
4
- data.tar.gz: be51caca5c71a20b037e69206aa36adbc0757dc9
3
+ metadata.gz: cc3b45bd13e06f6643cd988849bce306296faf54
4
+ data.tar.gz: fc17630400c564c7d3144bf49e57786400a1e4e4
5
5
  SHA512:
6
- metadata.gz: 9a56f11aeb006ac17936ed6936e087df613d72d7919dbb5184ec0f49560ccb9176fd47f16da34aa88dea27fd68a0adf8ea8fdba78a80e71caeb59483cfa84a8b
7
- data.tar.gz: 59f5429305e04a0b61b060ca9e2025249a754efbd69aa182f00079121f595bc344d3eef6bc7891fadf1b1918231dbe5fd5bec47f0c4a3e2e747da0f973172a10
6
+ metadata.gz: 1f7f43276f7c01c32f019dc1621135e5d499daa534af1fe3818763cb1a673bcd5613a7a887e734a5880e5c4c9f3eeb0e9c08e57f31588c49163a3266a5658b88
7
+ data.tar.gz: 79a5d3c58b7b2d604f3ffb499a68776247d052d16897fd50f771193b72623111888231d34b882960ab23d698120704cabd1b3f1444858c0f67adf76036f3f094
@@ -51,8 +51,9 @@ module ::ProxyAPI
51
51
  begin
52
52
  parse(delete("arf/#{report.id}/#{cname}/#{report.reported_at.to_i}/#{report.policy_arf_report.digest}"))
53
53
  rescue => e
54
- logger.error "Failed to destroy arf report with id #{report.id} on Smart Proxy"
55
- logger.debug e.backtrace.join("\n\t")
54
+ msg = "Failed to destroy arf report with id #{report.id} on Smart Proxy, cause: #{e.message}"
55
+ logger.error msg
56
+ report.errors.add(:base, msg)
56
57
  false
57
58
  end
58
59
  end
@@ -177,18 +177,22 @@ module ForemanOpenscap
177
177
  end
178
178
 
179
179
  def destroy_from_proxy
180
- if host
181
- begin
182
- openscap_proxy_api.destroy_report(self, ForemanOpenscap::Helper::find_name_or_uuid_by_host(host))
183
- rescue Foreman::Exception => e
184
- logger.error "Failed to delete report with id #{id} from proxy, cause: #{e.message}"
185
- logger.debug e.backtrace.join("\n\t")
186
- end
180
+ if !host
181
+ destroy_from_proxy_warning "host"
182
+ elsif !policy
183
+ destroy_from_proxy_warning "policy"
184
+ elsif !openscap_proxy
185
+ destroy_from_proxy_warning "OpenSCAP proxy"
187
186
  else
188
- logger.error "Failed to delete report with id #{id} from proxy, no host associated with report"
187
+ openscap_proxy_api.destroy_report(self, ForemanOpenscap::Helper::find_name_or_uuid_by_host(host))
189
188
  end
190
189
  end
191
190
 
191
+ def destroy_from_proxy_warning(associated)
192
+ logger.warn "Skipping deletion of report with id #{id} from proxy, no #{associated} associated with report"
193
+ true
194
+ end
195
+
192
196
  def self.newline_to_space(string)
193
197
  string.gsub(/ *\n+/, " ")
194
198
  end
@@ -1,8 +1,10 @@
1
1
  class RemoveArfReportsWithoutPolicy < ActiveRecord::Migration
2
2
  def up
3
- ids_to_keep = ForemanOpenscap::ArfReport.unscoped.all.joins(:policy_arf_report).pluck(:id)
4
- ForemanOpenscap::ArfReport.unscoped.where.not(:id => ids_to_keep).find_in_batches do |batch|
5
- batch.map(&:destroy!)
3
+ User.as_anonymous_admin do
4
+ ids_to_keep = ForemanOpenscap::ArfReport.unscoped.all.joins(:policy_arf_report).pluck(:id)
5
+ ForemanOpenscap::ArfReport.unscoped.where.not(:id => ids_to_keep).find_in_batches do |batch|
6
+ batch.map(&:destroy!)
7
+ end
6
8
  end
7
9
  end
8
10
  end
@@ -1,3 +1,3 @@
1
1
  module ForemanOpenscap
2
- VERSION = "0.7.11".freeze
2
+ VERSION = "0.7.12".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.7.11
4
+ version: 0.7.12
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: 2017-11-23 00:00:00.000000000 Z
11
+ date: 2018-03-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: deface