dockermap.map package

Submodules

dockermap.map.client module

dockermap.map.exceptions module

exception dockermap.map.exceptions.ActionException(src_exc, *args, **kwargs)

Bases: dockermap.exceptions.SourceExceptionMixin, dockermap.map.exceptions.ClientExceptionMixin, dockermap.map.exceptions.ActionExceptionMixin, exceptions.Exception

Exception type for issues that occur while running a single action for a configuration.

class dockermap.map.exceptions.ActionExceptionMixin(config_id, action_type, *args, **kwargs)

Bases: object

action_type

Action type on which the error occurred.

Returns:Action type.
Return type:dockermap.map.action.ActionEnum
config_id

Configuration id on which the error occurred.

Returns:Configuration id.
Return type:dockermap.map.input.MapConfigId
exception dockermap.map.exceptions.ActionRunnerException(src_exc, *args, **kwargs)

Bases: dockermap.exceptions.SourceExceptionMixin, dockermap.map.exceptions.ClientExceptionMixin, dockermap.map.exceptions.ActionExceptionMixin, dockermap.exceptions.PartialResultsMixin, exceptions.Exception

Errors that occur while running a set of actions, while some of them might already be completed.

classmethod from_action_exception(ae, partial_results, *args, **kwargs)
exception dockermap.map.exceptions.ActionTypeException(config_id, action_type, *args, **kwargs)

Bases: dockermap.map.exceptions.ActionExceptionMixin, exceptions.Exception

action_type

Action type on which the error occurred.

Returns:Action type.
Return type:dockermap.map.action.ActionEnum
config_id

Configuration id on which the error occurred.

Returns:Configuration id.
Return type:dockermap.map.input.MapConfigId
config_type

Configuration type of where the exception was raised. Shortcut for config_id.config_type.

Return type:Configuration item type.
Return type:dockermap.map.input.ItemType
class dockermap.map.exceptions.ClientExceptionMixin(client_name, *args, **kwargs)

Bases: object

client_name

Client alias where the error occurred.

Returns:Client name.
Return type:unicode | str
exception dockermap.map.exceptions.MapIntegrityError(message)

Bases: exceptions.Exception

Exception for cases where the configurations are not consistent (e.g. a volume alias is missing on the map).

message
exception dockermap.map.exceptions.ScriptActionException

Bases: exceptions.Exception

exception dockermap.map.exceptions.ScriptRunException

Bases: exceptions.Exception

dockermap.map.input module

class dockermap.map.input.AttachedVolumeList(seq=())

Bases: dockermap.map.input.NamedTupleList

Converts a single value, a list or tuple, or a dictionary into a list of SharedVolume or UsedVolume tuples for attached volumes.

element_type = (<class 'dockermap.map.input.SharedVolume'>, <class 'dockermap.map.input.UsedVolume'>)
get_type_item(value)

Converts the given value to a UsedVolume or SharedVolume tuple for attached volumes. It accepts strings, lists, tuples, and dicts as input.

For strings and collections of a single element, the first item is considered to be an alias for lookup on the map. It is converted to a SharedVolume tuple. For two-element collections, the first item defines a new volume alias that can be re-used by other instances and the second item is considered to be the mount point for the volume. All attached volumes are considered as read-write access.

Parameters:value – Input value for conversion.
Returns:UsedVolume or SharedVolume tuple.
Return type:UsedVolume | SharedVolume
class dockermap.map.input.CmdCheck

Bases: dockermap.map.SimpleEnum

FULL = u'full'
NONE = u'none'
PARTIAL = u'partial'

Bases: tuple

alias

Alias for field number 1

container

Alias for field number 0

Bases: dockermap.map.input.NamedTupleList

Converts a single value, a list or tuple, or a dictionary into a list of ContainerLink tuples.

element_type

alias of ContainerLink

get_type_item(value)

Converts the input to a ContainerLink tuple. It can be from a single string, list, or tuple. Single values (also single-element lists or tuples) are considered a simple container link, whereas two-element items are read as (linked container, alias name).

Parameters:value – Input value for conversion.
Returns:ContainerLink tuple.
Return type:ContainerLink
class dockermap.map.input.ExecCommand

Bases: dockermap.map.input.ExecCommand

class dockermap.map.input.ExecCommandList(seq=())

Bases: dockermap.map.input.NamedTupleList

Converts a single value, a list or tuple, or a dictionary into a list of ExecCommand tuples.

element_type

alias of ExecCommand

get_type_item(value)

Converts the input to a ExecCommand tuple. It can be from a single string, list, or tuple. Single values (also single-element lists or tuples) are considered a command string, whereas two-element items are read as (command string, user name).

Parameters:value – Input value for conversion.
Returns:ExecCommand tuple.
Return type:ExecCommand
class dockermap.map.input.ExecPolicy

Bases: dockermap.map.SimpleEnum

INITIAL = u'initial'
RESTART = u'restart'
class dockermap.map.input.HealthCheck

Bases: dockermap.map.input.HealthCheck

class dockermap.map.input.HostVolume(path, host_path, readonly)

Bases: tuple

host_path

Alias for field number 1

path

Alias for field number 0

readonly

Alias for field number 2

class dockermap.map.input.InputConfigId

Bases: dockermap.map.input.InputConfigId

class dockermap.map.input.InputConfigIdList(seq=(), map_name=None, instances=None)

Bases: dockermap.map.input.NamedTupleList

element_type

alias of InputConfigId

get_type_item(value, map_name=None, instances=None)

Converts the input to a InputConfigId tuple. It can be from a single string, list, or tuple. Single values (also single-element lists or tuples) are considered to be a container configuration on the default map. A string with two elements separated by a dot or two-element lists / tuples are considered to be referring to a specific map and configuration. Three strings concatenated with a dot or three-element lists / tuples are considered to be referring to a map, configuration, and instances. Multiple instances can be specified in the third element by passing a tuple or list.

Parameters:
  • value – Input value for conversion.
  • map_name (unicode | str) – Map name; provides the default map name unless otherwise specified in value.
  • instances (unicode | str | tuple[unicode | str | NoneType]) – Instance names; instances to set if not otherwise specified in value.
Returns:

InputConfigId tuple.

Return type:

InputConfigId

class dockermap.map.input.ItemType

Bases: dockermap.map.SimpleEnum

CONTAINER = u'container'
IMAGE = u'image'
NETWORK = u'network'
VOLUME = u'volume'
class dockermap.map.input.MapConfigId

Bases: dockermap.map.input.MapConfigId

class dockermap.map.input.NamedTupleList(seq=())

Bases: list

append(item)
element_type = None
extend(iterable)
get_type_item(value)
insert(index, item)
class dockermap.map.input.NetworkEndpoint

Bases: dockermap.map.input.NetworkEndpoint

class dockermap.map.input.NetworkEndpointList(seq=())

Bases: dockermap.map.input.NamedTupleList

Converts a single value, a list or tuple, or a dictionary into a list of NetworkEndpoint tuples.

element_type

alias of NetworkEndpoint

get_type_item(value)

Converts the input to a NetworkEndpoint tuple. It can be from a single-entry dictionary, single string, list, or tuple. Single values (also single-element lists or tuples) are considered a network name. Dictionaries can also contain nested dictionaries with keyword arguments to the NetworkEndpoint. Lists / tuples of length 2 are also checked for such dictionaries.

Parameters:value – Input value for conversion.
Returns:NetworkEndpoint tuple.
Return type:NetworkEndpoint
class dockermap.map.input.PortBinding(exposed_port, host_port, interface, ipv6)

Bases: tuple

exposed_port

Alias for field number 0

host_port

Alias for field number 1

interface

Alias for field number 2

ipv6

Alias for field number 3

class dockermap.map.input.PortBindingList(seq=())

Bases: dockermap.map.input.NamedTupleList

Converts a single value, a list or tuple, or a dictionary into a list of PortBinding tuples.

element_type

alias of PortBinding

get_type_item(value)

Converts the given value to a PortBinding tuple. Input may come as a single value (exposed port for container linking only), a two-element tuple/list (port published on all host interfaces) or a three-element tuple/list (port published on a particular host interface). It can also be a dictionary with keyword arguments exposed_port, host_port, interface, and ipv6.

Parameters:value – Input value for conversion.
Returns:PortBinding tuple.
Return type:PortBinding
class dockermap.map.input.SharedHostVolumesList(seq=())

Bases: dockermap.map.input.NamedTupleList

Converts a single value, a list or tuple, or a dictionary into a list of SharedVolume or HostVolume tuples for host volumes.

element_type = (<class 'dockermap.map.input.SharedVolume'>, <class 'dockermap.map.input.HostVolume'>)
get_type_item(value)

Converts the input to a SharedVolume or HostVolume tuple for a host bind. Input can be a single string, a list or tuple, or a single-entry dictionary. Single values are assumed to be volume aliases for read-write access. Tuples or lists with two elements, can be (alias, read-only indicator), or (container path, host path). The latter is assumed, unless the second element is boolean or a string of either ro or rw, indicating read-only or read-write access for a volume alias. Three elements are always used as (container path, host path, read-only indicator). Nested values are unpacked, so that valid input formats are also {container path: (host path, read-only)} or (container_path: [host path, read-only]).

Parameters:value – Input value for conversion.
Returns:A SharedVolume tuple
Return type:SharedVolume
class dockermap.map.input.SharedVolume(name, readonly)

Bases: tuple

name

Alias for field number 0

readonly

Alias for field number 1

class dockermap.map.input.UsedVolume(name, path, readonly)

Bases: tuple

name

Alias for field number 0

path

Alias for field number 1

readonly

Alias for field number 2

class dockermap.map.input.UsedVolumeList(seq=())

Bases: dockermap.map.input.NamedTupleList

Converts a single value, a list or tuple, or a dictionary into a list of SharedVolume or UsedVolume tuples for used volumes.

element_type = (<class 'dockermap.map.input.SharedVolume'>, <class 'dockermap.map.input.UsedVolume'>)
get_type_item(value)

Converts the given value to a UsedVolume or SharedVolume tuple for used volumes. It accepts strings, lists, tuples, and dicts as input.

Single values are assumed to be volume aliases for read-write access. Tuples or lists with two elements, can be (alias, read-only indicator), or (alias, mount path). The latter is assumed, unless the second element is boolean or a string of either ro or rw, indicating read-only or read-write access for a volume alias. Three elements are always used as (alias, mount path, read-only indicator). Nested values are unpacked, so that valid input formats are also {alias: (mount path, read-only)} or (alias: [mount path, read-only]).

Parameters:value – Input value for conversion.
Returns:UsedVolume or SharedVolume tuple.
Return type:UsedVolume | SharedVolume
dockermap.map.input.bool_if_set(value)

Converts the value to a boolean, unless it is NotSet.

Parameters:value – Value to convert.
Returns:Boolean
Return type:bool | _NotSet
dockermap.map.input.get_healthcheck(value)

Converts input into a HealthCheck tuple. Input can be passed as string, tuple, list, or a dictionary. If set to None, the health check will be set to NONE, i.e. override an existing configuration from the image.

Parameters:value (unicode | str | tuple | list | NoneType) – Health check input.
Returns:HealthCheck tuple
Return type:HealthCheck
dockermap.map.input.get_list(value)

Wraps the given value in a list. None returns an empty list. Lists and tuples are returned as lists. Single strings and registered types are wrapped in a list.

Parameters:value – Value to return as a list.
Returns:List with the provided value(s).
Return type:list
dockermap.map.input.get_network_mode(value)

Generates input for the network_mode of a Docker host configuration. If it points at a container, the configuration of the container is returned.

Parameters:value (unicode | str | tuple | list | NoneType) – Network mode input.
Returns:Network mode or container to re-use the network stack of.
Return type:unicode | str | tuple | NoneType
dockermap.map.input.is_path(value)

Checks whether the given value represents a path, i.e. a string which starts with an indicator for absolute or relative paths.

Parameters:value – Value to check.
Returns:True, if the value appears to be representing a path.
Return type:bool
dockermap.map.input.read_only(value)

Checks whether the given value indicates a read-only access for a volume. For simplicity, this is any True-equivalent value that except for the string “rw” (read-write).

Parameters:value – Value to check.
Returns:True if the volume is to be read-only.
Return type:bool

dockermap.map.yaml module

Module contents

class dockermap.map.AttributeMixin(*args, **kwargs)

Bases: object

Utility class which allows access to a dictionary by attributes and keys. Also overrides the default iteration to return keys and values.

core_properties = []
core_property_set = set([])
external_properties = []
internal_properties = []
update(other=None, **kwargs)
class dockermap.map.DefaultDictMap(*args, **kwargs)

Bases: dockermap.map.AttributeMixin, collections.defaultdict

copy()
core_properties = []
core_property_set = set([])
external_properties = []
internal_properties = []
class dockermap.map.DictMap(*args, **kwargs)

Bases: dockermap.map.AttributeMixin, dict

copy()
core_properties = []
core_property_set = set([])
external_properties = []
internal_properties = []
class dockermap.map.Flags

Bases: int

NONE = Flags()
fields = {'NONE': 0}
class dockermap.map.FlagsMeta

Bases: type

class dockermap.map.PropertyDictMeta(name, bases, dct)

Bases: type

class dockermap.map.SimpleEnum

Bases: enum.Enum