Ticket #2219 (new enhancement)

Opened 15 months ago

Last modified 3 weeks ago

Make sample configuration modular.

Reported by: tom.prince Owned by: config
Priority: major Milestone: 0.9.0
Version: 0.8.5 Keywords:
Cc:

Description (last modified by dustin) (diff)

Best practices for buildbot configuration are to have modular config of some sort. Don't ship with an example that doesn't follow best practices.

<@exarkun> (Heck, the sample deployment _starts_ as a mess; to avoid a mess, you'd have to clean it up the config distributed with buildbot)

Change History

comment:1 Changed 15 months ago by dustin

Modular configs lead to difficulty with reloading, so they're not for the faint of heart. I'm not sure that the initial recommendation should look like that.

comment:2 Changed 15 months ago by tom.prince

That won't be an issue, once we reconfig by graceful shutdown.

comment:3 Changed 15 months ago by bdbaddog

I've got a pretty stable modular config which handles reconfig's well. The main trick was to get rid of :

from XYZ import a,b,c

Since those aren't re-evaluated on reconfig. However doing something like:

import XYZ
a=XYZ.a
b=XYZ.b
c=XYZ.c

Seems to handle reconfig well.

comment:4 Changed 3 weeks ago by ewong

I tried the following:

import buildbot.status
html=buildbot.status.html

I get the following error during checkconfig:

(sandbox)bash-4.1$ buildbot checkconfig master
error while parsing config file:
Traceback (most recent call last):
  File "/home/cc/projs/bb9/master/bin/buildbot", line 4, in <module>
    runner.run()
  File "/home/cc/projs/bb9/master/buildbot/scripts/runner.py", line 743, in run
    sys.exit(subcommandFunction(subconfig))
  File "/home/cc/projs/bb9/master/buildbot/scripts/checkconfig.py", line 50, in checkconfig
    return cl.load(quiet=quiet)
  File "/home/cc/projs/bb9/master/buildbot/scripts/checkconfig.py", line 29, in load
    self.basedir, self.configFileName)
--- <exception caught here> ---
  File "/home/cc/projs/bb9/master/buildbot/config.py", line 156, in loadConfig
    exec f in localDict
  File "/home/cc/projs/playground/c-c/master/master.cfg", line 116, in <module>
    html=buildbot.status.html
exceptions.AttributeError: 'module' object has no attribute 'html'
Configuration Errors:
  error while parsing config file: 'module' object has no attribute 'html' (traceback in logfile)

comment:5 Changed 3 weeks ago by dustin

  • Description modified (diff)

Right, that won't work - Python doesn't automatically import all sub-modules of a package. I'm not sure what prompted you to try that?

Note: See TracTickets for help on using tickets.