Okay, I figured it out, and I wanted
to share. First, the code which was
commented out did disable the inventory portion. After uncommenting it out on the
minion, it did work. I know that there probably are issues with flatten=False,
but it shouldn’t have been completely disabled….well, I’m not sure if it
should. def inventory(self,
flatten=True): """ Returns information on
all installed packages. By default, 'flatten' is
passed in as True, which makes printouts very clean in diffs for use
by func-inventory. If you are writting another software application,
using flatten=False will prevent the need to parse the returns. """ # I have not been able
to get flatten=False to work if there # is more than 491
entries in the dict -- ashcrow ts =
rpm.TransactionSet() mi = ts.dbMatch() results = [] if not mi: return for hdr in mi: name = hdr['name'] epoch =
(hdr['epoch'] or 0) version =
hdr['version'] release =
hdr['release'] arch = hdr['arch'] if flatten:
results.append("%s %s %s %s %s" % (name, epoch, version,
release, arch)) else:
results.append([name, epoch, version, release, arch]) # results = [] return results The next step (and I’m not sure
if this is optional) is to compile (on the minions – script update doesn’t seem
to matter on the overlord). Assuming you’re in the modules
directory: python -O -mcompileall . And then restart funcd on the
minion. This was not obvious to a
neophyte like me. Perhaps the documentation on the wiki can be updated to
include this tidbit. service funcd restart Thanks to Léon Keijser for
mentioning the restart to me on a separate email thread. Call from the overlord: func
minion1 call rpms inventory. From:
func-list-bounces@xxxxxxxxxx [mailto:func-list-bounces@xxxxxxxxxx] On Behalf
Of Jeff Liu All, I’ve noticed that rpms.py seems
to have a section of the script commented out which might be the reason. I installed via func-0.24-1.el5
rpm. def
inventory(self, flatten=True):
"""
Returns information on all installed packages.
By default, 'flatten' is passed in as True, which makes printouts very
clean in diffs for use by func-inventory. If you are writting another
software application, using flatten=False will prevent the need to
parse the returns.
"""
# I have not been able to get flatten=False to work if there
# is more than 491 entries in the dict -- ashcrow
ts = rpm.TransactionSet() #
mi = ts.dbMatch() #
results = [] #
for hdr in mi: #
name = hdr['name'] #
epoch = (hdr['epoch'] or 0) #
version = hdr['version'] #
release = hdr['release'] #
arch = hdr['arch'] #
if flatten: #
results.append("%s %s %s %s %s" % (name, epoch, version, #
release, arch)) #
else: #
results.append([name, epoch, version, release, arch])
results = []
return results I tried uncommenting those lines,
but it doesn’t seem to take. Unfortunately, I’m not a python
expert, so I wasn’t able to re-generate the compiled binaries for rpms.pyc and
rpms.pyo. I’m not sure what else I can do. Any info is greatly appreciated. Thanks, Jeff From: func-list-bounces@xxxxxxxxxx
[mailto:func-list-bounces@xxxxxxxxxx] On Behalf Of Jeff Liu Just wondering if anyone can help. I’m relatively new to func, and I’m attempting to gather rpm
inventory. I’m calling func’s rpm module, but it’s not returning any
values. The target minion is running CentOS 5.2. func nj1qmlt01 call rpms inventory {'nj1qmlt01': []} I’ve checked /var/log/func/func.log on both the overlord and
the minion, but there are no errors. I’m not sure how to turn up the debugging level. Any help would be greatly appreciated. Thanks in advance, Jeff |
_______________________________________________ Func-list mailing list Func-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/func-list