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

Changes in #357 break Ubuntu version dependent resources #372

Closed
dbeckham opened this issue Aug 9, 2017 · 1 comment
Closed

Changes in #357 break Ubuntu version dependent resources #372

dbeckham opened this issue Aug 9, 2017 · 1 comment

Comments

@dbeckham
Copy link
Contributor

dbeckham commented Aug 9, 2017

Changes in #357 break Ubuntu version dependent resources when using Facter 3.x.

The changes integrate the new facts hash from Puppet 4, but it appears that the version strings were also changed to 12, 14, etc., which is broken for current releases of Puppet 4 and Facter 3.x. Facter reports these facts as 12.04, 14.04, or 14.10, etc. The old Facter 2.x was reporting 12 and 14, but it appears that it can be very buggy from release to release.

This behavior can be verified by installing Puppet 4 from the official Puppetlabs Ubuntu repository.

Either way, using $foo == '14.04', or $foo == '14' are both short sighted and will fail for anything but those exact versions. What should be done, and in general a Puppet best practice, is to use the built-in versioncmp function to do a version comparison to ensure that your resources are applied to any applicable versions.

Examples:

# Ubuntu 14 only
if (versioncmp($facts['os']['release']['full'], '14') >= 0 and 
    versioncmp($facts['os']['release']['full'], '16') < 0) {
  # do something version specific
}

# Ubuntu 16 and later releases:
if versioncmp($facts['os']['release']['full'], '16') >= 0 {
  # do something version specific
}

@dbeckham
Copy link
Contributor Author

Well, I looked over #357 and saw a couple of == changes for the Ubuntu version and made an assumption about all of the changes. My apologies. This doesn't affect ALL ubuntu versions, just 12 and 14. I'm going to submit a PR with a fix in it for the affected manifests.

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

No branches or pull requests

2 participants