Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfixes related to #630 #631

Closed
wants to merge 1 commit into from
Closed

Conversation

gardart
Copy link
Contributor

@gardart gardart commented Sep 22, 2017

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

@@ -90,7 +90,7 @@ def on_page_load(request):

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively, we can patch up pynag and turn cfg_file into a property that recreates pynag.Model.config whenever cfg_file is changed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point, I will try this out

@sonarcloud
Copy link

sonarcloud bot commented Nov 5, 2021

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@gardart
Copy link
Contributor Author

gardart commented Nov 15, 2021

fixed in #671

@gardart gardart closed this Nov 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants