On Mon, 28 Mar 2011 09:02:20 -0400, Gary Algier <gaa(a)ulticom.com> wrote:
Hello,
I would like to write a cobbler trigger to do something every time I add a
system. I looked at the documentation at:
https://fedorahosted.org/cobbler/wiki/CobblerTriggers
but I think I am missing something.
A simple example is given in the form of a shell script and it shows $1 used
as the name of a newly added system. However, I see nothing defining the
arguments passed, nor the environment. I see that one can use the
CobblerApi, but when I follow the link it tells me not to use "BootApi" (is
BootApi == CobblerApi?) but to use "CobblerXmlrpc" instead. That seems to be
a client/server system. The trigger docs say not to use it.
A says use B. B says don't use B, use C. A says don't use C. ????
So, is there anything defining the trigger API?
Does one really need to use Python to do anything meaningful? I'm definitely
not a Python wiz.
It says that pre-triggers can prevent an add operation. How? Just exit(1)?
How do I report errors back to the user?
In case it would help to understand my situation, I would like to be able to
leave the networking empty and have a system add operation automatically
define eth0 using the hostname to look up the MAC via "getent ethers
hostname". I can easily write the code to do the lookup in sh/bash/ksh or
perl, but I need to be able to supply the information back to the cobbler
system after the lookup. I need to be able to fail on errors.
The best example I can give you is the triggers found in the modules
directory in the cobbler source [1]. The install_* ones and sync_*
ones. The api passed in is a copy of BootAPI (which is the actual name
of CobblerAPI). It is normally not ok to use BootAPI for various
reasons, but in this case the trigger is running inside of cobblerd and
can safely make use of BootAPI.
[1] -
http://git.fedorahosted.org/git/?p=cobbler;a=tree;f=cobbler/modules;h=a6f...
--
Scott Henson
Red Hat CIS Operator
WVU Alum BSAE/BSME