Last active
October 6, 2017 16:38
-
-
Save FlorinAsavoaie/c4694582f6613d10c39aff243d3599ad to your computer and use it in GitHub Desktop.
External Puppet fact listing leaf packages of Yum, without depending on yum-utils.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# This is to be used as an external Puppet fact that can tell you what are the | |
# leaf packages (the ones that no other package has a dependency on) installed | |
# on RHEL based a machine. | |
import logging | |
from yum import YumBase | |
logging.getLogger('yum.verbose.YumPlugins').setLevel(logging.CRITICAL) | |
print '%s: %s' % ('leaf_packages', | |
[ package.name for package in YumBase().rpmdb.returnLeafNodes() ]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment