id int32 0 252k | repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
35,000 | saltstack/salt | salt/modules/glusterfs.py | peer_status | def peer_status():
'''
Return peer status information
The return value is a dictionary with peer UUIDs as keys and dicts of peer
information as values. Hostnames are listed in one list. GlusterFS separates
one of the hostnames but the only reason for this seems to be which hostname
happens to b... | python | def peer_status():
'''
Return peer status information
The return value is a dictionary with peer UUIDs as keys and dicts of peer
information as values. Hostnames are listed in one list. GlusterFS separates
one of the hostnames but the only reason for this seems to be which hostname
happens to b... | [
"def",
"peer_status",
"(",
")",
":",
"root",
"=",
"_gluster_xml",
"(",
"'peer status'",
")",
"if",
"not",
"_gluster_ok",
"(",
"root",
")",
":",
"return",
"None",
"result",
"=",
"{",
"}",
"for",
"peer",
"in",
"_iter",
"(",
"root",
",",
"'peer'",
")",
... | Return peer status information
The return value is a dictionary with peer UUIDs as keys and dicts of peer
information as values. Hostnames are listed in one list. GlusterFS separates
one of the hostnames but the only reason for this seems to be which hostname
happens to be used first in peering.
C... | [
"Return",
"peer",
"status",
"information"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glusterfs.py#L130-L181 |
35,001 | saltstack/salt | salt/modules/glusterfs.py | peer | def peer(name):
'''
Add another node into the peer list.
name
The remote host to probe.
CLI Example:
.. code-block:: bash
salt 'one.gluster.*' glusterfs.peer two
GLUSTER direct CLI example (to show what salt is sending to gluster):
$ gluster peer probe ftp2
GLU... | python | def peer(name):
'''
Add another node into the peer list.
name
The remote host to probe.
CLI Example:
.. code-block:: bash
salt 'one.gluster.*' glusterfs.peer two
GLUSTER direct CLI example (to show what salt is sending to gluster):
$ gluster peer probe ftp2
GLU... | [
"def",
"peer",
"(",
"name",
")",
":",
"if",
"salt",
".",
"utils",
".",
"cloud",
".",
"check_name",
"(",
"name",
",",
"'a-zA-Z0-9._-'",
")",
":",
"raise",
"SaltInvocationError",
"(",
"'Invalid characters in peer name \"{0}\"'",
".",
"format",
"(",
"name",
")",
... | Add another node into the peer list.
name
The remote host to probe.
CLI Example:
.. code-block:: bash
salt 'one.gluster.*' glusterfs.peer two
GLUSTER direct CLI example (to show what salt is sending to gluster):
$ gluster peer probe ftp2
GLUSTER CLI 3.4.4 return exampl... | [
"Add",
"another",
"node",
"into",
"the",
"peer",
"list",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glusterfs.py#L184-L219 |
35,002 | saltstack/salt | salt/modules/glusterfs.py | create_volume | def create_volume(name, bricks, stripe=False, replica=False, device_vg=False,
transport='tcp', start=False, force=False, arbiter=False):
'''
Create a glusterfs volume
name
Name of the gluster volume
bricks
Bricks to create volume from, in <peer>:<brick path> format. F... | python | def create_volume(name, bricks, stripe=False, replica=False, device_vg=False,
transport='tcp', start=False, force=False, arbiter=False):
'''
Create a glusterfs volume
name
Name of the gluster volume
bricks
Bricks to create volume from, in <peer>:<brick path> format. F... | [
"def",
"create_volume",
"(",
"name",
",",
"bricks",
",",
"stripe",
"=",
"False",
",",
"replica",
"=",
"False",
",",
"device_vg",
"=",
"False",
",",
"transport",
"=",
"'tcp'",
",",
"start",
"=",
"False",
",",
"force",
"=",
"False",
",",
"arbiter",
"=",
... | Create a glusterfs volume
name
Name of the gluster volume
bricks
Bricks to create volume from, in <peer>:<brick path> format. For \
multiple bricks use list format: '["<peer1>:<brick1>", \
"<peer2>:<brick2>"]'
stripe
Stripe count, the number of bricks should be a m... | [
"Create",
"a",
"glusterfs",
"volume"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glusterfs.py#L222-L320 |
35,003 | saltstack/salt | salt/modules/glusterfs.py | list_volumes | def list_volumes():
'''
List configured volumes
CLI Example:
.. code-block:: bash
salt '*' glusterfs.list_volumes
'''
root = _gluster_xml('volume list')
if not _gluster_ok(root):
return None
results = [x.text for x in _iter(root, 'volume')]
return results | python | def list_volumes():
'''
List configured volumes
CLI Example:
.. code-block:: bash
salt '*' glusterfs.list_volumes
'''
root = _gluster_xml('volume list')
if not _gluster_ok(root):
return None
results = [x.text for x in _iter(root, 'volume')]
return results | [
"def",
"list_volumes",
"(",
")",
":",
"root",
"=",
"_gluster_xml",
"(",
"'volume list'",
")",
"if",
"not",
"_gluster_ok",
"(",
"root",
")",
":",
"return",
"None",
"results",
"=",
"[",
"x",
".",
"text",
"for",
"x",
"in",
"_iter",
"(",
"root",
",",
"'v... | List configured volumes
CLI Example:
.. code-block:: bash
salt '*' glusterfs.list_volumes | [
"List",
"configured",
"volumes"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glusterfs.py#L323-L338 |
35,004 | saltstack/salt | salt/modules/glusterfs.py | status | def status(name):
'''
Check the status of a gluster volume.
name
Volume name
CLI Example:
.. code-block:: bash
salt '*' glusterfs.status myvolume
'''
# Get volume status
root = _gluster_xml('volume status {0}'.format(name))
if not _gluster_ok(root):
# Most... | python | def status(name):
'''
Check the status of a gluster volume.
name
Volume name
CLI Example:
.. code-block:: bash
salt '*' glusterfs.status myvolume
'''
# Get volume status
root = _gluster_xml('volume status {0}'.format(name))
if not _gluster_ok(root):
# Most... | [
"def",
"status",
"(",
"name",
")",
":",
"# Get volume status",
"root",
"=",
"_gluster_xml",
"(",
"'volume status {0}'",
".",
"format",
"(",
"name",
")",
")",
"if",
"not",
"_gluster_ok",
"(",
"root",
")",
":",
"# Most probably non-existing volume, the error output is... | Check the status of a gluster volume.
name
Volume name
CLI Example:
.. code-block:: bash
salt '*' glusterfs.status myvolume | [
"Check",
"the",
"status",
"of",
"a",
"gluster",
"volume",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glusterfs.py#L341-L392 |
35,005 | saltstack/salt | salt/modules/glusterfs.py | start_volume | def start_volume(name, force=False):
'''
Start a gluster volume
name
Volume name
force
Force the volume start even if the volume is started
.. versionadded:: 2015.8.4
CLI Example:
.. code-block:: bash
salt '*' glusterfs.start mycluster
'''
cmd = 'volu... | python | def start_volume(name, force=False):
'''
Start a gluster volume
name
Volume name
force
Force the volume start even if the volume is started
.. versionadded:: 2015.8.4
CLI Example:
.. code-block:: bash
salt '*' glusterfs.start mycluster
'''
cmd = 'volu... | [
"def",
"start_volume",
"(",
"name",
",",
"force",
"=",
"False",
")",
":",
"cmd",
"=",
"'volume start {0}'",
".",
"format",
"(",
"name",
")",
"if",
"force",
":",
"cmd",
"=",
"'{0} force'",
".",
"format",
"(",
"cmd",
")",
"volinfo",
"=",
"info",
"(",
"... | Start a gluster volume
name
Volume name
force
Force the volume start even if the volume is started
.. versionadded:: 2015.8.4
CLI Example:
.. code-block:: bash
salt '*' glusterfs.start mycluster | [
"Start",
"a",
"gluster",
"volume"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glusterfs.py#L442-L472 |
35,006 | saltstack/salt | salt/modules/glusterfs.py | stop_volume | def stop_volume(name, force=False):
'''
Stop a gluster volume
name
Volume name
force
Force stop the volume
.. versionadded:: 2015.8.4
CLI Example:
.. code-block:: bash
salt '*' glusterfs.stop_volume mycluster
'''
volinfo = info()
if name not in v... | python | def stop_volume(name, force=False):
'''
Stop a gluster volume
name
Volume name
force
Force stop the volume
.. versionadded:: 2015.8.4
CLI Example:
.. code-block:: bash
salt '*' glusterfs.stop_volume mycluster
'''
volinfo = info()
if name not in v... | [
"def",
"stop_volume",
"(",
"name",
",",
"force",
"=",
"False",
")",
":",
"volinfo",
"=",
"info",
"(",
")",
"if",
"name",
"not",
"in",
"volinfo",
":",
"log",
".",
"error",
"(",
"'Cannot stop non-existing volume %s'",
",",
"name",
")",
"return",
"False",
"... | Stop a gluster volume
name
Volume name
force
Force stop the volume
.. versionadded:: 2015.8.4
CLI Example:
.. code-block:: bash
salt '*' glusterfs.stop_volume mycluster | [
"Stop",
"a",
"gluster",
"volume"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glusterfs.py#L475-L505 |
35,007 | saltstack/salt | salt/modules/glusterfs.py | delete_volume | def delete_volume(target, stop=True):
'''
Deletes a gluster volume
target
Volume to delete
stop : True
If ``True``, stop volume before delete
CLI Example:
.. code-block:: bash
salt '*' glusterfs.delete_volume <volume>
'''
volinfo = info()
if target not in... | python | def delete_volume(target, stop=True):
'''
Deletes a gluster volume
target
Volume to delete
stop : True
If ``True``, stop volume before delete
CLI Example:
.. code-block:: bash
salt '*' glusterfs.delete_volume <volume>
'''
volinfo = info()
if target not in... | [
"def",
"delete_volume",
"(",
"target",
",",
"stop",
"=",
"True",
")",
":",
"volinfo",
"=",
"info",
"(",
")",
"if",
"target",
"not",
"in",
"volinfo",
":",
"log",
".",
"error",
"(",
"'Cannot delete non-existing volume %s'",
",",
"target",
")",
"return",
"Fal... | Deletes a gluster volume
target
Volume to delete
stop : True
If ``True``, stop volume before delete
CLI Example:
.. code-block:: bash
salt '*' glusterfs.delete_volume <volume> | [
"Deletes",
"a",
"gluster",
"volume"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glusterfs.py#L508-L542 |
35,008 | saltstack/salt | salt/modules/glusterfs.py | set_quota_volume | def set_quota_volume(name, path, size, enable_quota=False):
'''
Set quota to glusterfs volume.
name
Name of the gluster volume
path
Folder path for restriction in volume ("/")
size
Hard-limit size of the volume (MB/GB)
enable_quota
Enable quota before set up r... | python | def set_quota_volume(name, path, size, enable_quota=False):
'''
Set quota to glusterfs volume.
name
Name of the gluster volume
path
Folder path for restriction in volume ("/")
size
Hard-limit size of the volume (MB/GB)
enable_quota
Enable quota before set up r... | [
"def",
"set_quota_volume",
"(",
"name",
",",
"path",
",",
"size",
",",
"enable_quota",
"=",
"False",
")",
":",
"cmd",
"=",
"'volume quota {0}'",
".",
"format",
"(",
"name",
")",
"if",
"path",
":",
"cmd",
"+=",
"' limit-usage {0}'",
".",
"format",
"(",
"p... | Set quota to glusterfs volume.
name
Name of the gluster volume
path
Folder path for restriction in volume ("/")
size
Hard-limit size of the volume (MB/GB)
enable_quota
Enable quota before set up restriction
CLI Example:
.. code-block:: bash
salt '*'... | [
"Set",
"quota",
"to",
"glusterfs",
"volume",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glusterfs.py#L632-L665 |
35,009 | 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 |
35,010 | 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 |
35,011 | 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 |
35,012 | 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 |
35,013 | 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 |
35,014 | 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 |
35,015 | 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 |
35,016 | 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 |
35,017 | 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 |
35,018 | 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 |
35,019 | 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 |
35,020 | 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 |
35,021 | 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 |
35,022 | 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 |
35,023 | 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 |
35,024 | 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 |
35,025 | 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 |
35,026 | 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 |
35,027 | 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 |
35,028 | 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 |
35,029 | 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 |
35,030 | 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 |
35,031 | 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 |
35,032 | 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 |
35,033 | 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 |
35,034 | 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 |
35,035 | 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 |
35,036 | 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 |
35,037 | 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 |
35,038 | 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 |
35,039 | 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 |
35,040 | 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 |
35,041 | 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 |
35,042 | 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 |
35,043 | 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 |
35,044 | 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 |
35,045 | 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 |
35,046 | 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 |
35,047 | 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 |
35,048 | 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 |
35,049 | 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 |
35,050 | 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 |
35,051 | 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 |
35,052 | 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 |
35,053 | 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 |
35,054 | 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 |
35,055 | 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 |
35,056 | 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 |
35,057 | 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 |
35,058 | 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 |
35,059 | 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 |
35,060 | saltstack/salt | salt/netapi/rest_tornado/saltnado_websockets.py | AllEventsHandler.get | def get(self, token):
'''
Check the token, returns a 401 if the token is invalid.
Else open the websocket connection
'''
log.debug('In the websocket get method')
self.token = token
# close the connection, if not authenticated
if not self.application.auth.... | python | def get(self, token):
'''
Check the token, returns a 401 if the token is invalid.
Else open the websocket connection
'''
log.debug('In the websocket get method')
self.token = token
# close the connection, if not authenticated
if not self.application.auth.... | [
"def",
"get",
"(",
"self",
",",
"token",
")",
":",
"log",
".",
"debug",
"(",
"'In the websocket get method'",
")",
"self",
".",
"token",
"=",
"token",
"# close the connection, if not authenticated",
"if",
"not",
"self",
".",
"application",
".",
"auth",
".",
"g... | Check the token, returns a 401 if the token is invalid.
Else open the websocket connection | [
"Check",
"the",
"token",
"returns",
"a",
"401",
"if",
"the",
"token",
"is",
"invalid",
".",
"Else",
"open",
"the",
"websocket",
"connection"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_tornado/saltnado_websockets.py#L315-L328 |
35,061 | saltstack/salt | salt/netapi/rest_tornado/saltnado_websockets.py | AllEventsHandler.check_origin | def check_origin(self, origin):
"""
If cors is enabled, check that the origin is allowed
"""
mod_opts = self.application.mod_opts
if mod_opts.get('cors_origin'):
return bool(_check_cors_origin(origin, mod_opts['cors_origin']))
else:
return super(... | python | def check_origin(self, origin):
"""
If cors is enabled, check that the origin is allowed
"""
mod_opts = self.application.mod_opts
if mod_opts.get('cors_origin'):
return bool(_check_cors_origin(origin, mod_opts['cors_origin']))
else:
return super(... | [
"def",
"check_origin",
"(",
"self",
",",
"origin",
")",
":",
"mod_opts",
"=",
"self",
".",
"application",
".",
"mod_opts",
"if",
"mod_opts",
".",
"get",
"(",
"'cors_origin'",
")",
":",
"return",
"bool",
"(",
"_check_cors_origin",
"(",
"origin",
",",
"mod_o... | If cors is enabled, check that the origin is allowed | [
"If",
"cors",
"is",
"enabled",
"check",
"that",
"the",
"origin",
"is",
"allowed"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_tornado/saltnado_websockets.py#L375-L385 |
35,062 | saltstack/salt | salt/modules/supervisord.py | _get_supervisorctl_bin | def _get_supervisorctl_bin(bin_env):
'''
Return supervisorctl command to call, either from a virtualenv, an argument
passed in, or from the global modules options
'''
cmd = 'supervisorctl'
if not bin_env:
which_result = __salt__['cmd.which_bin']([cmd])
if which_result is None:
... | python | def _get_supervisorctl_bin(bin_env):
'''
Return supervisorctl command to call, either from a virtualenv, an argument
passed in, or from the global modules options
'''
cmd = 'supervisorctl'
if not bin_env:
which_result = __salt__['cmd.which_bin']([cmd])
if which_result is None:
... | [
"def",
"_get_supervisorctl_bin",
"(",
"bin_env",
")",
":",
"cmd",
"=",
"'supervisorctl'",
"if",
"not",
"bin_env",
":",
"which_result",
"=",
"__salt__",
"[",
"'cmd.which_bin'",
"]",
"(",
"[",
"cmd",
"]",
")",
"if",
"which_result",
"is",
"None",
":",
"raise",
... | Return supervisorctl command to call, either from a virtualenv, an argument
passed in, or from the global modules options | [
"Return",
"supervisorctl",
"command",
"to",
"call",
"either",
"from",
"a",
"virtualenv",
"an",
"argument",
"passed",
"in",
"or",
"from",
"the",
"global",
"modules",
"options"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/supervisord.py#L28-L49 |
35,063 | saltstack/salt | salt/modules/supervisord.py | _ctl_cmd | def _ctl_cmd(cmd, name, conf_file, bin_env):
'''
Return the command list to use
'''
ret = [_get_supervisorctl_bin(bin_env)]
if conf_file is not None:
ret += ['-c', conf_file]
ret.append(cmd)
if name:
ret.append(name)
return ret | python | def _ctl_cmd(cmd, name, conf_file, bin_env):
'''
Return the command list to use
'''
ret = [_get_supervisorctl_bin(bin_env)]
if conf_file is not None:
ret += ['-c', conf_file]
ret.append(cmd)
if name:
ret.append(name)
return ret | [
"def",
"_ctl_cmd",
"(",
"cmd",
",",
"name",
",",
"conf_file",
",",
"bin_env",
")",
":",
"ret",
"=",
"[",
"_get_supervisorctl_bin",
"(",
"bin_env",
")",
"]",
"if",
"conf_file",
"is",
"not",
"None",
":",
"ret",
"+=",
"[",
"'-c'",
",",
"conf_file",
"]",
... | Return the command list to use | [
"Return",
"the",
"command",
"list",
"to",
"use"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/supervisord.py#L52-L62 |
35,064 | saltstack/salt | salt/modules/supervisord.py | start | def start(name='all', user=None, conf_file=None, bin_env=None):
'''
Start the named service.
Process group names should not include a trailing asterisk.
user
user to run supervisorctl as
conf_file
path to supervisord config file
bin_env
path to supervisorctl bin or path ... | python | def start(name='all', user=None, conf_file=None, bin_env=None):
'''
Start the named service.
Process group names should not include a trailing asterisk.
user
user to run supervisorctl as
conf_file
path to supervisord config file
bin_env
path to supervisorctl bin or path ... | [
"def",
"start",
"(",
"name",
"=",
"'all'",
",",
"user",
"=",
"None",
",",
"conf_file",
"=",
"None",
",",
"bin_env",
"=",
"None",
")",
":",
"if",
"name",
".",
"endswith",
"(",
"':*'",
")",
":",
"name",
"=",
"name",
"[",
":",
"-",
"1",
"]",
"ret"... | Start the named service.
Process group names should not include a trailing asterisk.
user
user to run supervisorctl as
conf_file
path to supervisord config file
bin_env
path to supervisorctl bin or path to virtualenv with supervisor
installed
CLI Example:
.. co... | [
"Start",
"the",
"named",
"service",
".",
"Process",
"group",
"names",
"should",
"not",
"include",
"a",
"trailing",
"asterisk",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/supervisord.py#L72-L99 |
35,065 | saltstack/salt | salt/modules/supervisord.py | reread | def reread(user=None, conf_file=None, bin_env=None):
'''
Reload the daemon's configuration files
user
user to run supervisorctl as
conf_file
path to supervisord config file
bin_env
path to supervisorctl bin or path to virtualenv with supervisor
installed
CLI Exa... | python | def reread(user=None, conf_file=None, bin_env=None):
'''
Reload the daemon's configuration files
user
user to run supervisorctl as
conf_file
path to supervisord config file
bin_env
path to supervisorctl bin or path to virtualenv with supervisor
installed
CLI Exa... | [
"def",
"reread",
"(",
"user",
"=",
"None",
",",
"conf_file",
"=",
"None",
",",
"bin_env",
"=",
"None",
")",
":",
"ret",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"_ctl_cmd",
"(",
"'reread'",
",",
"None",
",",
"conf_file",
",",
"bin_env",
")",
... | Reload the daemon's configuration files
user
user to run supervisorctl as
conf_file
path to supervisord config file
bin_env
path to supervisorctl bin or path to virtualenv with supervisor
installed
CLI Example:
.. code-block:: bash
salt '*' supervisord.rer... | [
"Reload",
"the",
"daemon",
"s",
"configuration",
"files"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/supervisord.py#L222-L245 |
35,066 | saltstack/salt | salt/modules/supervisord.py | status | def status(name=None, user=None, conf_file=None, bin_env=None):
'''
List programs and its state
user
user to run supervisorctl as
conf_file
path to supervisord config file
bin_env
path to supervisorctl bin or path to virtualenv with supervisor
installed
CLI Exam... | python | def status(name=None, user=None, conf_file=None, bin_env=None):
'''
List programs and its state
user
user to run supervisorctl as
conf_file
path to supervisord config file
bin_env
path to supervisorctl bin or path to virtualenv with supervisor
installed
CLI Exam... | [
"def",
"status",
"(",
"name",
"=",
"None",
",",
"user",
"=",
"None",
",",
"conf_file",
"=",
"None",
",",
"bin_env",
"=",
"None",
")",
":",
"all_process",
"=",
"{",
"}",
"for",
"line",
"in",
"status_raw",
"(",
"name",
",",
"user",
",",
"conf_file",
... | List programs and its state
user
user to run supervisorctl as
conf_file
path to supervisord config file
bin_env
path to supervisorctl bin or path to virtualenv with supervisor
installed
CLI Example:
.. code-block:: bash
salt '*' supervisord.status | [
"List",
"programs",
"and",
"its",
"state"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/supervisord.py#L284-L309 |
35,067 | saltstack/salt | salt/modules/supervisord.py | status_raw | def status_raw(name=None, user=None, conf_file=None, bin_env=None):
'''
Display the raw output of status
user
user to run supervisorctl as
conf_file
path to supervisord config file
bin_env
path to supervisorctl bin or path to virtualenv with supervisor
installed
... | python | def status_raw(name=None, user=None, conf_file=None, bin_env=None):
'''
Display the raw output of status
user
user to run supervisorctl as
conf_file
path to supervisord config file
bin_env
path to supervisorctl bin or path to virtualenv with supervisor
installed
... | [
"def",
"status_raw",
"(",
"name",
"=",
"None",
",",
"user",
"=",
"None",
",",
"conf_file",
"=",
"None",
",",
"bin_env",
"=",
"None",
")",
":",
"ret",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"_ctl_cmd",
"(",
"'status'",
",",
"name",
",",
"con... | Display the raw output of status
user
user to run supervisorctl as
conf_file
path to supervisord config file
bin_env
path to supervisorctl bin or path to virtualenv with supervisor
installed
CLI Example:
.. code-block:: bash
salt '*' supervisord.status_raw | [
"Display",
"the",
"raw",
"output",
"of",
"status"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/supervisord.py#L312-L335 |
35,068 | saltstack/salt | salt/modules/supervisord.py | custom | def custom(command, user=None, conf_file=None, bin_env=None):
'''
Run any custom supervisord command
user
user to run supervisorctl as
conf_file
path to supervisord config file
bin_env
path to supervisorctl bin or path to virtualenv with supervisor
installed
CLI... | python | def custom(command, user=None, conf_file=None, bin_env=None):
'''
Run any custom supervisord command
user
user to run supervisorctl as
conf_file
path to supervisord config file
bin_env
path to supervisorctl bin or path to virtualenv with supervisor
installed
CLI... | [
"def",
"custom",
"(",
"command",
",",
"user",
"=",
"None",
",",
"conf_file",
"=",
"None",
",",
"bin_env",
"=",
"None",
")",
":",
"ret",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"_ctl_cmd",
"(",
"command",
",",
"None",
",",
"conf_file",
",",
"... | Run any custom supervisord command
user
user to run supervisorctl as
conf_file
path to supervisord config file
bin_env
path to supervisorctl bin or path to virtualenv with supervisor
installed
CLI Example:
.. code-block:: bash
salt '*' supervisord.custom "... | [
"Run",
"any",
"custom",
"supervisord",
"command"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/supervisord.py#L338-L361 |
35,069 | saltstack/salt | salt/modules/supervisord.py | _read_config | def _read_config(conf_file=None):
'''
Reads the config file using configparser
'''
if conf_file is None:
paths = ('/etc/supervisor/supervisord.conf', '/etc/supervisord.conf')
for path in paths:
if os.path.exists(path):
conf_file = path
break
... | python | def _read_config(conf_file=None):
'''
Reads the config file using configparser
'''
if conf_file is None:
paths = ('/etc/supervisor/supervisord.conf', '/etc/supervisord.conf')
for path in paths:
if os.path.exists(path):
conf_file = path
break
... | [
"def",
"_read_config",
"(",
"conf_file",
"=",
"None",
")",
":",
"if",
"conf_file",
"is",
"None",
":",
"paths",
"=",
"(",
"'/etc/supervisor/supervisord.conf'",
",",
"'/etc/supervisord.conf'",
")",
"for",
"path",
"in",
"paths",
":",
"if",
"os",
".",
"path",
".... | Reads the config file using configparser | [
"Reads",
"the",
"config",
"file",
"using",
"configparser"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/supervisord.py#L366-L385 |
35,070 | saltstack/salt | salt/states/logadm.py | rotate | def rotate(name, **kwargs):
'''
Add a log to the logadm configuration
name : string
alias for entryname
kwargs : boolean|string|int
optional additional flags and parameters
'''
ret = {'name': name,
'changes': {},
'result': None,
'comment': ''}
... | python | def rotate(name, **kwargs):
'''
Add a log to the logadm configuration
name : string
alias for entryname
kwargs : boolean|string|int
optional additional flags and parameters
'''
ret = {'name': name,
'changes': {},
'result': None,
'comment': ''}
... | [
"def",
"rotate",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"None",
",",
"'comment'",
":",
"''",
"}",
"# cleanup kwargs",
"kwargs",
"=",
"salt",
"."... | Add a log to the logadm configuration
name : string
alias for entryname
kwargs : boolean|string|int
optional additional flags and parameters | [
"Add",
"a",
"log",
"to",
"the",
"logadm",
"configuration"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/logadm.py#L48-L114 |
35,071 | saltstack/salt | salt/states/logadm.py | remove | def remove(name, log_file=None):
'''
Remove a log from the logadm configuration
name : string
entryname
log_file : string
(optional) log file path
.. note::
If log_file is specified it will be used instead of the entry name.
'''
ret = {'name': name,
'cha... | python | def remove(name, log_file=None):
'''
Remove a log from the logadm configuration
name : string
entryname
log_file : string
(optional) log file path
.. note::
If log_file is specified it will be used instead of the entry name.
'''
ret = {'name': name,
'cha... | [
"def",
"remove",
"(",
"name",
",",
"log_file",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"None",
",",
"'comment'",
":",
"''",
"}",
"# retrieve all log configuration",
"config",
... | Remove a log from the logadm configuration
name : string
entryname
log_file : string
(optional) log file path
.. note::
If log_file is specified it will be used instead of the entry name. | [
"Remove",
"a",
"log",
"from",
"the",
"logadm",
"configuration"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/logadm.py#L117-L168 |
35,072 | saltstack/salt | salt/states/win_firewall.py | add_rule | def add_rule(name,
localport,
protocol='tcp',
action='allow',
dir='in',
remoteip='any'):
'''
Add a new inbound or outbound rule to the firewall policy
Args:
name (str): The name of the rule. Must be unique and cannot be "all".
... | python | def add_rule(name,
localport,
protocol='tcp',
action='allow',
dir='in',
remoteip='any'):
'''
Add a new inbound or outbound rule to the firewall policy
Args:
name (str): The name of the rule. Must be unique and cannot be "all".
... | [
"def",
"add_rule",
"(",
"name",
",",
"localport",
",",
"protocol",
"=",
"'tcp'",
",",
"action",
"=",
"'allow'",
",",
"dir",
"=",
"'in'",
",",
"remoteip",
"=",
"'any'",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",
"True",
... | Add a new inbound or outbound rule to the firewall policy
Args:
name (str): The name of the rule. Must be unique and cannot be "all".
Required.
localport (int): The port the rule applies to. Must be a number between
0 and 65535. Can be a range. Can specify multiple ports s... | [
"Add",
"a",
"new",
"inbound",
"or",
"outbound",
"rule",
"to",
"the",
"firewall",
"policy"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/win_firewall.py#L94-L184 |
35,073 | saltstack/salt | salt/states/win_firewall.py | delete_rule | def delete_rule(name,
localport=None,
protocol=None,
dir=None,
remoteip=None):
'''
Delete an existing firewall rule identified by name and optionally by ports,
protocols, direction, and remote IP.
.. versionadded:: Neon
Args:
name (str):... | python | def delete_rule(name,
localport=None,
protocol=None,
dir=None,
remoteip=None):
'''
Delete an existing firewall rule identified by name and optionally by ports,
protocols, direction, and remote IP.
.. versionadded:: Neon
Args:
name (str):... | [
"def",
"delete_rule",
"(",
"name",
",",
"localport",
"=",
"None",
",",
"protocol",
"=",
"None",
",",
"dir",
"=",
"None",
",",
"remoteip",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",
"True",
",",
"'changes'",
... | Delete an existing firewall rule identified by name and optionally by ports,
protocols, direction, and remote IP.
.. versionadded:: Neon
Args:
name (str): The name of the rule to delete. If the name ``all`` is used
you must specify additional parameters.
localport (Optional[s... | [
"Delete",
"an",
"existing",
"firewall",
"rule",
"identified",
"by",
"name",
"and",
"optionally",
"by",
"ports",
"protocols",
"direction",
"and",
"remote",
"IP",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/win_firewall.py#L187-L246 |
35,074 | saltstack/salt | salt/modules/vault.py | read_secret | def read_secret(path, key=None):
'''
Return the value of key at path in vault, or entire secret
Jinja Example:
.. code-block:: jinja
my-secret: {{ salt['vault'].read_secret('secret/my/secret', 'some-key') }}
.. code-block:: jinja
{% set supersecret = salt['vault'].read_secret('s... | python | def read_secret(path, key=None):
'''
Return the value of key at path in vault, or entire secret
Jinja Example:
.. code-block:: jinja
my-secret: {{ salt['vault'].read_secret('secret/my/secret', 'some-key') }}
.. code-block:: jinja
{% set supersecret = salt['vault'].read_secret('s... | [
"def",
"read_secret",
"(",
"path",
",",
"key",
"=",
"None",
")",
":",
"log",
".",
"debug",
"(",
"'Reading Vault secret for %s at %s'",
",",
"__grains__",
"[",
"'id'",
"]",
",",
"path",
")",
"try",
":",
"url",
"=",
"'v1/{0}'",
".",
"format",
"(",
"path",
... | Return the value of key at path in vault, or entire secret
Jinja Example:
.. code-block:: jinja
my-secret: {{ salt['vault'].read_secret('secret/my/secret', 'some-key') }}
.. code-block:: jinja
{% set supersecret = salt['vault'].read_secret('secret/my/secret') %}
secrets:
... | [
"Return",
"the",
"value",
"of",
"key",
"at",
"path",
"in",
"vault",
"or",
"entire",
"secret"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/vault.py#L142-L172 |
35,075 | saltstack/salt | salt/modules/vault.py | write_secret | def write_secret(path, **kwargs):
'''
Set secret at the path in vault. The vault policy used must allow this.
CLI Example:
.. code-block:: bash
salt '*' vault.write_secret "secret/my/secret" user="foo" password="bar"
'''
log.debug('Writing vault secrets for %s at %s', __grains__['... | python | def write_secret(path, **kwargs):
'''
Set secret at the path in vault. The vault policy used must allow this.
CLI Example:
.. code-block:: bash
salt '*' vault.write_secret "secret/my/secret" user="foo" password="bar"
'''
log.debug('Writing vault secrets for %s at %s', __grains__['... | [
"def",
"write_secret",
"(",
"path",
",",
"*",
"*",
"kwargs",
")",
":",
"log",
".",
"debug",
"(",
"'Writing vault secrets for %s at %s'",
",",
"__grains__",
"[",
"'id'",
"]",
",",
"path",
")",
"data",
"=",
"dict",
"(",
"[",
"(",
"x",
",",
"y",
")",
"f... | Set secret at the path in vault. The vault policy used must allow this.
CLI Example:
.. code-block:: bash
salt '*' vault.write_secret "secret/my/secret" user="foo" password="bar" | [
"Set",
"secret",
"at",
"the",
"path",
"in",
"vault",
".",
"The",
"vault",
"policy",
"used",
"must",
"allow",
"this",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/vault.py#L175-L197 |
35,076 | saltstack/salt | salt/modules/vault.py | write_raw | def write_raw(path, raw):
'''
Set raw data at the path in vault. The vault policy used must allow this.
CLI Example:
.. code-block:: bash
salt '*' vault.write_raw "secret/my/secret" '{"user":"foo","password": "bar"}'
'''
log.debug('Writing vault secrets for %s at %s', __grains__['... | python | def write_raw(path, raw):
'''
Set raw data at the path in vault. The vault policy used must allow this.
CLI Example:
.. code-block:: bash
salt '*' vault.write_raw "secret/my/secret" '{"user":"foo","password": "bar"}'
'''
log.debug('Writing vault secrets for %s at %s', __grains__['... | [
"def",
"write_raw",
"(",
"path",
",",
"raw",
")",
":",
"log",
".",
"debug",
"(",
"'Writing vault secrets for %s at %s'",
",",
"__grains__",
"[",
"'id'",
"]",
",",
"path",
")",
"try",
":",
"url",
"=",
"'v1/{0}'",
".",
"format",
"(",
"path",
")",
"response... | Set raw data at the path in vault. The vault policy used must allow this.
CLI Example:
.. code-block:: bash
salt '*' vault.write_raw "secret/my/secret" '{"user":"foo","password": "bar"}' | [
"Set",
"raw",
"data",
"at",
"the",
"path",
"in",
"vault",
".",
"The",
"vault",
"policy",
"used",
"must",
"allow",
"this",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/vault.py#L200-L221 |
35,077 | saltstack/salt | salt/renderers/hjson.py | render | def render(hjson_data, saltenv='base', sls='', **kws):
'''
Accepts HJSON as a string or as a file object and runs it through the HJSON
parser.
:rtype: A Python data structure
'''
if not isinstance(hjson_data, six.string_types):
hjson_data = hjson_data.read()
if hjson_data.startswit... | python | def render(hjson_data, saltenv='base', sls='', **kws):
'''
Accepts HJSON as a string or as a file object and runs it through the HJSON
parser.
:rtype: A Python data structure
'''
if not isinstance(hjson_data, six.string_types):
hjson_data = hjson_data.read()
if hjson_data.startswit... | [
"def",
"render",
"(",
"hjson_data",
",",
"saltenv",
"=",
"'base'",
",",
"sls",
"=",
"''",
",",
"*",
"*",
"kws",
")",
":",
"if",
"not",
"isinstance",
"(",
"hjson_data",
",",
"six",
".",
"string_types",
")",
":",
"hjson_data",
"=",
"hjson_data",
".",
"... | Accepts HJSON as a string or as a file object and runs it through the HJSON
parser.
:rtype: A Python data structure | [
"Accepts",
"HJSON",
"as",
"a",
"string",
"or",
"as",
"a",
"file",
"object",
"and",
"runs",
"it",
"through",
"the",
"HJSON",
"parser",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/renderers/hjson.py#L23-L37 |
35,078 | saltstack/salt | salt/states/boto_lambda.py | event_source_mapping_absent | def event_source_mapping_absent(name, EventSourceArn, FunctionName,
region=None, key=None, keyid=None, profile=None):
'''
Ensure event source mapping with passed properties is absent.
name
The name of the state definition.
EventSourceArn
ARN of the event... | python | def event_source_mapping_absent(name, EventSourceArn, FunctionName,
region=None, key=None, keyid=None, profile=None):
'''
Ensure event source mapping with passed properties is absent.
name
The name of the state definition.
EventSourceArn
ARN of the event... | [
"def",
"event_source_mapping_absent",
"(",
"name",
",",
"EventSourceArn",
",",
"FunctionName",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"None",
... | Ensure event source mapping with passed properties is absent.
name
The name of the state definition.
EventSourceArn
ARN of the event source.
FunctionName
Name of the lambda function.
region
Region to connect to.
key
Secret key to be used.
keyid
... | [
"Ensure",
"event",
"source",
"mapping",
"with",
"passed",
"properties",
"is",
"absent",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_lambda.py#L900-L963 |
35,079 | saltstack/salt | salt/modules/libcloud_loadbalancer.py | list_balancers | def list_balancers(profile, **libcloud_kwargs):
'''
Return a list of load balancers.
:param profile: The profile key
:type profile: ``str``
:param libcloud_kwargs: Extra arguments for the driver's list_balancers method
:type libcloud_kwargs: ``dict``
CLI Example:
.. code-block:: ba... | python | def list_balancers(profile, **libcloud_kwargs):
'''
Return a list of load balancers.
:param profile: The profile key
:type profile: ``str``
:param libcloud_kwargs: Extra arguments for the driver's list_balancers method
:type libcloud_kwargs: ``dict``
CLI Example:
.. code-block:: ba... | [
"def",
"list_balancers",
"(",
"profile",
",",
"*",
"*",
"libcloud_kwargs",
")",
":",
"conn",
"=",
"_get_driver",
"(",
"profile",
"=",
"profile",
")",
"libcloud_kwargs",
"=",
"salt",
".",
"utils",
".",
"args",
".",
"clean_kwargs",
"(",
"*",
"*",
"libcloud_k... | Return a list of load balancers.
:param profile: The profile key
:type profile: ``str``
:param libcloud_kwargs: Extra arguments for the driver's list_balancers method
:type libcloud_kwargs: ``dict``
CLI Example:
.. code-block:: bash
salt myminion libcloud_storage.list_balancers pr... | [
"Return",
"a",
"list",
"of",
"load",
"balancers",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/libcloud_loadbalancer.py#L104-L126 |
35,080 | saltstack/salt | salt/modules/libcloud_loadbalancer.py | list_protocols | def list_protocols(profile, **libcloud_kwargs):
'''
Return a list of supported protocols.
:param profile: The profile key
:type profile: ``str``
:param libcloud_kwargs: Extra arguments for the driver's list_protocols method
:type libcloud_kwargs: ``dict``
:return: a list of supported pr... | python | def list_protocols(profile, **libcloud_kwargs):
'''
Return a list of supported protocols.
:param profile: The profile key
:type profile: ``str``
:param libcloud_kwargs: Extra arguments for the driver's list_protocols method
:type libcloud_kwargs: ``dict``
:return: a list of supported pr... | [
"def",
"list_protocols",
"(",
"profile",
",",
"*",
"*",
"libcloud_kwargs",
")",
":",
"conn",
"=",
"_get_driver",
"(",
"profile",
"=",
"profile",
")",
"libcloud_kwargs",
"=",
"salt",
".",
"utils",
".",
"args",
".",
"clean_kwargs",
"(",
"*",
"*",
"libcloud_k... | Return a list of supported protocols.
:param profile: The profile key
:type profile: ``str``
:param libcloud_kwargs: Extra arguments for the driver's list_protocols method
:type libcloud_kwargs: ``dict``
:return: a list of supported protocols
:rtype: ``list`` of ``str``
CLI Example:
... | [
"Return",
"a",
"list",
"of",
"supported",
"protocols",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/libcloud_loadbalancer.py#L129-L150 |
35,081 | saltstack/salt | salt/modules/libcloud_loadbalancer.py | create_balancer | def create_balancer(name, port, protocol, profile, algorithm=None, members=None, **libcloud_kwargs):
'''
Create a new load balancer instance
:param name: Name of the new load balancer (required)
:type name: ``str``
:param port: Port the load balancer should listen on, defaults to 80
:type po... | python | def create_balancer(name, port, protocol, profile, algorithm=None, members=None, **libcloud_kwargs):
'''
Create a new load balancer instance
:param name: Name of the new load balancer (required)
:type name: ``str``
:param port: Port the load balancer should listen on, defaults to 80
:type po... | [
"def",
"create_balancer",
"(",
"name",
",",
"port",
",",
"protocol",
",",
"profile",
",",
"algorithm",
"=",
"None",
",",
"members",
"=",
"None",
",",
"*",
"*",
"libcloud_kwargs",
")",
":",
"if",
"algorithm",
"is",
"None",
":",
"algorithm",
"=",
"Algorith... | Create a new load balancer instance
:param name: Name of the new load balancer (required)
:type name: ``str``
:param port: Port the load balancer should listen on, defaults to 80
:type port: ``str``
:param protocol: Loadbalancer protocol, defaults to http.
:type protocol: ``str``
:par... | [
"Create",
"a",
"new",
"load",
"balancer",
"instance"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/libcloud_loadbalancer.py#L153-L200 |
35,082 | saltstack/salt | salt/modules/libcloud_loadbalancer.py | destroy_balancer | def destroy_balancer(balancer_id, profile, **libcloud_kwargs):
'''
Destroy a load balancer
:param balancer_id: LoadBalancer ID which should be used
:type balancer_id: ``str``
:param profile: The profile key
:type profile: ``str``
:param libcloud_kwargs: Extra arguments for the driver's ... | python | def destroy_balancer(balancer_id, profile, **libcloud_kwargs):
'''
Destroy a load balancer
:param balancer_id: LoadBalancer ID which should be used
:type balancer_id: ``str``
:param profile: The profile key
:type profile: ``str``
:param libcloud_kwargs: Extra arguments for the driver's ... | [
"def",
"destroy_balancer",
"(",
"balancer_id",
",",
"profile",
",",
"*",
"*",
"libcloud_kwargs",
")",
":",
"conn",
"=",
"_get_driver",
"(",
"profile",
"=",
"profile",
")",
"libcloud_kwargs",
"=",
"salt",
".",
"utils",
".",
"args",
".",
"clean_kwargs",
"(",
... | Destroy a load balancer
:param balancer_id: LoadBalancer ID which should be used
:type balancer_id: ``str``
:param profile: The profile key
:type profile: ``str``
:param libcloud_kwargs: Extra arguments for the driver's destroy_balancer method
:type libcloud_kwargs: ``dict``
:return: ... | [
"Destroy",
"a",
"load",
"balancer"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/libcloud_loadbalancer.py#L203-L228 |
35,083 | saltstack/salt | salt/modules/libcloud_loadbalancer.py | get_balancer_by_name | def get_balancer_by_name(name, profile, **libcloud_kwargs):
'''
Get the details for a load balancer by name
:param name: Name of a load balancer you want to fetch
:type name: ``str``
:param profile: The profile key
:type profile: ``str``
:param libcloud_kwargs: Extra arguments for the d... | python | def get_balancer_by_name(name, profile, **libcloud_kwargs):
'''
Get the details for a load balancer by name
:param name: Name of a load balancer you want to fetch
:type name: ``str``
:param profile: The profile key
:type profile: ``str``
:param libcloud_kwargs: Extra arguments for the d... | [
"def",
"get_balancer_by_name",
"(",
"name",
",",
"profile",
",",
"*",
"*",
"libcloud_kwargs",
")",
":",
"conn",
"=",
"_get_driver",
"(",
"profile",
"=",
"profile",
")",
"libcloud_kwargs",
"=",
"salt",
".",
"utils",
".",
"args",
".",
"clean_kwargs",
"(",
"*... | Get the details for a load balancer by name
:param name: Name of a load balancer you want to fetch
:type name: ``str``
:param profile: The profile key
:type profile: ``str``
:param libcloud_kwargs: Extra arguments for the driver's list_balancers method
:type libcloud_kwargs: ``dict``
... | [
"Get",
"the",
"details",
"for",
"a",
"load",
"balancer",
"by",
"name"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/libcloud_loadbalancer.py#L231-L261 |
35,084 | saltstack/salt | salt/modules/libcloud_loadbalancer.py | list_balancer_members | def list_balancer_members(balancer_id, profile, **libcloud_kwargs):
'''
List the members of a load balancer
:param balancer_id: id of a load balancer you want to fetch
:type balancer_id: ``str``
:param profile: The profile key
:type profile: ``str``
:param libcloud_kwargs: Extra argumen... | python | def list_balancer_members(balancer_id, profile, **libcloud_kwargs):
'''
List the members of a load balancer
:param balancer_id: id of a load balancer you want to fetch
:type balancer_id: ``str``
:param profile: The profile key
:type profile: ``str``
:param libcloud_kwargs: Extra argumen... | [
"def",
"list_balancer_members",
"(",
"balancer_id",
",",
"profile",
",",
"*",
"*",
"libcloud_kwargs",
")",
":",
"conn",
"=",
"_get_driver",
"(",
"profile",
"=",
"profile",
")",
"balancer",
"=",
"conn",
".",
"get_balancer",
"(",
"balancer_id",
")",
"libcloud_kw... | List the members of a load balancer
:param balancer_id: id of a load balancer you want to fetch
:type balancer_id: ``str``
:param profile: The profile key
:type profile: ``str``
:param libcloud_kwargs: Extra arguments for the driver's list_balancer_members method
:type libcloud_kwargs: ``d... | [
"List",
"the",
"members",
"of",
"a",
"load",
"balancer"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/libcloud_loadbalancer.py#L386-L409 |
35,085 | saltstack/salt | salt/auth/__init__.py | LoadAuth.load_name | def load_name(self, load):
'''
Return the primary name associate with the load, if an empty string
is returned then the load does not match the function
'''
if 'eauth' not in load:
return ''
fstr = '{0}.auth'.format(load['eauth'])
if fstr not in self.a... | python | def load_name(self, load):
'''
Return the primary name associate with the load, if an empty string
is returned then the load does not match the function
'''
if 'eauth' not in load:
return ''
fstr = '{0}.auth'.format(load['eauth'])
if fstr not in self.a... | [
"def",
"load_name",
"(",
"self",
",",
"load",
")",
":",
"if",
"'eauth'",
"not",
"in",
"load",
":",
"return",
"''",
"fstr",
"=",
"'{0}.auth'",
".",
"format",
"(",
"load",
"[",
"'eauth'",
"]",
")",
"if",
"fstr",
"not",
"in",
"self",
".",
"auth",
":",... | Return the primary name associate with the load, if an empty string
is returned then the load does not match the function | [
"Return",
"the",
"primary",
"name",
"associate",
"with",
"the",
"load",
"if",
"an",
"empty",
"string",
"is",
"returned",
"then",
"the",
"load",
"does",
"not",
"match",
"the",
"function"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/auth/__init__.py#L70-L84 |
35,086 | saltstack/salt | salt/auth/__init__.py | LoadAuth.__auth_call | def __auth_call(self, load):
'''
Return the token and set the cache data for use
Do not call this directly! Use the time_auth method to overcome timing
attacks
'''
if 'eauth' not in load:
return False
fstr = '{0}.auth'.format(load['eauth'])
if... | python | def __auth_call(self, load):
'''
Return the token and set the cache data for use
Do not call this directly! Use the time_auth method to overcome timing
attacks
'''
if 'eauth' not in load:
return False
fstr = '{0}.auth'.format(load['eauth'])
if... | [
"def",
"__auth_call",
"(",
"self",
",",
"load",
")",
":",
"if",
"'eauth'",
"not",
"in",
"load",
":",
"return",
"False",
"fstr",
"=",
"'{0}.auth'",
".",
"format",
"(",
"load",
"[",
"'eauth'",
"]",
")",
"if",
"fstr",
"not",
"in",
"self",
".",
"auth",
... | Return the token and set the cache data for use
Do not call this directly! Use the time_auth method to overcome timing
attacks | [
"Return",
"the",
"token",
"and",
"set",
"the",
"cache",
"data",
"for",
"use"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/auth/__init__.py#L86-L114 |
35,087 | saltstack/salt | salt/auth/__init__.py | LoadAuth.time_auth | def time_auth(self, load):
'''
Make sure that all failures happen in the same amount of time
'''
start = time.time()
ret = self.__auth_call(load)
if ret:
return ret
f_time = time.time() - start
if f_time > self.max_fail:
self.max_fa... | python | def time_auth(self, load):
'''
Make sure that all failures happen in the same amount of time
'''
start = time.time()
ret = self.__auth_call(load)
if ret:
return ret
f_time = time.time() - start
if f_time > self.max_fail:
self.max_fa... | [
"def",
"time_auth",
"(",
"self",
",",
"load",
")",
":",
"start",
"=",
"time",
".",
"time",
"(",
")",
"ret",
"=",
"self",
".",
"__auth_call",
"(",
"load",
")",
"if",
"ret",
":",
"return",
"ret",
"f_time",
"=",
"time",
".",
"time",
"(",
")",
"-",
... | Make sure that all failures happen in the same amount of time | [
"Make",
"sure",
"that",
"all",
"failures",
"happen",
"in",
"the",
"same",
"amount",
"of",
"time"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/auth/__init__.py#L116-L134 |
35,088 | saltstack/salt | salt/auth/__init__.py | LoadAuth.__process_acl | def __process_acl(self, load, auth_list):
'''
Allows eauth module to modify the access list right before it'll be applied to the request.
For example ldap auth module expands entries
'''
if 'eauth' not in load:
return auth_list
fstr = '{0}.process_acl'.format(... | python | def __process_acl(self, load, auth_list):
'''
Allows eauth module to modify the access list right before it'll be applied to the request.
For example ldap auth module expands entries
'''
if 'eauth' not in load:
return auth_list
fstr = '{0}.process_acl'.format(... | [
"def",
"__process_acl",
"(",
"self",
",",
"load",
",",
"auth_list",
")",
":",
"if",
"'eauth'",
"not",
"in",
"load",
":",
"return",
"auth_list",
"fstr",
"=",
"'{0}.process_acl'",
".",
"format",
"(",
"load",
"[",
"'eauth'",
"]",
")",
"if",
"fstr",
"not",
... | Allows eauth module to modify the access list right before it'll be applied to the request.
For example ldap auth module expands entries | [
"Allows",
"eauth",
"module",
"to",
"modify",
"the",
"access",
"list",
"right",
"before",
"it",
"ll",
"be",
"applied",
"to",
"the",
"request",
".",
"For",
"example",
"ldap",
"auth",
"module",
"expands",
"entries"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/auth/__init__.py#L160-L174 |
35,089 | saltstack/salt | salt/auth/__init__.py | LoadAuth.get_groups | def get_groups(self, load):
'''
Read in a load and return the groups a user is a member of
by asking the appropriate provider
'''
if 'eauth' not in load:
return False
fstr = '{0}.groups'.format(load['eauth'])
if fstr not in self.auth:
retur... | python | def get_groups(self, load):
'''
Read in a load and return the groups a user is a member of
by asking the appropriate provider
'''
if 'eauth' not in load:
return False
fstr = '{0}.groups'.format(load['eauth'])
if fstr not in self.auth:
retur... | [
"def",
"get_groups",
"(",
"self",
",",
"load",
")",
":",
"if",
"'eauth'",
"not",
"in",
"load",
":",
"return",
"False",
"fstr",
"=",
"'{0}.groups'",
".",
"format",
"(",
"load",
"[",
"'eauth'",
"]",
")",
"if",
"fstr",
"not",
"in",
"self",
".",
"auth",
... | Read in a load and return the groups a user is a member of
by asking the appropriate provider | [
"Read",
"in",
"a",
"load",
"and",
"return",
"the",
"groups",
"a",
"user",
"is",
"a",
"member",
"of",
"by",
"asking",
"the",
"appropriate",
"provider"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/auth/__init__.py#L176-L195 |
35,090 | saltstack/salt | salt/auth/__init__.py | LoadAuth._allow_custom_expire | def _allow_custom_expire(self, load):
'''
Return bool if requesting user is allowed to set custom expire
'''
expire_override = self.opts.get('token_expire_user_override', False)
if expire_override is True:
return True
if isinstance(expire_override, collectio... | python | def _allow_custom_expire(self, load):
'''
Return bool if requesting user is allowed to set custom expire
'''
expire_override = self.opts.get('token_expire_user_override', False)
if expire_override is True:
return True
if isinstance(expire_override, collectio... | [
"def",
"_allow_custom_expire",
"(",
"self",
",",
"load",
")",
":",
"expire_override",
"=",
"self",
".",
"opts",
".",
"get",
"(",
"'token_expire_user_override'",
",",
"False",
")",
"if",
"expire_override",
"is",
"True",
":",
"return",
"True",
"if",
"isinstance"... | Return bool if requesting user is allowed to set custom expire | [
"Return",
"bool",
"if",
"requesting",
"user",
"is",
"allowed",
"to",
"set",
"custom",
"expire"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/auth/__init__.py#L197-L212 |
35,091 | saltstack/salt | salt/auth/__init__.py | LoadAuth.mk_token | def mk_token(self, load):
'''
Run time_auth and create a token. Return False or the token
'''
if not self.authenticate_eauth(load):
return {}
if self._allow_custom_expire(load):
token_expire = load.pop('token_expire', self.opts['token_expire'])
el... | python | def mk_token(self, load):
'''
Run time_auth and create a token. Return False or the token
'''
if not self.authenticate_eauth(load):
return {}
if self._allow_custom_expire(load):
token_expire = load.pop('token_expire', self.opts['token_expire'])
el... | [
"def",
"mk_token",
"(",
"self",
",",
"load",
")",
":",
"if",
"not",
"self",
".",
"authenticate_eauth",
"(",
"load",
")",
":",
"return",
"{",
"}",
"if",
"self",
".",
"_allow_custom_expire",
"(",
"load",
")",
":",
"token_expire",
"=",
"load",
".",
"pop",... | Run time_auth and create a token. Return False or the token | [
"Run",
"time_auth",
"and",
"create",
"a",
"token",
".",
"Return",
"False",
"or",
"the",
"token"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/auth/__init__.py#L214-L240 |
35,092 | saltstack/salt | salt/auth/__init__.py | LoadAuth.get_tok | def get_tok(self, tok):
'''
Return the name associated with the token, or False if the token is
not valid
'''
tdata = self.tokens["{0}.get_token".format(self.opts['eauth_tokens'])](self.opts, tok)
if not tdata:
return {}
rm_tok = False
if 'exp... | python | def get_tok(self, tok):
'''
Return the name associated with the token, or False if the token is
not valid
'''
tdata = self.tokens["{0}.get_token".format(self.opts['eauth_tokens'])](self.opts, tok)
if not tdata:
return {}
rm_tok = False
if 'exp... | [
"def",
"get_tok",
"(",
"self",
",",
"tok",
")",
":",
"tdata",
"=",
"self",
".",
"tokens",
"[",
"\"{0}.get_token\"",
".",
"format",
"(",
"self",
".",
"opts",
"[",
"'eauth_tokens'",
"]",
")",
"]",
"(",
"self",
".",
"opts",
",",
"tok",
")",
"if",
"not... | Return the name associated with the token, or False if the token is
not valid | [
"Return",
"the",
"name",
"associated",
"with",
"the",
"token",
"or",
"False",
"if",
"the",
"token",
"is",
"not",
"valid"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/auth/__init__.py#L242-L260 |
35,093 | saltstack/salt | salt/auth/__init__.py | LoadAuth.rm_token | def rm_token(self, tok):
'''
Remove the given token from token storage.
'''
self.tokens["{0}.rm_token".format(self.opts['eauth_tokens'])](self.opts, tok) | python | def rm_token(self, tok):
'''
Remove the given token from token storage.
'''
self.tokens["{0}.rm_token".format(self.opts['eauth_tokens'])](self.opts, tok) | [
"def",
"rm_token",
"(",
"self",
",",
"tok",
")",
":",
"self",
".",
"tokens",
"[",
"\"{0}.rm_token\"",
".",
"format",
"(",
"self",
".",
"opts",
"[",
"'eauth_tokens'",
"]",
")",
"]",
"(",
"self",
".",
"opts",
",",
"tok",
")"
] | Remove the given token from token storage. | [
"Remove",
"the",
"given",
"token",
"from",
"token",
"storage",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/auth/__init__.py#L268-L272 |
35,094 | saltstack/salt | salt/auth/__init__.py | LoadAuth.authenticate_token | def authenticate_token(self, load):
'''
Authenticate a user by the token specified in load.
Return the token object or False if auth failed.
'''
token = self.get_tok(load['token'])
# Bail if the token is empty or if the eauth type specified is not allowed
if not ... | python | def authenticate_token(self, load):
'''
Authenticate a user by the token specified in load.
Return the token object or False if auth failed.
'''
token = self.get_tok(load['token'])
# Bail if the token is empty or if the eauth type specified is not allowed
if not ... | [
"def",
"authenticate_token",
"(",
"self",
",",
"load",
")",
":",
"token",
"=",
"self",
".",
"get_tok",
"(",
"load",
"[",
"'token'",
"]",
")",
"# Bail if the token is empty or if the eauth type specified is not allowed",
"if",
"not",
"token",
"or",
"token",
"[",
"'... | Authenticate a user by the token specified in load.
Return the token object or False if auth failed. | [
"Authenticate",
"a",
"user",
"by",
"the",
"token",
"specified",
"in",
"load",
".",
"Return",
"the",
"token",
"object",
"or",
"False",
"if",
"auth",
"failed",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/auth/__init__.py#L274-L286 |
35,095 | saltstack/salt | salt/auth/__init__.py | LoadAuth.authenticate_eauth | def authenticate_eauth(self, load):
'''
Authenticate a user by the external auth module specified in load.
Return True on success or False on failure.
'''
if 'eauth' not in load:
log.warning('Authentication failure of type "eauth" occurred.')
return False
... | python | def authenticate_eauth(self, load):
'''
Authenticate a user by the external auth module specified in load.
Return True on success or False on failure.
'''
if 'eauth' not in load:
log.warning('Authentication failure of type "eauth" occurred.')
return False
... | [
"def",
"authenticate_eauth",
"(",
"self",
",",
"load",
")",
":",
"if",
"'eauth'",
"not",
"in",
"load",
":",
"log",
".",
"warning",
"(",
"'Authentication failure of type \"eauth\" occurred.'",
")",
"return",
"False",
"if",
"load",
"[",
"'eauth'",
"]",
"not",
"i... | Authenticate a user by the external auth module specified in load.
Return True on success or False on failure. | [
"Authenticate",
"a",
"user",
"by",
"the",
"external",
"auth",
"module",
"specified",
"in",
"load",
".",
"Return",
"True",
"on",
"success",
"or",
"False",
"on",
"failure",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/auth/__init__.py#L288-L308 |
35,096 | saltstack/salt | salt/auth/__init__.py | LoadAuth.get_auth_list | def get_auth_list(self, load, token=None):
'''
Retrieve access list for the user specified in load.
The list is built by eauth module or from master eauth configuration.
Return None if current configuration doesn't provide any ACL for the user. Return an empty
list if the user ha... | python | def get_auth_list(self, load, token=None):
'''
Retrieve access list for the user specified in load.
The list is built by eauth module or from master eauth configuration.
Return None if current configuration doesn't provide any ACL for the user. Return an empty
list if the user ha... | [
"def",
"get_auth_list",
"(",
"self",
",",
"load",
",",
"token",
"=",
"None",
")",
":",
"# Get auth list from token",
"if",
"token",
"and",
"self",
".",
"opts",
"[",
"'keep_acl_in_token'",
"]",
"and",
"'auth_list'",
"in",
"token",
":",
"return",
"token",
"[",... | Retrieve access list for the user specified in load.
The list is built by eauth module or from master eauth configuration.
Return None if current configuration doesn't provide any ACL for the user. Return an empty
list if the user has no rights to execute anything on this master and returns non-... | [
"Retrieve",
"access",
"list",
"for",
"the",
"user",
"specified",
"in",
"load",
".",
"The",
"list",
"is",
"built",
"by",
"eauth",
"module",
"or",
"from",
"master",
"eauth",
"configuration",
".",
"Return",
"None",
"if",
"current",
"configuration",
"doesn",
"t"... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/auth/__init__.py#L357-L404 |
35,097 | saltstack/salt | salt/auth/__init__.py | Authorize.auth_data | def auth_data(self):
'''
Gather and create the authorization data sets
We're looking at several constructs here.
Standard eauth: allow jsmith to auth via pam, and execute any command
on server web1
external_auth:
pam:
jsmith:
- web1:
... | python | def auth_data(self):
'''
Gather and create the authorization data sets
We're looking at several constructs here.
Standard eauth: allow jsmith to auth via pam, and execute any command
on server web1
external_auth:
pam:
jsmith:
- web1:
... | [
"def",
"auth_data",
"(",
"self",
")",
":",
"auth_data",
"=",
"self",
".",
"opts",
"[",
"'external_auth'",
"]",
"merge_lists",
"=",
"self",
".",
"opts",
"[",
"'pillar_merge_lists'",
"]",
"if",
"'django'",
"in",
"auth_data",
"and",
"'^model'",
"in",
"auth_data... | Gather and create the authorization data sets
We're looking at several constructs here.
Standard eauth: allow jsmith to auth via pam, and execute any command
on server web1
external_auth:
pam:
jsmith:
- web1:
- .*
Django eaut... | [
"Gather",
"and",
"create",
"the",
"authorization",
"data",
"sets"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/auth/__init__.py#L501-L560 |
35,098 | saltstack/salt | salt/auth/__init__.py | Authorize.token | def token(self, adata, load):
'''
Determine if token auth is valid and yield the adata
'''
try:
token = self.loadauth.get_tok(load['token'])
except Exception as exc:
log.error('Exception occurred when generating auth token: %s', exc)
yield {}
... | python | def token(self, adata, load):
'''
Determine if token auth is valid and yield the adata
'''
try:
token = self.loadauth.get_tok(load['token'])
except Exception as exc:
log.error('Exception occurred when generating auth token: %s', exc)
yield {}
... | [
"def",
"token",
"(",
"self",
",",
"adata",
",",
"load",
")",
":",
"try",
":",
"token",
"=",
"self",
".",
"loadauth",
".",
"get_tok",
"(",
"load",
"[",
"'token'",
"]",
")",
"except",
"Exception",
"as",
"exc",
":",
"log",
".",
"error",
"(",
"'Excepti... | Determine if token auth is valid and yield the adata | [
"Determine",
"if",
"token",
"auth",
"is",
"valid",
"and",
"yield",
"the",
"adata"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/auth/__init__.py#L562-L582 |
35,099 | saltstack/salt | salt/auth/__init__.py | Authorize.eauth | def eauth(self, adata, load):
'''
Determine if the given eauth is valid and yield the adata
'''
for sub_auth in [adata]:
if load['eauth'] not in sub_auth:
continue
try:
name = self.loadauth.load_name(load)
if not ((n... | python | def eauth(self, adata, load):
'''
Determine if the given eauth is valid and yield the adata
'''
for sub_auth in [adata]:
if load['eauth'] not in sub_auth:
continue
try:
name = self.loadauth.load_name(load)
if not ((n... | [
"def",
"eauth",
"(",
"self",
",",
"adata",
",",
"load",
")",
":",
"for",
"sub_auth",
"in",
"[",
"adata",
"]",
":",
"if",
"load",
"[",
"'eauth'",
"]",
"not",
"in",
"sub_auth",
":",
"continue",
"try",
":",
"name",
"=",
"self",
".",
"loadauth",
".",
... | Determine if the given eauth is valid and yield the adata | [
"Determine",
"if",
"the",
"given",
"eauth",
"is",
"valid",
"and",
"yield",
"the",
"adata"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/auth/__init__.py#L584-L602 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.