labtest.provider package¶
Subpackages¶
Submodules¶
labtest.provider.base_secret module¶
-
class
labtest.provider.base_secret.
BaseSecret
(config)[source]¶ Bases:
object
Base class for secret providers
When initialized, the BaseSecret sets its
config
attribute and sets an attribute for each key, value in the config.Example
>>> state = BaseSecret({'dir': 'foo', 'length': 5}) >>> state.config {'dir': 'foo', 'length': 5} >>> state.dir 'foo' >>> state.length 5
- Parameters
config – The configuration for the state
-
decrypt
(ciphertext)[source]¶ Decrypt the ciphertext and return the result
- Parameters
ciphertext – The encrypted secret to decrypt
- Returns
The plaintext
-
default_config
= None¶
labtest.provider.base_service module¶
-
class
labtest.provider.base_service.
BaseService
(service, create_function=None, destroy_function=None, check_config_function=None)[source]¶ Bases:
object
Base class for managing a backing service
- Parameters
service – The type of the service, like
mysql
orredis
create_function – The function to call to create the service
destroy_function – The function to call to destroy the service
check_config_function – The function to call to check for a valid configuration for this service
-
check_config
(config)[source]¶ Check the configuration to make sure it is valid for this service.
Note
If sub-classes don’t provide a
check_config_function
, it will always returnTrue
.- Parameters
self – The object
config – The configuration
- Returns
True
if the configuration is valid, otherwiseFalse
.
-
create
(config, name)[source]¶ Creates the service (if necessary)
- Parameters
config – The configuration for the service
name – The name of the service
- Returns
A
dict
that may includeenvironment
orhosts
keys. These are a method of communication back to the experiment to potentially alter its own containerExample result:
{ 'environment': [], # Items to add to the environment of the container (--env) 'hosts': [] # Add hosts using the --add-host option }
labtest.provider.base_state module¶
-
class
labtest.provider.base_state.
BaseState
(config)[source]¶ Bases:
object
Base class for state providers
When initialized, the BaseState sets its
config
attribute and sets an attribute for each key, value in the config.Example
>>> state = BaseState({'dir': 'foo', 'length': 5}) >>> state.config {'dir': 'foo', 'length': 5} >>> state.dir 'foo' >>> state.length 5
- Parameters
config – The configuration for the state
-
default_config
= None¶