OPSI.Util.Task.ConfigureBackend.MySQL module

Functionality to automatically configure an OPSI MySQL backend.

New in version 4.0.4.6.

author:Niko Wenselowski <n.wenselowski@uib.de>
license:GNU Affero General Public License version 3
exception OPSI.Util.Task.ConfigureBackend.MySQL.DatabaseConnectionFailedException

Bases: exceptions.Exception

OPSI.Util.Task.ConfigureBackend.MySQL.configureMySQLBackend(dbAdminUser, dbAdminPass, config=None, systemConfiguration=None, additionalBackendConfig=None, backendConfigFile=u'/etc/opsi/backends/mysql.conf', notificationFunction=None, errorFunction=None)

Does the initial configuration of an MySQL backend.

It will set up the database for OPSI, grant the specified user the rights needed, try if the connection works, save the configuration to the backend file and create the backend base.

Parameters:
  • dbAdminUser – Username of the DBA.
  • dbAdminPass – Password for the DBA.
  • backendConfigFile – Path to mysql backend configuration file.
  • config (dict) – The configuration for the database. This should include values for the keys database, username, password and address. address is also the address of the database. If not given this will be read from backendConfigFile.
  • additionalBackendConfig – If given this will update config
  • notificationFunction (func) – A function that notifications will be passed on to. Defaults to Logger.notice.
  • errorFunction (func) – A function that error messages will be passed on to. Defaults to Logger.error.
OPSI.Util.Task.ConfigureBackend.MySQL.initializeDatabase(dbAdminUser, dbAdminPass, config, systemConfig=None, notificationFunction=None, errorFunction=None)

Create a database and grant the OPSI user the needed rights on it.