adagios icon indicating copy to clipboard operation
adagios copied to clipboard

Config error on changing contact_name

Open hakong opened this issue 11 years ago • 4 comments

Reproduced in 2 adagios installs with 2 contacts. Steps to reproduce: Configure > Contacts > select a contact > change Contact Name -> Save -> Reload -> Warning! Error: Could not find any contact matching 'new contact name' (config file '/etc/nagios/okconfig/contactgroups/host.com.cfg', starting on line 5)

hakong avatar Feb 17 '14 15:02 hakong

Should this be closed, or is there anything to be done about this? Would be really nice if Adagios/Pynag would update attribute values that reference something that was just renamed, like... super nice :)

If I remember correctly, me and @palli discussed this and he didn't want to do anything about this because of reasons I don't remember

hakong avatar Mar 26 '14 09:03 hakong

I'm quite sure this has to do with changing contact_name and updating all objects which refer to this contact object. Considering the following:

Pre-chage

define contact {
    use                 generic-contact
    contact_name        thedude 
}

define contactgroup {
    contactgroup_name   dudes
    alias               a group of dudes
    members             thedude    
}

Updating contact_name

define contact {
    use                 generic-contact
    contact_name        thefoo
}

define contactgroup {
    contactgroup_name   dudes
    alias               a group of dudes
    members             thedude    
}

Here the "clever" thing would be to find all references to the contact in all object types that support it and update, which is not how it is today.

So the question is in my mind, should "Configure" be this clever or not? If so for consistency all object types would have to be reviewed and work in the same manner.

@palli if you have any comments, that would be super.

tomas-edwardsson avatar Sep 02 '14 11:09 tomas-edwardsson

This is not trivial to implement because there are very many edge cases to consider.

This can be done after the underlying config changes required are implemented, there is already progress on this via pynag.Model.*.rename() methods which can facilitate for this.

However they are not all complete, i.e. host is done, but contact is not.

palli avatar Oct 03 '14 15:10 palli

Any takers on implementing rename() for all object types ?

palli avatar Oct 03 '14 15:10 palli