Skip to content

Commit

Permalink
Fix to show vm/image related info in audit log when deleting vm/image
Browse files Browse the repository at this point in the history
  • Loading branch information
hsong-rh committed May 31, 2018
1 parent a09f2d1 commit 083ce04
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/models/audit_event.rb
Expand Up @@ -12,9 +12,11 @@ def self.generate(attrs)
}.merge(attrs)

event = AuditEvent.create(attrs)
ipaddress = MiqServer.my_server.ipaddress
hostname = MiqServer.my_server.hostname

# Cut an Audit log message
$audit_log.send(attrs[:status], "MIQ(#{attrs[:source]}) userid: [#{attrs[:userid]}] - #{attrs[:message]}")
$audit_log.send(attrs[:status], "MIQ(#{attrs[:source]}) userid: [#{attrs[:userid]}] userip: [#{ipaddress}] hostname: [#{hostname}] - #{attrs[:message]}")
event
end

Expand Down
2 changes: 2 additions & 0 deletions app/models/mixins/process_tasks_mixin.rb
Expand Up @@ -54,6 +54,8 @@ def invoke_tasks_local(options)
invoke_task_local(task, instance, options, args)

msg = "#{instance.name}: '#{options[:task]}' initiated"
msg = "[Name: #{instance.name},Id: #{instance.id}, Ems_ref: #{instance.ems_ref}] Record destroyed" if options[:task] == 'destroy'

task_audit_event(:success, options, :target_id => instance.id, :message => msg)
task.update_status("Queued", "Ok", "Task has been queued") if task
end
Expand Down

0 comments on commit 083ce04

Please sign in to comment.