OPSI.Backend.Backend module

Basic backend.

This holds the basic backend classes.

copyright:uib GmbH <info@uib.de>
author:Jan Schneider <j.schneider@uib.de>
author:Erol Ueluekmen <e.ueluekmen@uib.de>
author:Niko Wenselowski <n.wenselowski@uib.de>
license:GNU Affero General Public License version 3
OPSI.Backend.Backend.describeInterface(instance)

Describes what public methods are available and the signatures they use.

These methods are represented as a dict with the following keys: name, params, args, varargs, keywords, defaults.

Return type:[{},]
OPSI.Backend.Backend.getArgAndCallString(method)

Inspects method to gain information about the method signature.

Return type:(str, str)
OPSI.Backend.Backend.temporaryBackendOptions(*args, **kwds)
class OPSI.Backend.Backend.DeferredCall(callback=None)

Bases: object

setCallback(callback, *args, **kwargs)
waitForResult()
class OPSI.Backend.Backend.Backend(**kwargs)

Base backend.

backend_exit()

Exit the backend.

This method should be used to close connections or clean up used resources.

backend_getInterface()

Returns what public methods are available and the signatures they use.

These methods are represented as a dict with the following keys: name, params, args, varargs, keywords, defaults.

Return type:[{},]
backend_getOptions()

Get the current backend options.

Return type:dict
backend_info()

Get info about the used opsi version and the licensed modules.

Return type:dict
backend_setOptions(options)

Change the behaviour of the backend.

Parameters:options (dict) – The options to set. Unknown keywords will be ignored.
matchCache = {}
class OPSI.Backend.Backend.ExtendedBackend(backend, overwrite=True)

Bases: OPSI.Backend.Backend.Backend

Extending an backend with additional functionality.

backend_exit()
backend_getOptions()

Get options from the current and the extended backend.

Return type:dict
backend_info()
backend_setOptions(options)

Set options on self and the extended backend.

class OPSI.Backend.Backend.ConfigDataBackend(**kwargs)

Bases: OPSI.Backend.Backend.Backend

Base class for backends holding data.

These backends should keep data integrity intact but not alter the data.

auditHardwareOnHost_deleteObjects(auditHardwareOnHosts)
auditHardwareOnHost_getHashes(attributes=[], **filter)
auditHardwareOnHost_getObjects(attributes=[], **filter)
auditHardwareOnHost_insertObject(auditHardwareOnHost)
auditHardwareOnHost_updateObject(auditHardwareOnHost)
auditHardware_deleteObjects(auditHardwares)
auditHardware_getConfig(language=None)
auditHardware_getHashes(attributes=[], **filter)
auditHardware_getObjects(attributes=[], **filter)
auditHardware_insertObject(auditHardware)
auditHardware_updateObject(auditHardware)
auditSoftwareOnClient_deleteObjects(auditSoftwareOnClients)
auditSoftwareOnClient_getHashes(attributes=[], **filter)
auditSoftwareOnClient_getObjects(attributes=[], **filter)
auditSoftwareOnClient_insertObject(auditSoftwareOnClient)
auditSoftwareOnClient_updateObject(auditSoftwareOnClient)
auditSoftwareToLicensePool_deleteObjects(auditSoftwareToLicensePools)
auditSoftwareToLicensePool_getHashes(attributes=[], **filter)
auditSoftwareToLicensePool_getObjects(attributes=[], **filter)
auditSoftwareToLicensePool_insertObject(auditSoftwareToLicensePool)
auditSoftwareToLicensePool_updateObject(auditSoftwareToLicensePool)
auditSoftware_deleteObjects(auditSoftwares)
auditSoftware_getHashes(attributes=[], **filter)
auditSoftware_getObjects(attributes=[], **filter)
auditSoftware_insertObject(auditSoftware)
auditSoftware_updateObject(auditSoftware)
backend_createBase()

Setting up the base for the backend to store its data.

This can be something like creating a directory structure to setting up a databse.

backend_deleteBase()

Deleting the base of the backend.

This is the place to undo all the things that were created by backend_createBase.

backend_getSystemConfiguration()

Returns current system configuration.

This holds information about server-side settings that may be relevant for clients.

Under the key log information about log settings will be returned in form of a dict. In it under size_limit you will find the amount of bytes currently allowed as maximum log size. Under types you will find a list with currently supported log types.

Return type:dict
configState_deleteObjects(configStates)
configState_getHashes(attributes=[], **filter)
configState_getObjects(attributes=[], **filter)
configState_insertObject(configState)
configState_updateObject(configState)
config_deleteObjects(configs)
config_getHashes(attributes=[], **filter)
config_getObjects(attributes=[], **filter)
config_insertObject(config)
config_updateObject(config)
getData(query)
getRawData(query)
group_deleteObjects(groups)
group_getHashes(attributes=[], **filter)
group_getObjects(attributes=[], **filter)
group_insertObject(group)
group_updateObject(group)
host_deleteObjects(hosts)
host_getHashes(attributes=[], **filter)
host_getObjects(attributes=[], **filter)
host_insertObject(host)
host_updateObject(host)
licenseContract_deleteObjects(licenseContracts)
licenseContract_getHashes(attributes=[], **filter)
licenseContract_getObjects(attributes=[], **filter)
licenseContract_insertObject(licenseContract)
licenseContract_updateObject(licenseContract)
licenseOnClient_deleteObjects(licenseOnClients)
licenseOnClient_getHashes(attributes=[], **filter)
licenseOnClient_getObjects(attributes=[], **filter)
licenseOnClient_insertObject(licenseOnClient)
licenseOnClient_updateObject(licenseOnClient)
licensePool_deleteObjects(licensePools)
licensePool_getHashes(attributes=[], **filter)
licensePool_getObjects(attributes=[], **filter)
licensePool_insertObject(licensePool)
licensePool_updateObject(licensePool)
log_read(logType, objectId=None, maxSize=5000000)

Return the content of a log.

Parameters:
  • logType – Type of log. Currently supported: bootimage, clientconnect, instlog, opsiconfd or userlogin.
  • objectId – Specialising of logType
  • maxSize – Limit for the size of returned characters in bytes. Setting this to 0 disables limiting.
log_write(logType, data, objectId=None, append=False)

Write log data into the corresponding log file.

Parameters:
  • logType – Type of log. Currently supported: bootimage, clientconnect, instlog, opsiconfd or userlogin.
  • data (Unicode) – Log content
  • objectId – Specialising of logType
  • append (bool) – Changes the behaviour to either append or overwrite the log.
objectToGroup_deleteObjects(objectToGroups)
objectToGroup_getHashes(attributes=[], **filter)
objectToGroup_getObjects(attributes=[], **filter)
objectToGroup_insertObject(objectToGroup)
objectToGroup_updateObject(objectToGroup)
productDependency_deleteObjects(productDependencies)
productDependency_getHashes(attributes=[], **filter)
productDependency_getObjects(attributes=[], **filter)
productDependency_insertObject(productDependency)
productDependency_updateObject(productDependency)
productOnClient_deleteObjects(productOnClients)
productOnClient_getHashes(attributes=[], **filter)
productOnClient_getObjects(attributes=[], **filter)
productOnClient_insertObject(productOnClient)
productOnClient_updateObject(productOnClient)
productOnDepot_deleteObjects(productOnDepots)
productOnDepot_getHashes(attributes=[], **filter)
productOnDepot_getObjects(attributes=[], **filter)
productOnDepot_insertObject(productOnDepot)
productOnDepot_updateObject(productOnDepot)
productPropertyState_deleteObjects(productPropertyStates)
productPropertyState_getHashes(attributes=[], **filter)
productPropertyState_getObjects(attributes=[], **filter)
productPropertyState_insertObject(productPropertyState)
productPropertyState_updateObject(productPropertyState)
productProperty_deleteObjects(productProperties)
productProperty_getHashes(attributes=[], **filter)
productProperty_getObjects(attributes=[], **filter)
productProperty_insertObject(productProperty)
productProperty_updateObject(productProperty)
product_deleteObjects(products)
product_getHashes(attributes=[], **filter)
product_getObjects(attributes=[], **filter)
product_insertObject(product)
product_updateObject(product)
softwareLicenseToLicensePool_deleteObjects(softwareLicenseToLicensePools)
softwareLicenseToLicensePool_getHashes(attributes=[], **filter)
softwareLicenseToLicensePool_getObjects(attributes=[], **filter)
softwareLicenseToLicensePool_insertObject(softwareLicenseToLicensePool)
softwareLicenseToLicensePool_updateObject(softwareLicenseToLicensePool)
softwareLicense_deleteObjects(softwareLicenses)
softwareLicense_getHashes(attributes=[], **filter)
softwareLicense_getObjects(attributes=[], **filter)
softwareLicense_insertObject(softwareLicense)
softwareLicense_updateObject(softwareLicense)
user_getCredentials(username=u'pcpatch', hostId=None)

Get the credentials of an opsi user. The information is stored in /etc/opsi/passwd.

Parameters:hostId – Optional value that should be the calling host.
Returns:Dict with the keys password and rsaPrivateKey. If this is called with an valid hostId the data will be encrypted with the opsi host key.
Return type:dict
user_setCredentials(username, password)

Set the password of an opsi user. The information is stored in /etc/opsi/passwd. The password will be encrypted with the opsi host key of the depot where the method is.

class OPSI.Backend.Backend.ExtendedConfigDataBackend(configDataBackend, overwrite=True)

Bases: OPSI.Backend.Backend.ExtendedBackend

auditHardwareOnHost_create(hostId, hardwareClass, firstseen=None, lastseen=None, state=None, **kwargs)
auditHardwareOnHost_createObjects(auditHardwareOnHosts)
auditHardwareOnHost_delete(hostId, hardwareClass, firstseen=None, lastseen=None, state=None, **kwargs)
auditHardwareOnHost_getIdents(returnType='unicode', **filter)
auditHardwareOnHost_setObsolete(hostId)
auditHardwareOnHost_updateObject(auditHardwareOnHost)

Update an auditHardwareOnHost object.

This will update the attributes state and lastseen on the object.

auditHardwareOnHost_updateObjects(auditHardwareOnHosts)
auditHardware_create(hardwareClass, **kwargs)
auditHardware_createObjects(auditHardwares)
auditHardware_delete(hardwareClass, **kwargs)
auditHardware_getIdents(returnType='unicode', **filter)
auditHardware_updateObjects(auditHardwares)
auditSoftwareOnClient_create(name, version, subVersion, language, architecture, clientId, uninstallString=None, binaryName=None, firstseen=None, lastseen=None, state=None, usageFrequency=None, lastUsed=None, licenseKey=None)
auditSoftwareOnClient_createObjects(auditSoftwareOnClients)
auditSoftwareOnClient_delete(name, version, subVersion, language, architecture, clientId)
auditSoftwareOnClient_getIdents(returnType='unicode', **filter)
auditSoftwareOnClient_setObsolete(clientId)
auditSoftwareOnClient_updateObjects(auditSoftwareOnClients)
auditSoftwareToLicensePool_create(name, version, subVersion, language, architecture, licensePoolId)
auditSoftwareToLicensePool_createObjects(auditSoftwareToLicensePools)
auditSoftwareToLicensePool_delete(name, version, subVersion, language, architecture, licensePoolId)
auditSoftwareToLicensePool_getIdents(returnType='unicode', **filter)
auditSoftwareToLicensePool_updateObjects(auditSoftwareToLicensePools)
auditSoftware_create(name, version, subVersion, language, architecture, windowsSoftwareId=None, windowsDisplayName=None, windowsDisplayVersion=None, installSize=None)
auditSoftware_createObjects(auditSoftwares)
auditSoftware_delete(name, version, subVersion, language, architecture)
auditSoftware_getIdents(returnType='unicode', **filter)
auditSoftware_updateObjects(auditSoftwares)
backend_searchIdents(filter)
configState_create(configId, objectId, values=None)
configState_createObjects(configStates)
configState_delete(configId, objectId)
configState_getClientToDepotserver(depotIds=[], clientIds=[], masterOnly=True, productIds=[])

Get a mapping of client and depots.

Parameters:
  • depotIds ([str, ]) – Limit the search to the specified depot ids. If nothing is given all depots are taken into account.
  • clientIds ([str, ]) – Limit the search to the specified client ids. If nothing is given all depots are taken into account.
  • masterOnly (bool) – If this is set to True only master depots are taken into account.
  • productIds ([str,]) – Limit the data to the specified products if alternative depots are to be taken into account.
Returns:

A list of dicts containing the keys depotId and clientId that belong to each other. If alternative depots are taken into the IDs of these depots are to be found in the list behind alternativeDepotIds. The key does always exist but may be empty.

Return type:

[{“depotId”: str, “alternativeDepotIds”: [str, ], “clientId”: str},]

configState_getIdents(returnType='unicode', **filter)
configState_getObjects(attributes=[], **filter)

Add default objects to result for objects which do not exist in backend

configState_insertObject(configState)
configState_updateObject(configState)
configState_updateObjects(configStates)
config_create(id, description=None, possibleValues=None, defaultValues=None, editable=None, multiValue=None)
config_createBool(id, description=None, defaultValues=None)
config_createObjects(configs)
config_createUnicode(id, description=None, possibleValues=None, defaultValues=None, editable=None, multiValue=None)
config_delete(id)
config_getIdents(returnType='unicode', **filter)
config_updateObjects(configs)
group_createHostGroup(id, description=None, notes=None, parentGroupId=None)
group_createObjects(groups)
group_createProductGroup(id, description=None, notes=None, parentGroupId=None)
group_delete(id)
group_getIdents(returnType='unicode', **filter)
group_updateObjects(groups)
host_createObjects(hosts)
host_createOpsiClient(id, opsiHostKey=None, description=None, notes=None, hardwareAddress=None, ipAddress=None, inventoryNumber=None, oneTimePassword=None, created=None, lastSeen=None)
host_createOpsiConfigserver(id, opsiHostKey=None, depotLocalUrl=None, depotRemoteUrl=None, depotWebdavUrl=None, repositoryLocalUrl=None, repositoryRemoteUrl=None, description=None, notes=None, hardwareAddress=None, ipAddress=None, inventoryNumber=None, networkAddress=None, maxBandwidth=None, isMasterDepot=None, masterDepotId=None, workbenchLocalUrl=None, workbenchRemoteUrl=None)
host_createOpsiDepotserver(id, opsiHostKey=None, depotLocalUrl=None, depotRemoteUrl=None, depotWebdavUrl=None, repositoryLocalUrl=None, repositoryRemoteUrl=None, description=None, notes=None, hardwareAddress=None, ipAddress=None, inventoryNumber=None, networkAddress=None, maxBandwidth=None, isMasterDepot=None, masterDepotId=None, workbenchLocalUrl=None, workbenchRemoteUrl=None)
host_delete(id)
host_getIdents(returnType='unicode', **filter)
host_renameOpsiClient(id, newId)
host_renameOpsiDepotserver(oldId, newId)

Rename OpsiDepotserver with id oldId to newId.

References to the old id will be changed aswell.

Raises:
  • BackendMissingDataError – If no depot oldId is found.
  • BackendError – If depot newId already exists.
Parameters:
  • oldId (str) – ID of the server to change.
  • oldId – New ID.
host_updateObjects(hosts)
licenseContract_create(id, description=None, notes=None, partner=None, conclusionDate=None, notificationDate=None, expirationDate=None)
licenseContract_createObjects(licenseContracts)
licenseContract_delete(id)
licenseContract_getIdents(returnType='unicode', **filter)
licenseContract_updateObjects(licenseContracts)
licenseOnClient_create(softwareLicenseId, licensePoolId, clientId, licenseKey=None, notes=None)
licenseOnClient_createObjects(licenseOnClients)
licenseOnClient_delete(softwareLicenseId, licensePoolId, clientId)
licenseOnClient_getIdents(returnType='unicode', **filter)
licenseOnClient_getOrCreateObject(clientId, licensePoolId=None, productId=None, windowsSoftwareId=None)
licenseOnClient_updateObjects(licenseOnClients)
licensePool_create(id, description=None, productIds=None)
licensePool_createObjects(licensePools)
licensePool_delete(id)
licensePool_getIdents(returnType='unicode', **filter)
licensePool_updateObjects(licensePools)
objectToGroup_create(groupType, groupId, objectId)
objectToGroup_createObjects(objectToGroups)
objectToGroup_delete(groupType, groupId, objectId)
objectToGroup_getIdents(returnType='unicode', **filter)
objectToGroup_updateObjects(objectToGroups)
productDependency_create(productId, productVersion, packageVersion, productAction, requiredProductId, requiredProductVersion=None, requiredPackageVersion=None, requiredAction=None, requiredInstallationStatus=None, requirementType=None)
productDependency_createObjects(productDependencies)
productDependency_delete(productId, productVersion, packageVersion, productAction, requiredProductId)
productDependency_getIdents(returnType='unicode', **filter)
productDependency_updateObjects(productDependencies)
productOnClient_addDependencies(productOnClients)
productOnClient_create(productId, productType, clientId, installationStatus=None, actionRequest=None, lastAction=None, actionProgress=None, actionResult=None, productVersion=None, packageVersion=None, modificationTime=None)
productOnClient_createObjects(productOnClients)
productOnClient_delete(productId, clientId)
productOnClient_generateSequence(productOnClients)
productOnClient_getIdents(returnType='unicode', **filter)
productOnClient_getObjects(attributes=[], **filter)
possible attributes/filter-keys of ProductOnClient are:
productId productType clientId targetState installationStatus actionRequest lastAction actionProgress actionResult productVersion packageVersion modificationTime
missing ProductOnClients will be created with the following defaults:
installationStatus = u’not_installed’ actionRequest = u’none’ productVersion = None packageVersion = None modificationTime = None targetState = None lastAction = None actionProgress = None actionResult = None
productOnClient_insertObject(productOnClient)
productOnClient_updateObject(productOnClient)
productOnClient_updateObjects(productOnClients)
productOnDepot_create(productId, productType, productVersion, packageVersion, depotId, locked=None)
productOnDepot_createObjects(productOnDepots)
productOnDepot_delete(productId, depotId, productVersion=None, packageVersion=None)
productOnDepot_deleteObjects(productOnDepots)
productOnDepot_getIdents(returnType='unicode', **filter)
productOnDepot_insertObject(productOnDepot)

If productOnDepot exits (same productId, same depotId, different version) then update existing productOnDepot instead of creating a new one

productOnDepot_updateObjects(productOnDepots)
productPropertyState_create(productId, propertyId, objectId, values=None)
productPropertyState_createObjects(productPropertyStates)
productPropertyState_delete(productId, propertyId, objectId)
productPropertyState_getIdents(returnType='unicode', **filter)
productPropertyState_getObjects(attributes=[], **filter)

Add default objects to result for objects which do not exist in backend

productPropertyState_updateObjects(productPropertyStates)
productProperty_create(productId, productVersion, packageVersion, propertyId, description=None, possibleValues=None, defaultValues=None, editable=None, multiValue=None)
productProperty_createBool(productId, productVersion, packageVersion, propertyId, description=None, defaultValues=None)
productProperty_createObjects(productProperties)
productProperty_createUnicode(productId, productVersion, packageVersion, propertyId, description=None, possibleValues=None, defaultValues=None, editable=None, multiValue=None)
productProperty_delete(productId, productVersion, packageVersion, propertyId)
productProperty_getIdents(returnType='unicode', **filter)
productProperty_updateObjects(productProperties)
product_createLocalboot(id, productVersion, packageVersion, name=None, licenseRequired=None, setupScript=None, uninstallScript=None, updateScript=None, alwaysScript=None, onceScript=None, priority=None, description=None, advice=None, changelog=None, productClassIds=None, windowsSoftwareIds=None)
product_createNetboot(id, productVersion, packageVersion, name=None, licenseRequired=None, setupScript=None, uninstallScript=None, updateScript=None, alwaysScript=None, onceScript=None, priority=None, description=None, advice=None, changelog=None, productClassIds=None, windowsSoftwareIds=None, pxeConfigTemplate=None)
product_createObjects(products)
product_delete(productId, productVersion, packageVersion)
product_getIdents(returnType='unicode', **filter)
product_updateObjects(products)
softwareLicenseToLicensePool_create(softwareLicenseId, licensePoolId, licenseKey=None)
softwareLicenseToLicensePool_createObjects(softwareLicenseToLicensePools)
softwareLicenseToLicensePool_delete(softwareLicenseId, licensePoolId)
softwareLicenseToLicensePool_getIdents(returnType='unicode', **filter)
softwareLicenseToLicensePool_updateObjects(softwareLicenseToLicensePools)
softwareLicense_createConcurrent(id, licenseContractId, maxInstallations=None, boundToHost=None, expirationDate=None)
softwareLicense_createOEM(id, licenseContractId, maxInstallations=None, boundToHost=None, expirationDate=None)
softwareLicense_createObjects(softwareLicenses)
softwareLicense_createRetail(id, licenseContractId, maxInstallations=None, boundToHost=None, expirationDate=None)
softwareLicense_createVolume(id, licenseContractId, maxInstallations=None, boundToHost=None, expirationDate=None)
softwareLicense_delete(id)
softwareLicense_getIdents(returnType='unicode', **filter)
softwareLicense_updateObjects(softwareLicenses)
class OPSI.Backend.Backend.ModificationTrackingBackend(backend, overwrite=True)

Bases: OPSI.Backend.Backend.ExtendedBackend

addBackendChangeListener(backendChangeListener)
removeBackendChangeListener(backendChangeListener)
class OPSI.Backend.Backend.BackendModificationListener

Bases: object

backendModified(backend)
objectInserted(backend, obj)
objectUpdated(backend, obj)
objectsDeleted(backend, objs)