>
> The cobbler command line is written in the Python API and can do 100% of
> everything.
Sounds great!
But, why is 'cobbler xxx' slow even though cobbler command line is written
in the Python API? In my testing for 1000 system registration into cobbler, it
was 2411[sec] ('cobbler add xxxx') VS 4[sec] (python based script with API).
So, what's most overheads in cobbler commands?
>
> It looks like you're using the Python API from what you have below
> (excellent!), in which case you have numerous examples. The best thing
> you can do is look in the "modules/" directory of a source checkout.
> The cobbler CLI makes every call for every command line argument there,
> and you can see what calls are made for each CLI getopt argument.
Thanks! I had a look at thees codes in modules directory and could make a python
scripts with API to add system information (includes mac_address, ip_address
whatever I want it) into cobbler.
>
> Pretty close. The main thing is that I've exposed most of the internals
> directly in API.py, so other than calling methods on the actual cobbler
> objects like 'system', you can access everything through the API
> module. Anything lower level down is subject to change and isn't a
> stable API. api.py, however, is stable.
>
> import cobbler.api as capi # avoid namespace issue as you
> use 'api' later.
> api = capi.BootAPI()
> s = api.find_system(name='abc') # abc is a string, plus find is a top
> level API call, it's best not to go any deeper and just use the api.py
> implementation
> s.set_hostname('xyz') # use the set_ methods to
> ensure validation is always run on the input (very important!)
> api.add_system(s) # again, use the top level
> API function, which sets reasonable defaults for all the arguments
This is very useful to me also. Thanks again.
-Ihara
_______________________________________________
cobbler mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/cobbler