[cobbler] build_reporting failing with exceptions.NameError

James Cammarata jimi at sngx.net
Tue Jul 10 23:01:44 UTC 2012


On Tue, Jul 10, 2012 at 12:50 PM, Paul Raines
<raines at nmr.mgh.harvard.edu> wrote:
>
> I am running cobbler-2.2.3-2.el5 that I got of Fedora EPEL repo on
> a CentOS5 server.  In /etc/cobbler/settings I have
>
> build_reporting_enabled: 1
> build_reporting_sender: "Cobbler Server
> <root at raidsrv04.nmr.mgh.harvard.edu>"
> build_reporting_email: [ 'systems at nmr.mgh.harvard.edu' ]
> build_reporting_smtp_server: "localhost"
> build_reporting_subject: ""
>
> When a client has finished installing I never get an email and in
> /var/log/cobbler/cobbler.log I find:
>
> Tue Jul 10 13:31:52 2012 - DEBUG | running python trigger
> cobbler.modules.install_post_report
> Tue Jul 10 13:31:52 2012 - INFO | Exception occured: exceptions.NameError
> Tue Jul 10 13:31:52 2012 - INFO | Exception value: global name 'config' is
> not defined
> Tue Jul 10 13:31:52 2012 - INFO | Exception Info:
>   File "/usr/lib/python2.4/site-packages/cobbler/remote.py", line 1970, in
> _dispatch
>     return method_handle(*params)
>    File "/usr/lib/python2.4/site-packages/cobbler/remote.py", line 1299, in
> run_install_triggers
>     utils.run_triggers(self.api, None,
> "/var/lib/cobbler/triggers/install/%s/*" % mode,
> additional=[objtype,name,ip],logger=self.logger)
>    File "/usr/lib/python2.4/site-packages/cobbler/utils.py", line 919, in
> run_triggers
>     rc = m.run(api, arglist, logger)
>    File
> "/usr/lib/python2.4/site-packages/cobbler/modules/install_post_report.py",
> line 87, in run
>     message = templar.Templar(config.Config(api.BootAPI)).render(input_data,
> metadata, None)
>
> Except for not getting the email notice of the install being finished,
> everything seems to have gone okay.
>
> Any clue as to what I did wrong or if there is a bug in cobbler?
>
> In a older cobbler-2.2.2-1 install I did, I did not have this problem and
> the end of install email worked fine.

This is a bug.

If you're comfortable editing python, change line 87 of your
install_post_report.py file as follows:

-    message = templar.Templar(config.Config(api.BootAPI)).render(input_data,
metadata, None)
+    message = templar.Templar(api._config).render(input_data, metadata, None)

And be sure to remove the .pyc and .pyo versions of that file just to
be safe, and then restart cobblerd. If that works for you, I'll
correct this in the next release.


More information about the cobbler mailing list