Re: Looping through possibilities in a "snippet"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Sandor W. Sklar wrote:


I would probably solve the problem of sourcing the packages list from an external file in a different way...

For starters, assume you have your packages list arranged as follows:

/var/www/html/packages_list/systems/* (file named after systems go heere)
/var/www/html/packages_list/profiles/* (file named after profiles go here)
/var/www/html/packages_list/default (default files go here)

What follows is a bash script for the kickstart .. the format is slightly different as we have to escape the bash for Cheetah -- and we also need to do a quick trick to pass Cheetah variables into the bash section as bash variables... So that's what the first four lines up to "#raw" do.

you can validate that this works for you by running "cobbler sync" and then looking at http://server/cobbler/kickstart_sys/name/ks.cfg to make sure it's templated out with URLs/values that look good to you, though this should be pretty close.

Basically it makes three seperate wget requests and stops when it gets a file that is not zero length. Once it has the file saved to /tmp/packages we later include (using kickstart) the file /tmp/packages into the middle of the package list at runtime. This also allows the package list to be modified without having to run "cobbler sync" to apply changes to it.

%pre
profile = $profile
name = $name
server = $server
#raw
wget http://$server/packages_list/systems/$name -O /tmp/packages
if [ ! -s /tmp/packages ]
then

wget http://$server/packages_list/profiles/$profile -O /tmp/packages

if [ ! -s /tmp/packages ]
then
wget http://$server/packages_list/default -O /tmp/packages
fi

fi
#endraw


In your %packages section:
%include /tmp/packages


Will that work? That's a pretty good idea for a way to source a packages list, so I may include that snippet in a future release of Cobbler if it meets requirements. We could carve out space in /var/www/cobbler to store the packages lists and include info on the Wiki about how to use it. (Note that right now, that's not advisable, as cobbler cleans out content in /var/www/cobbler each time it runs).

--Michael

_______________________________________________
et-mgmt-tools mailing list
et-mgmt-tools@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/et-mgmt-tools

[Index of Archives]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux