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

Skip versioncmp when pe_server_version is missing #23

Merged
merged 2 commits into from
Sep 18, 2019

Conversation

Sharpie
Copy link
Member

@Sharpie Sharpie commented Jul 19, 2019

This commit updates the version checking logic in
puppet_metrics_collector::puppetserver to skip versioncmp() when the
pe_server_version fact is missing. This change allows the class to
be applied to FOSS nodes without causing a compilation failure.

@Sharpie Sharpie requested a review from npwalker July 19, 2019 00:56
@@ -18,7 +18,7 @@
override_metrics_command => $override_metrics_command,
}

if versioncmp($facts['pe_server_version'], '2018.1.0') < 0 {
if ($facts['pe_server_version'] =~ NotUndef) and (versioncmp($facts['pe_server_version'], '2018.1.0') < 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want to add a parameter that would allow users to enable these if they are on a new enough version of puppetserver?

Copy link
Member Author

Choose a reason for hiding this comment

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

This will be enabled for open source Puppet Server 5.x or newer. I promoted these metrics to the /status API in that version. The pe_server_version check here is testing for older versions of PE and uses the /metrics API to retrieve the data there.

Most Puppet Server metrics were "PE only" prior to 5.x, so there isn't much to gain by backporting this specific check, but we should think about how to do version-specific metrics in a way that supports both PE and Open Source.

@Sharpie Sharpie requested a review from npwalker August 19, 2019 19:59
jarretlavallee
jarretlavallee previously approved these changes Aug 20, 2019
Copy link
Contributor

@jarretlavallee jarretlavallee left a comment

Choose a reason for hiding this comment

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

LGTM

This commit updates the version checking logic in
puppet_metrics_collector::puppetserver to skip `versioncmp()` when the
`pe_server_version` fact is missing. This change allows the class to
be applied to FOSS nodes without causing a compilation failure.
@jarretlavallee
Copy link
Contributor

@npwalker Are you alright with merging this one?

Copy link
Contributor

@npwalker npwalker left a comment

Choose a reason for hiding this comment

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

LGTM

@jarretlavallee jarretlavallee merged commit efa644f into puppetlabs:master Sep 18, 2019
@Sharpie Sharpie deleted the enable-foss-usage branch September 19, 2019 01:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants