Bug #25331
closedFact imports erranously cause audits to be created
Description
For very fact import an audit record is written although nothing changes.
#<Audited::Audit id: 8238963, auditable_id: 30056, auditable_type: "Nic::Managed", user_id: 4, user_type: nil, username: "API Admin", action: "update", audited_changes: {"attrs"=>[{"mtu"=>"1500", "netmask"=>"255.255.224.0", "netmask6"=>"ffff:ffff:ffff:ffff::", "network"=>"172.22.0.0", "network6"=>"fe80::"}, {"mtu"=>1500, "netmask"=>"255.255.224.0", "netmask6"=>"ffff:ffff:ffff:ffff::", "network"=>"172.22.0.0", "network6"=>"fe80::"}]}, version: 7, comment: nil, associated_id: 23973, associated_type: "Host::Base", request_uuid: "7263349c-f216-415a-8721-f7464856031e", created_at: "2018-10-29 10:08:25", remote_address: "1.2.3.4", auditable_name: "xxxxx...", associated_name: "xxxx...">
Files
Updated by Lukas Zapletal about 6 years ago
- Status changed from New to Need more information
- Priority changed from Normal to High
Timo, thanks. Is this per fact upload or per single change of a fact? The latter looks like important issue for performance.
Updated by Timo Goebel about 6 years ago
- Status changed from Need more information to New
This is per fact upload as far as I traced it.
Updated by Timo Goebel about 6 years ago
I have slowed down the effect by sorting the hash in /usr/share/foreman/app/models/host/base.rb
-iface.attrs = attributes
+iface.attrs = attributes.sort.to_h
The diff in the example above is that mtu seems to toggle between integer and string.
Tomer proposed that we don't write any audits at all during fact import. While that might be a good approach we should also not update the interface unless something really changed.
Updated by The Foreman Bot about 6 years ago
- Status changed from New to Ready For Testing
- Assignee set to Lukas Zapletal
- Pull request https://github.com/theforeman/foreman/pull/6178 added
Updated by The Foreman Bot about 6 years ago
- Pull request https://github.com/theforeman/foreman/pull/6179 added
Updated by The Foreman Bot about 6 years ago
- Pull request https://github.com/theforeman/foreman/pull/6182 added
Updated by Tomer Brisker about 6 years ago
- Fixed in Releases 1.19.1, 1.20.0 added
Updated by Tomer Brisker about 6 years ago
- Subject changed from for every fact import an audit record is written to Fact imports erranously cause audits to be created
clarifying title for the release note.
Updated by Lukas Zapletal about 6 years ago
- Related to Feature #25364: Disable all auditing during high-load client-initiated API calls added
Updated by The Foreman Bot about 6 years ago
- Pull request https://github.com/theforeman/foreman/pull/6198 added
Updated by Timo Goebel about 6 years ago
- Status changed from Ready For Testing to Closed
Applied in changeset 6e9be602ef891a60545c105d546fa28d9d74316d.