honeycomb.utils package


honeycomb.utils.config_utils module

Honeycomb Config Utilities.

honeycomb.utils.config_utils.config_field_type(field, cls)[source]

Validate a config field against a type.

Similar functionality to validate_field_matches_type() but returns honeycomb.defs.ConfigField


Return the parameters section from config.json.


Convert a string to a pythonized parameter.


Ensure field name is valid.

honeycomb.utils.config_utils.process_config(ctx, configfile)[source]

Proccess a yaml config with instructions.

This is a heavy method that loads lots of content, so we only run the imports if its called.

honeycomb.utils.config_utils.validate_config(config_json, fields)[source]

Validate a JSON file configuration against list of honeycomb.defs.ConfigField

honeycomb.utils.config_utils.validate_config_parameters(config_json, allowed_keys, allowed_types)[source]

Validate parameters in config file.

honeycomb.utils.config_utils.validate_field(field, allowed_keys, allowed_types)[source]

Validate field is allowed and valid.

honeycomb.utils.config_utils.validate_field_matches_type(field, value, field_type, select_items=None, _min=None, _max=None)[source]

Validate a config field against a specific type.

honeycomb.utils.daemon module

Honeycomb DaemonRunner utility.

class honeycomb.utils.daemon.myRunner(app, pidfile=None, stdout=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>, stderr=<_io.TextIOWrapper name='<stderr>' mode='w' encoding='UTF-8'>, stdin=<_io.TextIOWrapper name='/dev/null' mode='rt' encoding='UTF-8'>)[source]

Bases: daemon.runner.DaemonRunner

Overriding default runner behaviour to be simpler.

honeycomb.utils.plugin_utils module

Honeycomb generic plugin install utils.

exception honeycomb.utils.plugin_utils.CTError(errors)[source]

Bases: Exception

Copytree exception class, used to collect errors from the recursive copy_tree function.

honeycomb.utils.plugin_utils.copy_file(src, dst)[source]

Copy a single file.

:param:src: Source name :param:dst: Destination name

honeycomb.utils.plugin_utils.copy_tree(src, dst, symlinks=False, ignore=[])[source]

Copy a full directory structure.

:param:src: Source path :param:dst: Destination path :param:symlinks: Copy symlinks :param:ignore: Subdirs/filenames to ignore

honeycomb.utils.plugin_utils.get_plugin_path(home, plugin_type, plugin_name, editable=False)[source]

Return path to plugin.

:param:home: Path to honeycomb home :param:plugin_type: Type of plugin (honeycomb.defs.SERVICES pr honeycomb.defs.INTEGRATIONS) :param:plugin_name: Name of plugin :param:editable: Use plugin_name as direct path instead of loading from honeycomb home folder


Return list of possible select items.


Install plugin dependencies using pip.

We import pip here to reduce load time for when its not needed.

honeycomb.utils.plugin_utils.install_dir(pkgpath, install_path, register_func, delete_after_install=False)[source]

Install plugin from specified directory.

install_path and register_func are same as install_plugin(). :delete_after_install: Delete pkgpath after install (used in install_from_zip()).

honeycomb.utils.plugin_utils.install_from_repo(pkgname, plugin_type, install_path, register_func)[source]

Install plugin from online repo.

honeycomb.utils.plugin_utils.install_from_zip(pkgpath, install_path, register_func, delete_after_install=False)[source]

Install plugin from zipfile.

honeycomb.utils.plugin_utils.install_plugin(pkgpath, plugin_type, install_path, register_func)[source]

Install specified plugin.

:param:pkgpath: Name of plugin to be downloaded from online repo or path to plugin folder or zip file. :param:install_path: Path where plugin will be installed. :param:register_func: Method used to register and validate plugin.

honeycomb.utils.plugin_utils.list_local_plugins(plugin_type, plugins_path, plugin_details)[source]

List local plugins with details.

honeycomb.utils.plugin_utils.list_remote_plugins(installed_plugins, plugin_type)[source]

List remote plugins from online repo.

honeycomb.utils.plugin_utils.parse_plugin_args(command_args, config_args)[source]

Parse command line arguments based on the plugin’s parameters config.

  • command_args – Command line arguments as provided by the user in key=value format.
  • config_args – Plugin parameters parsed from config.json.

Validated dictionary of parameters that will be passed to plugin class


Pring plugin parameters table.

honeycomb.utils.plugin_utils.uninstall_plugin(pkgpath, force)[source]

Uninstall a plugin.

:param:pkgpath: Path to package to uninstall (delete) :param:force: Force uninstall without asking

honeycomb.utils.tailer module

Honeycomb service log tailer.

class honeycomb.utils.tailer.Tailer(name, filepath, color='', nlines=10, follow=False, outfile=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>, sleeptime=0.5, show_name=True, used_colors=[])[source]

Bases: object

Colorized file tailer.

Print lines from a file prefixed with a colored name. Optionally continue to follow file.


Follow a file and send every new line to a callback.


Print a line from a logfile.


Print a line from a logfile prefixed with service name.


Stop follow.

honeycomb.utils.validators module

Hooneycomb generic validators.


IP/Host parameter validator.


Validate port is in standard range.

honeycomb.utils.wait module

Honeycomb wait utilities.

exception honeycomb.utils.wait.TimeoutException[source]

Bases: Exception

Exception to be raised on timeout.

honeycomb.utils.wait.search_json_log(filepath, key, value)[source]

Search json log file for a key=value pair.

  • filepath – Valid path to a json file
  • key – key to match
  • value – value to match

First matching line in json log file, parsed by json.loads()

honeycomb.utils.wait.wait_until(func, check_return_value=True, total_timeout=60, interval=0.5, exc_list=None, error_message='', *args, **kwargs)[source]

Run a command in a loop until desired result or timeout occurs.

  • func – Function to call and wait for
  • check_return_value (bool) – Examine return value
  • total_timeout (int) – Wait timeout,
  • interval (float) – Sleep interval between retrys
  • exc_list (list) – Acceptable exception list
  • error_message (str) – Default error messages
  • args – args to pass to func
  • kwargs – lwargs to pass to fun

Module contents

Honeycomb Utils.