Bugfixes related to #630#631
Conversation
| def update_global_variables(): | ||
| """Updates all required global variables.""" | ||
| pynag.Model.cfg_file = adagios.settings.nagios_config | ||
| pynag.Model.config.cfg_file = adagios.settings.nagios_config |
There was a problem hiding this comment.
The fact pynag has a global variable for this is not great, and even worse that there are two that go out of sync.
pynag.Model.config looks like an implementation detail of pynag.Model. Maybe best we don't muddle with that too much.
I think what we need here is some logic that whenever pynag.Model.cfg_file is being changed, then pynag.Model.config gets regenerated.
Something like this:
if pynag.Model.cfg_file != adagios.settings.nagios_config:
pynag.Model.cfg_file = adagios.settings.nagios_config
Model.ObjectDefinition.objects.reload_cache()
what do you think?
There was a problem hiding this comment.
Alternatively, we can patch up pynag and turn cfg_file into a property that recreates pynag.Model.config whenever cfg_file is changed.
There was a problem hiding this comment.
good point, I will try this out
|
Kudos, SonarCloud Quality Gate passed!
|
|
fixed in #671 |








This should fix issue #630.
Variables in that are set in Adagios settings should be used.