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.
|
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. |

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.

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
rakein your checkout directory, or review the CI job triggered whenever you push to a pull request.rake coverage:specor ignoring untestable sections of code with# :nocovcomments. If you need help getting to 100% coverage please ask; however, don't just submit code with no tests..gemfile into the vendor/cache directory.