repo stringclasses 85
values | path stringlengths 8 121 | func_name stringlengths 1 82 | original_string stringlengths 112 65.5k | language stringclasses 1
value | code stringlengths 112 65.5k | code_tokens listlengths 20 4.09k | docstring stringlengths 3 46.3k | docstring_tokens listlengths 1 564 | sha stringclasses 85
values | url stringlengths 93 218 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
saltstack/salt | salt/modules/glusterfs.py | unset_quota_volume | def unset_quota_volume(name, path):
'''
Unset quota on glusterfs volume
name
Name of the gluster volume
path
Folder path for restriction in volume
CLI Example:
.. code-block:: bash
salt '*' glusterfs.unset_quota_volume <volume> <path>
'''
cmd = 'volume quota ... | python | def unset_quota_volume(name, path):
'''
Unset quota on glusterfs volume
name
Name of the gluster volume
path
Folder path for restriction in volume
CLI Example:
.. code-block:: bash
salt '*' glusterfs.unset_quota_volume <volume> <path>
'''
cmd = 'volume quota ... | [
"def",
"unset_quota_volume",
"(",
"name",
",",
"path",
")",
":",
"cmd",
"=",
"'volume quota {0}'",
".",
"format",
"(",
"name",
")",
"if",
"path",
":",
"cmd",
"+=",
"' remove {0}'",
".",
"format",
"(",
"path",
")",
"if",
"not",
"_gluster",
"(",
"cmd",
"... | Unset quota on glusterfs volume
name
Name of the gluster volume
path
Folder path for restriction in volume
CLI Example:
.. code-block:: bash
salt '*' glusterfs.unset_quota_volume <volume> <path> | [
"Unset",
"quota",
"on",
"glusterfs",
"volume"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glusterfs.py#L668-L690 | train |
saltstack/salt | salt/modules/glusterfs.py | list_quota_volume | def list_quota_volume(name):
'''
List quotas of glusterfs volume
name
Name of the gluster volume
CLI Example:
.. code-block:: bash
salt '*' glusterfs.list_quota_volume <volume>
'''
cmd = 'volume quota {0}'.format(name)
cmd += ' list'
root = _gluster_xml(cmd)
... | python | def list_quota_volume(name):
'''
List quotas of glusterfs volume
name
Name of the gluster volume
CLI Example:
.. code-block:: bash
salt '*' glusterfs.list_quota_volume <volume>
'''
cmd = 'volume quota {0}'.format(name)
cmd += ' list'
root = _gluster_xml(cmd)
... | [
"def",
"list_quota_volume",
"(",
"name",
")",
":",
"cmd",
"=",
"'volume quota {0}'",
".",
"format",
"(",
"name",
")",
"cmd",
"+=",
"' list'",
"root",
"=",
"_gluster_xml",
"(",
"cmd",
")",
"if",
"not",
"_gluster_ok",
"(",
"root",
")",
":",
"return",
"None... | List quotas of glusterfs volume
name
Name of the gluster volume
CLI Example:
.. code-block:: bash
salt '*' glusterfs.list_quota_volume <volume> | [
"List",
"quotas",
"of",
"glusterfs",
"volume"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glusterfs.py#L693-L718 | train |
saltstack/salt | salt/modules/glusterfs.py | get_op_version | def get_op_version(name):
'''
.. versionadded:: 2019.2.0
Returns the glusterfs volume op-version
name
Name of the glusterfs volume
CLI Example:
.. code-block:: bash
salt '*' glusterfs.get_op_version <volume>
'''
cmd = 'volume get {0} cluster.op-version'.format(name)... | python | def get_op_version(name):
'''
.. versionadded:: 2019.2.0
Returns the glusterfs volume op-version
name
Name of the glusterfs volume
CLI Example:
.. code-block:: bash
salt '*' glusterfs.get_op_version <volume>
'''
cmd = 'volume get {0} cluster.op-version'.format(name)... | [
"def",
"get_op_version",
"(",
"name",
")",
":",
"cmd",
"=",
"'volume get {0} cluster.op-version'",
".",
"format",
"(",
"name",
")",
"root",
"=",
"_gluster_xml",
"(",
"cmd",
")",
"if",
"not",
"_gluster_ok",
"(",
"root",
")",
":",
"return",
"False",
",",
"ro... | .. versionadded:: 2019.2.0
Returns the glusterfs volume op-version
name
Name of the glusterfs volume
CLI Example:
.. code-block:: bash
salt '*' glusterfs.get_op_version <volume> | [
"..",
"versionadded",
"::",
"2019",
".",
"2",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glusterfs.py#L721-L753 | train |
saltstack/salt | salt/modules/glusterfs.py | get_max_op_version | def get_max_op_version():
'''
.. versionadded:: 2019.2.0
Returns the glusterfs volume's max op-version value
Requires Glusterfs version > 3.9
CLI Example:
.. code-block:: bash
salt '*' glusterfs.get_max_op_version
'''
if _get_version() < (3, 10,):
return False, 'Gluste... | python | def get_max_op_version():
'''
.. versionadded:: 2019.2.0
Returns the glusterfs volume's max op-version value
Requires Glusterfs version > 3.9
CLI Example:
.. code-block:: bash
salt '*' glusterfs.get_max_op_version
'''
if _get_version() < (3, 10,):
return False, 'Gluste... | [
"def",
"get_max_op_version",
"(",
")",
":",
"if",
"_get_version",
"(",
")",
"<",
"(",
"3",
",",
"10",
",",
")",
":",
"return",
"False",
",",
"'Glusterfs version must be 3.10+. Your version is {0}.'",
".",
"format",
"(",
"str",
"(",
"'.'",
".",
"join",
"(",
... | .. versionadded:: 2019.2.0
Returns the glusterfs volume's max op-version value
Requires Glusterfs version > 3.9
CLI Example:
.. code-block:: bash
salt '*' glusterfs.get_max_op_version | [
"..",
"versionadded",
"::",
"2019",
".",
"2",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glusterfs.py#L756-L787 | train |
saltstack/salt | salt/modules/glusterfs.py | set_op_version | def set_op_version(version):
'''
.. versionadded:: 2019.2.0
Set the glusterfs volume op-version
version
Version to set the glusterfs volume op-version
CLI Example:
.. code-block:: bash
salt '*' glusterfs.set_op_version <volume>
'''
cmd = 'volume set all cluster.op-v... | python | def set_op_version(version):
'''
.. versionadded:: 2019.2.0
Set the glusterfs volume op-version
version
Version to set the glusterfs volume op-version
CLI Example:
.. code-block:: bash
salt '*' glusterfs.set_op_version <volume>
'''
cmd = 'volume set all cluster.op-v... | [
"def",
"set_op_version",
"(",
"version",
")",
":",
"cmd",
"=",
"'volume set all cluster.op-version {0}'",
".",
"format",
"(",
"version",
")",
"root",
"=",
"_gluster_xml",
"(",
"cmd",
")",
"if",
"not",
"_gluster_ok",
"(",
"root",
")",
":",
"return",
"False",
... | .. versionadded:: 2019.2.0
Set the glusterfs volume op-version
version
Version to set the glusterfs volume op-version
CLI Example:
.. code-block:: bash
salt '*' glusterfs.set_op_version <volume> | [
"..",
"versionadded",
"::",
"2019",
".",
"2",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glusterfs.py#L790-L812 | train |
saltstack/salt | salt/modules/bower.py | _check_valid_version | def _check_valid_version():
'''
Check the version of Bower to ensure this module will work. Currently
bower must be at least version 1.3.
'''
# pylint: disable=no-member
bower_version = _LooseVersion(
__salt__['cmd.run']('bower --version'))
valid_version = _LooseVersion('1.3')
# ... | python | def _check_valid_version():
'''
Check the version of Bower to ensure this module will work. Currently
bower must be at least version 1.3.
'''
# pylint: disable=no-member
bower_version = _LooseVersion(
__salt__['cmd.run']('bower --version'))
valid_version = _LooseVersion('1.3')
# ... | [
"def",
"_check_valid_version",
"(",
")",
":",
"# pylint: disable=no-member",
"bower_version",
"=",
"_LooseVersion",
"(",
"__salt__",
"[",
"'cmd.run'",
"]",
"(",
"'bower --version'",
")",
")",
"valid_version",
"=",
"_LooseVersion",
"(",
"'1.3'",
")",
"# pylint: enable=... | Check the version of Bower to ensure this module will work. Currently
bower must be at least version 1.3. | [
"Check",
"the",
"version",
"of",
"Bower",
"to",
"ensure",
"this",
"module",
"will",
"work",
".",
"Currently",
"bower",
"must",
"be",
"at",
"least",
"version",
"1",
".",
"3",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bower.py#L41-L57 | train |
saltstack/salt | salt/modules/bower.py | _construct_bower_command | def _construct_bower_command(bower_command):
'''
Create bower command line string
'''
if not bower_command:
raise CommandExecutionError(
'bower_command, e.g. install, must be specified')
cmd = ['bower'] + shlex.split(bower_command)
cmd.extend(['--config.analytics', 'false',
... | python | def _construct_bower_command(bower_command):
'''
Create bower command line string
'''
if not bower_command:
raise CommandExecutionError(
'bower_command, e.g. install, must be specified')
cmd = ['bower'] + shlex.split(bower_command)
cmd.extend(['--config.analytics', 'false',
... | [
"def",
"_construct_bower_command",
"(",
"bower_command",
")",
":",
"if",
"not",
"bower_command",
":",
"raise",
"CommandExecutionError",
"(",
"'bower_command, e.g. install, must be specified'",
")",
"cmd",
"=",
"[",
"'bower'",
"]",
"+",
"shlex",
".",
"split",
"(",
"b... | Create bower command line string | [
"Create",
"bower",
"command",
"line",
"string"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bower.py#L60-L72 | train |
saltstack/salt | salt/modules/bower.py | install | def install(pkg,
dir,
pkgs=None,
runas=None,
env=None):
'''
Install a Bower package.
If no package is specified, the dependencies (from bower.json) of the
package in the given directory will be installed.
pkg
A package name in any format acce... | python | def install(pkg,
dir,
pkgs=None,
runas=None,
env=None):
'''
Install a Bower package.
If no package is specified, the dependencies (from bower.json) of the
package in the given directory will be installed.
pkg
A package name in any format acce... | [
"def",
"install",
"(",
"pkg",
",",
"dir",
",",
"pkgs",
"=",
"None",
",",
"runas",
"=",
"None",
",",
"env",
"=",
"None",
")",
":",
"_check_valid_version",
"(",
")",
"cmd",
"=",
"_construct_bower_command",
"(",
"'install'",
")",
"if",
"pkg",
":",
"cmd",
... | Install a Bower package.
If no package is specified, the dependencies (from bower.json) of the
package in the given directory will be installed.
pkg
A package name in any format accepted by Bower, including a version
identifier
dir
The target directory in which to install the ... | [
"Install",
"a",
"Bower",
"package",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bower.py#L75-L133 | train |
saltstack/salt | salt/modules/linux_sysctl.py | default_config | def default_config():
'''
Linux hosts using systemd 207 or later ignore ``/etc/sysctl.conf`` and only
load from ``/etc/sysctl.d/*.conf``. This function will do the proper checks
and return a default config file which will be valid for the Minion. Hosts
running systemd >= 207 will use ``/etc/sysctl.d... | python | def default_config():
'''
Linux hosts using systemd 207 or later ignore ``/etc/sysctl.conf`` and only
load from ``/etc/sysctl.d/*.conf``. This function will do the proper checks
and return a default config file which will be valid for the Minion. Hosts
running systemd >= 207 will use ``/etc/sysctl.d... | [
"def",
"default_config",
"(",
")",
":",
"if",
"salt",
".",
"utils",
".",
"systemd",
".",
"booted",
"(",
"__context__",
")",
"and",
"salt",
".",
"utils",
".",
"systemd",
".",
"version",
"(",
"__context__",
")",
">=",
"207",
":",
"return",
"'/etc/sysctl.d/... | Linux hosts using systemd 207 or later ignore ``/etc/sysctl.conf`` and only
load from ``/etc/sysctl.d/*.conf``. This function will do the proper checks
and return a default config file which will be valid for the Minion. Hosts
running systemd >= 207 will use ``/etc/sysctl.d/99-salt.conf``.
CLI Example:... | [
"Linux",
"hosts",
"using",
"systemd",
"207",
"or",
"later",
"ignore",
"/",
"etc",
"/",
"sysctl",
".",
"conf",
"and",
"only",
"load",
"from",
"/",
"etc",
"/",
"sysctl",
".",
"d",
"/",
"*",
".",
"conf",
".",
"This",
"function",
"will",
"do",
"the",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/linux_sysctl.py#L40-L56 | train |
saltstack/salt | salt/modules/linux_sysctl.py | show | def show(config_file=False):
'''
Return a list of sysctl parameters for this minion
config: Pull the data from the system configuration file
instead of the live data.
CLI Example:
.. code-block:: bash
salt '*' sysctl.show
'''
ret = {}
if config_file:
# If the ... | python | def show(config_file=False):
'''
Return a list of sysctl parameters for this minion
config: Pull the data from the system configuration file
instead of the live data.
CLI Example:
.. code-block:: bash
salt '*' sysctl.show
'''
ret = {}
if config_file:
# If the ... | [
"def",
"show",
"(",
"config_file",
"=",
"False",
")",
":",
"ret",
"=",
"{",
"}",
"if",
"config_file",
":",
"# If the file doesn't exist, return an empty list",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"config_file",
")",
":",
"return",
"[",
"]",
... | Return a list of sysctl parameters for this minion
config: Pull the data from the system configuration file
instead of the live data.
CLI Example:
.. code-block:: bash
salt '*' sysctl.show | [
"Return",
"a",
"list",
"of",
"sysctl",
"parameters",
"for",
"this",
"minion"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/linux_sysctl.py#L59-L102 | train |
saltstack/salt | salt/modules/linux_sysctl.py | assign | def assign(name, value):
'''
Assign a single sysctl parameter for this minion
CLI Example:
.. code-block:: bash
salt '*' sysctl.assign net.ipv4.ip_forward 1
'''
value = six.text_type(value)
if six.PY3:
tran_tab = name.translate(''.maketrans('./', '/.'))
else:
... | python | def assign(name, value):
'''
Assign a single sysctl parameter for this minion
CLI Example:
.. code-block:: bash
salt '*' sysctl.assign net.ipv4.ip_forward 1
'''
value = six.text_type(value)
if six.PY3:
tran_tab = name.translate(''.maketrans('./', '/.'))
else:
... | [
"def",
"assign",
"(",
"name",
",",
"value",
")",
":",
"value",
"=",
"six",
".",
"text_type",
"(",
"value",
")",
"if",
"six",
".",
"PY3",
":",
"tran_tab",
"=",
"name",
".",
"translate",
"(",
"''",
".",
"maketrans",
"(",
"'./'",
",",
"'/.'",
")",
"... | Assign a single sysctl parameter for this minion
CLI Example:
.. code-block:: bash
salt '*' sysctl.assign net.ipv4.ip_forward 1 | [
"Assign",
"a",
"single",
"sysctl",
"parameter",
"for",
"this",
"minion"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/linux_sysctl.py#L120-L164 | train |
saltstack/salt | salt/modules/linux_sysctl.py | persist | def persist(name, value, config=None):
'''
Assign and persist a simple sysctl parameter for this minion. If ``config``
is not specified, a sensible default will be chosen using
:mod:`sysctl.default_config <salt.modules.linux_sysctl.default_config>`.
CLI Example:
.. code-block:: bash
s... | python | def persist(name, value, config=None):
'''
Assign and persist a simple sysctl parameter for this minion. If ``config``
is not specified, a sensible default will be chosen using
:mod:`sysctl.default_config <salt.modules.linux_sysctl.default_config>`.
CLI Example:
.. code-block:: bash
s... | [
"def",
"persist",
"(",
"name",
",",
"value",
",",
"config",
"=",
"None",
")",
":",
"if",
"config",
"is",
"None",
":",
"config",
"=",
"default_config",
"(",
")",
"edited",
"=",
"False",
"# If the sysctl.conf is not present, add it",
"if",
"not",
"os",
".",
... | Assign and persist a simple sysctl parameter for this minion. If ``config``
is not specified, a sensible default will be chosen using
:mod:`sysctl.default_config <salt.modules.linux_sysctl.default_config>`.
CLI Example:
.. code-block:: bash
salt '*' sysctl.persist net.ipv4.ip_forward 1 | [
"Assign",
"and",
"persist",
"a",
"simple",
"sysctl",
"parameter",
"for",
"this",
"minion",
".",
"If",
"config",
"is",
"not",
"specified",
"a",
"sensible",
"default",
"will",
"be",
"chosen",
"using",
":",
"mod",
":",
"sysctl",
".",
"default_config",
"<salt",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/linux_sysctl.py#L167-L256 | train |
saltstack/salt | salt/pillar/mongo.py | ext_pillar | def ext_pillar(minion_id,
pillar, # pylint: disable=W0613
collection='pillar',
id_field='_id',
re_pattern=None,
re_replace='',
fields=None):
'''
Connect to a mongo database and read per-node pillar information.
Param... | python | def ext_pillar(minion_id,
pillar, # pylint: disable=W0613
collection='pillar',
id_field='_id',
re_pattern=None,
re_replace='',
fields=None):
'''
Connect to a mongo database and read per-node pillar information.
Param... | [
"def",
"ext_pillar",
"(",
"minion_id",
",",
"pillar",
",",
"# pylint: disable=W0613",
"collection",
"=",
"'pillar'",
",",
"id_field",
"=",
"'_id'",
",",
"re_pattern",
"=",
"None",
",",
"re_replace",
"=",
"''",
",",
"fields",
"=",
"None",
")",
":",
"host",
... | Connect to a mongo database and read per-node pillar information.
Parameters:
* `collection`: The mongodb collection to read data from. Defaults to
``'pillar'``.
* `id_field`: The field in the collection that represents an individual
minion id. Defaults to ``'_id'``.
* `... | [
"Connect",
"to",
"a",
"mongo",
"database",
"and",
"read",
"per",
"-",
"node",
"pillar",
"information",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/mongo.py#L89-L165 | train |
saltstack/salt | salt/utils/xmlutil.py | _conv_name | def _conv_name(x):
'''
If this XML tree has an xmlns attribute, then etree will add it
to the beginning of the tag, like: "{http://path}tag".
'''
if '}' in x:
comps = x.split('}')
name = comps[1]
return name
return x | python | def _conv_name(x):
'''
If this XML tree has an xmlns attribute, then etree will add it
to the beginning of the tag, like: "{http://path}tag".
'''
if '}' in x:
comps = x.split('}')
name = comps[1]
return name
return x | [
"def",
"_conv_name",
"(",
"x",
")",
":",
"if",
"'}'",
"in",
"x",
":",
"comps",
"=",
"x",
".",
"split",
"(",
"'}'",
")",
"name",
"=",
"comps",
"[",
"1",
"]",
"return",
"name",
"return",
"x"
] | If this XML tree has an xmlns attribute, then etree will add it
to the beginning of the tag, like: "{http://path}tag". | [
"If",
"this",
"XML",
"tree",
"has",
"an",
"xmlns",
"attribute",
"then",
"etree",
"will",
"add",
"it",
"to",
"the",
"beginning",
"of",
"the",
"tag",
"like",
":",
"{",
"http",
":",
"//",
"path",
"}",
"tag",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/xmlutil.py#L10-L19 | train |
saltstack/salt | salt/utils/xmlutil.py | _to_dict | def _to_dict(xmltree):
'''
Converts an XML ElementTree to a dictionary that only contains items.
This is the default behavior in version 2017.7. This will default to prevent
unexpected parsing issues on modules dependant on this.
'''
# If this object has no children, the for..loop below will ret... | python | def _to_dict(xmltree):
'''
Converts an XML ElementTree to a dictionary that only contains items.
This is the default behavior in version 2017.7. This will default to prevent
unexpected parsing issues on modules dependant on this.
'''
# If this object has no children, the for..loop below will ret... | [
"def",
"_to_dict",
"(",
"xmltree",
")",
":",
"# If this object has no children, the for..loop below will return nothing",
"# for it, so just return a single dict representing it.",
"if",
"not",
"xmltree",
".",
"getchildren",
"(",
")",
":",
"name",
"=",
"_conv_name",
"(",
"xml... | Converts an XML ElementTree to a dictionary that only contains items.
This is the default behavior in version 2017.7. This will default to prevent
unexpected parsing issues on modules dependant on this. | [
"Converts",
"an",
"XML",
"ElementTree",
"to",
"a",
"dictionary",
"that",
"only",
"contains",
"items",
".",
"This",
"is",
"the",
"default",
"behavior",
"in",
"version",
"2017",
".",
"7",
".",
"This",
"will",
"default",
"to",
"prevent",
"unexpected",
"parsing"... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/xmlutil.py#L22-L50 | train |
saltstack/salt | salt/utils/xmlutil.py | _to_full_dict | def _to_full_dict(xmltree):
'''
Returns the full XML dictionary including attributes.
'''
xmldict = {}
for attrName, attrValue in xmltree.attrib.items():
xmldict[attrName] = attrValue
if not xmltree.getchildren():
if not xmldict:
# If we don't have attributes, we sh... | python | def _to_full_dict(xmltree):
'''
Returns the full XML dictionary including attributes.
'''
xmldict = {}
for attrName, attrValue in xmltree.attrib.items():
xmldict[attrName] = attrValue
if not xmltree.getchildren():
if not xmldict:
# If we don't have attributes, we sh... | [
"def",
"_to_full_dict",
"(",
"xmltree",
")",
":",
"xmldict",
"=",
"{",
"}",
"for",
"attrName",
",",
"attrValue",
"in",
"xmltree",
".",
"attrib",
".",
"items",
"(",
")",
":",
"xmldict",
"[",
"attrName",
"]",
"=",
"attrValue",
"if",
"not",
"xmltree",
"."... | Returns the full XML dictionary including attributes. | [
"Returns",
"the",
"full",
"XML",
"dictionary",
"including",
"attributes",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/xmlutil.py#L53-L86 | train |
saltstack/salt | salt/states/stateconf.py | _no_op | def _no_op(name, **kwargs):
'''
No-op state to support state config via the stateconf renderer.
'''
return dict(name=name, result=True, changes={}, comment='') | python | def _no_op(name, **kwargs):
'''
No-op state to support state config via the stateconf renderer.
'''
return dict(name=name, result=True, changes={}, comment='') | [
"def",
"_no_op",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"dict",
"(",
"name",
"=",
"name",
",",
"result",
"=",
"True",
",",
"changes",
"=",
"{",
"}",
",",
"comment",
"=",
"''",
")"
] | No-op state to support state config via the stateconf renderer. | [
"No",
"-",
"op",
"state",
"to",
"support",
"state",
"config",
"via",
"the",
"stateconf",
"renderer",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/stateconf.py#L13-L17 | train |
saltstack/salt | salt/modules/dockermod.py | _get_state | def _get_state(inspect_results):
'''
Helper for deriving the current state of the container from the inspect
results.
'''
if inspect_results.get('State', {}).get('Paused', False):
return 'paused'
elif inspect_results.get('State', {}).get('Running', False):
return 'running'
el... | python | def _get_state(inspect_results):
'''
Helper for deriving the current state of the container from the inspect
results.
'''
if inspect_results.get('State', {}).get('Paused', False):
return 'paused'
elif inspect_results.get('State', {}).get('Running', False):
return 'running'
el... | [
"def",
"_get_state",
"(",
"inspect_results",
")",
":",
"if",
"inspect_results",
".",
"get",
"(",
"'State'",
",",
"{",
"}",
")",
".",
"get",
"(",
"'Paused'",
",",
"False",
")",
":",
"return",
"'paused'",
"elif",
"inspect_results",
".",
"get",
"(",
"'State... | Helper for deriving the current state of the container from the inspect
results. | [
"Helper",
"for",
"deriving",
"the",
"current",
"state",
"of",
"the",
"container",
"from",
"the",
"inspect",
"results",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L395-L405 | train |
saltstack/salt | salt/modules/dockermod.py | _docker_client | def _docker_client(wrapped):
'''
Decorator to run a function that requires the use of a docker.Client()
instance.
'''
@functools.wraps(wrapped)
def wrapper(*args, **kwargs):
'''
Ensure that the client is present
'''
kwargs = __utils__['args.clean_kwargs'](**kwargs... | python | def _docker_client(wrapped):
'''
Decorator to run a function that requires the use of a docker.Client()
instance.
'''
@functools.wraps(wrapped)
def wrapper(*args, **kwargs):
'''
Ensure that the client is present
'''
kwargs = __utils__['args.clean_kwargs'](**kwargs... | [
"def",
"_docker_client",
"(",
"wrapped",
")",
":",
"@",
"functools",
".",
"wraps",
"(",
"wrapped",
")",
"def",
"wrapper",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"'''\n Ensure that the client is present\n '''",
"kwargs",
"=",
"__utils_... | Decorator to run a function that requires the use of a docker.Client()
instance. | [
"Decorator",
"to",
"run",
"a",
"function",
"that",
"requires",
"the",
"use",
"of",
"a",
"docker",
".",
"Client",
"()",
"instance",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L409-L436 | train |
saltstack/salt | salt/modules/dockermod.py | _refresh_mine_cache | def _refresh_mine_cache(wrapped):
'''
Decorator to trigger a refresh of salt mine data.
'''
@functools.wraps(wrapped)
def wrapper(*args, **kwargs):
'''
refresh salt mine on exit.
'''
returned = wrapped(*args, **__utils__['args.clean_kwargs'](**kwargs))
if _che... | python | def _refresh_mine_cache(wrapped):
'''
Decorator to trigger a refresh of salt mine data.
'''
@functools.wraps(wrapped)
def wrapper(*args, **kwargs):
'''
refresh salt mine on exit.
'''
returned = wrapped(*args, **__utils__['args.clean_kwargs'](**kwargs))
if _che... | [
"def",
"_refresh_mine_cache",
"(",
"wrapped",
")",
":",
"@",
"functools",
".",
"wraps",
"(",
"wrapped",
")",
"def",
"wrapper",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"'''\n refresh salt mine on exit.\n '''",
"returned",
"=",
"wrapped"... | Decorator to trigger a refresh of salt mine data. | [
"Decorator",
"to",
"trigger",
"a",
"refresh",
"of",
"salt",
"mine",
"data",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L439-L453 | train |
saltstack/salt | salt/modules/dockermod.py | _change_state | def _change_state(name, action, expected, *args, **kwargs):
'''
Change the state of a container
'''
pre = state(name)
if action != 'restart' and pre == expected:
return {'result': False,
'state': {'old': expected, 'new': expected},
'comment': ('Container \'{0}... | python | def _change_state(name, action, expected, *args, **kwargs):
'''
Change the state of a container
'''
pre = state(name)
if action != 'restart' and pre == expected:
return {'result': False,
'state': {'old': expected, 'new': expected},
'comment': ('Container \'{0}... | [
"def",
"_change_state",
"(",
"name",
",",
"action",
",",
"expected",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"pre",
"=",
"state",
"(",
"name",
")",
"if",
"action",
"!=",
"'restart'",
"and",
"pre",
"==",
"expected",
":",
"return",
"{",
... | Change the state of a container | [
"Change",
"the",
"state",
"of",
"a",
"container"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L466-L485 | train |
saltstack/salt | salt/modules/dockermod.py | _get_md5 | def _get_md5(name, path):
'''
Get the MD5 checksum of a file from a container
'''
output = run_stdout(name,
'md5sum {0}'.format(pipes.quote(path)),
ignore_retcode=True)
try:
return output.split()[0]
except IndexError:
# Destination ... | python | def _get_md5(name, path):
'''
Get the MD5 checksum of a file from a container
'''
output = run_stdout(name,
'md5sum {0}'.format(pipes.quote(path)),
ignore_retcode=True)
try:
return output.split()[0]
except IndexError:
# Destination ... | [
"def",
"_get_md5",
"(",
"name",
",",
"path",
")",
":",
"output",
"=",
"run_stdout",
"(",
"name",
",",
"'md5sum {0}'",
".",
"format",
"(",
"pipes",
".",
"quote",
"(",
"path",
")",
")",
",",
"ignore_retcode",
"=",
"True",
")",
"try",
":",
"return",
"ou... | Get the MD5 checksum of a file from a container | [
"Get",
"the",
"MD5",
"checksum",
"of",
"a",
"file",
"from",
"a",
"container"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L507-L518 | train |
saltstack/salt | salt/modules/dockermod.py | _get_exec_driver | def _get_exec_driver():
'''
Get the method to be used in shell commands
'''
contextkey = 'docker.exec_driver'
if contextkey not in __context__:
from_config = __salt__['config.get'](contextkey, None)
# This if block can be removed once we make docker-exec a default
# option, a... | python | def _get_exec_driver():
'''
Get the method to be used in shell commands
'''
contextkey = 'docker.exec_driver'
if contextkey not in __context__:
from_config = __salt__['config.get'](contextkey, None)
# This if block can be removed once we make docker-exec a default
# option, a... | [
"def",
"_get_exec_driver",
"(",
")",
":",
"contextkey",
"=",
"'docker.exec_driver'",
"if",
"contextkey",
"not",
"in",
"__context__",
":",
"from_config",
"=",
"__salt__",
"[",
"'config.get'",
"]",
"(",
"contextkey",
",",
"None",
")",
"# This if block can be removed o... | Get the method to be used in shell commands | [
"Get",
"the",
"method",
"to",
"be",
"used",
"in",
"shell",
"commands"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L521-L556 | train |
saltstack/salt | salt/modules/dockermod.py | _get_top_level_images | def _get_top_level_images(imagedata, subset=None):
'''
Returns a list of the top-level images (those which are not parents). If
``subset`` (an iterable) is passed, the top-level images in the subset will
be returned, otherwise all top-level images will be returned.
'''
try:
parents = [im... | python | def _get_top_level_images(imagedata, subset=None):
'''
Returns a list of the top-level images (those which are not parents). If
``subset`` (an iterable) is passed, the top-level images in the subset will
be returned, otherwise all top-level images will be returned.
'''
try:
parents = [im... | [
"def",
"_get_top_level_images",
"(",
"imagedata",
",",
"subset",
"=",
"None",
")",
":",
"try",
":",
"parents",
"=",
"[",
"imagedata",
"[",
"x",
"]",
"[",
"'ParentId'",
"]",
"for",
"x",
"in",
"imagedata",
"]",
"filter_",
"=",
"subset",
"if",
"subset",
"... | Returns a list of the top-level images (those which are not parents). If
``subset`` (an iterable) is passed, the top-level images in the subset will
be returned, otherwise all top-level images will be returned. | [
"Returns",
"a",
"list",
"of",
"the",
"top",
"-",
"level",
"images",
"(",
"those",
"which",
"are",
"not",
"parents",
")",
".",
"If",
"subset",
"(",
"an",
"iterable",
")",
"is",
"passed",
"the",
"top",
"-",
"level",
"images",
"in",
"the",
"subset",
"wi... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L559-L573 | train |
saltstack/salt | salt/modules/dockermod.py | _scrub_links | def _scrub_links(links, name):
'''
Remove container name from HostConfig:Links values to enable comparing
container configurations correctly.
'''
if isinstance(links, list):
ret = []
for l in links:
ret.append(l.replace('/{0}/'.format(name), '/', 1))
else:
ret... | python | def _scrub_links(links, name):
'''
Remove container name from HostConfig:Links values to enable comparing
container configurations correctly.
'''
if isinstance(links, list):
ret = []
for l in links:
ret.append(l.replace('/{0}/'.format(name), '/', 1))
else:
ret... | [
"def",
"_scrub_links",
"(",
"links",
",",
"name",
")",
":",
"if",
"isinstance",
"(",
"links",
",",
"list",
")",
":",
"ret",
"=",
"[",
"]",
"for",
"l",
"in",
"links",
":",
"ret",
".",
"append",
"(",
"l",
".",
"replace",
"(",
"'/{0}/'",
".",
"forma... | Remove container name from HostConfig:Links values to enable comparing
container configurations correctly. | [
"Remove",
"container",
"name",
"from",
"HostConfig",
":",
"Links",
"values",
"to",
"enable",
"comparing",
"container",
"configurations",
"correctly",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L584-L596 | train |
saltstack/salt | salt/modules/dockermod.py | _size_fmt | def _size_fmt(num):
'''
Format bytes as human-readable file sizes
'''
try:
num = int(num)
if num < 1024:
return '{0} bytes'.format(num)
num /= 1024.0
for unit in ('KiB', 'MiB', 'GiB', 'TiB', 'PiB'):
if num < 1024.0:
return '{0:3.1f}... | python | def _size_fmt(num):
'''
Format bytes as human-readable file sizes
'''
try:
num = int(num)
if num < 1024:
return '{0} bytes'.format(num)
num /= 1024.0
for unit in ('KiB', 'MiB', 'GiB', 'TiB', 'PiB'):
if num < 1024.0:
return '{0:3.1f}... | [
"def",
"_size_fmt",
"(",
"num",
")",
":",
"try",
":",
"num",
"=",
"int",
"(",
"num",
")",
"if",
"num",
"<",
"1024",
":",
"return",
"'{0} bytes'",
".",
"format",
"(",
"num",
")",
"num",
"/=",
"1024.0",
"for",
"unit",
"in",
"(",
"'KiB'",
",",
"'MiB... | Format bytes as human-readable file sizes | [
"Format",
"bytes",
"as",
"human",
"-",
"readable",
"file",
"sizes"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L608-L623 | train |
saltstack/salt | salt/modules/dockermod.py | _client_wrapper | def _client_wrapper(attr, *args, **kwargs):
'''
Common functionality for running low-level API calls
'''
catch_api_errors = kwargs.pop('catch_api_errors', True)
func = getattr(__context__['docker.client'], attr, None)
if func is None or not hasattr(func, '__call__'):
raise SaltInvocation... | python | def _client_wrapper(attr, *args, **kwargs):
'''
Common functionality for running low-level API calls
'''
catch_api_errors = kwargs.pop('catch_api_errors', True)
func = getattr(__context__['docker.client'], attr, None)
if func is None or not hasattr(func, '__call__'):
raise SaltInvocation... | [
"def",
"_client_wrapper",
"(",
"attr",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"catch_api_errors",
"=",
"kwargs",
".",
"pop",
"(",
"'catch_api_errors'",
",",
"True",
")",
"func",
"=",
"getattr",
"(",
"__context__",
"[",
"'docker.client'",
"]",... | Common functionality for running low-level API calls | [
"Common",
"functionality",
"for",
"running",
"low",
"-",
"level",
"API",
"calls"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L627-L671 | train |
saltstack/salt | salt/modules/dockermod.py | _build_status | def _build_status(data, item):
'''
Process a status update from a docker build, updating the data structure
'''
stream = item['stream']
if 'Running in' in stream:
data.setdefault('Intermediate_Containers', []).append(
stream.rstrip().split()[-1])
if 'Successfully built' in st... | python | def _build_status(data, item):
'''
Process a status update from a docker build, updating the data structure
'''
stream = item['stream']
if 'Running in' in stream:
data.setdefault('Intermediate_Containers', []).append(
stream.rstrip().split()[-1])
if 'Successfully built' in st... | [
"def",
"_build_status",
"(",
"data",
",",
"item",
")",
":",
"stream",
"=",
"item",
"[",
"'stream'",
"]",
"if",
"'Running in'",
"in",
"stream",
":",
"data",
".",
"setdefault",
"(",
"'Intermediate_Containers'",
",",
"[",
"]",
")",
".",
"append",
"(",
"stre... | Process a status update from a docker build, updating the data structure | [
"Process",
"a",
"status",
"update",
"from",
"a",
"docker",
"build",
"updating",
"the",
"data",
"structure"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L674-L683 | train |
saltstack/salt | salt/modules/dockermod.py | _import_status | def _import_status(data, item, repo_name, repo_tag):
'''
Process a status update from docker import, updating the data structure
'''
status = item['status']
try:
if 'Downloading from' in status:
return
elif all(x in string.hexdigits for x in status):
# Status ... | python | def _import_status(data, item, repo_name, repo_tag):
'''
Process a status update from docker import, updating the data structure
'''
status = item['status']
try:
if 'Downloading from' in status:
return
elif all(x in string.hexdigits for x in status):
# Status ... | [
"def",
"_import_status",
"(",
"data",
",",
"item",
",",
"repo_name",
",",
"repo_tag",
")",
":",
"status",
"=",
"item",
"[",
"'status'",
"]",
"try",
":",
"if",
"'Downloading from'",
"in",
"status",
":",
"return",
"elif",
"all",
"(",
"x",
"in",
"string",
... | Process a status update from docker import, updating the data structure | [
"Process",
"a",
"status",
"update",
"from",
"docker",
"import",
"updating",
"the",
"data",
"structure"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L686-L699 | train |
saltstack/salt | salt/modules/dockermod.py | _pull_status | def _pull_status(data, item):
'''
Process a status update from a docker pull, updating the data structure.
For containers created with older versions of Docker, there is no
distinction in the status updates between layers that were already present
(and thus not necessary to download), and those whi... | python | def _pull_status(data, item):
'''
Process a status update from a docker pull, updating the data structure.
For containers created with older versions of Docker, there is no
distinction in the status updates between layers that were already present
(and thus not necessary to download), and those whi... | [
"def",
"_pull_status",
"(",
"data",
",",
"item",
")",
":",
"def",
"_already_exists",
"(",
"id_",
")",
":",
"'''\n Layer already exists\n '''",
"already_pulled",
"=",
"data",
".",
"setdefault",
"(",
"'Layers'",
",",
"{",
"}",
")",
".",
"setdefault",... | Process a status update from a docker pull, updating the data structure.
For containers created with older versions of Docker, there is no
distinction in the status updates between layers that were already present
(and thus not necessary to download), and those which were actually
downloaded. Because o... | [
"Process",
"a",
"status",
"update",
"from",
"a",
"docker",
"pull",
"updating",
"the",
"data",
"structure",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L702-L759 | train |
saltstack/salt | salt/modules/dockermod.py | _push_status | def _push_status(data, item):
'''
Process a status update from a docker push, updating the data structure
'''
status = item['status'].lower()
if 'id' in item:
if 'already pushed' in status or 'already exists' in status:
# Layer already exists
already_pushed = data.set... | python | def _push_status(data, item):
'''
Process a status update from a docker push, updating the data structure
'''
status = item['status'].lower()
if 'id' in item:
if 'already pushed' in status or 'already exists' in status:
# Layer already exists
already_pushed = data.set... | [
"def",
"_push_status",
"(",
"data",
",",
"item",
")",
":",
"status",
"=",
"item",
"[",
"'status'",
"]",
".",
"lower",
"(",
")",
"if",
"'id'",
"in",
"item",
":",
"if",
"'already pushed'",
"in",
"status",
"or",
"'already exists'",
"in",
"status",
":",
"#... | Process a status update from a docker push, updating the data structure | [
"Process",
"a",
"status",
"update",
"from",
"a",
"docker",
"push",
"updating",
"the",
"data",
"structure"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L762-L777 | train |
saltstack/salt | salt/modules/dockermod.py | _error_detail | def _error_detail(data, item):
'''
Process an API error, updating the data structure
'''
err = item['errorDetail']
if 'code' in err:
try:
msg = ': '.join((
item['errorDetail']['code'],
item['errorDetail']['message']
))
except Ty... | python | def _error_detail(data, item):
'''
Process an API error, updating the data structure
'''
err = item['errorDetail']
if 'code' in err:
try:
msg = ': '.join((
item['errorDetail']['code'],
item['errorDetail']['message']
))
except Ty... | [
"def",
"_error_detail",
"(",
"data",
",",
"item",
")",
":",
"err",
"=",
"item",
"[",
"'errorDetail'",
"]",
"if",
"'code'",
"in",
"err",
":",
"try",
":",
"msg",
"=",
"': '",
".",
"join",
"(",
"(",
"item",
"[",
"'errorDetail'",
"]",
"[",
"'code'",
"]... | Process an API error, updating the data structure | [
"Process",
"an",
"API",
"error",
"updating",
"the",
"data",
"structure"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L780-L798 | train |
saltstack/salt | salt/modules/dockermod.py | _get_create_kwargs | def _get_create_kwargs(skip_translate=None,
ignore_collisions=False,
validate_ip_addrs=True,
client_args=None,
**kwargs):
'''
Take input kwargs and return a kwargs dict to pass to docker-py's
create_container() funct... | python | def _get_create_kwargs(skip_translate=None,
ignore_collisions=False,
validate_ip_addrs=True,
client_args=None,
**kwargs):
'''
Take input kwargs and return a kwargs dict to pass to docker-py's
create_container() funct... | [
"def",
"_get_create_kwargs",
"(",
"skip_translate",
"=",
"None",
",",
"ignore_collisions",
"=",
"False",
",",
"validate_ip_addrs",
"=",
"True",
",",
"client_args",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"networks",
"=",
"kwargs",
".",
"pop",
"(",
... | Take input kwargs and return a kwargs dict to pass to docker-py's
create_container() function. | [
"Take",
"input",
"kwargs",
"and",
"return",
"a",
"kwargs",
"dict",
"to",
"pass",
"to",
"docker",
"-",
"py",
"s",
"create_container",
"()",
"function",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L852-L907 | train |
saltstack/salt | salt/modules/dockermod.py | compare_containers | def compare_containers(first, second, ignore=None):
'''
.. versionadded:: 2017.7.0
.. versionchanged:: 2018.3.0
Renamed from ``docker.compare_container`` to
``docker.compare_containers`` (old function name remains as an alias)
Compare two containers' Config and and HostConfig and return... | python | def compare_containers(first, second, ignore=None):
'''
.. versionadded:: 2017.7.0
.. versionchanged:: 2018.3.0
Renamed from ``docker.compare_container`` to
``docker.compare_containers`` (old function name remains as an alias)
Compare two containers' Config and and HostConfig and return... | [
"def",
"compare_containers",
"(",
"first",
",",
"second",
",",
"ignore",
"=",
"None",
")",
":",
"ignore",
"=",
"__utils__",
"[",
"'args.split_input'",
"]",
"(",
"ignore",
"or",
"[",
"]",
")",
"result1",
"=",
"inspect_container",
"(",
"first",
")",
"result2... | .. versionadded:: 2017.7.0
.. versionchanged:: 2018.3.0
Renamed from ``docker.compare_container`` to
``docker.compare_containers`` (old function name remains as an alias)
Compare two containers' Config and and HostConfig and return any
differences between the two.
first
Name or... | [
"..",
"versionadded",
"::",
"2017",
".",
"7",
".",
"0",
"..",
"versionchanged",
"::",
"2018",
".",
"3",
".",
"0",
"Renamed",
"from",
"docker",
".",
"compare_container",
"to",
"docker",
".",
"compare_containers",
"(",
"old",
"function",
"name",
"remains",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L910-L1004 | train |
saltstack/salt | salt/modules/dockermod.py | compare_container_networks | def compare_container_networks(first, second):
'''
.. versionadded:: 2018.3.0
Returns the differences between two containers' networks. When a network is
only present one of the two containers, that network's diff will simply be
represented with ``True`` for the side of the diff in which the networ... | python | def compare_container_networks(first, second):
'''
.. versionadded:: 2018.3.0
Returns the differences between two containers' networks. When a network is
only present one of the two containers, that network's diff will simply be
represented with ``True`` for the side of the diff in which the networ... | [
"def",
"compare_container_networks",
"(",
"first",
",",
"second",
")",
":",
"def",
"_get_nets",
"(",
"data",
")",
":",
"return",
"data",
".",
"get",
"(",
"'NetworkSettings'",
",",
"{",
"}",
")",
".",
"get",
"(",
"'Networks'",
",",
"{",
"}",
")",
"compa... | .. versionadded:: 2018.3.0
Returns the differences between two containers' networks. When a network is
only present one of the two containers, that network's diff will simply be
represented with ``True`` for the side of the diff in which the network is
present) and ``False`` for the side of the diff in... | [
"..",
"versionadded",
"::",
"2018",
".",
"3",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L1012-L1248 | train |
saltstack/salt | salt/modules/dockermod.py | compare_networks | def compare_networks(first, second, ignore='Name,Id,Created,Containers'):
'''
.. versionadded:: 2018.3.0
Compare two networks and return any differences between the two
first
Name or ID of first container
second
Name or ID of second container
ignore : Name,Id,Created,Containe... | python | def compare_networks(first, second, ignore='Name,Id,Created,Containers'):
'''
.. versionadded:: 2018.3.0
Compare two networks and return any differences between the two
first
Name or ID of first container
second
Name or ID of second container
ignore : Name,Id,Created,Containe... | [
"def",
"compare_networks",
"(",
"first",
",",
"second",
",",
"ignore",
"=",
"'Name,Id,Created,Containers'",
")",
":",
"ignore",
"=",
"__utils__",
"[",
"'args.split_input'",
"]",
"(",
"ignore",
"or",
"[",
"]",
")",
"net1",
"=",
"inspect_network",
"(",
"first",
... | .. versionadded:: 2018.3.0
Compare two networks and return any differences between the two
first
Name or ID of first container
second
Name or ID of second container
ignore : Name,Id,Created,Containers
A comma-separated list (or Python list) of keys to ignore when
comp... | [
"..",
"versionadded",
"::",
"2018",
".",
"3",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L1251-L1322 | train |
saltstack/salt | salt/modules/dockermod.py | connected | def connected(name, verbose=False):
'''
.. versionadded:: 2018.3.0
Return a list of running containers attached to the specified network
name
Network name
verbose : False
If ``True``, return extended info about each container (IP
configuration, etc.)
CLI Example:
... | python | def connected(name, verbose=False):
'''
.. versionadded:: 2018.3.0
Return a list of running containers attached to the specified network
name
Network name
verbose : False
If ``True``, return extended info about each container (IP
configuration, etc.)
CLI Example:
... | [
"def",
"connected",
"(",
"name",
",",
"verbose",
"=",
"False",
")",
":",
"containers",
"=",
"inspect_network",
"(",
"name",
")",
".",
"get",
"(",
"'Containers'",
",",
"{",
"}",
")",
"ret",
"=",
"{",
"}",
"for",
"cid",
",",
"cinfo",
"in",
"six",
"."... | .. versionadded:: 2018.3.0
Return a list of running containers attached to the specified network
name
Network name
verbose : False
If ``True``, return extended info about each container (IP
configuration, etc.)
CLI Example:
.. code-block:: bash
salt myminion doc... | [
"..",
"versionadded",
"::",
"2018",
".",
"3",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L1325-L1366 | train |
saltstack/salt | salt/modules/dockermod.py | login | def login(*registries):
'''
.. versionadded:: 2016.3.7,2016.11.4,2017.7.0
Performs a ``docker login`` to authenticate to one or more configured
repositories. See the documentation at the top of this page to configure
authentication credentials.
Multiple registry URLs (matching those configured... | python | def login(*registries):
'''
.. versionadded:: 2016.3.7,2016.11.4,2017.7.0
Performs a ``docker login`` to authenticate to one or more configured
repositories. See the documentation at the top of this page to configure
authentication credentials.
Multiple registry URLs (matching those configured... | [
"def",
"login",
"(",
"*",
"registries",
")",
":",
"# NOTE: This function uses the \"docker login\" CLI command so that login",
"# information is added to the config.json, since docker-py isn't designed",
"# to do so.",
"registry_auth",
"=",
"__pillar__",
".",
"get",
"(",
"'docker-reg... | .. versionadded:: 2016.3.7,2016.11.4,2017.7.0
Performs a ``docker login`` to authenticate to one or more configured
repositories. See the documentation at the top of this page to configure
authentication credentials.
Multiple registry URLs (matching those configured in Pillar) can be passed,
and S... | [
"..",
"versionadded",
"::",
"2016",
".",
"3",
".",
"7",
"2016",
".",
"11",
".",
"4",
"2017",
".",
"7",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L1369-L1465 | train |
saltstack/salt | salt/modules/dockermod.py | depends | def depends(name):
'''
Returns the containers and images, if any, which depend on the given image
name
Name or ID of image
**RETURN DATA**
A dictionary containing the following keys:
- ``Containers`` - A list of containers which depend on the specified image
- ``Images`` - A lis... | python | def depends(name):
'''
Returns the containers and images, if any, which depend on the given image
name
Name or ID of image
**RETURN DATA**
A dictionary containing the following keys:
- ``Containers`` - A list of containers which depend on the specified image
- ``Images`` - A lis... | [
"def",
"depends",
"(",
"name",
")",
":",
"# Resolve tag or short-SHA to full SHA",
"image_id",
"=",
"inspect_image",
"(",
"name",
")",
"[",
"'Id'",
"]",
"container_depends",
"=",
"[",
"]",
"for",
"container",
"in",
"six",
".",
"itervalues",
"(",
"ps_",
"(",
... | Returns the containers and images, if any, which depend on the given image
name
Name or ID of image
**RETURN DATA**
A dictionary containing the following keys:
- ``Containers`` - A list of containers which depend on the specified image
- ``Images`` - A list of IDs of images which depend... | [
"Returns",
"the",
"containers",
"and",
"images",
"if",
"any",
"which",
"depend",
"on",
"the",
"given",
"image"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L1469-L1506 | train |
saltstack/salt | salt/modules/dockermod.py | diff | def diff(name):
'''
Get information on changes made to container's filesystem since it was
created. Equivalent to running the ``docker diff`` Docker CLI command.
name
Container name or ID
**RETURN DATA**
A dictionary containing any of the following keys:
- ``Added`` - A list of ... | python | def diff(name):
'''
Get information on changes made to container's filesystem since it was
created. Equivalent to running the ``docker diff`` Docker CLI command.
name
Container name or ID
**RETURN DATA**
A dictionary containing any of the following keys:
- ``Added`` - A list of ... | [
"def",
"diff",
"(",
"name",
")",
":",
"changes",
"=",
"_client_wrapper",
"(",
"'diff'",
",",
"name",
")",
"kind_map",
"=",
"{",
"0",
":",
"'Changed'",
",",
"1",
":",
"'Added'",
",",
"2",
":",
"'Deleted'",
"}",
"ret",
"=",
"{",
"}",
"for",
"change",... | Get information on changes made to container's filesystem since it was
created. Equivalent to running the ``docker diff`` Docker CLI command.
name
Container name or ID
**RETURN DATA**
A dictionary containing any of the following keys:
- ``Added`` - A list of paths that were added.
-... | [
"Get",
"information",
"on",
"changes",
"made",
"to",
"container",
"s",
"filesystem",
"since",
"it",
"was",
"created",
".",
"Equivalent",
"to",
"running",
"the",
"docker",
"diff",
"Docker",
"CLI",
"command",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L1509-L1548 | train |
saltstack/salt | salt/modules/dockermod.py | exists | def exists(name):
'''
Check if a given container exists
name
Container name or ID
**RETURN DATA**
A boolean (``True`` if the container exists, otherwise ``False``)
CLI Example:
.. code-block:: bash
salt myminion docker.exists mycontainer
'''
contextkey = 'dock... | python | def exists(name):
'''
Check if a given container exists
name
Container name or ID
**RETURN DATA**
A boolean (``True`` if the container exists, otherwise ``False``)
CLI Example:
.. code-block:: bash
salt myminion docker.exists mycontainer
'''
contextkey = 'dock... | [
"def",
"exists",
"(",
"name",
")",
":",
"contextkey",
"=",
"'docker.exists.{0}'",
".",
"format",
"(",
"name",
")",
"if",
"contextkey",
"in",
"__context__",
":",
"return",
"__context__",
"[",
"contextkey",
"]",
"try",
":",
"c_info",
"=",
"_client_wrapper",
"(... | Check if a given container exists
name
Container name or ID
**RETURN DATA**
A boolean (``True`` if the container exists, otherwise ``False``)
CLI Example:
.. code-block:: bash
salt myminion docker.exists mycontainer | [
"Check",
"if",
"a",
"given",
"container",
"exists"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L1551-L1581 | train |
saltstack/salt | salt/modules/dockermod.py | history | def history(name, quiet=False):
'''
Return the history for an image. Equivalent to running the ``docker
history`` Docker CLI command.
name
Container name or ID
quiet : False
If ``True``, the return data will simply be a list of the commands run
to build the container.
... | python | def history(name, quiet=False):
'''
Return the history for an image. Equivalent to running the ``docker
history`` Docker CLI command.
name
Container name or ID
quiet : False
If ``True``, the return data will simply be a list of the commands run
to build the container.
... | [
"def",
"history",
"(",
"name",
",",
"quiet",
"=",
"False",
")",
":",
"response",
"=",
"_client_wrapper",
"(",
"'history'",
",",
"name",
")",
"key_map",
"=",
"{",
"'CreatedBy'",
":",
"'Command'",
",",
"'Created'",
":",
"'Time_Created_Epoch'",
",",
"}",
"com... | Return the history for an image. Equivalent to running the ``docker
history`` Docker CLI command.
name
Container name or ID
quiet : False
If ``True``, the return data will simply be a list of the commands run
to build the container.
.. code-block:: bash
$ salt... | [
"Return",
"the",
"history",
"for",
"an",
"image",
".",
"Equivalent",
"to",
"running",
"the",
"docker",
"history",
"Docker",
"CLI",
"command",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L1584-L1670 | train |
saltstack/salt | salt/modules/dockermod.py | images | def images(verbose=False, **kwargs):
'''
Returns information about the Docker images on the Minion. Equivalent to
running the ``docker images`` Docker CLI command.
all : False
If ``True``, untagged images will also be returned
verbose : False
If ``True``, a ``docker inspect`` will ... | python | def images(verbose=False, **kwargs):
'''
Returns information about the Docker images on the Minion. Equivalent to
running the ``docker images`` Docker CLI command.
all : False
If ``True``, untagged images will also be returned
verbose : False
If ``True``, a ``docker inspect`` will ... | [
"def",
"images",
"(",
"verbose",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"'docker.images'",
"not",
"in",
"__context__",
":",
"response",
"=",
"_client_wrapper",
"(",
"'images'",
",",
"all",
"=",
"kwargs",
".",
"get",
"(",
"'all'",
",",
"... | Returns information about the Docker images on the Minion. Equivalent to
running the ``docker images`` Docker CLI command.
all : False
If ``True``, untagged images will also be returned
verbose : False
If ``True``, a ``docker inspect`` will be run on each image returned.
**RETURN DAT... | [
"Returns",
"information",
"about",
"the",
"Docker",
"images",
"on",
"the",
"Minion",
".",
"Equivalent",
"to",
"running",
"the",
"docker",
"images",
"Docker",
"CLI",
"command",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L1673-L1739 | train |
saltstack/salt | salt/modules/dockermod.py | inspect | def inspect(name):
'''
.. versionchanged:: 2017.7.0
Volumes and networks are now checked, in addition to containers and
images.
This is a generic container/image/volume/network inspecton function. It
will run the following functions in order:
- :py:func:`docker.inspect_container
... | python | def inspect(name):
'''
.. versionchanged:: 2017.7.0
Volumes and networks are now checked, in addition to containers and
images.
This is a generic container/image/volume/network inspecton function. It
will run the following functions in order:
- :py:func:`docker.inspect_container
... | [
"def",
"inspect",
"(",
"name",
")",
":",
"try",
":",
"return",
"inspect_container",
"(",
"name",
")",
"except",
"CommandExecutionError",
"as",
"exc",
":",
"if",
"'does not exist'",
"not",
"in",
"exc",
".",
"strerror",
":",
"raise",
"try",
":",
"return",
"i... | .. versionchanged:: 2017.7.0
Volumes and networks are now checked, in addition to containers and
images.
This is a generic container/image/volume/network inspecton function. It
will run the following functions in order:
- :py:func:`docker.inspect_container
<salt.modules.dockermod.ins... | [
"..",
"versionchanged",
"::",
"2017",
".",
"7",
".",
"0",
"Volumes",
"and",
"networks",
"are",
"now",
"checked",
"in",
"addition",
"to",
"containers",
"and",
"images",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L1756-L1812 | train |
saltstack/salt | salt/modules/dockermod.py | inspect_image | def inspect_image(name):
'''
Retrieves image information. Equivalent to running the ``docker inspect``
Docker CLI command, but will only look for image information.
.. note::
To inspect an image, it must have been pulled from a registry or built
locally. Images on a Docker registry whic... | python | def inspect_image(name):
'''
Retrieves image information. Equivalent to running the ``docker inspect``
Docker CLI command, but will only look for image information.
.. note::
To inspect an image, it must have been pulled from a registry or built
locally. Images on a Docker registry whic... | [
"def",
"inspect_image",
"(",
"name",
")",
":",
"ret",
"=",
"_client_wrapper",
"(",
"'inspect_image'",
",",
"name",
")",
"for",
"param",
"in",
"(",
"'Size'",
",",
"'VirtualSize'",
")",
":",
"if",
"param",
"in",
"ret",
":",
"ret",
"[",
"'{0}_Human'",
".",
... | Retrieves image information. Equivalent to running the ``docker inspect``
Docker CLI command, but will only look for image information.
.. note::
To inspect an image, it must have been pulled from a registry or built
locally. Images on a Docker registry which have not been pulled cannot
... | [
"Retrieves",
"image",
"information",
".",
"Equivalent",
"to",
"running",
"the",
"docker",
"inspect",
"Docker",
"CLI",
"command",
"but",
"will",
"only",
"look",
"for",
"image",
"information",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L1839-L1870 | train |
saltstack/salt | salt/modules/dockermod.py | list_containers | def list_containers(**kwargs):
'''
Returns a list of containers by name. This is different from
:py:func:`docker.ps <salt.modules.dockermod.ps_>` in that
:py:func:`docker.ps <salt.modules.dockermod.ps_>` returns its results
organized by container ID.
all : False
If ``True``, stopped con... | python | def list_containers(**kwargs):
'''
Returns a list of containers by name. This is different from
:py:func:`docker.ps <salt.modules.dockermod.ps_>` in that
:py:func:`docker.ps <salt.modules.dockermod.ps_>` returns its results
organized by container ID.
all : False
If ``True``, stopped con... | [
"def",
"list_containers",
"(",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"set",
"(",
")",
"for",
"item",
"in",
"six",
".",
"itervalues",
"(",
"ps_",
"(",
"all",
"=",
"kwargs",
".",
"get",
"(",
"'all'",
",",
"False",
")",
")",
")",
":",
"names",
... | Returns a list of containers by name. This is different from
:py:func:`docker.ps <salt.modules.dockermod.ps_>` in that
:py:func:`docker.ps <salt.modules.dockermod.ps_>` returns its results
organized by container ID.
all : False
If ``True``, stopped containers will be included in return data
... | [
"Returns",
"a",
"list",
"of",
"containers",
"by",
"name",
".",
"This",
"is",
"different",
"from",
":",
"py",
":",
"func",
":",
"docker",
".",
"ps",
"<salt",
".",
"modules",
".",
"dockermod",
".",
"ps_",
">",
"in",
"that",
":",
"py",
":",
"func",
":... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L1873-L1896 | train |
saltstack/salt | salt/modules/dockermod.py | list_tags | def list_tags():
'''
Returns a list of tagged images
CLI Example:
.. code-block:: bash
salt myminion docker.list_tags
'''
ret = set()
for item in six.itervalues(images()):
if not item.get('RepoTags'):
continue
ret.update(set(item['RepoTags']))
retur... | python | def list_tags():
'''
Returns a list of tagged images
CLI Example:
.. code-block:: bash
salt myminion docker.list_tags
'''
ret = set()
for item in six.itervalues(images()):
if not item.get('RepoTags'):
continue
ret.update(set(item['RepoTags']))
retur... | [
"def",
"list_tags",
"(",
")",
":",
"ret",
"=",
"set",
"(",
")",
"for",
"item",
"in",
"six",
".",
"itervalues",
"(",
"images",
"(",
")",
")",
":",
"if",
"not",
"item",
".",
"get",
"(",
"'RepoTags'",
")",
":",
"continue",
"ret",
".",
"update",
"(",... | Returns a list of tagged images
CLI Example:
.. code-block:: bash
salt myminion docker.list_tags | [
"Returns",
"a",
"list",
"of",
"tagged",
"images"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L1899-L1914 | train |
saltstack/salt | salt/modules/dockermod.py | resolve_image_id | def resolve_image_id(name):
'''
.. versionadded:: 2018.3.0
Given an image name (or partial image ID), return the full image ID. If no
match is found among the locally-pulled images, then ``False`` will be
returned.
CLI Examples:
.. code-block:: bash
salt myminion docker.resolve_i... | python | def resolve_image_id(name):
'''
.. versionadded:: 2018.3.0
Given an image name (or partial image ID), return the full image ID. If no
match is found among the locally-pulled images, then ``False`` will be
returned.
CLI Examples:
.. code-block:: bash
salt myminion docker.resolve_i... | [
"def",
"resolve_image_id",
"(",
"name",
")",
":",
"try",
":",
"inspect_result",
"=",
"inspect_image",
"(",
"name",
")",
"return",
"inspect_result",
"[",
"'Id'",
"]",
"except",
"CommandExecutionError",
":",
"# No matching image pulled locally, or inspect_image otherwise fa... | .. versionadded:: 2018.3.0
Given an image name (or partial image ID), return the full image ID. If no
match is found among the locally-pulled images, then ``False`` will be
returned.
CLI Examples:
.. code-block:: bash
salt myminion docker.resolve_image_id foo
salt myminion docker... | [
"..",
"versionadded",
"::",
"2018",
".",
"3",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L1917-L1944 | train |
saltstack/salt | salt/modules/dockermod.py | resolve_tag | def resolve_tag(name, **kwargs):
'''
.. versionadded:: 2017.7.2
.. versionchanged:: 2018.3.0
Instead of matching against pulled tags using
:py:func:`docker.list_tags <salt.modules.dockermod.list_tags>`, this
function now simply inspects the passed image name using
:py:func:`d... | python | def resolve_tag(name, **kwargs):
'''
.. versionadded:: 2017.7.2
.. versionchanged:: 2018.3.0
Instead of matching against pulled tags using
:py:func:`docker.list_tags <salt.modules.dockermod.list_tags>`, this
function now simply inspects the passed image name using
:py:func:`d... | [
"def",
"resolve_tag",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"=",
"__utils__",
"[",
"'args.clean_kwargs'",
"]",
"(",
"*",
"*",
"kwargs",
")",
"all_",
"=",
"kwargs",
".",
"pop",
"(",
"'all'",
",",
"False",
")",
"if",
"kwargs",
":",
... | .. versionadded:: 2017.7.2
.. versionchanged:: 2018.3.0
Instead of matching against pulled tags using
:py:func:`docker.list_tags <salt.modules.dockermod.list_tags>`, this
function now simply inspects the passed image name using
:py:func:`docker.inspect_image <salt.modules.dockermod.i... | [
"..",
"versionadded",
"::",
"2017",
".",
"7",
".",
"2",
"..",
"versionchanged",
"::",
"2018",
".",
"3",
".",
"0",
"Instead",
"of",
"matching",
"against",
"pulled",
"tags",
"using",
":",
"py",
":",
"func",
":",
"docker",
".",
"list_tags",
"<salt",
".",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L1947-L2012 | train |
saltstack/salt | salt/modules/dockermod.py | logs | def logs(name, **kwargs):
'''
.. versionchanged:: 2018.3.0
Support for all of docker-py's `logs()`_ function's arguments, with the
exception of ``stream``.
Returns the logs for the container. An interface to docker-py's `logs()`_
function.
name
Container name or ID
std... | python | def logs(name, **kwargs):
'''
.. versionchanged:: 2018.3.0
Support for all of docker-py's `logs()`_ function's arguments, with the
exception of ``stream``.
Returns the logs for the container. An interface to docker-py's `logs()`_
function.
name
Container name or ID
std... | [
"def",
"logs",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"=",
"__utils__",
"[",
"'args.clean_kwargs'",
"]",
"(",
"*",
"*",
"kwargs",
")",
"if",
"'stream'",
"in",
"kwargs",
":",
"raise",
"SaltInvocationError",
"(",
"'The \\'stream\\' argument ... | .. versionchanged:: 2018.3.0
Support for all of docker-py's `logs()`_ function's arguments, with the
exception of ``stream``.
Returns the logs for the container. An interface to docker-py's `logs()`_
function.
name
Container name or ID
stdout : True
Return stdout lines... | [
"..",
"versionchanged",
"::",
"2018",
".",
"3",
".",
"0",
"Support",
"for",
"all",
"of",
"docker",
"-",
"py",
"s",
"logs",
"()",
"_",
"function",
"s",
"arguments",
"with",
"the",
"exception",
"of",
"stream",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L2015-L2096 | train |
saltstack/salt | salt/modules/dockermod.py | port | def port(name, private_port=None):
'''
Returns port mapping information for a given container. Equivalent to
running the ``docker port`` Docker CLI command.
name
Container name or ID
.. versionchanged:: 2019.2.0
This value can now be a pattern expression (using the
... | python | def port(name, private_port=None):
'''
Returns port mapping information for a given container. Equivalent to
running the ``docker port`` Docker CLI command.
name
Container name or ID
.. versionchanged:: 2019.2.0
This value can now be a pattern expression (using the
... | [
"def",
"port",
"(",
"name",
",",
"private_port",
"=",
"None",
")",
":",
"pattern_used",
"=",
"bool",
"(",
"re",
".",
"search",
"(",
"r'[*?\\[]'",
",",
"name",
")",
")",
"names",
"=",
"fnmatch",
".",
"filter",
"(",
"list_containers",
"(",
"all",
"=",
... | Returns port mapping information for a given container. Equivalent to
running the ``docker port`` Docker CLI command.
name
Container name or ID
.. versionchanged:: 2019.2.0
This value can now be a pattern expression (using the
pattern-matching characters defined in fnma... | [
"Returns",
"port",
"mapping",
"information",
"for",
"a",
"given",
"container",
".",
"Equivalent",
"to",
"running",
"the",
"docker",
"port",
"Docker",
"CLI",
"command",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L2116-L2192 | train |
saltstack/salt | salt/modules/dockermod.py | ps_ | def ps_(filters=None, **kwargs):
'''
Returns information about the Docker containers on the Minion. Equivalent
to running the ``docker ps`` Docker CLI command.
all : False
If ``True``, stopped containers will also be returned
host: False
If ``True``, local host's network topology w... | python | def ps_(filters=None, **kwargs):
'''
Returns information about the Docker containers on the Minion. Equivalent
to running the ``docker ps`` Docker CLI command.
all : False
If ``True``, stopped containers will also be returned
host: False
If ``True``, local host's network topology w... | [
"def",
"ps_",
"(",
"filters",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"response",
"=",
"_client_wrapper",
"(",
"'containers'",
",",
"all",
"=",
"True",
",",
"filters",
"=",
"filters",
")",
"key_map",
"=",
"{",
"'Created'",
":",
"'Time_Created_Epo... | Returns information about the Docker containers on the Minion. Equivalent
to running the ``docker ps`` Docker CLI command.
all : False
If ``True``, stopped containers will also be returned
host: False
If ``True``, local host's network topology will be included
verbose : False
... | [
"Returns",
"information",
"about",
"the",
"Docker",
"containers",
"on",
"the",
"Minion",
".",
"Equivalent",
"to",
"running",
"the",
"docker",
"ps",
"Docker",
"CLI",
"command",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L2195-L2268 | train |
saltstack/salt | salt/modules/dockermod.py | state | def state(name):
'''
Returns the state of the container
name
Container name or ID
**RETURN DATA**
A string representing the current state of the container (either
``running``, ``paused``, or ``stopped``)
CLI Example:
.. code-block:: bash
salt myminion docker.state... | python | def state(name):
'''
Returns the state of the container
name
Container name or ID
**RETURN DATA**
A string representing the current state of the container (either
``running``, ``paused``, or ``stopped``)
CLI Example:
.. code-block:: bash
salt myminion docker.state... | [
"def",
"state",
"(",
"name",
")",
":",
"contextkey",
"=",
"'docker.state.{0}'",
".",
"format",
"(",
"name",
")",
"if",
"contextkey",
"in",
"__context__",
":",
"return",
"__context__",
"[",
"contextkey",
"]",
"__context__",
"[",
"contextkey",
"]",
"=",
"_get_... | Returns the state of the container
name
Container name or ID
**RETURN DATA**
A string representing the current state of the container (either
``running``, ``paused``, or ``stopped``)
CLI Example:
.. code-block:: bash
salt myminion docker.state mycontainer | [
"Returns",
"the",
"state",
"of",
"the",
"container"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L2271-L2295 | train |
saltstack/salt | salt/modules/dockermod.py | search | def search(name, official=False, trusted=False):
'''
Searches the registry for an image
name
Search keyword
official : False
Limit results to official builds
trusted : False
Limit results to `trusted builds`_
**RETURN DATA**
A dictionary with each key being the n... | python | def search(name, official=False, trusted=False):
'''
Searches the registry for an image
name
Search keyword
official : False
Limit results to official builds
trusted : False
Limit results to `trusted builds`_
**RETURN DATA**
A dictionary with each key being the n... | [
"def",
"search",
"(",
"name",
",",
"official",
"=",
"False",
",",
"trusted",
"=",
"False",
")",
":",
"response",
"=",
"_client_wrapper",
"(",
"'search'",
",",
"name",
")",
"if",
"not",
"response",
":",
"raise",
"CommandExecutionError",
"(",
"'No images match... | Searches the registry for an image
name
Search keyword
official : False
Limit results to official builds
trusted : False
Limit results to `trusted builds`_
**RETURN DATA**
A dictionary with each key being the name of an image, and the following
information for each i... | [
"Searches",
"the",
"registry",
"for",
"an",
"image"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L2298-L2365 | train |
saltstack/salt | salt/modules/dockermod.py | top | def top(name):
'''
Runs the `docker top` command on a specific container
name
Container name or ID
CLI Example:
**RETURN DATA**
A list of dictionaries containing information about each process
.. code-block:: bash
salt myminion docker.top mycontainer
salt mymi... | python | def top(name):
'''
Runs the `docker top` command on a specific container
name
Container name or ID
CLI Example:
**RETURN DATA**
A list of dictionaries containing information about each process
.. code-block:: bash
salt myminion docker.top mycontainer
salt mymi... | [
"def",
"top",
"(",
"name",
")",
":",
"response",
"=",
"_client_wrapper",
"(",
"'top'",
",",
"name",
")",
"# Read in column names",
"columns",
"=",
"{",
"}",
"for",
"idx",
",",
"col_name",
"in",
"enumerate",
"(",
"response",
"[",
"'Titles'",
"]",
")",
":"... | Runs the `docker top` command on a specific container
name
Container name or ID
CLI Example:
**RETURN DATA**
A list of dictionaries containing information about each process
.. code-block:: bash
salt myminion docker.top mycontainer
salt myminion docker.top 0123456789a... | [
"Runs",
"the",
"docker",
"top",
"command",
"on",
"a",
"specific",
"container"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L2368-L2402 | train |
saltstack/salt | salt/modules/dockermod.py | version | def version():
'''
Returns a dictionary of Docker version information. Equivalent to running
the ``docker version`` Docker CLI command.
CLI Example:
.. code-block:: bash
salt myminion docker.version
'''
ret = _client_wrapper('version')
version_re = re.compile(VERSION_RE)
i... | python | def version():
'''
Returns a dictionary of Docker version information. Equivalent to running
the ``docker version`` Docker CLI command.
CLI Example:
.. code-block:: bash
salt myminion docker.version
'''
ret = _client_wrapper('version')
version_re = re.compile(VERSION_RE)
i... | [
"def",
"version",
"(",
")",
":",
"ret",
"=",
"_client_wrapper",
"(",
"'version'",
")",
"version_re",
"=",
"re",
".",
"compile",
"(",
"VERSION_RE",
")",
"if",
"'Version'",
"in",
"ret",
":",
"match",
"=",
"version_re",
".",
"match",
"(",
"six",
".",
"tex... | Returns a dictionary of Docker version information. Equivalent to running
the ``docker version`` Docker CLI command.
CLI Example:
.. code-block:: bash
salt myminion docker.version | [
"Returns",
"a",
"dictionary",
"of",
"Docker",
"version",
"information",
".",
"Equivalent",
"to",
"running",
"the",
"docker",
"version",
"Docker",
"CLI",
"command",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L2405-L2430 | train |
saltstack/salt | salt/modules/dockermod.py | create | def create(image,
name=None,
start=False,
skip_translate=None,
ignore_collisions=False,
validate_ip_addrs=True,
client_timeout=salt.utils.docker.CLIENT_TIMEOUT,
**kwargs):
'''
Create a new container
image
Image from which ... | python | def create(image,
name=None,
start=False,
skip_translate=None,
ignore_collisions=False,
validate_ip_addrs=True,
client_timeout=salt.utils.docker.CLIENT_TIMEOUT,
**kwargs):
'''
Create a new container
image
Image from which ... | [
"def",
"create",
"(",
"image",
",",
"name",
"=",
"None",
",",
"start",
"=",
"False",
",",
"skip_translate",
"=",
"None",
",",
"ignore_collisions",
"=",
"False",
",",
"validate_ip_addrs",
"=",
"True",
",",
"client_timeout",
"=",
"salt",
".",
"utils",
".",
... | Create a new container
image
Image from which to create the container
name
Name for the new container. If not provided, Docker will randomly
generate one for you (it will be included in the return data).
start : False
If ``True``, start container after creating it
... | [
"Create",
"a",
"new",
"container"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L2440-L3210 | train |
saltstack/salt | salt/modules/dockermod.py | run_container | def run_container(image,
name=None,
skip_translate=None,
ignore_collisions=False,
validate_ip_addrs=True,
client_timeout=salt.utils.docker.CLIENT_TIMEOUT,
bg=False,
replace=False,
... | python | def run_container(image,
name=None,
skip_translate=None,
ignore_collisions=False,
validate_ip_addrs=True,
client_timeout=salt.utils.docker.CLIENT_TIMEOUT,
bg=False,
replace=False,
... | [
"def",
"run_container",
"(",
"image",
",",
"name",
"=",
"None",
",",
"skip_translate",
"=",
"None",
",",
"ignore_collisions",
"=",
"False",
",",
"validate_ip_addrs",
"=",
"True",
",",
"client_timeout",
"=",
"salt",
".",
"utils",
".",
"docker",
".",
"CLIENT_T... | .. versionadded:: 2018.3.0
Equivalent to ``docker run`` on the Docker CLI. Runs the container, waits
for it to exit, and returns the container's logs when complete.
.. note::
Not to be confused with :py:func:`docker.run
<salt.modules.dockermod.run>`, which provides a :py:func:`cmd.run
... | [
"..",
"versionadded",
"::",
"2018",
".",
"3",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L3214-L3452 | train |
saltstack/salt | salt/modules/dockermod.py | copy_from | def copy_from(name, source, dest, overwrite=False, makedirs=False):
'''
Copy a file from inside a container to the Minion
name
Container name
source
Path of the file on the container's filesystem
dest
Destination on the Minion. Must be an absolute path. If the destination
... | python | def copy_from(name, source, dest, overwrite=False, makedirs=False):
'''
Copy a file from inside a container to the Minion
name
Container name
source
Path of the file on the container's filesystem
dest
Destination on the Minion. Must be an absolute path. If the destination
... | [
"def",
"copy_from",
"(",
"name",
",",
"source",
",",
"dest",
",",
"overwrite",
"=",
"False",
",",
"makedirs",
"=",
"False",
")",
":",
"c_state",
"=",
"state",
"(",
"name",
")",
"if",
"c_state",
"!=",
"'running'",
":",
"raise",
"CommandExecutionError",
"(... | Copy a file from inside a container to the Minion
name
Container name
source
Path of the file on the container's filesystem
dest
Destination on the Minion. Must be an absolute path. If the destination
is a directory, the file will be copied into that directory.
overwr... | [
"Copy",
"a",
"file",
"from",
"inside",
"a",
"container",
"to",
"the",
"Minion"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L3455-L3563 | train |
saltstack/salt | salt/modules/dockermod.py | copy_to | def copy_to(name,
source,
dest,
exec_driver=None,
overwrite=False,
makedirs=False):
'''
Copy a file from the host into a container
name
Container name
source
File to be copied to the container. Can be a local path on the Minio... | python | def copy_to(name,
source,
dest,
exec_driver=None,
overwrite=False,
makedirs=False):
'''
Copy a file from the host into a container
name
Container name
source
File to be copied to the container. Can be a local path on the Minio... | [
"def",
"copy_to",
"(",
"name",
",",
"source",
",",
"dest",
",",
"exec_driver",
"=",
"None",
",",
"overwrite",
"=",
"False",
",",
"makedirs",
"=",
"False",
")",
":",
"if",
"exec_driver",
"is",
"None",
":",
"exec_driver",
"=",
"_get_exec_driver",
"(",
")",... | Copy a file from the host into a container
name
Container name
source
File to be copied to the container. Can be a local path on the Minion
or a remote file from the Salt fileserver.
dest
Destination on the container. Must be an absolute path. If the
destination is... | [
"Copy",
"a",
"file",
"from",
"the",
"host",
"into",
"a",
"container"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L3570-L3624 | train |
saltstack/salt | salt/modules/dockermod.py | export | def export(name,
path,
overwrite=False,
makedirs=False,
compression=None,
**kwargs):
'''
Exports a container to a tar archive. It can also optionally compress that
tar archive, and push it up to the Master.
name
Container name or ID
pa... | python | def export(name,
path,
overwrite=False,
makedirs=False,
compression=None,
**kwargs):
'''
Exports a container to a tar archive. It can also optionally compress that
tar archive, and push it up to the Master.
name
Container name or ID
pa... | [
"def",
"export",
"(",
"name",
",",
"path",
",",
"overwrite",
"=",
"False",
",",
"makedirs",
"=",
"False",
",",
"compression",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"err",
"=",
"'Path \\'{0}\\' is not absolute'",
".",
"format",
"(",
"path",
")",... | Exports a container to a tar archive. It can also optionally compress that
tar archive, and push it up to the Master.
name
Container name or ID
path
Absolute path on the Minion where the container will be exported
overwrite : False
Unless this option is set to ``True``, then i... | [
"Exports",
"a",
"container",
"to",
"a",
"tar",
"archive",
".",
"It",
"can",
"also",
"optionally",
"compress",
"that",
"tar",
"archive",
"and",
"push",
"it",
"up",
"to",
"the",
"Master",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L3627-L3806 | train |
saltstack/salt | salt/modules/dockermod.py | rm_ | def rm_(name, force=False, volumes=False, **kwargs):
'''
Removes a container
name
Container name or ID
force : False
If ``True``, the container will be killed first before removal, as the
Docker API will not permit a running container to be removed. This
option is set t... | python | def rm_(name, force=False, volumes=False, **kwargs):
'''
Removes a container
name
Container name or ID
force : False
If ``True``, the container will be killed first before removal, as the
Docker API will not permit a running container to be removed. This
option is set t... | [
"def",
"rm_",
"(",
"name",
",",
"force",
"=",
"False",
",",
"volumes",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"=",
"__utils__",
"[",
"'args.clean_kwargs'",
"]",
"(",
"*",
"*",
"kwargs",
")",
"stop_",
"=",
"kwargs",
".",
"pop",
"... | Removes a container
name
Container name or ID
force : False
If ``True``, the container will be killed first before removal, as the
Docker API will not permit a running container to be removed. This
option is set to ``False`` by default to prevent accidental removal of
a... | [
"Removes",
"a",
"container"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L3810-L3880 | train |
saltstack/salt | salt/modules/dockermod.py | rename | def rename(name, new_name):
'''
.. versionadded:: 2017.7.0
Renames a container. Returns ``True`` if successful, and raises an error if
the API returns one. If unsuccessful and the API returns no error (should
not happen), then ``False`` will be returned.
name
Name or ID of existing con... | python | def rename(name, new_name):
'''
.. versionadded:: 2017.7.0
Renames a container. Returns ``True`` if successful, and raises an error if
the API returns one. If unsuccessful and the API returns no error (should
not happen), then ``False`` will be returned.
name
Name or ID of existing con... | [
"def",
"rename",
"(",
"name",
",",
"new_name",
")",
":",
"id_",
"=",
"inspect_container",
"(",
"name",
")",
"[",
"'Id'",
"]",
"log",
".",
"debug",
"(",
"'Renaming container \\'%s\\' (ID: %s) to \\'%s\\''",
",",
"name",
",",
"id_",
",",
"new_name",
")",
"_cli... | .. versionadded:: 2017.7.0
Renames a container. Returns ``True`` if successful, and raises an error if
the API returns one. If unsuccessful and the API returns no error (should
not happen), then ``False`` will be returned.
name
Name or ID of existing container
new_name
New name to... | [
"..",
"versionadded",
"::",
"2017",
".",
"7",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L3883-L3909 | train |
saltstack/salt | salt/modules/dockermod.py | build | def build(path=None,
repository=None,
tag=None,
cache=True,
rm=True,
api_response=False,
fileobj=None,
dockerfile=None,
buildargs=None,
network_mode=None,
labels=None,
cache_from=None,
target=None):
... | python | def build(path=None,
repository=None,
tag=None,
cache=True,
rm=True,
api_response=False,
fileobj=None,
dockerfile=None,
buildargs=None,
network_mode=None,
labels=None,
cache_from=None,
target=None):
... | [
"def",
"build",
"(",
"path",
"=",
"None",
",",
"repository",
"=",
"None",
",",
"tag",
"=",
"None",
",",
"cache",
"=",
"True",
",",
"rm",
"=",
"True",
",",
"api_response",
"=",
"False",
",",
"fileobj",
"=",
"None",
",",
"dockerfile",
"=",
"None",
",... | .. versionchanged:: 2018.3.0
If the built image should be tagged, then the repository and tag must
now be passed separately using the ``repository`` and ``tag``
arguments, rather than together in the (now deprecated) ``image``
argument.
Builds a docker image from a Dockerfile or a U... | [
"..",
"versionchanged",
"::",
"2018",
".",
"3",
".",
"0",
"If",
"the",
"built",
"image",
"should",
"be",
"tagged",
"then",
"the",
"repository",
"and",
"tag",
"must",
"now",
"be",
"passed",
"separately",
"using",
"the",
"repository",
"and",
"tag",
"argument... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L3913-L4106 | train |
saltstack/salt | salt/modules/dockermod.py | commit | def commit(name,
repository,
tag='latest',
message=None,
author=None):
'''
.. versionchanged:: 2018.3.0
The repository and tag must now be passed separately using the
``repository`` and ``tag`` arguments, rather than together in the (now
deprec... | python | def commit(name,
repository,
tag='latest',
message=None,
author=None):
'''
.. versionchanged:: 2018.3.0
The repository and tag must now be passed separately using the
``repository`` and ``tag`` arguments, rather than together in the (now
deprec... | [
"def",
"commit",
"(",
"name",
",",
"repository",
",",
"tag",
"=",
"'latest'",
",",
"message",
"=",
"None",
",",
"author",
"=",
"None",
")",
":",
"if",
"not",
"isinstance",
"(",
"repository",
",",
"six",
".",
"string_types",
")",
":",
"repository",
"=",... | .. versionchanged:: 2018.3.0
The repository and tag must now be passed separately using the
``repository`` and ``tag`` arguments, rather than together in the (now
deprecated) ``image`` argument.
Commits a container, thereby promoting it to an image. Equivalent to
running the ``docker co... | [
"..",
"versionchanged",
"::",
"2018",
".",
"3",
".",
"0",
"The",
"repository",
"and",
"tag",
"must",
"now",
"be",
"passed",
"separately",
"using",
"the",
"repository",
"and",
"tag",
"arguments",
"rather",
"than",
"together",
"in",
"the",
"(",
"now",
"depre... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L4109-L4188 | train |
saltstack/salt | salt/modules/dockermod.py | dangling | def dangling(prune=False, force=False):
'''
Return top-level images (those on which no other images depend) which do
not have a tag assigned to them. These include:
- Images which were once tagged but were later untagged, such as those
which were superseded by committing a new copy of an existing... | python | def dangling(prune=False, force=False):
'''
Return top-level images (those on which no other images depend) which do
not have a tag assigned to them. These include:
- Images which were once tagged but were later untagged, such as those
which were superseded by committing a new copy of an existing... | [
"def",
"dangling",
"(",
"prune",
"=",
"False",
",",
"force",
"=",
"False",
")",
":",
"all_images",
"=",
"images",
"(",
"all",
"=",
"True",
")",
"dangling_images",
"=",
"[",
"x",
"[",
":",
"12",
"]",
"for",
"x",
"in",
"_get_top_level_images",
"(",
"al... | Return top-level images (those on which no other images depend) which do
not have a tag assigned to them. These include:
- Images which were once tagged but were later untagged, such as those
which were superseded by committing a new copy of an existing tagged
image.
- Images which were loaded ... | [
"Return",
"top",
"-",
"level",
"images",
"(",
"those",
"on",
"which",
"no",
"other",
"images",
"depend",
")",
"which",
"do",
"not",
"have",
"a",
"tag",
"assigned",
"to",
"them",
".",
"These",
"include",
":"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L4191-L4245 | train |
saltstack/salt | salt/modules/dockermod.py | import_ | def import_(source,
repository,
tag='latest',
api_response=False):
'''
.. versionchanged:: 2018.3.0
The repository and tag must now be passed separately using the
``repository`` and ``tag`` arguments, rather than together in the (now
deprecated) ``imag... | python | def import_(source,
repository,
tag='latest',
api_response=False):
'''
.. versionchanged:: 2018.3.0
The repository and tag must now be passed separately using the
``repository`` and ``tag`` arguments, rather than together in the (now
deprecated) ``imag... | [
"def",
"import_",
"(",
"source",
",",
"repository",
",",
"tag",
"=",
"'latest'",
",",
"api_response",
"=",
"False",
")",
":",
"if",
"not",
"isinstance",
"(",
"repository",
",",
"six",
".",
"string_types",
")",
":",
"repository",
"=",
"six",
".",
"text_ty... | .. versionchanged:: 2018.3.0
The repository and tag must now be passed separately using the
``repository`` and ``tag`` arguments, rather than together in the (now
deprecated) ``image`` argument.
Imports content from a local tarball or a URL as a new docker image
source
Content ... | [
"..",
"versionchanged",
"::",
"2018",
".",
"3",
".",
"0",
"The",
"repository",
"and",
"tag",
"must",
"now",
"be",
"passed",
"separately",
"using",
"the",
"repository",
"and",
"tag",
"arguments",
"rather",
"than",
"together",
"in",
"the",
"(",
"now",
"depre... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L4248-L4348 | train |
saltstack/salt | salt/modules/dockermod.py | load | def load(path, repository=None, tag=None):
'''
.. versionchanged:: 2018.3.0
If the loaded image should be tagged, then the repository and tag must
now be passed separately using the ``repository`` and ``tag``
arguments, rather than together in the (now deprecated) ``image``
argum... | python | def load(path, repository=None, tag=None):
'''
.. versionchanged:: 2018.3.0
If the loaded image should be tagged, then the repository and tag must
now be passed separately using the ``repository`` and ``tag``
arguments, rather than together in the (now deprecated) ``image``
argum... | [
"def",
"load",
"(",
"path",
",",
"repository",
"=",
"None",
",",
"tag",
"=",
"None",
")",
":",
"if",
"(",
"repository",
"or",
"tag",
")",
"and",
"not",
"(",
"repository",
"and",
"tag",
")",
":",
"# Have to have both or neither",
"raise",
"SaltInvocationErr... | .. versionchanged:: 2018.3.0
If the loaded image should be tagged, then the repository and tag must
now be passed separately using the ``repository`` and ``tag``
arguments, rather than together in the (now deprecated) ``image``
argument.
Load a tar archive that was created using :py... | [
"..",
"versionchanged",
"::",
"2018",
".",
"3",
".",
"0",
"If",
"the",
"loaded",
"image",
"should",
"be",
"tagged",
"then",
"the",
"repository",
"and",
"tag",
"must",
"now",
"be",
"passed",
"separately",
"using",
"the",
"repository",
"and",
"tag",
"argumen... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L4351-L4469 | train |
saltstack/salt | salt/modules/dockermod.py | layers | def layers(name):
'''
Returns a list of the IDs of layers belonging to the specified image, with
the top-most layer (the one correspnding to the passed name) appearing
last.
name
Image name or ID
CLI Example:
.. code-block:: bash
salt myminion docker.layers centos:7
'... | python | def layers(name):
'''
Returns a list of the IDs of layers belonging to the specified image, with
the top-most layer (the one correspnding to the passed name) appearing
last.
name
Image name or ID
CLI Example:
.. code-block:: bash
salt myminion docker.layers centos:7
'... | [
"def",
"layers",
"(",
"name",
")",
":",
"ret",
"=",
"[",
"]",
"cmd",
"=",
"[",
"'docker'",
",",
"'history'",
",",
"'-q'",
",",
"name",
"]",
"for",
"line",
"in",
"reversed",
"(",
"__salt__",
"[",
"'cmd.run_stdout'",
"]",
"(",
"cmd",
",",
"python_shell... | Returns a list of the IDs of layers belonging to the specified image, with
the top-most layer (the one correspnding to the passed name) appearing
last.
name
Image name or ID
CLI Example:
.. code-block:: bash
salt myminion docker.layers centos:7 | [
"Returns",
"a",
"list",
"of",
"the",
"IDs",
"of",
"layers",
"belonging",
"to",
"the",
"specified",
"image",
"with",
"the",
"top",
"-",
"most",
"layer",
"(",
"the",
"one",
"correspnding",
"to",
"the",
"passed",
"name",
")",
"appearing",
"last",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L4472-L4494 | train |
saltstack/salt | salt/modules/dockermod.py | pull | def pull(image,
insecure_registry=False,
api_response=False,
client_timeout=salt.utils.docker.CLIENT_TIMEOUT):
'''
.. versionchanged:: 2018.3.0
If no tag is specified in the ``image`` argument, all tags for the
image will be pulled. For this reason is it recommended to... | python | def pull(image,
insecure_registry=False,
api_response=False,
client_timeout=salt.utils.docker.CLIENT_TIMEOUT):
'''
.. versionchanged:: 2018.3.0
If no tag is specified in the ``image`` argument, all tags for the
image will be pulled. For this reason is it recommended to... | [
"def",
"pull",
"(",
"image",
",",
"insecure_registry",
"=",
"False",
",",
"api_response",
"=",
"False",
",",
"client_timeout",
"=",
"salt",
".",
"utils",
".",
"docker",
".",
"CLIENT_TIMEOUT",
")",
":",
"_prep_pull",
"(",
")",
"kwargs",
"=",
"{",
"'stream'"... | .. versionchanged:: 2018.3.0
If no tag is specified in the ``image`` argument, all tags for the
image will be pulled. For this reason is it recommended to pass
``image`` using the ``repo:tag`` notation.
Pulls an image from a Docker registry
image
Image to be pulled
insecur... | [
"..",
"versionchanged",
"::",
"2018",
".",
"3",
".",
"0",
"If",
"no",
"tag",
"is",
"specified",
"in",
"the",
"image",
"argument",
"all",
"tags",
"for",
"the",
"image",
"will",
"be",
"pulled",
".",
"For",
"this",
"reason",
"is",
"it",
"recommended",
"to... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L4497-L4593 | train |
saltstack/salt | salt/modules/dockermod.py | push | def push(image,
insecure_registry=False,
api_response=False,
client_timeout=salt.utils.docker.CLIENT_TIMEOUT):
'''
.. versionchanged:: 2015.8.4
The ``Id`` and ``Image`` keys are no longer present in the return data.
This is due to changes in the Docker Remote API.
... | python | def push(image,
insecure_registry=False,
api_response=False,
client_timeout=salt.utils.docker.CLIENT_TIMEOUT):
'''
.. versionchanged:: 2015.8.4
The ``Id`` and ``Image`` keys are no longer present in the return data.
This is due to changes in the Docker Remote API.
... | [
"def",
"push",
"(",
"image",
",",
"insecure_registry",
"=",
"False",
",",
"api_response",
"=",
"False",
",",
"client_timeout",
"=",
"salt",
".",
"utils",
".",
"docker",
".",
"CLIENT_TIMEOUT",
")",
":",
"if",
"not",
"isinstance",
"(",
"image",
",",
"six",
... | .. versionchanged:: 2015.8.4
The ``Id`` and ``Image`` keys are no longer present in the return data.
This is due to changes in the Docker Remote API.
Pushes an image to a Docker registry. See the documentation at top of this
page to configure authentication credentials.
image
Image... | [
"..",
"versionchanged",
"::",
"2015",
".",
"8",
".",
"4",
"The",
"Id",
"and",
"Image",
"keys",
"are",
"no",
"longer",
"present",
"in",
"the",
"return",
"data",
".",
"This",
"is",
"due",
"to",
"changes",
"in",
"the",
"Docker",
"Remote",
"API",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L4596-L4688 | train |
saltstack/salt | salt/modules/dockermod.py | rmi | def rmi(*names, **kwargs):
'''
Removes an image
name
Name (in ``repo:tag`` notation) or ID of image.
force : False
If ``True``, the image will be removed even if the Minion has
containers created from that image
prune : True
If ``True``, untagged parent image layer... | python | def rmi(*names, **kwargs):
'''
Removes an image
name
Name (in ``repo:tag`` notation) or ID of image.
force : False
If ``True``, the image will be removed even if the Minion has
containers created from that image
prune : True
If ``True``, untagged parent image layer... | [
"def",
"rmi",
"(",
"*",
"names",
",",
"*",
"*",
"kwargs",
")",
":",
"pre_images",
"=",
"images",
"(",
"all",
"=",
"True",
")",
"pre_tags",
"=",
"list_tags",
"(",
")",
"force",
"=",
"kwargs",
".",
"get",
"(",
"'force'",
",",
"False",
")",
"noprune",... | Removes an image
name
Name (in ``repo:tag`` notation) or ID of image.
force : False
If ``True``, the image will be removed even if the Minion has
containers created from that image
prune : True
If ``True``, untagged parent image layers will be removed as well, set
... | [
"Removes",
"an",
"image"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L4691-L4765 | train |
saltstack/salt | salt/modules/dockermod.py | tag_ | def tag_(name, repository, tag='latest', force=False):
'''
.. versionchanged:: 2018.3.0
The repository and tag must now be passed separately using the
``repository`` and ``tag`` arguments, rather than together in the (now
deprecated) ``image`` argument.
Tag an image into a repositor... | python | def tag_(name, repository, tag='latest', force=False):
'''
.. versionchanged:: 2018.3.0
The repository and tag must now be passed separately using the
``repository`` and ``tag`` arguments, rather than together in the (now
deprecated) ``image`` argument.
Tag an image into a repositor... | [
"def",
"tag_",
"(",
"name",
",",
"repository",
",",
"tag",
"=",
"'latest'",
",",
"force",
"=",
"False",
")",
":",
"if",
"not",
"isinstance",
"(",
"repository",
",",
"six",
".",
"string_types",
")",
":",
"repository",
"=",
"six",
".",
"text_type",
"(",
... | .. versionchanged:: 2018.3.0
The repository and tag must now be passed separately using the
``repository`` and ``tag`` arguments, rather than together in the (now
deprecated) ``image`` argument.
Tag an image into a repository and return ``True``. If the tag was
unsuccessful, an error wi... | [
"..",
"versionchanged",
"::",
"2018",
".",
"3",
".",
"0",
"The",
"repository",
"and",
"tag",
"must",
"now",
"be",
"passed",
"separately",
"using",
"the",
"repository",
"and",
"tag",
"arguments",
"rather",
"than",
"together",
"in",
"the",
"(",
"now",
"depre... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L4973-L5022 | train |
saltstack/salt | salt/modules/dockermod.py | networks | def networks(names=None, ids=None):
'''
.. versionchanged:: 2017.7.0
The ``names`` and ``ids`` can be passed as a comma-separated list now,
as well as a Python list.
.. versionchanged:: 2018.3.0
The ``Containers`` key for each network is no longer always empty.
List existing net... | python | def networks(names=None, ids=None):
'''
.. versionchanged:: 2017.7.0
The ``names`` and ``ids`` can be passed as a comma-separated list now,
as well as a Python list.
.. versionchanged:: 2018.3.0
The ``Containers`` key for each network is no longer always empty.
List existing net... | [
"def",
"networks",
"(",
"names",
"=",
"None",
",",
"ids",
"=",
"None",
")",
":",
"if",
"names",
"is",
"not",
"None",
":",
"names",
"=",
"__utils__",
"[",
"'args.split_input'",
"]",
"(",
"names",
")",
"if",
"ids",
"is",
"not",
"None",
":",
"ids",
"=... | .. versionchanged:: 2017.7.0
The ``names`` and ``ids`` can be passed as a comma-separated list now,
as well as a Python list.
.. versionchanged:: 2018.3.0
The ``Containers`` key for each network is no longer always empty.
List existing networks
names
Filter by name
ids... | [
"..",
"versionchanged",
"::",
"2017",
".",
"7",
".",
"0",
"The",
"names",
"and",
"ids",
"can",
"be",
"passed",
"as",
"a",
"comma",
"-",
"separated",
"list",
"now",
"as",
"well",
"as",
"a",
"Python",
"list",
".",
"..",
"versionchanged",
"::",
"2018",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L5026-L5065 | train |
saltstack/salt | salt/modules/dockermod.py | create_network | def create_network(name,
skip_translate=None,
ignore_collisions=False,
validate_ip_addrs=True,
client_timeout=salt.utils.docker.CLIENT_TIMEOUT,
**kwargs):
'''
.. versionchanged:: 2018.3.0
Support added for net... | python | def create_network(name,
skip_translate=None,
ignore_collisions=False,
validate_ip_addrs=True,
client_timeout=salt.utils.docker.CLIENT_TIMEOUT,
**kwargs):
'''
.. versionchanged:: 2018.3.0
Support added for net... | [
"def",
"create_network",
"(",
"name",
",",
"skip_translate",
"=",
"None",
",",
"ignore_collisions",
"=",
"False",
",",
"validate_ip_addrs",
"=",
"True",
",",
"client_timeout",
"=",
"salt",
".",
"utils",
".",
"docker",
".",
"CLIENT_TIMEOUT",
",",
"*",
"*",
"k... | .. versionchanged:: 2018.3.0
Support added for network configuration options other than ``driver``
and ``driver_opts``, as well as IPAM configuration.
Create a new network
.. note::
This function supports all arguments for network and IPAM pool
configuration which are available... | [
"..",
"versionchanged",
"::",
"2018",
".",
"3",
".",
"0",
"Support",
"added",
"for",
"network",
"configuration",
"options",
"other",
"than",
"driver",
"and",
"driver_opts",
"as",
"well",
"as",
"IPAM",
"configuration",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L5068-L5335 | train |
saltstack/salt | salt/modules/dockermod.py | connect_container_to_network | def connect_container_to_network(container, net_id, **kwargs):
'''
.. versionadded:: 2015.8.3
.. versionchanged:: 2017.7.0
Support for ``ipv4_address`` argument added
.. versionchanged:: 2018.3.0
All arguments are now passed through to
`connect_container_to_network()`_, allowing ... | python | def connect_container_to_network(container, net_id, **kwargs):
'''
.. versionadded:: 2015.8.3
.. versionchanged:: 2017.7.0
Support for ``ipv4_address`` argument added
.. versionchanged:: 2018.3.0
All arguments are now passed through to
`connect_container_to_network()`_, allowing ... | [
"def",
"connect_container_to_network",
"(",
"container",
",",
"net_id",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"=",
"__utils__",
"[",
"'args.clean_kwargs'",
"]",
"(",
"*",
"*",
"kwargs",
")",
"log",
".",
"debug",
"(",
"'Connecting container \\'%s\\' to net... | .. versionadded:: 2015.8.3
.. versionchanged:: 2017.7.0
Support for ``ipv4_address`` argument added
.. versionchanged:: 2018.3.0
All arguments are now passed through to
`connect_container_to_network()`_, allowing for any new arguments added
to this function to be supported automa... | [
"..",
"versionadded",
"::",
"2015",
".",
"8",
".",
"3",
"..",
"versionchanged",
"::",
"2017",
".",
"7",
".",
"0",
"Support",
"for",
"ipv4_address",
"argument",
"added",
"..",
"versionchanged",
"::",
"2018",
".",
"3",
".",
"0",
"All",
"arguments",
"are",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L5376-L5417 | train |
saltstack/salt | salt/modules/dockermod.py | disconnect_container_from_network | def disconnect_container_from_network(container, network_id):
'''
.. versionadded:: 2015.8.3
Disconnect container from network
container
Container name or ID
network_id
Network name or ID
CLI Examples:
.. code-block:: bash
salt myminion docker.disconnect_contain... | python | def disconnect_container_from_network(container, network_id):
'''
.. versionadded:: 2015.8.3
Disconnect container from network
container
Container name or ID
network_id
Network name or ID
CLI Examples:
.. code-block:: bash
salt myminion docker.disconnect_contain... | [
"def",
"disconnect_container_from_network",
"(",
"container",
",",
"network_id",
")",
":",
"log",
".",
"debug",
"(",
"'Disconnecting container \\'%s\\' from network \\'%s\\''",
",",
"container",
",",
"network_id",
")",
"response",
"=",
"_client_wrapper",
"(",
"'disconnect... | .. versionadded:: 2015.8.3
Disconnect container from network
container
Container name or ID
network_id
Network name or ID
CLI Examples:
.. code-block:: bash
salt myminion docker.disconnect_container_from_network web-1 mynet
salt myminion docker.disconnect_contai... | [
"..",
"versionadded",
"::",
"2015",
".",
"8",
".",
"3"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L5420-L5451 | train |
saltstack/salt | salt/modules/dockermod.py | disconnect_all_containers_from_network | def disconnect_all_containers_from_network(network_id):
'''
.. versionadded:: 2018.3.0
Runs :py:func:`docker.disconnect_container_from_network
<salt.modules.dockermod.disconnect_container_from_network>` on all
containers connected to the specified network, and returns the names of all
container... | python | def disconnect_all_containers_from_network(network_id):
'''
.. versionadded:: 2018.3.0
Runs :py:func:`docker.disconnect_container_from_network
<salt.modules.dockermod.disconnect_container_from_network>` on all
containers connected to the specified network, and returns the names of all
container... | [
"def",
"disconnect_all_containers_from_network",
"(",
"network_id",
")",
":",
"connected_containers",
"=",
"connected",
"(",
"network_id",
")",
"ret",
"=",
"[",
"]",
"failed",
"=",
"[",
"]",
"for",
"cname",
"in",
"connected_containers",
":",
"try",
":",
"disconn... | .. versionadded:: 2018.3.0
Runs :py:func:`docker.disconnect_container_from_network
<salt.modules.dockermod.disconnect_container_from_network>` on all
containers connected to the specified network, and returns the names of all
containers that were disconnected.
network_id
Network name or ID... | [
"..",
"versionadded",
"::",
"2018",
".",
"3",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L5454-L5492 | train |
saltstack/salt | salt/modules/dockermod.py | create_volume | def create_volume(name, driver=None, driver_opts=None):
'''
Create a new volume
.. versionadded:: 2015.8.4
name
name of volume
driver
Driver of the volume
driver_opts
Options for the driver volume
CLI Example:
.. code-block:: bash
salt myminion dock... | python | def create_volume(name, driver=None, driver_opts=None):
'''
Create a new volume
.. versionadded:: 2015.8.4
name
name of volume
driver
Driver of the volume
driver_opts
Options for the driver volume
CLI Example:
.. code-block:: bash
salt myminion dock... | [
"def",
"create_volume",
"(",
"name",
",",
"driver",
"=",
"None",
",",
"driver_opts",
"=",
"None",
")",
":",
"response",
"=",
"_client_wrapper",
"(",
"'create_volume'",
",",
"name",
",",
"driver",
"=",
"driver",
",",
"driver_opts",
"=",
"driver_opts",
")",
... | Create a new volume
.. versionadded:: 2015.8.4
name
name of volume
driver
Driver of the volume
driver_opts
Options for the driver volume
CLI Example:
.. code-block:: bash
salt myminion docker.create_volume my_volume driver=local | [
"Create",
"a",
"new",
"volume"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L5516-L5541 | train |
saltstack/salt | salt/modules/dockermod.py | pause | def pause(name):
'''
Pauses a container
name
Container name or ID
**RETURN DATA**
A dictionary will be returned, containing the following keys:
- ``status`` - A dictionary showing the prior state of the container as
well as the new state
- ``result`` - A boolean noting whe... | python | def pause(name):
'''
Pauses a container
name
Container name or ID
**RETURN DATA**
A dictionary will be returned, containing the following keys:
- ``status`` - A dictionary showing the prior state of the container as
well as the new state
- ``result`` - A boolean noting whe... | [
"def",
"pause",
"(",
"name",
")",
":",
"orig_state",
"=",
"state",
"(",
"name",
")",
"if",
"orig_state",
"==",
"'stopped'",
":",
"return",
"{",
"'result'",
":",
"False",
",",
"'state'",
":",
"{",
"'old'",
":",
"orig_state",
",",
"'new'",
":",
"orig_sta... | Pauses a container
name
Container name or ID
**RETURN DATA**
A dictionary will be returned, containing the following keys:
- ``status`` - A dictionary showing the prior state of the container as
well as the new state
- ``result`` - A boolean noting whether or not the action was su... | [
"Pauses",
"a",
"container"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L5615-L5645 | train |
saltstack/salt | salt/modules/dockermod.py | restart | def restart(name, timeout=10):
'''
Restarts a container
name
Container name or ID
timeout : 10
Timeout in seconds after which the container will be killed (if it has
not yet gracefully shut down)
**RETURN DATA**
A dictionary will be returned, containing the following... | python | def restart(name, timeout=10):
'''
Restarts a container
name
Container name or ID
timeout : 10
Timeout in seconds after which the container will be killed (if it has
not yet gracefully shut down)
**RETURN DATA**
A dictionary will be returned, containing the following... | [
"def",
"restart",
"(",
"name",
",",
"timeout",
"=",
"10",
")",
":",
"ret",
"=",
"_change_state",
"(",
"name",
",",
"'restart'",
",",
"'running'",
",",
"timeout",
"=",
"timeout",
")",
"if",
"ret",
"[",
"'result'",
"]",
":",
"ret",
"[",
"'restarted'",
... | Restarts a container
name
Container name or ID
timeout : 10
Timeout in seconds after which the container will be killed (if it has
not yet gracefully shut down)
**RETURN DATA**
A dictionary will be returned, containing the following keys:
- ``status`` - A dictionary sho... | [
"Restarts",
"a",
"container"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L5651-L5684 | train |
saltstack/salt | salt/modules/dockermod.py | start_ | def start_(name):
'''
Start a container
name
Container name or ID
**RETURN DATA**
A dictionary will be returned, containing the following keys:
- ``status`` - A dictionary showing the prior state of the container as
well as the new state
- ``result`` - A boolean noting whet... | python | def start_(name):
'''
Start a container
name
Container name or ID
**RETURN DATA**
A dictionary will be returned, containing the following keys:
- ``status`` - A dictionary showing the prior state of the container as
well as the new state
- ``result`` - A boolean noting whet... | [
"def",
"start_",
"(",
"name",
")",
":",
"orig_state",
"=",
"state",
"(",
"name",
")",
"if",
"orig_state",
"==",
"'paused'",
":",
"return",
"{",
"'result'",
":",
"False",
",",
"'state'",
":",
"{",
"'old'",
":",
"orig_state",
",",
"'new'",
":",
"orig_sta... | Start a container
name
Container name or ID
**RETURN DATA**
A dictionary will be returned, containing the following keys:
- ``status`` - A dictionary showing the prior state of the container as
well as the new state
- ``result`` - A boolean noting whether or not the action was succ... | [
"Start",
"a",
"container"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L5716-L5746 | train |
saltstack/salt | salt/modules/dockermod.py | stop | def stop(name, timeout=None, **kwargs):
'''
Stops a running container
name
Container name or ID
unpause : False
If ``True`` and the container is paused, it will be unpaused before
attempting to stop the container.
timeout
Timeout in seconds after which the containe... | python | def stop(name, timeout=None, **kwargs):
'''
Stops a running container
name
Container name or ID
unpause : False
If ``True`` and the container is paused, it will be unpaused before
attempting to stop the container.
timeout
Timeout in seconds after which the containe... | [
"def",
"stop",
"(",
"name",
",",
"timeout",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"timeout",
"is",
"None",
":",
"try",
":",
"# Get timeout from container config",
"timeout",
"=",
"inspect_container",
"(",
"name",
")",
"[",
"'Config'",
"]",
... | Stops a running container
name
Container name or ID
unpause : False
If ``True`` and the container is paused, it will be unpaused before
attempting to stop the container.
timeout
Timeout in seconds after which the container will be killed (if it has
not yet graceful... | [
"Stops",
"a",
"running",
"container"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L5750-L5814 | train |
saltstack/salt | salt/modules/dockermod.py | unpause | def unpause(name):
'''
Unpauses a container
name
Container name or ID
**RETURN DATA**
A dictionary will be returned, containing the following keys:
- ``status`` - A dictionary showing the prior state of the container as
well as the new state
- ``result`` - A boolean noting... | python | def unpause(name):
'''
Unpauses a container
name
Container name or ID
**RETURN DATA**
A dictionary will be returned, containing the following keys:
- ``status`` - A dictionary showing the prior state of the container as
well as the new state
- ``result`` - A boolean noting... | [
"def",
"unpause",
"(",
"name",
")",
":",
"orig_state",
"=",
"state",
"(",
"name",
")",
"if",
"orig_state",
"==",
"'stopped'",
":",
"return",
"{",
"'result'",
":",
"False",
",",
"'state'",
":",
"{",
"'old'",
":",
"orig_state",
",",
"'new'",
":",
"orig_s... | Unpauses a container
name
Container name or ID
**RETURN DATA**
A dictionary will be returned, containing the following keys:
- ``status`` - A dictionary showing the prior state of the container as
well as the new state
- ``result`` - A boolean noting whether or not the action was ... | [
"Unpauses",
"a",
"container"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L5818-L5848 | train |
saltstack/salt | salt/modules/dockermod.py | wait | def wait(name, ignore_already_stopped=False, fail_on_exit_status=False):
'''
Wait for the container to exit gracefully, and return its exit code
.. note::
This function will block until the container is stopped.
name
Container name or ID
ignore_already_stopped
Boolean fla... | python | def wait(name, ignore_already_stopped=False, fail_on_exit_status=False):
'''
Wait for the container to exit gracefully, and return its exit code
.. note::
This function will block until the container is stopped.
name
Container name or ID
ignore_already_stopped
Boolean fla... | [
"def",
"wait",
"(",
"name",
",",
"ignore_already_stopped",
"=",
"False",
",",
"fail_on_exit_status",
"=",
"False",
")",
":",
"try",
":",
"pre",
"=",
"state",
"(",
"name",
")",
"except",
"CommandExecutionError",
":",
"# Container doesn't exist anymore",
"return",
... | Wait for the container to exit gracefully, and return its exit code
.. note::
This function will block until the container is stopped.
name
Container name or ID
ignore_already_stopped
Boolean flag that prevents execution to fail, if a container
is already stopped.
fa... | [
"Wait",
"for",
"the",
"container",
"to",
"exit",
"gracefully",
"and",
"return",
"its",
"exit",
"code"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L5854-L5919 | train |
saltstack/salt | salt/modules/dockermod.py | prune | def prune(containers=False, networks=False, images=False,
build=False, volumes=False, system=None, **filters):
'''
.. versionadded:: 2019.2.0
Prune Docker's various subsystems
.. note::
This requires docker-py version 2.1.0 or later.
containers : False
If ``True``, prune... | python | def prune(containers=False, networks=False, images=False,
build=False, volumes=False, system=None, **filters):
'''
.. versionadded:: 2019.2.0
Prune Docker's various subsystems
.. note::
This requires docker-py version 2.1.0 or later.
containers : False
If ``True``, prune... | [
"def",
"prune",
"(",
"containers",
"=",
"False",
",",
"networks",
"=",
"False",
",",
"images",
"=",
"False",
",",
"build",
"=",
"False",
",",
"volumes",
"=",
"False",
",",
"system",
"=",
"None",
",",
"*",
"*",
"filters",
")",
":",
"if",
"system",
"... | .. versionadded:: 2019.2.0
Prune Docker's various subsystems
.. note::
This requires docker-py version 2.1.0 or later.
containers : False
If ``True``, prunes stopped containers (documentation__)
.. __: https://docs.docker.com/engine/reference/commandline/container_prune/#filterin... | [
"..",
"versionadded",
"::",
"2019",
".",
"2",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L5922-L6020 | train |
saltstack/salt | salt/modules/dockermod.py | _run | def _run(name,
cmd,
exec_driver=None,
output=None,
stdin=None,
python_shell=True,
output_loglevel='debug',
ignore_retcode=False,
use_vt=False,
keep_env=None):
'''
Common logic for docker.run functions
'''
if exec_driver is ... | python | def _run(name,
cmd,
exec_driver=None,
output=None,
stdin=None,
python_shell=True,
output_loglevel='debug',
ignore_retcode=False,
use_vt=False,
keep_env=None):
'''
Common logic for docker.run functions
'''
if exec_driver is ... | [
"def",
"_run",
"(",
"name",
",",
"cmd",
",",
"exec_driver",
"=",
"None",
",",
"output",
"=",
"None",
",",
"stdin",
"=",
"None",
",",
"python_shell",
"=",
"True",
",",
"output_loglevel",
"=",
"'debug'",
",",
"ignore_retcode",
"=",
"False",
",",
"use_vt",
... | Common logic for docker.run functions | [
"Common",
"logic",
"for",
"docker",
".",
"run",
"functions"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L6025-L6056 | train |
saltstack/salt | salt/modules/dockermod.py | _script | def _script(name,
source,
saltenv='base',
args=None,
template=None,
exec_driver=None,
stdin=None,
python_shell=True,
output_loglevel='debug',
ignore_retcode=False,
use_vt=False,
keep_env=N... | python | def _script(name,
source,
saltenv='base',
args=None,
template=None,
exec_driver=None,
stdin=None,
python_shell=True,
output_loglevel='debug',
ignore_retcode=False,
use_vt=False,
keep_env=N... | [
"def",
"_script",
"(",
"name",
",",
"source",
",",
"saltenv",
"=",
"'base'",
",",
"args",
"=",
"None",
",",
"template",
"=",
"None",
",",
"exec_driver",
"=",
"None",
",",
"stdin",
"=",
"None",
",",
"python_shell",
"=",
"True",
",",
"output_loglevel",
"... | Common logic to run a script on a container | [
"Common",
"logic",
"to",
"run",
"a",
"script",
"on",
"a",
"container"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L6060-L6128 | train |
saltstack/salt | salt/modules/dockermod.py | script | def script(name,
source,
saltenv='base',
args=None,
template=None,
exec_driver=None,
stdin=None,
python_shell=True,
output_loglevel='debug',
ignore_retcode=False,
use_vt=False,
keep_env=None):
''... | python | def script(name,
source,
saltenv='base',
args=None,
template=None,
exec_driver=None,
stdin=None,
python_shell=True,
output_loglevel='debug',
ignore_retcode=False,
use_vt=False,
keep_env=None):
''... | [
"def",
"script",
"(",
"name",
",",
"source",
",",
"saltenv",
"=",
"'base'",
",",
"args",
"=",
"None",
",",
"template",
"=",
"None",
",",
"exec_driver",
"=",
"None",
",",
"stdin",
"=",
"None",
",",
"python_shell",
"=",
"True",
",",
"output_loglevel",
"=... | Run :py:func:`cmd.script <salt.modules.cmdmod.script>` within a container
.. note::
While the command is run within the container, it is initiated from the
host. Therefore, the PID in the return dict is from the host, not from
the container.
name
Container name or ID
sour... | [
"Run",
":",
"py",
":",
"func",
":",
"cmd",
".",
"script",
"<salt",
".",
"modules",
".",
"cmdmod",
".",
"script",
">",
"within",
"a",
"container"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L6424-L6499 | train |
saltstack/salt | salt/modules/dockermod.py | _prepare_trans_tar | def _prepare_trans_tar(name, sls_opts, mods=None,
pillar=None, extra_filerefs=''):
'''
Prepares a self contained tarball that has the state
to be applied in the container
'''
chunks = _compile_state(sls_opts, mods)
# reuse it from salt.ssh, however this function should
... | python | def _prepare_trans_tar(name, sls_opts, mods=None,
pillar=None, extra_filerefs=''):
'''
Prepares a self contained tarball that has the state
to be applied in the container
'''
chunks = _compile_state(sls_opts, mods)
# reuse it from salt.ssh, however this function should
... | [
"def",
"_prepare_trans_tar",
"(",
"name",
",",
"sls_opts",
",",
"mods",
"=",
"None",
",",
"pillar",
"=",
"None",
",",
"extra_filerefs",
"=",
"''",
")",
":",
"chunks",
"=",
"_compile_state",
"(",
"sls_opts",
",",
"mods",
")",
"# reuse it from salt.ssh, however ... | Prepares a self contained tarball that has the state
to be applied in the container | [
"Prepares",
"a",
"self",
"contained",
"tarball",
"that",
"has",
"the",
"state",
"to",
"be",
"applied",
"in",
"the",
"container"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L6590-L6604 | train |
saltstack/salt | salt/modules/dockermod.py | _compile_state | def _compile_state(sls_opts, mods=None):
'''
Generates the chunks of lowdata from the list of modules
'''
st_ = HighState(sls_opts)
if not mods:
return st_.compile_low_chunks()
high_data, errors = st_.render_highstate({sls_opts['saltenv']: mods})
high_data, ext_errors = st_.state.r... | python | def _compile_state(sls_opts, mods=None):
'''
Generates the chunks of lowdata from the list of modules
'''
st_ = HighState(sls_opts)
if not mods:
return st_.compile_low_chunks()
high_data, errors = st_.render_highstate({sls_opts['saltenv']: mods})
high_data, ext_errors = st_.state.r... | [
"def",
"_compile_state",
"(",
"sls_opts",
",",
"mods",
"=",
"None",
")",
":",
"st_",
"=",
"HighState",
"(",
"sls_opts",
")",
"if",
"not",
"mods",
":",
"return",
"st_",
".",
"compile_low_chunks",
"(",
")",
"high_data",
",",
"errors",
"=",
"st_",
".",
"r... | Generates the chunks of lowdata from the list of modules | [
"Generates",
"the",
"chunks",
"of",
"lowdata",
"from",
"the",
"list",
"of",
"modules"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L6607-L6631 | train |
saltstack/salt | salt/modules/dockermod.py | call | def call(name, function, *args, **kwargs):
'''
Executes a Salt function inside a running container
.. versionadded:: 2016.11.0
The container does not need to have Salt installed, but Python is required.
name
Container name or ID
function
Salt execution module function
CL... | python | def call(name, function, *args, **kwargs):
'''
Executes a Salt function inside a running container
.. versionadded:: 2016.11.0
The container does not need to have Salt installed, but Python is required.
name
Container name or ID
function
Salt execution module function
CL... | [
"def",
"call",
"(",
"name",
",",
"function",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# where to put the salt-thin",
"thin_dest_path",
"=",
"_generate_tmp_path",
"(",
")",
"mkdirp_thin_argv",
"=",
"[",
"'mkdir'",
",",
"'-p'",
",",
"thin_dest_path"... | Executes a Salt function inside a running container
.. versionadded:: 2016.11.0
The container does not need to have Salt installed, but Python is required.
name
Container name or ID
function
Salt execution module function
CLI Example:
.. code-block:: bash
salt mymi... | [
"Executes",
"a",
"Salt",
"function",
"inside",
"a",
"running",
"container"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L6634-L6720 | train |
saltstack/salt | salt/modules/dockermod.py | apply_ | def apply_(name, mods=None, **kwargs):
'''
.. versionadded:: 2019.2.0
Apply states! This function will call highstate or state.sls based on the
arguments passed in, ``apply`` is intended to be the main gateway for
all state executions.
CLI Example:
.. code-block:: bash
salt 'dock... | python | def apply_(name, mods=None, **kwargs):
'''
.. versionadded:: 2019.2.0
Apply states! This function will call highstate or state.sls based on the
arguments passed in, ``apply`` is intended to be the main gateway for
all state executions.
CLI Example:
.. code-block:: bash
salt 'dock... | [
"def",
"apply_",
"(",
"name",
",",
"mods",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"mods",
":",
"return",
"sls",
"(",
"name",
",",
"mods",
",",
"*",
"*",
"kwargs",
")",
"return",
"highstate",
"(",
"name",
",",
"*",
"*",
"kwargs",
... | .. versionadded:: 2019.2.0
Apply states! This function will call highstate or state.sls based on the
arguments passed in, ``apply`` is intended to be the main gateway for
all state executions.
CLI Example:
.. code-block:: bash
salt 'docker' docker.apply web01
salt 'docker' docker... | [
"..",
"versionadded",
"::",
"2019",
".",
"2",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L6723-L6741 | train |
saltstack/salt | salt/modules/dockermod.py | sls | def sls(name, mods=None, **kwargs):
'''
Apply the states defined by the specified SLS modules to the running
container
.. versionadded:: 2016.11.0
The container does not need to have Salt installed, but Python is required.
name
Container name or ID
mods : None
A string co... | python | def sls(name, mods=None, **kwargs):
'''
Apply the states defined by the specified SLS modules to the running
container
.. versionadded:: 2016.11.0
The container does not need to have Salt installed, but Python is required.
name
Container name or ID
mods : None
A string co... | [
"def",
"sls",
"(",
"name",
",",
"mods",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"mods",
"=",
"[",
"item",
".",
"strip",
"(",
")",
"for",
"item",
"in",
"mods",
".",
"split",
"(",
"','",
")",
"]",
"if",
"mods",
"else",
"[",
"]",
"# Figu... | Apply the states defined by the specified SLS modules to the running
container
.. versionadded:: 2016.11.0
The container does not need to have Salt installed, but Python is required.
name
Container name or ID
mods : None
A string containing comma-separated list of SLS with define... | [
"Apply",
"the",
"states",
"defined",
"by",
"the",
"specified",
"SLS",
"modules",
"to",
"the",
"running",
"container"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L6744-L6858 | train |
saltstack/salt | salt/modules/dockermod.py | sls_build | def sls_build(repository,
tag='latest',
base='opensuse/python',
mods=None,
dryrun=False,
**kwargs):
'''
.. versionchanged:: 2018.3.0
The repository and tag must now be passed separately using the
``repository`` and ``tag`` arg... | python | def sls_build(repository,
tag='latest',
base='opensuse/python',
mods=None,
dryrun=False,
**kwargs):
'''
.. versionchanged:: 2018.3.0
The repository and tag must now be passed separately using the
``repository`` and ``tag`` arg... | [
"def",
"sls_build",
"(",
"repository",
",",
"tag",
"=",
"'latest'",
",",
"base",
"=",
"'opensuse/python'",
",",
"mods",
"=",
"None",
",",
"dryrun",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"create_kwargs",
"=",
"__utils__",
"[",
"'args.clean_kwargs... | .. versionchanged:: 2018.3.0
The repository and tag must now be passed separately using the
``repository`` and ``tag`` arguments, rather than together in the (now
deprecated) ``image`` argument.
Build a Docker image using the specified SLS modules on top of base image
.. versionadded::... | [
"..",
"versionchanged",
"::",
"2018",
".",
"3",
".",
"0",
"The",
"repository",
"and",
"tag",
"must",
"now",
"be",
"passed",
"separately",
"using",
"the",
"repository",
"and",
"tag",
"arguments",
"rather",
"than",
"together",
"in",
"the",
"(",
"now",
"depre... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L6886-L6991 | train |
saltstack/salt | salt/states/netntp.py | _check | def _check(peers):
'''Checks whether the input is a valid list of peers and transforms domain names into IP Addresses'''
if not isinstance(peers, list):
return False
for peer in peers:
if not isinstance(peer, six.string_types):
return False
if not HAS_NETADDR: # if does ... | python | def _check(peers):
'''Checks whether the input is a valid list of peers and transforms domain names into IP Addresses'''
if not isinstance(peers, list):
return False
for peer in peers:
if not isinstance(peer, six.string_types):
return False
if not HAS_NETADDR: # if does ... | [
"def",
"_check",
"(",
"peers",
")",
":",
"if",
"not",
"isinstance",
"(",
"peers",
",",
"list",
")",
":",
"return",
"False",
"for",
"peer",
"in",
"peers",
":",
"if",
"not",
"isinstance",
"(",
"peer",
",",
"six",
".",
"string_types",
")",
":",
"return"... | Checks whether the input is a valid list of peers and transforms domain names into IP Addresses | [
"Checks",
"whether",
"the",
"input",
"is",
"a",
"valid",
"list",
"of",
"peers",
"and",
"transforms",
"domain",
"names",
"into",
"IP",
"Addresses"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/netntp.py#L105-L142 | train |
saltstack/salt | salt/states/netntp.py | managed | def managed(name, peers=None, servers=None):
'''
Manages the configuration of NTP peers and servers on the device, as specified in the state SLS file.
NTP entities not specified in these lists will be removed whilst entities not configured on the device will be set.
SLS Example:
.. code-block:: y... | python | def managed(name, peers=None, servers=None):
'''
Manages the configuration of NTP peers and servers on the device, as specified in the state SLS file.
NTP entities not specified in these lists will be removed whilst entities not configured on the device will be set.
SLS Example:
.. code-block:: y... | [
"def",
"managed",
"(",
"name",
",",
"peers",
"=",
"None",
",",
"servers",
"=",
"None",
")",
":",
"ret",
"=",
"_default_ret",
"(",
"name",
")",
"result",
"=",
"ret",
".",
"get",
"(",
"'result'",
",",
"False",
")",
"comment",
"=",
"ret",
".",
"get",
... | Manages the configuration of NTP peers and servers on the device, as specified in the state SLS file.
NTP entities not specified in these lists will be removed whilst entities not configured on the device will be set.
SLS Example:
.. code-block:: yaml
netntp_example:
netntp.managed:
... | [
"Manages",
"the",
"configuration",
"of",
"NTP",
"peers",
"and",
"servers",
"on",
"the",
"device",
"as",
"specified",
"in",
"the",
"state",
"SLS",
"file",
".",
"NTP",
"entities",
"not",
"specified",
"in",
"these",
"lists",
"will",
"be",
"removed",
"whilst",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/netntp.py#L287-L409 | train |
saltstack/salt | salt/modules/lvs.py | add_service | def add_service(protocol=None, service_address=None, scheduler='wlc'):
'''
Add a virtual service.
protocol
The service protocol(only support tcp, udp and fwmark service).
service_address
The LVS service address.
scheduler
Algorithm for allocating TCP connections and UDP da... | python | def add_service(protocol=None, service_address=None, scheduler='wlc'):
'''
Add a virtual service.
protocol
The service protocol(only support tcp, udp and fwmark service).
service_address
The LVS service address.
scheduler
Algorithm for allocating TCP connections and UDP da... | [
"def",
"add_service",
"(",
"protocol",
"=",
"None",
",",
"service_address",
"=",
"None",
",",
"scheduler",
"=",
"'wlc'",
")",
":",
"cmd",
"=",
"'{0} -A {1}'",
".",
"format",
"(",
"__detect_os",
"(",
")",
",",
"_build_cmd",
"(",
"protocol",
"=",
"protocol",... | Add a virtual service.
protocol
The service protocol(only support tcp, udp and fwmark service).
service_address
The LVS service address.
scheduler
Algorithm for allocating TCP connections and UDP datagrams to real servers.
CLI Example:
.. code-block:: bash
salt... | [
"Add",
"a",
"virtual",
"service",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lvs.py#L88-L120 | train |
saltstack/salt | salt/states/boto_kinesis.py | present | def present(name,
retention_hours=None,
enhanced_monitoring=None,
num_shards=None,
do_reshard=True,
region=None,
key=None,
keyid=None,
profile=None):
'''
Ensure the kinesis stream is properly configured and scaled.
... | python | def present(name,
retention_hours=None,
enhanced_monitoring=None,
num_shards=None,
do_reshard=True,
region=None,
key=None,
keyid=None,
profile=None):
'''
Ensure the kinesis stream is properly configured and scaled.
... | [
"def",
"present",
"(",
"name",
",",
"retention_hours",
"=",
"None",
",",
"enhanced_monitoring",
"=",
"None",
",",
"num_shards",
"=",
"None",
",",
"do_reshard",
"=",
"True",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
... | Ensure the kinesis stream is properly configured and scaled.
name (string)
Stream name
retention_hours (int)
Retain data for this many hours.
AWS allows minimum 24 hours, maximum 168 hours.
enhanced_monitoring (list of string)
Turn on enhanced monitoring for the specified ... | [
"Ensure",
"the",
"kinesis",
"stream",
"is",
"properly",
"configured",
"and",
"scaled",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_kinesis.py#L78-L384 | train |
saltstack/salt | salt/modules/bsd_shadow.py | info | def info(name):
'''
Return information for the specified user
CLI Example:
.. code-block:: bash
salt '*' shadow.info someuser
'''
try:
data = pwd.getpwnam(name)
ret = {
'name': data.pw_name,
'passwd': data.pw_passwd}
except KeyError:
... | python | def info(name):
'''
Return information for the specified user
CLI Example:
.. code-block:: bash
salt '*' shadow.info someuser
'''
try:
data = pwd.getpwnam(name)
ret = {
'name': data.pw_name,
'passwd': data.pw_passwd}
except KeyError:
... | [
"def",
"info",
"(",
"name",
")",
":",
"try",
":",
"data",
"=",
"pwd",
".",
"getpwnam",
"(",
"name",
")",
"ret",
"=",
"{",
"'name'",
":",
"data",
".",
"pw_name",
",",
"'passwd'",
":",
"data",
".",
"pw_passwd",
"}",
"except",
"KeyError",
":",
"return... | Return information for the specified user
CLI Example:
.. code-block:: bash
salt '*' shadow.info someuser | [
"Return",
"information",
"for",
"the",
"specified",
"user"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bsd_shadow.py#L49-L103 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.