Caution
Buildbot is deprecating Python 2.7. This is one of the last releases supporting it on the buildmaster. More info.
2.5.16. DbConfig¶
DbConfig is an utility for master.cfg
to get easy to use key/value storage in the Buildbot database
DbConfig can get and store any json
-able object to the db for use by other masters or separate UI plugins to edit them.
The design is voluntary simplistic, the focus is on the easy use rather than efficiency.
A separate db connection is created each time get()
or set()
is called.
Example:
from buildbot.plugins import util, worker
c = BuildmasterConfig = {}
c['db_url'] = 'mysql://username:password@mysqlserver/buildbot'
dbConfig = util.DbConfig(BuildmasterConfig, basedir)
workers = dbConfig.get("workers")
c['workers'] = [
worker.Worker(worker['name'], worker['passwd'],
properties=worker.get('properties')),
for worker in workers
]
-
class
DbConfig
¶ -
__init__
(BuildmasterConfig, basedir)¶ Parameters: - BuildmasterConfig – the
BuildmasterConfig
, wheredb_url
is already configured - basedir –
basedir
global variable of themaster.cfg
run environment. SQLite urls are relative to this dir
- BuildmasterConfig – the
-
get
(name, default=MarkerClass)¶ Parameters: - name – the name of the config variable to retrieve
- default – in case the config variable has not been set yet, default is returned if defined, else
KeyError
is raised
-
set
(name, value)¶ Parameters: - name – the name of the config variable to be set
- value – the value of the config variable to be set
-