[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: editfiles: DefineClasses can't be used in multiple BeginGroupIfNoSuc
From: |
Tim Auckland |
Subject: |
Re: editfiles: DefineClasses can't be used in multiple BeginGroupIfNoSuchLine |
Date: |
29 May 2002 10:22:15 -0700 |
> P.S.
> Any other ideas on how to configure cfengine to install software
> "on-demand" would be appreciated.
I'm doing something similar, but most of the work is offloaded into a
script. I have static cfengine classes grouping my systems into a
number of "staging" levels, and for each OS and each level I have a dir
full of packages that should be installed on systems of that OS and
level. My script just has rpm (or equivalent) do the work of comparing
the current state against the list of packages and installing what is
needed.
--
shellcommands:
StagingTest|StagingDevelopment|StagingProduction::
"/tools/config/cfengine/packages $(allclasses)" inform=false
--
Then my packages script does stuff like:
# Red Hat packages
redhat_rpm(){
pkgdir="$1"
# Get package list
pkgs=`rpm -qp $pkgdir/*`
if [ -n "$pkgs" ]; then
# Look for packages/versions not installed; failure is ok
updates=`rpm -q $pkgs 2> /dev/null |
awk '/ is not /{print "'$pkgdir'/"'\\$2'".*"}'`
if [ -n "$updates" ]; then
# Install/Upgrade them
rpm -Uv $updates
fi
fi
}
...
plus several "case" statements to pick the right packagedir according to
OS and staging level, eg:
case $CFALLCLASSES in
*:redhat_7_2:*) ...
I hope this helps,
Tim