Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Description of problem:
Add same policy twice to any host using bulk action fails with sql error, here is traceback
~~~
2020-07-30T10:02:15 [I|app|7234a419] Started POST "/compliance/policies/update_multiple_hosts?host_ids%5B%5D=4&host_ids%5B%5D=1" for 127.0.0.1 at 2020-07-30 10:02:15 -0400
2020-07-30T10:02:15 [I|app|7234a419] Processing by PoliciesController#update_multiple_hosts as HTML
2020-07-30T10:02:15 [I|app|7234a419] Parameters: {"utf8"=>"✓", "authenticity_token"=>"AsoqhvaapVoYTBwMLIox+2ICKHwvMRV3jjSP0T103oDAJKw954AF0pszr5CazvCF26e9ttVLQUIplONSx6IkGA==", "policy"=>{"id"=>"1"}, "host_ids"=>["4", "1"]}
2020-07-30T10:02:17 [D|tax|7234a419] Current location set to Default Location
2020-07-30T10:02:17 [D|tax|7234a419] Current organization set to Default Organization
2020-07-30T10:02:17 [W|app|7234a419] Action failed
2020-07-30T10:02:17 [D|app|7234a419] Backtrace for 'Action failed' error (ActiveRecord::RecordNotUnique): PG::UniqueViolation: ERROR: duplicate key value violates unique constraint "index_scaptimony_asset_policies_on_asset_id_and_policy_id"
DETAIL: Key (asset_id, policy_id)=(8, 1) already exists.
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.1/lib/active_record/connection_adapters/postgresql_adapter.rb:675:in `async_exec_params'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.1/lib/active_record/connection_adapters/postgresql_adapter.rb:675:in `block (2 levels) in exec_no_cache'
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.1/lib/active_support/dependencies/interlock.rb:48:in `block in permit_concurrent_loads'
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.1/lib/active_support/concurrency/share_lock.rb:187:in `yield_shares'
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.1/lib/active_support/dependencies/interlock.rb:47:in `permit_concurrent_loads'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.1/lib/active_record/connection_adapters/postgresql_adapter.rb:674:in `block in exec_no_cache'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.1/lib/active_record/connection_adapters/abstract_adapter.rb:722:in `block (2 levels) in log'
~~~
Version-Release number of selected component (if applicable): Satellite 6.8
How reproducible: Always
Steps to Reproduce:
1. Go To "All Hosts"
2. select few Hosts -> Click on "Select Action" on top right and click on "Assign Compliance Policy"
3. Select First Policy and click on submit
4. Repeat same step i.e select same hosts and try to assign same policy
Actual results: It should not fails with sql error.
Expected results: It should ignore the host if same epolicy is already assign
Additional info:
Verified
Verified with:
- Satellite 6.8.0 snap 12
Test steps:
1. Create a compliance policy
2. Go to Hosts > All Hosts page
3. Select few hosts and assign compliance policy.
4. Select same hosts and same assign compliance policy again.
Observations:
- No sql errors.
- compliance policy applied successfully.
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory (Important: Satellite 6.8 release), and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.
https://access.redhat.com/errata/RHSA-2020:4366
Description of problem: Add same policy twice to any host using bulk action fails with sql error, here is traceback ~~~ 2020-07-30T10:02:15 [I|app|7234a419] Started POST "/compliance/policies/update_multiple_hosts?host_ids%5B%5D=4&host_ids%5B%5D=1" for 127.0.0.1 at 2020-07-30 10:02:15 -0400 2020-07-30T10:02:15 [I|app|7234a419] Processing by PoliciesController#update_multiple_hosts as HTML 2020-07-30T10:02:15 [I|app|7234a419] Parameters: {"utf8"=>"✓", "authenticity_token"=>"AsoqhvaapVoYTBwMLIox+2ICKHwvMRV3jjSP0T103oDAJKw954AF0pszr5CazvCF26e9ttVLQUIplONSx6IkGA==", "policy"=>{"id"=>"1"}, "host_ids"=>["4", "1"]} 2020-07-30T10:02:17 [D|tax|7234a419] Current location set to Default Location 2020-07-30T10:02:17 [D|tax|7234a419] Current organization set to Default Organization 2020-07-30T10:02:17 [W|app|7234a419] Action failed 2020-07-30T10:02:17 [D|app|7234a419] Backtrace for 'Action failed' error (ActiveRecord::RecordNotUnique): PG::UniqueViolation: ERROR: duplicate key value violates unique constraint "index_scaptimony_asset_policies_on_asset_id_and_policy_id" DETAIL: Key (asset_id, policy_id)=(8, 1) already exists. /opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.1/lib/active_record/connection_adapters/postgresql_adapter.rb:675:in `async_exec_params' /opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.1/lib/active_record/connection_adapters/postgresql_adapter.rb:675:in `block (2 levels) in exec_no_cache' /opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.1/lib/active_support/dependencies/interlock.rb:48:in `block in permit_concurrent_loads' /opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.1/lib/active_support/concurrency/share_lock.rb:187:in `yield_shares' /opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.1/lib/active_support/dependencies/interlock.rb:47:in `permit_concurrent_loads' /opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.1/lib/active_record/connection_adapters/postgresql_adapter.rb:674:in `block in exec_no_cache' /opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.1/lib/active_record/connection_adapters/abstract_adapter.rb:722:in `block (2 levels) in log' ~~~ Version-Release number of selected component (if applicable): Satellite 6.8 How reproducible: Always Steps to Reproduce: 1. Go To "All Hosts" 2. select few Hosts -> Click on "Select Action" on top right and click on "Assign Compliance Policy" 3. Select First Policy and click on submit 4. Repeat same step i.e select same hosts and try to assign same policy Actual results: It should not fails with sql error. Expected results: It should ignore the host if same epolicy is already assign Additional info: