insalata package

Subpackages

Submodules

insalata.EnvironmentHandler module

insalata.Insalata module

class insalata.Insalata.Insalata(stdin='/dev/stdin', stdout='/dev/stdout', stderr='/dev/stderr')

Bases: object

Daemon for the insalata application.

applyConfiguration(environmentName, fileName)

Apply a previously uploaded configuration.

Parameters:
  • environmentName (str) – Name of the environment the new configuration will be applied to.
  • fileName (str) – Name of the file.
applyEnvironment(environmentFrom, environmentTo)

Apply a previously uploaded configuration.

Parameters:
  • environmentFrom (str) – Name of the environment to apply to another location.
  • environmentTo (str) – Name of the environment on which environmentFrom will be deployed.
  • fileName (str) – Name of the file.
exportEnvironmentToXml(environmentName, fileName)

Triggers the output of the information collected about this environment as an XML.

Parameters:
  • environmentName (str) – The names of the environment to export.
  • fileName (str) – The filename to use for exporting the information to the environment’s data directory.
getCommands()

Retrieve a list of all commands publicly available for clients of this service.

Returns:A dictionary with all publicly available commands, their minimum, maximum number of parameter associated and their docstring for description.
Return type:{str: (int, int, string) }
getEnvironments()

Retrieves a list of all environments.

Returns:The names of all environments.
Return type:[str]
getFile(environmentName, fileName)

Get a list of all files associated with an environment.

Parameters:
  • environmentName (str) – Name of the environment the XML file is part of
  • environmentName – Name of the environment the XML file is part of
Returns:

The name of all files inside the given environment.

Return type:

[str]

getSetupProgress(environmentName)

Get the current setup process of an environment.

Parameters:environmentName (str) – Name of the environment to get the setup process of.
listFiles(environmentName)

Get a list of all files associated with an environment.

Parameters:environmentName (str) – Name of the environment the XML will be part of
Returns:The name of all files inside the given environment.
Return type:[str]
uploadConfiguration(environmentName, fileName, xmlData)

Upload a new configuration file.

Parameters:
  • environmentName (str) – Name of the environment the XML will be part of
  • fileName (str) – Name of the file.
  • xmlData (str) – Xml-content as string

insalata.Logging module

insalata.Logging.createLogger(name, logFile, level, maxBytes, backup)

Get RotatingFile-Logger with the correct output format configured. Standard log-path is /var/log/insalata.

Parameters:
  • name (str) – Name the logger shall have.
  • logFile (str) – Name of the log file the logger should use
  • maxBytes (int) – Maximum size of the logfile before logger starts rotating
  • backup (int) – Number of files to hold as log backup
Returns:

Configured logger object

Return type:

:class:’logging.Logger’

insalata.Logging.getLogLevel(level)

Return the python internal value for a loglevel given as character string.

Parameters:level (str) – Log-level to use
Returns:Log level int representation used by :seealso:’logging’ module
Return type:int

insalata.RpcConnection module

class insalata.RpcConnection.RpcConnection(uri, user, passwd, storage=None)

Bases: object

Class is used to wrap the connection to a XenServer. Storage of to use on the XenServer is hold, too.

getConnectionSession()

Establishes a connection with the currently specified Xen-Server and user credentials.

Returns:Server reverence and session: (serverReference, sessionObject)
Return type:tuple
getDefaultStorage()

Get the name of the default storage.

Returns:Name of default storage
Return type:str
logout()

Logout from Xen server RPC session.

insalata.Timer module

class insalata.Timer.Timer(duration, method, args=[], kwargs={})

Bases: object

Own Timer implementation that uses pythons threading.Timer but supports pausing and resuming.

caller(method, *args, **kwargs)
cancel()

Cancel the timer execution.

getOver()
pause()

Pause the timer.

resume()

Resume the timer. Duration is the overall duration minus the time elapsed till pause.

start()

Start the timer.

insalata.XmlPrint module

This modules provides methods to print a configuration to a XML file.

insalata.XmlPrint.printHosts(root, hosts)

Output all Host objects contained in the graph.

Parameters:
  • root (:class:'xml.etree.ElementTree.Element') – XML element that shall contain the hosts
  • locations (set) – Host objects to print
insalata.XmlPrint.printLayer2Networks(root, networks)

Output all Layer2Network objects contained in the graph.

Parameters:
  • root (:class:'xml.etree.ElementTree.Element') – XML element that shall contain the networks
  • locations (set) – Layer2Network objects to print
insalata.XmlPrint.printLayer3Networks(root, networks)

Output all Layer3Network objects contained in the graph.

Parameters:
  • root (:class:'xml.etree.ElementTree.Element') – XML element that shall contain the networks
  • locations (set) – Layer3Network objects to print
insalata.XmlPrint.printLocations(root, locations)

Output all location objects contained in the graph.

Parameters:
  • root (:class:'xml.etree.ElementTree.Element') – XML element that shall contain the locations
  • locations (set) – Location objects to print
insalata.XmlPrint.printVlans(root, vlans)

Output all VLAN objects contained in the graph. :note: Obsolete

Parameters:
  • root (:class:'xml.etree.ElementTree.Element') – XML element that shall contain the networks
  • locations (set) – VLAN objects to print
insalata.XmlPrint.printXML(file, graph)

Print the XML for a given graph.

Parameters:
  • file (str) – File to print the XML into
  • graph (:class:'insalata.model.Graph') – Graph coantaining the scanned information

insalata.client module

Module contents