7.2.2.5. Module axivion.dashboard.setup_helper

Provides some helpers for initializing dashboard configurations.

Classes

AccessInfo(url, auth)

Contains information to create a :py:class:`axivion.dashboard.Dashboard`

SetupHelper()

Minimal functionality to initialize a dashboard configuration.

AccessInfo

class axivion.dashboard.setup_helper.AccessInfo(url, auth)

Bases: object

Contains information to create a :py:class:`axivion.dashboard.Dashboard`

get_url()

The Base-Url for accessing the Dashboard.

get_auth()

Administrative credentials if they were generated.

If they are not contained you should already know them somehow.

Returns:

a 2-tuple of username and password or None.

SetupHelper

class axivion.dashboard.setup_helper.SetupHelper

Bases: object

Minimal functionality to initialize a dashboard configuration.

set_config_value(config_dir, key, value)

Set a value in dashboard2.config.

Example keys are EmbeddedTomcat/HttpPort and Logging/Directory

Note that dashboard2/ will be prepended to the given key if not present.

Parameters:
  • config_dir (str | pathlib.Path) – the configuration directory

  • key (str) – the configuration key to set

  • value (str) – the configuration value

unset_config_value(config_dir, key)

Unset a value in dashboard2.config.

Example keys are EmbeddedTomcat/HttpPort and Logging/Directory

Note that dashboard2/ will be prepended to the given key if not present.

Parameters:
  • config_dir (str | pathlib.Path) – the configuration directory

  • key (str) – the configuration key to remove

start_dashboard(config_dir, *, env=None)

Use this in order to start a dashboard.

Independently of whether a configuration already exists at the given config_dir and whether or not the dashboard is already running there, this should return the url with which the dashboard can be accessed.

Only in case, that no configuration existed (no dashboard2.db) the returned object will also contain newly generated administrative credentials.

Parameters:
  • config_dir (typing.Union[str, os.PathLike]) – the configuration directory

  • env (typing.Optional[typing.Mapping[str, str]]) – if given uses the specified environment instead of inheriting the current one

Return type:

axivion.dashboard.setup_helper.AccessInfo

Returns:

dashboard url and possibly admin credentials

stop_dashboard(config_dir)

Use this in order to stop a dashboard.

Independently of whether the dashboard was running or not, when this method returns it won’t be running.

Parameters:

config_dir (str | pathlib.Path) – the configuration directory

Exceptions

DashboardSetupException

Indicates Configuration/Initialization Errors

DashboardSetupException

exception axivion.dashboard.setup_helper.DashboardSetupException

Bases: Exception

Indicates Configuration/Initialization Errors