foreman_openscap 8.0.0 → 8.0.1

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
  SHA256:
3
- metadata.gz: cff46602347754ec7072e88a2033eafc6815b7898909fe6b4e0fc1bd7502749a
4
- data.tar.gz: ae676b964339af51be73f77bdf2be8da05fc7d4250a73fc9d727c5324edc7086
3
+ metadata.gz: 3bf645bb17178ebf3a7845c4955f6b100814e3fcae13f834bcaa4b94522e6d67
4
+ data.tar.gz: e5a773297d59f9d7f81c3a26085b73534424149aac6dec6a205798d98f3764e2
5
5
  SHA512:
6
- metadata.gz: 4ff495ee8c3ca45fc5e658e1def666fe971ff6fc2cb8a43f245c6ecbfb579ac0506b2215770eb2c30a95d5e74ae1128f831dfd356f91593fa0b5718940d0b14a
7
- data.tar.gz: 4696593f4916854a2e5b616d8c40dafdaa25b974b07d0067fa0188fdbf8b6541be5768e549735853c348b4f4f5be48b839a16a6183d4ce2f346ca9155ac8c58a
6
+ metadata.gz: c51175dfdebd026cf1cd0f75a77cb04b10ed2c1fbdb05c74557a5385ff390b6b6e979f5ec7433229e965fb35ab8528c7d817a368d16b3483ca8ac80f228f3341
7
+ data.tar.gz: df041f57fe9dfa77f4568579c0294f92d2c7ce16b391884cc35fce39c2c60447b0aa648ee2c9edb8bd3322dc0c6ae1bccbf9d8b6bca0296cd32a3b89f53c51b4
@@ -109,11 +109,15 @@ module ForemanOpenscap
109
109
 
110
110
  included do
111
111
  if ForemanOpenscap.with_katello?
112
- has_one :lifecycle_environment, :through => :host
112
+ has_one :content_facet, :through => :host
113
+ has_many :content_view_environment_content_facets, through: :content_facet, class_name: 'Katello::ContentViewEnvironmentContentFacet'
114
+ has_many :content_view_environments, through: :content_view_environment_content_facets
115
+ has_many :content_views, through: :content_view_environments
116
+ has_many :lifecycle_environments, through: :content_view_environments
113
117
 
114
118
  has_many :host_collections, :through => :host
115
119
 
116
- scoped_search :relation => :lifecycle_environment, :on => :name, :complete_value => true, :rename => :lifecycle_environment
120
+ scoped_search :relation => :lifecycle_environments, :on => :name, :complete_value => true, :rename => :lifecycle_environment
117
121
  scoped_search :relation => :host_collections, :on => :name, :complete_value => true, :rename => :host_collection,
118
122
  :operators => ['= ', '!= '], :ext_method => :search_by_host_collection_name
119
123
  end
@@ -5,8 +5,8 @@ module ForemanOpenscap
5
5
  include InheritedPolicies
6
6
 
7
7
  included do
8
- has_one :asset, :as => :assetable, :class_name => "::ForemanOpenscap::Asset", dependent: :destroy
9
- has_many :asset_policies, :through => :asset, :class_name => "::ForemanOpenscap::AssetPolicy"
8
+ has_many :assets, :as => :assetable, :class_name => "::ForemanOpenscap::Asset", dependent: :destroy
9
+ has_many :asset_policies, :through => :assets, :class_name => "::ForemanOpenscap::AssetPolicy"
10
10
  has_many :policies, :through => :asset_policies, :class_name => "::ForemanOpenscap::Policy"
11
11
  end
12
12
 
@@ -1,6 +1,6 @@
1
1
  module ForemanOpenscap
2
2
  class Asset < ApplicationRecord
3
- has_many :asset_policies
3
+ has_many :asset_policies, :dependent => :delete_all
4
4
  has_many :policies, :through => :asset_policies
5
5
  belongs_to :assetable, :polymorphic => true
6
6
 
@@ -0,0 +1,6 @@
1
+ class RemoveOrphanedAssetPolicies < ActiveRecord::Migration[6.0]
2
+ def up
3
+ orphaned_asset_policy_ids = ForemanOpenscap::AssetPolicy.left_outer_joins(:asset).where(asset: { id: nil }).pluck(:asset_id)
4
+ ForemanOpenscap::AssetPolicy.where(asset_id: orphaned_asset_policy_ids).delete_all
5
+ end
6
+ end
@@ -1,3 +1,3 @@
1
1
  module ForemanOpenscap
2
- VERSION = "8.0.0".freeze
2
+ VERSION = "8.0.1".freeze
3
3
  end
@@ -0,0 +1,10 @@
1
+ require 'test_plugin_helper'
2
+
3
+ class HostgroupExtensionsTest < ActiveSupport::TestCase
4
+ test "should remove all linked assets on hostgroup destroy" do
5
+ hostgroup = FactoryBot.create(:hostgroup)
6
+ FactoryBot.create_list(:asset, 3, :assetable_id => hostgroup.id, :assetable_type => 'Hostgroup')
7
+ asset_scope = ::ForemanOpenscap::Asset.where(:assetable_id => hostgroup.id, :assetable_type => 'Hostgroup')
8
+ assert_difference("asset_scope.count", -3) { hostgroup.destroy }
9
+ end
10
+ end
@@ -1,3 +1,4 @@
1
+ /* eslint-disable camelcase */
1
2
  import React, { useContext, useState, useEffect } from 'react';
2
3
  import PropTypes from 'prop-types';
3
4
  import {
@@ -160,11 +161,18 @@ const ReviewHosts = () => {
160
161
  const columns = {
161
162
  name: {
162
163
  title: __('Name'),
163
- wrapper: ({ id, name }) => <a href={foremanUrl(`hosts/${id}`)}>{name}</a>,
164
+ wrapper: ({ id, display_name: displayName }) => (
165
+ <a href={foremanUrl(`hosts/${id}`)}>{displayName}</a>
166
+ ),
164
167
  isSorted: true,
168
+ weight: 50,
169
+ isRequired: true,
165
170
  },
166
- operatingsystem_name: {
171
+ os_title: {
167
172
  title: __('OS'),
173
+ wrapper: hostDetails => hostDetails?.operatingsystem_name,
174
+ isSorted: true,
175
+ weight: 200,
168
176
  },
169
177
  };
170
178
 
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: 8.0.0
4
+ version: 8.0.1
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: 2024-04-26 00:00:00.000000000 Z
11
+ date: 2024-05-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -326,6 +326,7 @@ files:
326
326
  - db/migrate/20210409095625_add_oval_policy_reference_to_cve.rb
327
327
  - db/migrate/20210819143316_drop_unused_tables.rb
328
328
  - db/migrate/20230912122310_add_fixes_to_message.rb
329
+ - db/migrate/20240426143215_remove_orphaned_asset_policies.rb
329
330
  - db/seeds.d/75-job_templates.rb
330
331
  - db/seeds.d/openscap_feature.rb
331
332
  - db/seeds.d/openscap_policy_notification.rb
@@ -449,6 +450,7 @@ files:
449
450
  - test/unit/arf_report_test.rb
450
451
  - test/unit/compliance_status_test.rb
451
452
  - test/unit/concerns/host_extensions_test.rb
453
+ - test/unit/concerns/hostgroup_extensions_test.rb
452
454
  - test/unit/concerns/openscap_proxy_extenstions_test.rb
453
455
  - test/unit/message_cleaner_test.rb
454
456
  - test/unit/openscap_host_test.rb
@@ -635,6 +637,7 @@ test_files:
635
637
  - test/unit/arf_report_test.rb
636
638
  - test/unit/compliance_status_test.rb
637
639
  - test/unit/concerns/host_extensions_test.rb
640
+ - test/unit/concerns/hostgroup_extensions_test.rb
638
641
  - test/unit/concerns/openscap_proxy_extenstions_test.rb
639
642
  - test/unit/message_cleaner_test.rb
640
643
  - test/unit/openscap_host_test.rb