-
Notifications
You must be signed in to change notification settings - Fork 85
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
Add support for PE package inventory facts #229
Conversation
When an agent gathers facts in a Puppet Enterprise environment with the PE-specific package inventory feature turned on, the package inventory is returned as part of the fact upload and then that package data is available in a PuppetDB endpoint independent of the rest of the facter data. You should not generally need to include the package inventory data for Octocatalog-Diff testing, but if you have a specific reason to want it included to more closely match what occurs in production this addition allows it to be included.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems okay to me, in general. Since I don't have a way to test against PE at the moment, could you post a diff output when this feature is used?
Let me see if I can come up with something simple but effective to show the behavior. |
@ahayworth Given that the only difference when enabling this option is the addition of one extra fact in both the from and to compiles it wasn't quite as simple as doing $timestamp = Timestamp.new()
$pkgs = $facts.dig('_puppet_inventory_1', 'packages')
if $pkgs {
$pkg_count = $pkgs.length
$msg = "${String($timestamp)}: ${pkg_count} packages"
} else {
$msg = "${String($timestamp)}: ${String($facts['_puppet_inventory_1'], '%p')}"
}
notify { 'package_inventory_count':
message => $msg,
} The idea is that the timestamp will differ, even if the actual fact does not. With the above code I get:
With the new option enabled:
Was that what you were looking for? |
@seanmil Yeah, that works! Seeing the puppet code is actually what made sense to me. In retrospect ... the change actually makes a lot more sense than I initially thought and I am not really sure what I was worried about. 😆 |
Overview
This pull request introduces functionality to feed the data from the
Puppet Enterprise package inventory feature back into the compile
process.
When an agent gathers facts in a Puppet Enterprise environment with
the PE-specific package inventory feature turned on, the package
inventory is returned as part of the fact upload and then that
package data is available in a PuppetDB endpoint independent of the
rest of the facter data.
You should not generally need to include the package inventory data
for Octocatalog-Diff testing, but if you have a specific reason to
want it included to more closely match what occurs in production
this addition allows it to be included.
Checklist
rake
in your checkout directory, or review the CI job triggered whenever you push to a pull request.rake coverage:spec
or ignoring untestable sections of code with# :nocov
comments. If you need help getting to 100% coverage please ask; however, don't just submit code with no tests..gem
file into the vendor/cache directory.