Bug #25331
Fact 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...">
Related issues
Associated revisions
History
#1
Updated by Lukas Zapletal over 4 years ago
- Priority changed from Normal to High
- Status changed from New to Need more information
Timo, thanks. Is this per fact upload or per single change of a fact? The latter looks like important issue for performance.
#2
Updated by Timo Goebel over 4 years ago
- Status changed from Need more information to New
This is per fact upload as far as I traced it.
#3
Updated by Timo Goebel over 4 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.
#4
Updated by The Foreman Bot over 4 years ago
- Assignee set to Lukas Zapletal
- Status changed from New to Ready For Testing
- Pull request https://github.com/theforeman/foreman/pull/6178 added
#5
Updated by The Foreman Bot over 4 years ago
- Pull request https://github.com/theforeman/foreman/pull/6179 added
#6
Updated by Lukas Zapletal over 4 years ago
- Triaged changed from No to Yes
#7
Updated by The Foreman Bot over 4 years ago
- Pull request https://github.com/theforeman/foreman/pull/6182 added
#8
Updated by Tomer Brisker over 4 years ago
- Fixed in Releases 1.19.1, 1.20.0 added
#9
Updated by Tomer Brisker over 4 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.
#10
Updated by Lukas Zapletal over 4 years ago
- Related to Feature #25364: Disable all auditing during high-load client-initiated API calls added
#11
Updated by The Foreman Bot over 4 years ago
- Pull request https://github.com/theforeman/foreman/pull/6198 added
#12
Updated by Timo Goebel over 4 years ago
- Status changed from Ready For Testing to Closed
Applied in changeset 6e9be602ef891a60545c105d546fa28d9d74316d.
#13
Updated by Lukas Zapletal over 4 years ago
- Bugzilla link set to 1660489
fixes #25331 - do not audit fact import