grep rather than cat | grep
sort | uniq rather than just uniq
- Dave
cobbler-bounces(a)lists.fedorahosted.org wrote on 01/13/2009 02:11:08 PM:
Eric Raymond wrote:
> Hello All,
>
> I am working on building a "live agent" to tie into Cobbler.
> Essentially, a new system is powered on, automatically PXE boots with
> this live agent, and would register itself to Cobbler, at which point
> a person can select the profile, and add in the customizations for
> ksmeta, and then reboot to be installed.
Interesting, is this based on booting a customized Fedora live image?
>
> My problem is that I can't seem to find the proper object name for
> adding the mac address when registering the server. I get the error:
>
> xmlrpclib.Fault: <Fault 1: "<class 'cobbler.cexceptions.CX
> <
http://cobbler.cexceptions.CX>'>:'object has no method:
mac_address'">
>
>
> The code snippet is:
>
> def registerSelf():
> mac = commands.getoutput("ifconfig eth0 | grep HWaddr | awk
> {'print $5'}")
> mem = commands.getoutput("cat /proc/meminfo | grep MemTotal | awk
> {'print $2 $3'}")
> cpu = commands.getoutput("cat /proc/cpuinfo | grep 'model name' |
> uniq | cut -f1,2 | awk {'print $0'}")
> numproc = commands.getoutput("cat /proc/cpuinfo | grep 'processor'
> | uniq ")
>
> print "MAC: %s" % mac
> print "Memory: %s" % mem
> print "CPU: %s" % cpu
>
> object = server.new_system(token)
> server.modify_system(object, "name", mac, token)
> server.modify_system(object, "profile", "Registration",
token)
> server.modify_system(object, "mac_address", mac, token)
>
> result = server.save_system(object, token)
The mac address is stored with the interface.
You can take a look at either remote.py (the tests at the bottom) or
CobblerWeb.py to see how the web application is modifying the interface
data.
Essentially you have to send a hash down with the interface information
as opposed to addressing the mac address directly. Each cobbler system
can have
more than one mac address, hence the complexity, and also now interfaces
can have arbitrary names.
--Michael
>
> I am trying to find where in the remote.py or any of the packages that
> has the correct naming for the model, so any help would be
greatly
> appreciated.
>
> Thanks,
>
> Eric
>
------------------------------------------------------------------------
>
> _______________________________________________
> cobbler mailing list
> cobbler(a)lists.fedorahosted.org
>
https://fedorahosted.org/mailman/listinfo/cobbler
>
_______________________________________________
cobbler mailing list
cobbler(a)lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/cobbler