labtest package¶
Subpackages¶
Submodules¶
labtest.cli module¶
labtest.config module¶
-
class
labtest.config.
LabTestConfig
(**kwargs)[source]¶ Bases:
labtest.configobj.Config
-
default_config_files
= ['.labtest.yml', '.labtest.yaml', 'setup.cfg', 'package.json']¶
-
dependencies
= {'build_provider': {'default': ['code_repo_url', 'app_build_image', 'app_build_command', 'container_build_command', 'container_provider']}}¶
-
get_default_app_name
()[source]¶ The default app_name is the name of the directory containing the .git directory
-
namespace
= 'labtest'¶
-
required_attrs
= ['app_build_command', 'app_build_image', 'app_name', 'before_start_command', 'build_provider', 'container_provider', 'docker_image_pattern', 'environment', 'host', 'host_name_pattern', 'services', 'test_domain', 'verbose']¶
-
labtest.configobj module¶
-
class
labtest.configobj.
Config
(**kwargs)[source]¶ Bases:
future.types.newobject.newobject
-
config
¶ This returns the configuration as a dict.
This method will use the logic in __getattr__ to set the values. It doesn’t just return the default _config dict.
-
default_config_files
= [u'.labtest.yml', u'setup.cfg', u'package.json']¶
-
extension_map
= {u'.cfg': u'read_ini_config', u'.ini': u'read_ini_config', u'.json': u'read_json_config', u'.yaml': u'read_yaml_config', u'.yml': u'read_yaml_config'}¶
-
namespace
= u'config'¶
-
parse_file
(filepath)[source]¶ Determine which method to use to parse the file, based on the file extension
-
required_attrs
= []¶
-
labtest.filesystem module¶
Provides helpers for filesystem operations that extend Fabric’s
-
labtest.filesystem.
create_dir
(remote_path, owner=None, group='docker', mode=None)[source]¶ Create a directory and the intermediate paths as required.
The group will always be set to
group
. The owner and mode will not be set unless specified- Parameters
remote_path – The remote directory path
owner – The name of the user to set the owner of the directory
group – The name of the group to set the group of the directory
mode – The mode to set the directory, as a string
-
labtest.filesystem.
get_file_contents
(remote_path)[source]¶ Reads the file contents into a buffer.
The buffer is a BytesIO buffer, so it works for binary and text documents.
For text documents, you will have to coerce it appropriately.
- Parameters
remote_path – The path to the remote file
- Returns
A BytesIO buffer.
labtest.instance module¶
labtest.secrets module¶
labtest.services module¶
A collection of common functions to setup and destroy OS services
-
labtest.services.
delete_service
(service_name, quiet=False)[source]¶ Remove the service and clean up
- Parameters
service_name – The name of the service
quiet – Set to
True
to suppress Fabric output
-
labtest.services.
setup_service
(service_name, local_template_path, context, quiet=False)[source]¶ Setup a service using a template and context to render the correct service file
- Parameters
service_name – The name of the service
local_template_path – The path to the template to use to render the service
context – A
dict
containing values to use in the rendering of the templatequiet – Set to
True
to suppress Fabric output