vent.api package¶
Submodules¶
vent.api.actions module¶
-
class
vent.api.actions.
Action
(**kargs)[source]¶ Bases:
object
Handle actions in menu
-
add
(repo, tools=None, overrides=None, version='HEAD', image=None, branch='master', build=True, user=None, pw=None, groups=None, version_alias=None, wild=None, remove_old=True, disable_old=True, update_repo=None)[source]¶ Add a new set of tool(s)
-
add_image
(image, link_name, tag=None, registry=None, groups=None)[source]¶ Add a new image from a Docker registry
-
backup
()[source]¶ Saves the configuration information of the current running vent instance to be used for restoring at a later time
-
build
(repo=None, name=None, groups=None, enabled='yes', branch='master', version='HEAD')[source]¶ Build a set of tools that match the parameters given
-
clean
(repo=None, name=None, groups=None, enabled='yes', branch='master', version='HEAD')[source]¶ Clean (stop and remove) a set of tools that match the parameters given, if no parameters are given, clean all installed tools on the master branch at verison HEAD that are enabled
-
disable
(repo=None, name=None, groups=None, enabled='yes', branch='master', version='HEAD')[source]¶ Take an enabled tool and disable it
-
enable
(repo=None, name=None, groups=None, enabled='no', branch='master', version='HEAD')[source]¶ Take a disabled tool and enable it
-
get_configure
(repo=None, name=None, groups=None, enabled='yes', branch='master', version='HEAD', main_cfg=False)[source]¶ Get the vent.template settings for a given tool by looking at the plugin_manifest
-
static
get_request
(url)[source]¶ Send a get request to the given url
- Args:
- url(str): url to send the data to. Eg: http://0.0.0.0:37728
- Returns:
- A tuple of success status and whatever the url is supposed to give after a GET request or a failure message
-
static
get_vent_tool_url
(tool_name)[source]¶ Iterate through all containers and grab the port number corresponding to the given tool name. Works for only CORE tools since it specifically looks for core
- Args:
- tool_name(str): tool name to search for. Eg: network-tap
- Returns:
- A tuple of success status and the url corresponding to the given tool name or a failure mesage. An example return url is http://0.0.0.0:37728. Works well with send_request and get_request.
-
static
post_request
(url, json_data)[source]¶ Send a application/json post request to the given url
- Args:
url(str): url to send the data to. Eg: http://0.0.0.0:37728 json_data(dict): json obj with data that will be sent to specified
urlaction(str): what is being done. Eg: ‘starting a container’
- Returns:
- A tuple of success status and whatever the url is supposed to give after a POST request or a failure message
-
prep_start
(repo=None, name=None, groups=None, enabled='yes', branch='master', version='HEAD')[source]¶ Prep a bunch of containers to be started to they can be ordered
-
remove
(repo=None, namespace=None, name=None, groups=None, enabled='yes', branch='master', version='HEAD', built='yes')[source]¶ Remove tools or a repo
-
restart_tools
(repo=None, name=None, groups=None, enabled='yes', branch='master', version='HEAD', main_cfg=False, old_val='', new_val='')[source]¶ Restart necessary tools based on changes that have been made either to vent.cfg or to vent.template. This includes tools that need to be restarted because they depend on other tools that were changed.
-
save_configure
(repo=None, name=None, groups=None, enabled='yes', branch='master', version='HEAD', config_val='', from_registry=False, main_cfg=False, instances=1)[source]¶ Save changes made to vent.template through npyscreen to the template and to plugin_manifest
-
start
(tool_d)[source]¶ Start a set of tools that match the parameters given, if no parameters are given, start all installed tools on the master branch at verison HEAD that are enabled
-
startup
()[source]¶ Automatically detect if a startup file is specified and stand up a vent host with all necessary tools based on the specifications in that file
-
stop
(repo=None, name=None, groups=None, enabled='yes', branch='master', version='HEAD')[source]¶ Stop a set of tools that match the parameters given, if no parameters are given, stop all installed tools on the master branch at verison HEAD that are enabled
-
tool_status_checker
(tool_name)[source]¶ Reads from the plugin manifest. Checks to see if: 1. plugin manifest exists 2. if the given tool is built 3. if the given tool is running
- Args:
- tool_name(str): tool name. Checks plugin manifest option name
- Returns:
- A tuple of success status, and a tuple containing: bool describing if plugin manifest exists, bool describing if tool is built, bool describing if tool is running. eg: (True, (True, True, False))
-
tool_status_output
(tool_name)[source]¶ Function uses tool_status_checker to see tool status. Using that, it will return messages to output
- Args:
- tool_name(str): tool name
- Returns:
- A tuple of success status and a string to display
-
vent.api.plugin_helpers module¶
-
class
vent.api.plugin_helpers.
PluginHelper
(**kargs)[source]¶ Bases:
object
Handle helper functions for the Plugin class
-
available_tools
(path, version='HEAD', groups=None)[source]¶ Return list of possible tools in repo for the given version and branch
-
constraint_options
(constraint_dict, options)[source]¶ Return result of constraints and options against a template
-
prep_start
(repo=None, name=None, groups=None, enabled='yes', branch='master', version='HEAD')[source]¶ Start a set of tools that match the parameters given, if no parameters are given, start all installed tools on the master branch at verison HEAD that are enabled
-
start_containers
(container, tool_d, s_containers, f_containers)[source]¶ Start container that was passed in and return status
-
start_priority_containers
(groups, group_orders, tool_d)[source]¶ Select containers based on priorities to start
-
start_remaining_containers
(containers_remaining, tool_d)[source]¶ Select remaining containers that didn’t have priorities to start
-
vent.api.plugins module¶
-
class
vent.api.plugins.
Plugin
(**kargs)[source]¶ Bases:
object
Handle Plugins
-
add
(repo, tools=None, overrides=None, version='HEAD', image=None, branch='master', build=True, user=None, pw=None, groups=None, version_alias=None, wild=None, remove_old=True, disable_old=True, limit_groups=None, core=False, update_repo=None)[source]¶ Adds a plugin of tool(s) tools is a list of tuples, where the pair is a tool name (path to Dockerfile) and version tools are for explicitly limiting which tools and versions (if version in tuple is ‘’, then defaults to version) overrides is a list of tuples, where the pair is a tool name (path to Dockerfile) and a version overrides are for explicitly removing tools and overriding versions of tools (if version in tuple is ‘’, then tool is removed, otherwise that tool is checked out at the specific version in the tuple) if tools and overrides are left as empty lists, then all tools in the repo are pulled down at the version and branch specified or defaulted to version is globally set for all tools, unless overridden in tools or overrides branch is globally set for all tools build is a boolean of whether or not to build the tools now user is the username for a private repo if needed pw is the password to go along with the username for a private repo groups is globally set for all tools version_alias is globally set for all tools and is a mapping from a friendly version tag to the real version commit ID wild lets you specify individual overrides for additional values in the tuple of tools or overrides. wild is a list containing one or more of the following: branch, build, groups, version_alias the order of the items in the wild list will expect values to be tacked on in the same order to the tuple for tools and overrides in additional to the tool name and version remove_old lets you specify whether or not to remove previously found tools that match to ones being added currently (note does not stop currently running instances of the older version) disable_old lets you specify whether or not to disable previously found tools that match to ones being added currently (note does not stop currently running instances of the older version) limit_groups is a list of groups to build tools for that match group names in vent.template of each tool if exists Examples: - repo=fe: (get all tools from repo ‘fe’ at version ‘HEAD’ on branch ‘master’) - repo=foo, version=”3d1f”, branch=”foo”: (get all tools from repo ‘foo’ at verion ‘3d1f’ on branch ‘foo’) - repo=foo, tools=[(‘bar’, ‘’), (‘baz’, ‘1d32’)]: (get only ‘bar’ from repo ‘foo’ at version ‘HEAD’ on branch ‘master’ and ‘baz’ from repo ‘foo’ at version ‘1d32’ on branch ‘master’, ignore all other tools in repo ‘foo’) - repo=foo overrides=[(‘baz/bar’, ‘’), (‘.’, ‘1c4e’)], version=‘4fad’: (get all tools from repo ‘foo’ at verion ‘4fad’ on branch ‘master’ except ‘baz/bar’ and for tool ‘.’ get version ‘1c4e’) - repo=foo tools=[(‘bar’, ‘1a2d’)], overrides=[(‘baz’, ‘f2a1’)]: (not a particularly useful example, but get ‘bar’ from ‘foo’ at version ‘1a2d’ and get ‘baz’ from ‘foo’ at version ‘f2a1’ on branch ‘master’, ignore all other tools)
-
add_image
(**kwargs)¶
-
auto_install
()[source]¶ Automatically detects images and installs them in the manifest if they are not there already
-
builder
(**kwargs)¶
-
current_version
(name, namespace=None, branch='master')[source]¶ Return current version for a given tool
-
disable
(name, namespace=None, branch='master', version='HEAD')[source]¶ Disable tool at a specific version, default to head
-
enable
(name, namespace=None, branch='master', version='HEAD')[source]¶ Enable tool at a specific version, default to head
-
fill_config
(path)[source]¶ Will take a yml located in home directory titled ‘.plugin_config.yml’. It’ll then fill in, using the yml, the plugin’s config file
-
remove
(name=None, repo=None, namespace=None, branch='master', groups=None, enabled='yes', version='HEAD', built='yes')[source]¶ Remove tool (name) or repository, repository is the url. If no arguments are specified, all tools will be removed for the defaults.
-
state
(name, namespace=None, branch='master')[source]¶ Return state of a tool, disabled/enabled for each version
-
vent.api.templates module¶
-
class
vent.api.templates.
Template
(template=None)[source]¶ Bases:
object
Handle parsing templates
-
add_option
(**kwargs)¶
-
add_section
(**kwargs)¶
-
constrained_sections
(**kwargs)¶
-
del_option
(**kwargs)¶
-
del_section
(**kwargs)¶
-
option
(**kwargs)¶
-
options
(**kwargs)¶
-
section
(**kwargs)¶
-
sections
(**kwargs)¶
-
set_option
(**kwargs)¶
-
write_config
(**kwargs)¶
-