Project

General

Profile

Bug #35132

Audit page shows "auditable id / Host2" for "Host1" but Host2 does not exist or deleted from the all hosts

Added by Shimon Shtein 9 months ago. Updated 6 months ago.

Status:
Closed
Priority:
High
Assignee:
Category:
Audit Log
Target version:
-
Difficulty:
Triaged:
No
Bugzilla link:
Fixed in Releases:
Found in Releases:
Red Hat JIRA:

Description

Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1845489

Description of problem: Go to "Monitor"->"Audits", and search for "host = host1.example.com". Few audit entry list of the host contains the auditable id / host2.example.com.

Here host2.example.com does not exist and according to the customer it is deleted.

This result creates confusion
1. While searching for host1 it gives references for host2
2. Even if above records are correct. There is should tooltip to explain why the host2 reference is coming up and what happened to host2.

Screenshot attached.

Version-Release number of selected component (if applicable): Satellite 6.6

How reproducible: Not Reproducible

Additional info:
  1. hammer audit list --search="host=host1.example.com"
    -------|---------------------|----------------|-------------------|--------|------------|---------------
    ID | AT | IP | USER | ACTION | AUDIT TYPE | AUDIT RECORD
    -------|---------------------|----------------|-------------------|--------|------------|---------------
    208294 | 2020/05/14 12:52:30 | ip1 | foreman_admin | update | Host::Base | 1580 <-- The UI shows this records
    208071 | 2020/05/13 06:02:16 | | foreman_admin | update | Host::Base | 1580 as 1580 / host2.example.com
    207678 | 2020/05/12 19:41:58 | | foreman_admin | update | Host::Base | 1580
    207374 | 2020/05/11 14:03:29 | | foreman_admin | update | Host::Base | 1580
    207370 | 2020/05/11 13:57:21 | | foreman_admin | update | Host::Base | 1580
    207359 | 2020/05/11 13:56:24 | ip2 | foreman_admin | update | Host::Base | 1580
    207358 | 2020/05/11 13:56:20 | ip3 | user | create | Host::Base | 1580
    198460 | 2020/02/14 10:23:12 | IP | foreman_api_admin | update | Host::Base | host1.example.com
    198451 | 2020/02/14 10:19:17 | ip | foreman_admin | update | Host::Base | host1.example.com
    198447 | 2020/02/14 10:19:04 | ip | reguser | create | Host::Base | host1.example.com
    188766 | 2019/11/05 16:29:57 | | foreman_admin | update | Host::Base | 1580
    -------|---------------------|----------------|-------------------|--------|------------|---------------

    cat << FIX | foreman-rake console

a = Audit.find_by_id 208294
a.associated
a = Audit.find_by_id 207370
a.associated
a = Audit.find_by_id 208071
a.associated
a = Audit.find_by_id 207359
a.associated
a = Audit.find_by_id 207358
a.associated
a = Audit.find_by_id 188766
a.associated
FIX

Loading production environment (Rails 5.2.1)
Switch to inspect mode.
a = Audit.find_by_id 208294
#<Audited::Audit id: 208294, auditable_id: 1580, auditable_type: "Host::Base", user_id: 1, user_type: nil, username: "Anonymous Admin", action: "update", audited_changes: {"uuid"=>["33a48bca-1f4d-400f-899f-da7a9a186854", nil]}, version: 11, comment: nil, associated_id: 1652, associated_type: "Host::Base", request_uuid: "fbe777e3-9c3c-4e82-ba4f-880eca169328", created_at: "2020-05-14 18:52:30", remote_address: "ip", auditable_name: "1580", associated_name: "host2.example.com">
a.associated
nil
a = Audit.find_by_id 207370
#<Audited::Audit id: 207370, auditable_id: 1580, auditable_type: "Host::Base", user_id: 1, user_type: nil, username: "Anonymous Admin", action: "update", audited_changes: {"installable_security_errata_count"=>[0, 36], "installable_enhancement_errata_count"=>[0, 8], "installable_bugfix_errata_count"=>[0, 106], "applicable_rpm_count"=>[0, 432], "upgradable_rpm_count"=>[0, 432]}, version: 7, comment: nil, associated_id: 1652, associated_type: "Host::Base", request_uuid: "ce1dc204-7c8a-45ee-9659-442c5a45fe14", created_at: "2020-05-11 19:57:21", remote_address: nil, auditable_name: "1580", associated_name: "host2.example.com">
a.associated
nil
a = Audit.find_by_id 208071
#<Audited::Audit id: 208071, auditable_id: 1580, auditable_type: "Host::Base", user_id: 1, user_type: nil, username: "Anonymous Admin", action: "update", audited_changes: {"installable_security_errata_count"=>[1, 0], "installable_bugfix_errata_count"=>[12, 0], "applicable_rpm_count"=>[58, 0], "upgradable_rpm_count"=>[58, 0]}, version: 10, comment: nil, associated_id: 1652, associated_type: "Host::Base", request_uuid: "1d565380-11c7-4de0-a3d1-1712a5358a06", created_at: "2020-05-13 12:02:16", remote_address: nil, auditable_name: "1580", associated_name: "host2.example.com">
a.associated
nil
a = Audit.find_by_id 207359
#<Audited::Audit id: 207359, auditable_id: 1580, auditable_type: "Host::Base", user_id: 1, user_type: nil, username: "Anonymous Admin", action: "update", audited_changes: {"uuid"=>[nil, "33a48bca-1f4d-400f-899f-da7a9a186854"]}, version: 6, comment: nil, associated_id: 1652, associated_type: "Host::Base", request_uuid: "1753c0d4-6121-4893-a138-c9802b4993f1", created_at: "2020-05-11 19:56:24", remote_address: "ip", auditable_name: "1580", associated_name: "host2.example.com">
a.associated
nil
a = Audit.find_by_id 207358
#<Audited::Audit id: 207358, auditable_id: 1580, auditable_type: "Host::Base", user_id: 26, user_type: nil, username: "user", action: "create", audited_changes: {"host_id"=>1652, "uuid"=>nil, "content_view_id"=>2, "lifecycle_environment_id"=>2, "kickstart_repository_id"=>nil, "content_source_id"=>1, "installable_security_errata_count"=>0, "installable_enhancement_errata_count"=>0, "installable_bugfix_errata_count"=>0, "applicable_rpm_count"=>0, "upgradable_rpm_count"=>0, "applicable_module_stream_count"=>0, "upgradable_module_stream_count"=>0}, version: 5, comment: nil, associated_id: 1652, associated_type: "Host::Base", request_uuid: "xxx", created_at: "2020-05-11 19:56:20", remote_address: "ip", auditable_name: "1580", associated_name: "host2.example.com">
a.associated
nil
a = Audit.find_by_id 188766
#<Audited::Audit id: 188766, auditable_id: 1580, auditable_type: "Host::Base", user_id: 1, user_type: nil, username: "Anonymous Admin", action: "update", audited_changes: {"purpose_role"=>[nil, ""], "purpose_usage"=>[nil, ""]}, version: 1, comment: nil, associated_id: 1502, associated_type: "Host::Base", request_uuid: "93db7d35-2dcc-49d9-ae64-dfe876a99de6", created_at: "2019-11-05 23:29:57", remote_address: nil, auditable_name: "1580", associated_name: "host3.example.com">
a.associated
#<Host::Managed id: 1502, name: "host3.example.com", last_compile: "2020-05-24 23:03:29", last_report: "2020-05-27 17:54:47", updated_at: "2020-05-27 17:54:52", created_at: "2019-09-23 19:17:22", root_pass: nil, architecture_id: 1, operatingsystem_id: 1, environment_id: 2, ptable_id: nil, medium_id: nil, build: false, comment: nil, disk: nil, installed_at: nil, model_id: 1, hostgroup_id: 9, owner_id: 34, owner_type: "User", enabled: true, puppet_ca_proxy_id: 1, managed: true, use_image: nil, image_file: nil, uuid: nil, compute_resource_id: nil, puppet_proxy_id: 1, certname: "xxx", image_id: nil, organization_id: 3, location_id: 4, type: "Host::Managed", otp: nil, realm_id: nil, compute_profile_id: nil, provision_method: nil, grub_pass: "", global_status: 0, lookup_value_matcher: "fqdn=host3.example.com", discovery_rule_id: nil, openscap_proxy_id: nil, pxe_loader: nil, initiated_at: nil, build_errors: nil>

Associated revisions

Revision f28bc34c (diff)
Added by Shimon Shtein 8 months ago

Fixes #35132 - Make audits host detection regex more strict

History

#1 Updated by The Foreman Bot 9 months ago

  • Assignee set to Shimon Shtein
  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/9286 added

#2 Updated by The Foreman Bot 8 months ago

  • Fixed in Releases 3.4.0 added

#3 Updated by Shimon Shtein 8 months ago

  • Status changed from Ready For Testing to Closed

#4 Updated by The Foreman Bot 6 months ago

  • Fixed in Releases 3.3.1 added

Also available in: Atom PDF