Re: Listing packages on hosts or hosts with packages
Will Partain <[email protected]> Thu, 18 Dec 2003 18:41:55 +0000
| Newsgroups | gmane.comp.sysutils.ark.devel |
|---|---|
| Message-ID | <[email protected]> |
Joel S writes:
> We frequently are asked questions like, "What hosts have
> Perl 5.6.0 installed?" Another favorite is, "Tell me all
> the packages installed on host abcd."
>
> Ark has answers to these questions squirreled away in
> /sys/ark-state. Is there an an ark invocation to display
> the answers?
There is as yet no known code to wander about in the
ark-state dir.
Note that the questions could be answered in two subtly
different ways: (a) looking at what the state says [as you
suggest], and (b) looking at the ARK source, which tells you
what the state *should* say :-). If you're lucky, the two
say the same thing.
A little script [Python's easiest] of the (b) form wouldn't
be too hard. A sample (which actually ran for glasli1) is
A little script [Python's easiest] below.
Will
#!/usr/local/bin/python
import ark.package
import ark.host
pkgsMgr = ark.package.ArkPkgsMgr()
hostsMgr = ark.host.ArkHostsMgr()
for pkg in pkgsMgr.getAll():
if not pkg.isRelevant(): continue
print pkg.idString, ":",
for host in hostsMgr.getAll():
if not host.isRelevant(): continue
if pkg.appliesToHost(host) != None:
print host.idString,
print ''
-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills. Sign up for IBM's
Free Linux Tutorials. Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click