From 5252504b80415bc452479eec045c72b489a3ba5a Mon Sep 17 00:00:00 2001 From: alazik Date: Wed, 14 Aug 2024 14:07:33 +0000 Subject: [PATCH] Fixes #37733 - Add audits of ansible role changes on hosts This records audits when ansible role is added to a host or removed from a host. --- app/models/host_ansible_role.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/models/host_ansible_role.rb b/app/models/host_ansible_role.rb index f902de79e..f784477c3 100644 --- a/app/models/host_ansible_role.rb +++ b/app/models/host_ansible_role.rb @@ -2,10 +2,16 @@ # Join model that hosts the connection between hosts and ansible_roles class HostAnsibleRole < ApplicationRecord + audited associated_with: :host + belongs_to_host belongs_to :ansible_role acts_as_list scope: :host validates :ansible_role_id, :presence => true, :uniqueness => { :scope => :host_id } + + def to_label + ansible_role.name + end end