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

Render Icinga config helpers with safe globals access #1654

Merged
merged 1 commit into from
Sep 27, 2018

Conversation

dnsmichi
Copy link
Contributor

globals[key] works, although it wasn't documented how it
behaves in the case when this field doesn't exist.

Previously this has been a dictionary which silently returns
null if the key doesn't exist. With v2.10, globals turned
into a namespace which throws an error if not existing (which is
the correct behaviour).

In order to avoid configuration errors with 2.10, this is changed
into contains() which has been sitting in dictionaries since 2014.
So this patch ensures compatibility with older versions as well.

globals[key] works, although it wasn't documented how it
behaves in the case when this field doesn't exist.

Previously this has been a dictionary which silently returns
null if the key doesn't exist. With v2.10, globals turned
into a namespace which throws an error if not existing (which is
the correct behaviour).

In order to avoid configuration errors with 2.10, this is changed
into `contains()` which has been sitting in dictionaries since 2014.
So this patch ensures compatibility with older versions as well.
@dnsmichi dnsmichi requested a review from lazyfrosch September 27, 2018 07:18
@Thomas-Gelf
Copy link
Contributor

Looks good to me, thanks for the pull request and the related details. 2014 means that Agents running 2.6 are safe I guess. @lazyfrosch: if you have the chance to give 2.6 a quick test this would be cool, otherwise I'd blindly trust @dnsmichi and merge to master.

@dnsmichi
Copy link
Contributor Author

Anything since 2.4 should work here, contains() as dictionary method was available when globals was introduced the first time (December 2014, or so).

@Thomas-Gelf Thomas-Gelf merged commit bb81de8 into master Sep 27, 2018
@Thomas-Gelf Thomas-Gelf deleted the bugfix/director-basics-globals branch September 27, 2018 08:41
@Thomas-Gelf
Copy link
Contributor

Thanks again!

@dnsmichi
Copy link
Contributor Author

Since this problem comes out more often, I've discussed it again with @lippserd ... the patch for the Director is safe, still we need to take care about existing deployments where this would stop with 2.10. The patch for the Director is fine and safe, but we don't need a release for it now. I'll like a PR for 2.10 which solves the access problem, and allows for smooth upgrading.

dnsmichi pushed a commit to Icinga/icinga2 that referenced this pull request Oct 11, 2018
Examples:

```
globals["abc"]
globals.def
```

The patch for the Icinga Director unfortunately only solves the
master, and as discussed with @lippserd we need to ensure that
satellites and clients with 2.10 can be restarted without any errors
from deployed configuration.

refs #6509
refs Icinga/icingaweb2-module-director#1654
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