repo stringclasses 85
values | path stringlengths 8 121 | func_name stringlengths 1 82 | original_string stringlengths 112 65.5k | language stringclasses 1
value | code stringlengths 112 65.5k | code_tokens listlengths 20 4.09k | docstring stringlengths 3 46.3k | docstring_tokens listlengths 1 564 | sha stringclasses 85
values | url stringlengths 93 218 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
saltstack/salt | salt/modules/freebsdservice.py | get_disabled | def get_disabled(jail=None):
'''
Return what services are available but not enabled to start at boot
.. versionchanged:: 2016.3.4
Support for jail (representing jid or jail name) keyword argument in kwargs
CLI Example:
.. code-block:: bash
salt '*' service.get_disabled
'''
e... | python | def get_disabled(jail=None):
'''
Return what services are available but not enabled to start at boot
.. versionchanged:: 2016.3.4
Support for jail (representing jid or jail name) keyword argument in kwargs
CLI Example:
.. code-block:: bash
salt '*' service.get_disabled
'''
e... | [
"def",
"get_disabled",
"(",
"jail",
"=",
"None",
")",
":",
"en_",
"=",
"get_enabled",
"(",
"jail",
")",
"all_",
"=",
"get_all",
"(",
"jail",
")",
"return",
"sorted",
"(",
"set",
"(",
"all_",
")",
"-",
"set",
"(",
"en_",
")",
")"
] | Return what services are available but not enabled to start at boot
.. versionchanged:: 2016.3.4
Support for jail (representing jid or jail name) keyword argument in kwargs
CLI Example:
.. code-block:: bash
salt '*' service.get_disabled | [
"Return",
"what",
"services",
"are",
"available",
"but",
"not",
"enabled",
"to",
"start",
"at",
"boot"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/freebsdservice.py#L157-L173 | train |
saltstack/salt | salt/modules/freebsdservice.py | _switch | def _switch(name, # pylint: disable=C0103
on, # pylint: disable=C0103
**kwargs):
'''
Switch on/off service start at boot.
.. versionchanged:: 2016.3.4
Support for jail (representing jid or jail name) and chroot keyword argument
in kwarg... | python | def _switch(name, # pylint: disable=C0103
on, # pylint: disable=C0103
**kwargs):
'''
Switch on/off service start at boot.
.. versionchanged:: 2016.3.4
Support for jail (representing jid or jail name) and chroot keyword argument
in kwarg... | [
"def",
"_switch",
"(",
"name",
",",
"# pylint: disable=C0103",
"on",
",",
"# pylint: disable=C0103",
"*",
"*",
"kwargs",
")",
":",
"jail",
"=",
"kwargs",
".",
"get",
"(",
"'jail'",
",",
"''",
")",
"chroot",
"=",
"kwargs",
".",
"get",
"(",
"'chroot'",
","... | Switch on/off service start at boot.
.. versionchanged:: 2016.3.4
Support for jail (representing jid or jail name) and chroot keyword argument
in kwargs. chroot should be used when jail's /etc is mounted read-only and
should point to a root directory where jail's /etc is mounted read-write. | [
"Switch",
"on",
"/",
"off",
"service",
"start",
"at",
"boot",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/freebsdservice.py#L176-L245 | train |
saltstack/salt | salt/modules/freebsdservice.py | enabled | def enabled(name, **kwargs):
'''
Return True if the named service is enabled, false otherwise
name
Service name
.. versionchanged:: 2016.3.4
Support for jail (representing jid or jail name) keyword argument in kwargs
CLI Example:
.. code-block:: bash
salt '*' service.en... | python | def enabled(name, **kwargs):
'''
Return True if the named service is enabled, false otherwise
name
Service name
.. versionchanged:: 2016.3.4
Support for jail (representing jid or jail name) keyword argument in kwargs
CLI Example:
.. code-block:: bash
salt '*' service.en... | [
"def",
"enabled",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"jail",
"=",
"kwargs",
".",
"get",
"(",
"'jail'",
",",
"''",
")",
"if",
"not",
"available",
"(",
"name",
",",
"jail",
")",
":",
"log",
".",
"error",
"(",
"'Service %s not found'",
",... | Return True if the named service is enabled, false otherwise
name
Service name
.. versionchanged:: 2016.3.4
Support for jail (representing jid or jail name) keyword argument in kwargs
CLI Example:
.. code-block:: bash
salt '*' service.enabled <service name> | [
"Return",
"True",
"if",
"the",
"named",
"service",
"is",
"enabled",
"false",
"otherwise"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/freebsdservice.py#L302-L333 | train |
saltstack/salt | salt/modules/freebsdservice.py | get_all | def get_all(jail=None):
'''
Return a list of all available services
.. versionchanged:: 2016.3.4
jail: optional jid or jail name
CLI Example:
.. code-block:: bash
salt '*' service.get_all
'''
ret = []
service = _cmd(jail)
for srv in __salt__['cmd.run']('{0} -l'.forma... | python | def get_all(jail=None):
'''
Return a list of all available services
.. versionchanged:: 2016.3.4
jail: optional jid or jail name
CLI Example:
.. code-block:: bash
salt '*' service.get_all
'''
ret = []
service = _cmd(jail)
for srv in __salt__['cmd.run']('{0} -l'.forma... | [
"def",
"get_all",
"(",
"jail",
"=",
"None",
")",
":",
"ret",
"=",
"[",
"]",
"service",
"=",
"_cmd",
"(",
"jail",
")",
"for",
"srv",
"in",
"__salt__",
"[",
"'cmd.run'",
"]",
"(",
"'{0} -l'",
".",
"format",
"(",
"service",
")",
")",
".",
"splitlines"... | Return a list of all available services
.. versionchanged:: 2016.3.4
jail: optional jid or jail name
CLI Example:
.. code-block:: bash
salt '*' service.get_all | [
"Return",
"a",
"list",
"of",
"all",
"available",
"services"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/freebsdservice.py#L385-L404 | train |
saltstack/salt | salt/modules/freebsdservice.py | start | def start(name, jail=None):
'''
Start the specified service
.. versionchanged:: 2016.3.4
jail: optional jid or jail name
CLI Example:
.. code-block:: bash
salt '*' service.start <service name>
'''
cmd = '{0} {1} onestart'.format(_cmd(jail), name)
return not __salt__['cmd... | python | def start(name, jail=None):
'''
Start the specified service
.. versionchanged:: 2016.3.4
jail: optional jid or jail name
CLI Example:
.. code-block:: bash
salt '*' service.start <service name>
'''
cmd = '{0} {1} onestart'.format(_cmd(jail), name)
return not __salt__['cmd... | [
"def",
"start",
"(",
"name",
",",
"jail",
"=",
"None",
")",
":",
"cmd",
"=",
"'{0} {1} onestart'",
".",
"format",
"(",
"_cmd",
"(",
"jail",
")",
",",
"name",
")",
"return",
"not",
"__salt__",
"[",
"'cmd.retcode'",
"]",
"(",
"cmd",
",",
"python_shell",
... | Start the specified service
.. versionchanged:: 2016.3.4
jail: optional jid or jail name
CLI Example:
.. code-block:: bash
salt '*' service.start <service name> | [
"Start",
"the",
"specified",
"service"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/freebsdservice.py#L407-L422 | train |
saltstack/salt | salt/states/pyenv.py | _python_installed | def _python_installed(ret, python, user=None):
'''
Check to see if given python is installed.
'''
default = __salt__['pyenv.default'](runas=user)
for version in __salt__['pyenv.versions'](user):
if version == python:
ret['result'] = True
ret['comment'] = 'Requested py... | python | def _python_installed(ret, python, user=None):
'''
Check to see if given python is installed.
'''
default = __salt__['pyenv.default'](runas=user)
for version in __salt__['pyenv.versions'](user):
if version == python:
ret['result'] = True
ret['comment'] = 'Requested py... | [
"def",
"_python_installed",
"(",
"ret",
",",
"python",
",",
"user",
"=",
"None",
")",
":",
"default",
"=",
"__salt__",
"[",
"'pyenv.default'",
"]",
"(",
"runas",
"=",
"user",
")",
"for",
"version",
"in",
"__salt__",
"[",
"'pyenv.versions'",
"]",
"(",
"us... | Check to see if given python is installed. | [
"Check",
"to",
"see",
"if",
"given",
"python",
"is",
"installed",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pyenv.py#L67-L79 | train |
saltstack/salt | salt/states/pyenv.py | _check_and_install_python | def _check_and_install_python(ret, python, default=False, user=None):
'''
Verify that python is installed, install if unavailable
'''
ret = _python_installed(ret, python, user=user)
if not ret['result']:
if __salt__['pyenv.install_python'](python, runas=user):
ret['result'] = Tru... | python | def _check_and_install_python(ret, python, default=False, user=None):
'''
Verify that python is installed, install if unavailable
'''
ret = _python_installed(ret, python, user=user)
if not ret['result']:
if __salt__['pyenv.install_python'](python, runas=user):
ret['result'] = Tru... | [
"def",
"_check_and_install_python",
"(",
"ret",
",",
"python",
",",
"default",
"=",
"False",
",",
"user",
"=",
"None",
")",
":",
"ret",
"=",
"_python_installed",
"(",
"ret",
",",
"python",
",",
"user",
"=",
"user",
")",
"if",
"not",
"ret",
"[",
"'resul... | Verify that python is installed, install if unavailable | [
"Verify",
"that",
"python",
"is",
"installed",
"install",
"if",
"unavailable"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pyenv.py#L82-L101 | train |
saltstack/salt | salt/states/pyenv.py | installed | def installed(name, default=False, user=None):
'''
Verify that the specified python is installed with pyenv. pyenv is
installed if necessary.
name
The version of python to install
default : False
Whether to make this python the default.
user: None
The user to run pyenv... | python | def installed(name, default=False, user=None):
'''
Verify that the specified python is installed with pyenv. pyenv is
installed if necessary.
name
The version of python to install
default : False
Whether to make this python the default.
user: None
The user to run pyenv... | [
"def",
"installed",
"(",
"name",
",",
"default",
"=",
"False",
",",
"user",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",
"None",
",",
"'comment'",
":",
"''",
",",
"'changes'",
":",
"{",
"}",
"}",
"if",
"nam... | Verify that the specified python is installed with pyenv. pyenv is
installed if necessary.
name
The version of python to install
default : False
Whether to make this python the default.
user: None
The user to run pyenv as.
.. versionadded:: 0.17.0
.. versionadded... | [
"Verify",
"that",
"the",
"specified",
"python",
"is",
"installed",
"with",
"pyenv",
".",
"pyenv",
"is",
"installed",
"if",
"necessary",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pyenv.py#L104-L139 | train |
saltstack/salt | salt/states/pyenv.py | _check_and_uninstall_python | def _check_and_uninstall_python(ret, python, user=None):
'''
Verify that python is uninstalled
'''
ret = _python_installed(ret, python, user=user)
if ret['result']:
if ret['default']:
__salt__['pyenv.default']('system', runas=user)
if __salt__['pyenv.uninstall_python'](p... | python | def _check_and_uninstall_python(ret, python, user=None):
'''
Verify that python is uninstalled
'''
ret = _python_installed(ret, python, user=user)
if ret['result']:
if ret['default']:
__salt__['pyenv.default']('system', runas=user)
if __salt__['pyenv.uninstall_python'](p... | [
"def",
"_check_and_uninstall_python",
"(",
"ret",
",",
"python",
",",
"user",
"=",
"None",
")",
":",
"ret",
"=",
"_python_installed",
"(",
"ret",
",",
"python",
",",
"user",
"=",
"user",
")",
"if",
"ret",
"[",
"'result'",
"]",
":",
"if",
"ret",
"[",
... | Verify that python is uninstalled | [
"Verify",
"that",
"python",
"is",
"uninstalled"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pyenv.py#L142-L164 | train |
saltstack/salt | salt/states/pyenv.py | absent | def absent(name, user=None):
'''
Verify that the specified python is not installed with pyenv. pyenv
is installed if necessary.
name
The version of python to uninstall
user: None
The user to run pyenv as.
.. versionadded:: 0.17.0
.. versionadded:: 0.16.0
'''
r... | python | def absent(name, user=None):
'''
Verify that the specified python is not installed with pyenv. pyenv
is installed if necessary.
name
The version of python to uninstall
user: None
The user to run pyenv as.
.. versionadded:: 0.17.0
.. versionadded:: 0.16.0
'''
r... | [
"def",
"absent",
"(",
"name",
",",
"user",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",
"None",
",",
"'comment'",
":",
"''",
",",
"'changes'",
":",
"{",
"}",
"}",
"if",
"name",
".",
"startswith",
"(",
"'pyt... | Verify that the specified python is not installed with pyenv. pyenv
is installed if necessary.
name
The version of python to uninstall
user: None
The user to run pyenv as.
.. versionadded:: 0.17.0
.. versionadded:: 0.16.0 | [
"Verify",
"that",
"the",
"specified",
"python",
"is",
"not",
"installed",
"with",
"pyenv",
".",
"pyenv",
"is",
"installed",
"if",
"necessary",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pyenv.py#L167-L197 | train |
saltstack/salt | salt/states/pyenv.py | install_pyenv | def install_pyenv(name, user=None):
'''
Install pyenv if not installed. Allows you to require pyenv be installed
prior to installing the plugins. Useful if you want to install pyenv
plugins via the git or file modules and need them installed before
installing any rubies.
Use the pyenv.root conf... | python | def install_pyenv(name, user=None):
'''
Install pyenv if not installed. Allows you to require pyenv be installed
prior to installing the plugins. Useful if you want to install pyenv
plugins via the git or file modules and need them installed before
installing any rubies.
Use the pyenv.root conf... | [
"def",
"install_pyenv",
"(",
"name",
",",
"user",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",
"None",
",",
"'comment'",
":",
"''",
",",
"'changes'",
":",
"{",
"}",
"}",
"if",
"__opts__",
"[",
"'test'",
"]",
... | Install pyenv if not installed. Allows you to require pyenv be installed
prior to installing the plugins. Useful if you want to install pyenv
plugins via the git or file modules and need them installed before
installing any rubies.
Use the pyenv.root configuration option to set the path for pyenv if yo... | [
"Install",
"pyenv",
"if",
"not",
"installed",
".",
"Allows",
"you",
"to",
"require",
"pyenv",
"be",
"installed",
"prior",
"to",
"installing",
"the",
"plugins",
".",
"Useful",
"if",
"you",
"want",
"to",
"install",
"pyenv",
"plugins",
"via",
"the",
"git",
"o... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pyenv.py#L200-L219 | train |
saltstack/salt | salt/states/smtp.py | send_msg | def send_msg(name,
recipient,
subject,
sender=None,
profile=None,
use_ssl='True',
attachments=None):
'''
Send a message via SMTP
.. code-block:: yaml
server-warning-message:
smtp.send_msg:
- name: '... | python | def send_msg(name,
recipient,
subject,
sender=None,
profile=None,
use_ssl='True',
attachments=None):
'''
Send a message via SMTP
.. code-block:: yaml
server-warning-message:
smtp.send_msg:
- name: '... | [
"def",
"send_msg",
"(",
"name",
",",
"recipient",
",",
"subject",
",",
"sender",
"=",
"None",
",",
"profile",
"=",
"None",
",",
"use_ssl",
"=",
"'True'",
",",
"attachments",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'change... | Send a message via SMTP
.. code-block:: yaml
server-warning-message:
smtp.send_msg:
- name: 'This is a server warning message'
- profile: my-smtp-account
- subject: 'Message from Salt'
- recipient: admin@example.com
- sender: admin@exam... | [
"Send",
"a",
"message",
"via",
"SMTP"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/smtp.py#L30-L94 | train |
saltstack/salt | salt/modules/debconfmod.py | get_selections | def get_selections(fetchempty=True):
'''
Answers to debconf questions for all packages in the following format::
{'package': [['question', 'type', 'value'], ...]}
CLI Example:
.. code-block:: bash
salt '*' debconf.get_selections
'''
selections = {}
cmd = 'debconf-get-sele... | python | def get_selections(fetchempty=True):
'''
Answers to debconf questions for all packages in the following format::
{'package': [['question', 'type', 'value'], ...]}
CLI Example:
.. code-block:: bash
salt '*' debconf.get_selections
'''
selections = {}
cmd = 'debconf-get-sele... | [
"def",
"get_selections",
"(",
"fetchempty",
"=",
"True",
")",
":",
"selections",
"=",
"{",
"}",
"cmd",
"=",
"'debconf-get-selections'",
"out",
"=",
"__salt__",
"[",
"'cmd.run_stdout'",
"]",
"(",
"cmd",
")",
"lines",
"=",
"_unpack_lines",
"(",
"out",
")",
"... | Answers to debconf questions for all packages in the following format::
{'package': [['question', 'type', 'value'], ...]}
CLI Example:
.. code-block:: bash
salt '*' debconf.get_selections | [
"Answers",
"to",
"debconf",
"questions",
"for",
"all",
"packages",
"in",
"the",
"following",
"format",
"::"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debconfmod.py#L57-L83 | train |
saltstack/salt | salt/modules/debconfmod.py | set_ | def set_(package, question, type, value, *extra):
'''
Set answers to debconf questions for a package.
CLI Example:
.. code-block:: bash
salt '*' debconf.set <package> <question> <type> <value> [<value> ...]
'''
if extra:
value = ' '.join((value,) + tuple(extra))
fd_, fna... | python | def set_(package, question, type, value, *extra):
'''
Set answers to debconf questions for a package.
CLI Example:
.. code-block:: bash
salt '*' debconf.set <package> <question> <type> <value> [<value> ...]
'''
if extra:
value = ' '.join((value,) + tuple(extra))
fd_, fna... | [
"def",
"set_",
"(",
"package",
",",
"question",
",",
"type",
",",
"value",
",",
"*",
"extra",
")",
":",
"if",
"extra",
":",
"value",
"=",
"' '",
".",
"join",
"(",
"(",
"value",
",",
")",
"+",
"tuple",
"(",
"extra",
")",
")",
"fd_",
",",
"fname"... | Set answers to debconf questions for a package.
CLI Example:
.. code-block:: bash
salt '*' debconf.set <package> <question> <type> <value> [<value> ...] | [
"Set",
"answers",
"to",
"debconf",
"questions",
"for",
"a",
"package",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debconfmod.py#L115-L139 | train |
saltstack/salt | salt/modules/debconfmod.py | set_template | def set_template(path, template, context, defaults, saltenv='base', **kwargs):
'''
Set answers to debconf questions from a template.
path
location of the file containing the package selections
template
template format
context
variables to add to the template environment
... | python | def set_template(path, template, context, defaults, saltenv='base', **kwargs):
'''
Set answers to debconf questions from a template.
path
location of the file containing the package selections
template
template format
context
variables to add to the template environment
... | [
"def",
"set_template",
"(",
"path",
",",
"template",
",",
"context",
",",
"defaults",
",",
"saltenv",
"=",
"'base'",
",",
"*",
"*",
"kwargs",
")",
":",
"path",
"=",
"__salt__",
"[",
"'cp.get_template'",
"]",
"(",
"path",
"=",
"path",
",",
"dest",
"=",
... | Set answers to debconf questions from a template.
path
location of the file containing the package selections
template
template format
context
variables to add to the template environment
default
default values for the template environment
CLI Example:
.. co... | [
"Set",
"answers",
"to",
"debconf",
"questions",
"from",
"a",
"template",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debconfmod.py#L142-L175 | train |
saltstack/salt | salt/modules/debconfmod.py | set_file | def set_file(path, saltenv='base', **kwargs):
'''
Set answers to debconf questions from a file.
CLI Example:
.. code-block:: bash
salt '*' debconf.set_file salt://pathto/pkg.selections
'''
if '__env__' in kwargs:
# "env" is not supported; Use "saltenv".
kwargs.pop('__e... | python | def set_file(path, saltenv='base', **kwargs):
'''
Set answers to debconf questions from a file.
CLI Example:
.. code-block:: bash
salt '*' debconf.set_file salt://pathto/pkg.selections
'''
if '__env__' in kwargs:
# "env" is not supported; Use "saltenv".
kwargs.pop('__e... | [
"def",
"set_file",
"(",
"path",
",",
"saltenv",
"=",
"'base'",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"'__env__'",
"in",
"kwargs",
":",
"# \"env\" is not supported; Use \"saltenv\".",
"kwargs",
".",
"pop",
"(",
"'__env__'",
")",
"path",
"=",
"__salt__",
"[... | Set answers to debconf questions from a file.
CLI Example:
.. code-block:: bash
salt '*' debconf.set_file salt://pathto/pkg.selections | [
"Set",
"answers",
"to",
"debconf",
"questions",
"from",
"a",
"file",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debconfmod.py#L178-L197 | train |
saltstack/salt | salt/returners/multi_returner.py | prep_jid | def prep_jid(nocache=False, passed_jid=None):
'''
Call both with prep_jid on all returners in multi_returner
TODO: finish this, what do do when you get different jids from 2 returners...
since our jids are time based, this make this problem hard, because they
aren't unique, meaning that we have to ... | python | def prep_jid(nocache=False, passed_jid=None):
'''
Call both with prep_jid on all returners in multi_returner
TODO: finish this, what do do when you get different jids from 2 returners...
since our jids are time based, this make this problem hard, because they
aren't unique, meaning that we have to ... | [
"def",
"prep_jid",
"(",
"nocache",
"=",
"False",
",",
"passed_jid",
"=",
"None",
")",
":",
"jid",
"=",
"passed_jid",
"for",
"returner_",
"in",
"__opts__",
"[",
"CONFIG_KEY",
"]",
":",
"if",
"jid",
"is",
"None",
":",
"jid",
"=",
"_mminion",
"(",
")",
... | Call both with prep_jid on all returners in multi_returner
TODO: finish this, what do do when you get different jids from 2 returners...
since our jids are time based, this make this problem hard, because they
aren't unique, meaning that we have to make sure that no one else got the jid
and if they did... | [
"Call",
"both",
"with",
"prep_jid",
"on",
"all",
"returners",
"in",
"multi_returner"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/multi_returner.py#L34-L53 | train |
saltstack/salt | salt/returners/multi_returner.py | returner | def returner(load):
'''
Write return to all returners in multi_returner
'''
for returner_ in __opts__[CONFIG_KEY]:
_mminion().returners['{0}.returner'.format(returner_)](load) | python | def returner(load):
'''
Write return to all returners in multi_returner
'''
for returner_ in __opts__[CONFIG_KEY]:
_mminion().returners['{0}.returner'.format(returner_)](load) | [
"def",
"returner",
"(",
"load",
")",
":",
"for",
"returner_",
"in",
"__opts__",
"[",
"CONFIG_KEY",
"]",
":",
"_mminion",
"(",
")",
".",
"returners",
"[",
"'{0}.returner'",
".",
"format",
"(",
"returner_",
")",
"]",
"(",
"load",
")"
] | Write return to all returners in multi_returner | [
"Write",
"return",
"to",
"all",
"returners",
"in",
"multi_returner"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/multi_returner.py#L56-L61 | train |
saltstack/salt | salt/returners/multi_returner.py | save_load | def save_load(jid, clear_load, minions=None):
'''
Write load to all returners in multi_returner
'''
for returner_ in __opts__[CONFIG_KEY]:
_mminion().returners['{0}.save_load'.format(returner_)](jid, clear_load) | python | def save_load(jid, clear_load, minions=None):
'''
Write load to all returners in multi_returner
'''
for returner_ in __opts__[CONFIG_KEY]:
_mminion().returners['{0}.save_load'.format(returner_)](jid, clear_load) | [
"def",
"save_load",
"(",
"jid",
",",
"clear_load",
",",
"minions",
"=",
"None",
")",
":",
"for",
"returner_",
"in",
"__opts__",
"[",
"CONFIG_KEY",
"]",
":",
"_mminion",
"(",
")",
".",
"returners",
"[",
"'{0}.save_load'",
".",
"format",
"(",
"returner_",
... | Write load to all returners in multi_returner | [
"Write",
"load",
"to",
"all",
"returners",
"in",
"multi_returner"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/multi_returner.py#L64-L69 | train |
saltstack/salt | salt/returners/multi_returner.py | get_load | def get_load(jid):
'''
Merge the load data from all returners
'''
ret = {}
for returner_ in __opts__[CONFIG_KEY]:
ret.update(_mminion().returners['{0}.get_load'.format(returner_)](jid))
return ret | python | def get_load(jid):
'''
Merge the load data from all returners
'''
ret = {}
for returner_ in __opts__[CONFIG_KEY]:
ret.update(_mminion().returners['{0}.get_load'.format(returner_)](jid))
return ret | [
"def",
"get_load",
"(",
"jid",
")",
":",
"ret",
"=",
"{",
"}",
"for",
"returner_",
"in",
"__opts__",
"[",
"CONFIG_KEY",
"]",
":",
"ret",
".",
"update",
"(",
"_mminion",
"(",
")",
".",
"returners",
"[",
"'{0}.get_load'",
".",
"format",
"(",
"returner_",... | Merge the load data from all returners | [
"Merge",
"the",
"load",
"data",
"from",
"all",
"returners"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/multi_returner.py#L79-L87 | train |
saltstack/salt | salt/returners/multi_returner.py | get_jids | def get_jids():
'''
Return all job data from all returners
'''
ret = {}
for returner_ in __opts__[CONFIG_KEY]:
ret.update(_mminion().returners['{0}.get_jids'.format(returner_)]())
return ret | python | def get_jids():
'''
Return all job data from all returners
'''
ret = {}
for returner_ in __opts__[CONFIG_KEY]:
ret.update(_mminion().returners['{0}.get_jids'.format(returner_)]())
return ret | [
"def",
"get_jids",
"(",
")",
":",
"ret",
"=",
"{",
"}",
"for",
"returner_",
"in",
"__opts__",
"[",
"CONFIG_KEY",
"]",
":",
"ret",
".",
"update",
"(",
"_mminion",
"(",
")",
".",
"returners",
"[",
"'{0}.get_jids'",
".",
"format",
"(",
"returner_",
")",
... | Return all job data from all returners | [
"Return",
"all",
"job",
"data",
"from",
"all",
"returners"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/multi_returner.py#L101-L109 | train |
saltstack/salt | salt/returners/multi_returner.py | clean_old_jobs | def clean_old_jobs():
'''
Clean out the old jobs from all returners (if you have it)
'''
for returner_ in __opts__[CONFIG_KEY]:
fstr = '{0}.clean_old_jobs'.format(returner_)
if fstr in _mminion().returners:
_mminion().returners[fstr]() | python | def clean_old_jobs():
'''
Clean out the old jobs from all returners (if you have it)
'''
for returner_ in __opts__[CONFIG_KEY]:
fstr = '{0}.clean_old_jobs'.format(returner_)
if fstr in _mminion().returners:
_mminion().returners[fstr]() | [
"def",
"clean_old_jobs",
"(",
")",
":",
"for",
"returner_",
"in",
"__opts__",
"[",
"CONFIG_KEY",
"]",
":",
"fstr",
"=",
"'{0}.clean_old_jobs'",
".",
"format",
"(",
"returner_",
")",
"if",
"fstr",
"in",
"_mminion",
"(",
")",
".",
"returners",
":",
"_mminion... | Clean out the old jobs from all returners (if you have it) | [
"Clean",
"out",
"the",
"old",
"jobs",
"from",
"all",
"returners",
"(",
"if",
"you",
"have",
"it",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/multi_returner.py#L112-L119 | train |
saltstack/salt | salt/states/keystone_domain.py | present | def present(name, auth=None, **kwargs):
'''
Ensure domain exists and is up-to-date
name
Name of the domain
enabled
Boolean to control if domain is enabled
description
An arbitrary description of the domain
'''
ret = {'name': name,
'changes': {},
... | python | def present(name, auth=None, **kwargs):
'''
Ensure domain exists and is up-to-date
name
Name of the domain
enabled
Boolean to control if domain is enabled
description
An arbitrary description of the domain
'''
ret = {'name': name,
'changes': {},
... | [
"def",
"present",
"(",
"name",
",",
"auth",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"True",
",",
"'comment'",
":",
"''",
"}",
"kwargs",
"=",
... | Ensure domain exists and is up-to-date
name
Name of the domain
enabled
Boolean to control if domain is enabled
description
An arbitrary description of the domain | [
"Ensure",
"domain",
"exists",
"and",
"is",
"up",
"-",
"to",
"-",
"date"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/keystone_domain.py#L41-L91 | train |
saltstack/salt | salt/states/keystone_domain.py | absent | def absent(name, auth=None):
'''
Ensure domain does not exist
name
Name of the domain
'''
ret = {'name': name,
'changes': {},
'result': True,
'comment': ''}
__salt__['keystoneng.setup_clouds'](auth)
domain = __salt__['keystoneng.domain_get'](name=n... | python | def absent(name, auth=None):
'''
Ensure domain does not exist
name
Name of the domain
'''
ret = {'name': name,
'changes': {},
'result': True,
'comment': ''}
__salt__['keystoneng.setup_clouds'](auth)
domain = __salt__['keystoneng.domain_get'](name=n... | [
"def",
"absent",
"(",
"name",
",",
"auth",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"True",
",",
"'comment'",
":",
"''",
"}",
"__salt__",
"[",
"'keystoneng.setup_clouds'",
"... | Ensure domain does not exist
name
Name of the domain | [
"Ensure",
"domain",
"does",
"not",
"exist"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/keystone_domain.py#L94-L121 | train |
saltstack/salt | salt/matchers/compound_match.py | match | def match(tgt, opts=None):
'''
Runs the compound target check
'''
if not opts:
opts = __opts__
nodegroups = opts.get('nodegroups', {})
matchers = salt.loader.matchers(opts)
if not isinstance(tgt, six.string_types) and not isinstance(tgt, (list, tuple)):
log.error('Compound t... | python | def match(tgt, opts=None):
'''
Runs the compound target check
'''
if not opts:
opts = __opts__
nodegroups = opts.get('nodegroups', {})
matchers = salt.loader.matchers(opts)
if not isinstance(tgt, six.string_types) and not isinstance(tgt, (list, tuple)):
log.error('Compound t... | [
"def",
"match",
"(",
"tgt",
",",
"opts",
"=",
"None",
")",
":",
"if",
"not",
"opts",
":",
"opts",
"=",
"__opts__",
"nodegroups",
"=",
"opts",
".",
"get",
"(",
"'nodegroups'",
",",
"{",
"}",
")",
"matchers",
"=",
"salt",
".",
"loader",
".",
"matcher... | Runs the compound target check | [
"Runs",
"the",
"compound",
"target",
"check"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/matchers/compound_match.py#L22-L114 | train |
saltstack/salt | salt/states/marathon_app.py | config | def config(name, config):
'''
Ensure that the marathon app with the given id is present and is configured
to match the given config values.
:param name: The app name/id
:param config: The configuration to apply (dict)
:return: A standard Salt changes dictionary
'''
# setup return struct... | python | def config(name, config):
'''
Ensure that the marathon app with the given id is present and is configured
to match the given config values.
:param name: The app name/id
:param config: The configuration to apply (dict)
:return: A standard Salt changes dictionary
'''
# setup return struct... | [
"def",
"config",
"(",
"name",
",",
"config",
")",
":",
"# setup return structure",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"False",
",",
"'comment'",
":",
"''",
",",
"}",
"# get existing config if app ... | Ensure that the marathon app with the given id is present and is configured
to match the given config values.
:param name: The app name/id
:param config: The configuration to apply (dict)
:return: A standard Salt changes dictionary | [
"Ensure",
"that",
"the",
"marathon",
"app",
"with",
"the",
"given",
"id",
"is",
"present",
"and",
"is",
"configured",
"to",
"match",
"the",
"given",
"config",
"values",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/marathon_app.py#L27-L89 | train |
saltstack/salt | salt/states/marathon_app.py | running | def running(name, restart=False, force=True):
'''
Ensure that the marathon app with the given id is present and restart if set.
:param name: The app name/id
:param restart: Restart the app
:param force: Override the current deployment
:return: A standard Salt changes dictionary
'''
ret ... | python | def running(name, restart=False, force=True):
'''
Ensure that the marathon app with the given id is present and restart if set.
:param name: The app name/id
:param restart: Restart the app
:param force: Override the current deployment
:return: A standard Salt changes dictionary
'''
ret ... | [
"def",
"running",
"(",
"name",
",",
"restart",
"=",
"False",
",",
"force",
"=",
"True",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"False",
",",
"'comment'",
":",
"''",
"}",
"if",
"not... | Ensure that the marathon app with the given id is present and restart if set.
:param name: The app name/id
:param restart: Restart the app
:param force: Override the current deployment
:return: A standard Salt changes dictionary | [
"Ensure",
"that",
"the",
"marathon",
"app",
"with",
"the",
"given",
"id",
"is",
"present",
"and",
"restart",
"if",
"set",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/marathon_app.py#L122-L157 | train |
saltstack/salt | salt/states/boto_cfn.py | present | def present(name, template_body=None, template_url=None, parameters=None, notification_arns=None, disable_rollback=None,
timeout_in_minutes=None, capabilities=None, tags=None, on_failure=None, stack_policy_body=None,
stack_policy_url=None, use_previous_template=None, stack_policy_during_update_b... | python | def present(name, template_body=None, template_url=None, parameters=None, notification_arns=None, disable_rollback=None,
timeout_in_minutes=None, capabilities=None, tags=None, on_failure=None, stack_policy_body=None,
stack_policy_url=None, use_previous_template=None, stack_policy_during_update_b... | [
"def",
"present",
"(",
"name",
",",
"template_body",
"=",
"None",
",",
"template_url",
"=",
"None",
",",
"parameters",
"=",
"None",
",",
"notification_arns",
"=",
"None",
",",
"disable_rollback",
"=",
"None",
",",
"timeout_in_minutes",
"=",
"None",
",",
"cap... | Ensure cloud formation stack is present.
name (string) - Name of the stack.
template_body (string) – Structure containing the template body. Can also be loaded from a file by using salt://.
template_url (string) – Location of file containing the template body. The URL must point to a template located in
... | [
"Ensure",
"cloud",
"formation",
"stack",
"is",
"present",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_cfn.py#L75-L203 | train |
saltstack/salt | salt/states/boto_cfn.py | absent | def absent(name, region=None, key=None, keyid=None, profile=None):
'''
Ensure cloud formation stack is absent.
name (string) – The name of the stack to delete.
region (string) - Region to connect to.
key (string) - Secret key to be used.
keyid (string) - Access key to be used.
profile (... | python | def absent(name, region=None, key=None, keyid=None, profile=None):
'''
Ensure cloud formation stack is absent.
name (string) – The name of the stack to delete.
region (string) - Region to connect to.
key (string) - Secret key to be used.
keyid (string) - Access key to be used.
profile (... | [
"def",
"absent",
"(",
"name",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",
"True",
",",
"'comment'",
":",
"''"... | Ensure cloud formation stack is absent.
name (string) – The name of the stack to delete.
region (string) - Region to connect to.
key (string) - Secret key to be used.
keyid (string) - Access key to be used.
profile (dict) - A dict with region, key and keyid, or a pillar key (string) that contai... | [
"Ensure",
"cloud",
"formation",
"stack",
"is",
"absent",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_cfn.py#L206-L240 | train |
saltstack/salt | salt/states/influxdb_continuous_query.py | present | def present(name, database, query, resample_time=None, coverage_period=None, **client_args):
'''
Ensure that given continuous query is present.
name
Name of the continuous query to create.
database
Database to create continuous query on.
query
The query content
resamp... | python | def present(name, database, query, resample_time=None, coverage_period=None, **client_args):
'''
Ensure that given continuous query is present.
name
Name of the continuous query to create.
database
Database to create continuous query on.
query
The query content
resamp... | [
"def",
"present",
"(",
"name",
",",
"database",
",",
"query",
",",
"resample_time",
"=",
"None",
",",
"coverage_period",
"=",
"None",
",",
"*",
"*",
"client_args",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
","... | Ensure that given continuous query is present.
name
Name of the continuous query to create.
database
Database to create continuous query on.
query
The query content
resample_time : None
Duration between continuous query resampling.
coverage_period : None
... | [
"Ensure",
"that",
"given",
"continuous",
"query",
"is",
"present",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/influxdb_continuous_query.py#L24-L69 | train |
saltstack/salt | salt/states/timezone.py | system | def system(name, utc=True):
'''
Set the timezone for the system.
name
The name of the timezone to use (e.g.: America/Denver)
utc
Whether or not to set the hardware clock to UTC (default is True)
'''
ret = {'name': name,
'changes': {},
'result': None,
... | python | def system(name, utc=True):
'''
Set the timezone for the system.
name
The name of the timezone to use (e.g.: America/Denver)
utc
Whether or not to set the hardware clock to UTC (default is True)
'''
ret = {'name': name,
'changes': {},
'result': None,
... | [
"def",
"system",
"(",
"name",
",",
"utc",
"=",
"True",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"None",
",",
"'comment'",
":",
"''",
"}",
"# Set up metadata",
"do_utc",
"=",
"False",
"... | Set the timezone for the system.
name
The name of the timezone to use (e.g.: America/Denver)
utc
Whether or not to set the hardware clock to UTC (default is True) | [
"Set",
"the",
"timezone",
"for",
"the",
"system",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/timezone.py#L43-L127 | train |
saltstack/salt | salt/modules/nova.py | _auth | def _auth(profile=None, **kwargs):
'''
Set up nova credentials
'''
keystone_api_args = None
if kwargs is not None:
if kwargs.get('keystone_api_args') is not None:
keystone_api_args = kwargs['keystone_api_args']
if profile:
credentials = __salt__['config.option'](prof... | python | def _auth(profile=None, **kwargs):
'''
Set up nova credentials
'''
keystone_api_args = None
if kwargs is not None:
if kwargs.get('keystone_api_args') is not None:
keystone_api_args = kwargs['keystone_api_args']
if profile:
credentials = __salt__['config.option'](prof... | [
"def",
"_auth",
"(",
"profile",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"keystone_api_args",
"=",
"None",
"if",
"kwargs",
"is",
"not",
"None",
":",
"if",
"kwargs",
".",
"get",
"(",
"'keystone_api_args'",
")",
"is",
"not",
"None",
":",
"keystone... | Set up nova credentials | [
"Set",
"up",
"nova",
"credentials"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nova.py#L124-L210 | train |
saltstack/salt | salt/modules/nova.py | boot | def boot(name, flavor_id=0, image_id=0, profile=None, timeout=300, **kwargs):
'''
Boot (create) a new instance
name
Name of the new instance (must be first)
flavor_id
Unique integer ID for the flavor
image_id
Unique integer ID for the image
timeout
How long to... | python | def boot(name, flavor_id=0, image_id=0, profile=None, timeout=300, **kwargs):
'''
Boot (create) a new instance
name
Name of the new instance (must be first)
flavor_id
Unique integer ID for the flavor
image_id
Unique integer ID for the image
timeout
How long to... | [
"def",
"boot",
"(",
"name",
",",
"flavor_id",
"=",
"0",
",",
"image_id",
"=",
"0",
",",
"profile",
"=",
"None",
",",
"timeout",
"=",
"300",
",",
"*",
"*",
"kwargs",
")",
":",
"conn",
"=",
"_auth",
"(",
"profile",
",",
"*",
"*",
"kwargs",
")",
"... | Boot (create) a new instance
name
Name of the new instance (must be first)
flavor_id
Unique integer ID for the flavor
image_id
Unique integer ID for the image
timeout
How long to wait, after creating the instance, for the provider to
return information about i... | [
"Boot",
"(",
"create",
")",
"a",
"new",
"instance"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nova.py#L213-L247 | train |
saltstack/salt | salt/modules/nova.py | volume_list | def volume_list(search_opts=None, profile=None, **kwargs):
'''
List storage volumes
search_opts
Dictionary of search options
profile
Profile to use
CLI Example:
.. code-block:: bash
salt '*' nova.volume_list search_opts='{"display_name": "myblock"}' profile=openstack... | python | def volume_list(search_opts=None, profile=None, **kwargs):
'''
List storage volumes
search_opts
Dictionary of search options
profile
Profile to use
CLI Example:
.. code-block:: bash
salt '*' nova.volume_list search_opts='{"display_name": "myblock"}' profile=openstack... | [
"def",
"volume_list",
"(",
"search_opts",
"=",
"None",
",",
"profile",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"conn",
"=",
"_auth",
"(",
"profile",
",",
"*",
"*",
"kwargs",
")",
"return",
"conn",
".",
"volume_list",
"(",
"search_opts",
"=",
... | List storage volumes
search_opts
Dictionary of search options
profile
Profile to use
CLI Example:
.. code-block:: bash
salt '*' nova.volume_list search_opts='{"display_name": "myblock"}' profile=openstack | [
"List",
"storage",
"volumes"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nova.py#L250-L268 | train |
saltstack/salt | salt/modules/nova.py | volume_show | def volume_show(name, profile=None, **kwargs):
'''
Create a block storage volume
name
Name of the volume
profile
Profile to use
CLI Example:
.. code-block:: bash
salt '*' nova.volume_show myblock profile=openstack
'''
conn = _auth(profile, **kwargs)
retu... | python | def volume_show(name, profile=None, **kwargs):
'''
Create a block storage volume
name
Name of the volume
profile
Profile to use
CLI Example:
.. code-block:: bash
salt '*' nova.volume_show myblock profile=openstack
'''
conn = _auth(profile, **kwargs)
retu... | [
"def",
"volume_show",
"(",
"name",
",",
"profile",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"conn",
"=",
"_auth",
"(",
"profile",
",",
"*",
"*",
"kwargs",
")",
"return",
"conn",
".",
"volume_show",
"(",
"name",
")"
] | Create a block storage volume
name
Name of the volume
profile
Profile to use
CLI Example:
.. code-block:: bash
salt '*' nova.volume_show myblock profile=openstack | [
"Create",
"a",
"block",
"storage",
"volume"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nova.py#L271-L289 | train |
saltstack/salt | salt/modules/nova.py | volume_create | def volume_create(name, size=100, snapshot=None, voltype=None, profile=None, **kwargs):
'''
Create a block storage volume
name
Name of the new volume (must be first)
size
Volume size
snapshot
Block storage snapshot id
voltype
Type of storage
profile
... | python | def volume_create(name, size=100, snapshot=None, voltype=None, profile=None, **kwargs):
'''
Create a block storage volume
name
Name of the new volume (must be first)
size
Volume size
snapshot
Block storage snapshot id
voltype
Type of storage
profile
... | [
"def",
"volume_create",
"(",
"name",
",",
"size",
"=",
"100",
",",
"snapshot",
"=",
"None",
",",
"voltype",
"=",
"None",
",",
"profile",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"conn",
"=",
"_auth",
"(",
"profile",
",",
"*",
"*",
"kwargs",
... | Create a block storage volume
name
Name of the new volume (must be first)
size
Volume size
snapshot
Block storage snapshot id
voltype
Type of storage
profile
Profile to build on
CLI Example:
.. code-block:: bash
salt '*' nova.volume_cre... | [
"Create",
"a",
"block",
"storage",
"volume"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nova.py#L292-L324 | train |
saltstack/salt | salt/modules/nova.py | volume_delete | def volume_delete(name, profile=None, **kwargs):
'''
Destroy the volume
name
Name of the volume
profile
Profile to build on
CLI Example:
.. code-block:: bash
salt '*' nova.volume_delete myblock profile=openstack
'''
conn = _auth(profile, **kwargs)
return... | python | def volume_delete(name, profile=None, **kwargs):
'''
Destroy the volume
name
Name of the volume
profile
Profile to build on
CLI Example:
.. code-block:: bash
salt '*' nova.volume_delete myblock profile=openstack
'''
conn = _auth(profile, **kwargs)
return... | [
"def",
"volume_delete",
"(",
"name",
",",
"profile",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"conn",
"=",
"_auth",
"(",
"profile",
",",
"*",
"*",
"kwargs",
")",
"return",
"conn",
".",
"volume_delete",
"(",
"name",
")"
] | Destroy the volume
name
Name of the volume
profile
Profile to build on
CLI Example:
.. code-block:: bash
salt '*' nova.volume_delete myblock profile=openstack | [
"Destroy",
"the",
"volume"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nova.py#L327-L345 | train |
saltstack/salt | salt/modules/nova.py | volume_detach | def volume_detach(name, profile=None, timeout=300, **kwargs):
'''
Attach a block storage volume
name
Name of the new volume to attach
server_name
Name of the server to detach from
profile
Profile to build on
CLI Example:
.. code-block:: bash
salt '*' nov... | python | def volume_detach(name, profile=None, timeout=300, **kwargs):
'''
Attach a block storage volume
name
Name of the new volume to attach
server_name
Name of the server to detach from
profile
Profile to build on
CLI Example:
.. code-block:: bash
salt '*' nov... | [
"def",
"volume_detach",
"(",
"name",
",",
"profile",
"=",
"None",
",",
"timeout",
"=",
"300",
",",
"*",
"*",
"kwargs",
")",
":",
"conn",
"=",
"_auth",
"(",
"profile",
",",
"*",
"*",
"kwargs",
")",
"return",
"conn",
".",
"volume_detach",
"(",
"name",
... | Attach a block storage volume
name
Name of the new volume to attach
server_name
Name of the server to detach from
profile
Profile to build on
CLI Example:
.. code-block:: bash
salt '*' nova.volume_detach myblock profile=openstack | [
"Attach",
"a",
"block",
"storage",
"volume"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nova.py#L348-L372 | train |
saltstack/salt | salt/modules/nova.py | volume_attach | def volume_attach(name,
server_name,
device='/dev/xvdb',
profile=None,
timeout=300, **kwargs):
'''
Attach a block storage volume
name
Name of the new volume to attach
server_name
Name of the server to attach to
... | python | def volume_attach(name,
server_name,
device='/dev/xvdb',
profile=None,
timeout=300, **kwargs):
'''
Attach a block storage volume
name
Name of the new volume to attach
server_name
Name of the server to attach to
... | [
"def",
"volume_attach",
"(",
"name",
",",
"server_name",
",",
"device",
"=",
"'/dev/xvdb'",
",",
"profile",
"=",
"None",
",",
"timeout",
"=",
"300",
",",
"*",
"*",
"kwargs",
")",
":",
"conn",
"=",
"_auth",
"(",
"profile",
",",
"*",
"*",
"kwargs",
")"... | Attach a block storage volume
name
Name of the new volume to attach
server_name
Name of the server to attach to
device
Name of the device on the server
profile
Profile to build on
CLI Example:
.. code-block:: bash
salt '*' nova.volume_attach myblock... | [
"Attach",
"a",
"block",
"storage",
"volume"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nova.py#L375-L409 | train |
saltstack/salt | salt/modules/nova.py | suspend | def suspend(instance_id, profile=None, **kwargs):
'''
Suspend an instance
instance_id
ID of the instance to be suspended
CLI Example:
.. code-block:: bash
salt '*' nova.suspend 1138
'''
conn = _auth(profile, **kwargs)
return conn.suspend(instance_id) | python | def suspend(instance_id, profile=None, **kwargs):
'''
Suspend an instance
instance_id
ID of the instance to be suspended
CLI Example:
.. code-block:: bash
salt '*' nova.suspend 1138
'''
conn = _auth(profile, **kwargs)
return conn.suspend(instance_id) | [
"def",
"suspend",
"(",
"instance_id",
",",
"profile",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"conn",
"=",
"_auth",
"(",
"profile",
",",
"*",
"*",
"kwargs",
")",
"return",
"conn",
".",
"suspend",
"(",
"instance_id",
")"
] | Suspend an instance
instance_id
ID of the instance to be suspended
CLI Example:
.. code-block:: bash
salt '*' nova.suspend 1138 | [
"Suspend",
"an",
"instance"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nova.py#L412-L427 | train |
saltstack/salt | salt/modules/nova.py | resume | def resume(instance_id, profile=None, **kwargs):
'''
Resume an instance
instance_id
ID of the instance to be resumed
CLI Example:
.. code-block:: bash
salt '*' nova.resume 1138
'''
conn = _auth(profile, **kwargs)
return conn.resume(instance_id) | python | def resume(instance_id, profile=None, **kwargs):
'''
Resume an instance
instance_id
ID of the instance to be resumed
CLI Example:
.. code-block:: bash
salt '*' nova.resume 1138
'''
conn = _auth(profile, **kwargs)
return conn.resume(instance_id) | [
"def",
"resume",
"(",
"instance_id",
",",
"profile",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"conn",
"=",
"_auth",
"(",
"profile",
",",
"*",
"*",
"kwargs",
")",
"return",
"conn",
".",
"resume",
"(",
"instance_id",
")"
] | Resume an instance
instance_id
ID of the instance to be resumed
CLI Example:
.. code-block:: bash
salt '*' nova.resume 1138 | [
"Resume",
"an",
"instance"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nova.py#L430-L445 | train |
saltstack/salt | salt/modules/nova.py | lock | def lock(instance_id, profile=None, **kwargs):
'''
Lock an instance
instance_id
ID of the instance to be locked
CLI Example:
.. code-block:: bash
salt '*' nova.lock 1138
'''
conn = _auth(profile, **kwargs)
return conn.lock(instance_id) | python | def lock(instance_id, profile=None, **kwargs):
'''
Lock an instance
instance_id
ID of the instance to be locked
CLI Example:
.. code-block:: bash
salt '*' nova.lock 1138
'''
conn = _auth(profile, **kwargs)
return conn.lock(instance_id) | [
"def",
"lock",
"(",
"instance_id",
",",
"profile",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"conn",
"=",
"_auth",
"(",
"profile",
",",
"*",
"*",
"kwargs",
")",
"return",
"conn",
".",
"lock",
"(",
"instance_id",
")"
] | Lock an instance
instance_id
ID of the instance to be locked
CLI Example:
.. code-block:: bash
salt '*' nova.lock 1138 | [
"Lock",
"an",
"instance"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nova.py#L448-L463 | train |
saltstack/salt | salt/modules/nova.py | delete | def delete(instance_id, profile=None, **kwargs):
'''
Delete an instance
instance_id
ID of the instance to be deleted
CLI Example:
.. code-block:: bash
salt '*' nova.delete 1138
'''
conn = _auth(profile, **kwargs)
return conn.delete(instance_id) | python | def delete(instance_id, profile=None, **kwargs):
'''
Delete an instance
instance_id
ID of the instance to be deleted
CLI Example:
.. code-block:: bash
salt '*' nova.delete 1138
'''
conn = _auth(profile, **kwargs)
return conn.delete(instance_id) | [
"def",
"delete",
"(",
"instance_id",
",",
"profile",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"conn",
"=",
"_auth",
"(",
"profile",
",",
"*",
"*",
"kwargs",
")",
"return",
"conn",
".",
"delete",
"(",
"instance_id",
")"
] | Delete an instance
instance_id
ID of the instance to be deleted
CLI Example:
.. code-block:: bash
salt '*' nova.delete 1138 | [
"Delete",
"an",
"instance"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nova.py#L466-L481 | train |
saltstack/salt | salt/modules/nova.py | flavor_list | def flavor_list(profile=None, **kwargs):
'''
Return a list of available flavors (nova flavor-list)
CLI Example:
.. code-block:: bash
salt '*' nova.flavor_list
'''
filters = kwargs.get('filter', {})
conn = _auth(profile, **kwargs)
return conn.flavor_list(**filters) | python | def flavor_list(profile=None, **kwargs):
'''
Return a list of available flavors (nova flavor-list)
CLI Example:
.. code-block:: bash
salt '*' nova.flavor_list
'''
filters = kwargs.get('filter', {})
conn = _auth(profile, **kwargs)
return conn.flavor_list(**filters) | [
"def",
"flavor_list",
"(",
"profile",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"filters",
"=",
"kwargs",
".",
"get",
"(",
"'filter'",
",",
"{",
"}",
")",
"conn",
"=",
"_auth",
"(",
"profile",
",",
"*",
"*",
"kwargs",
")",
"return",
"conn",
... | Return a list of available flavors (nova flavor-list)
CLI Example:
.. code-block:: bash
salt '*' nova.flavor_list | [
"Return",
"a",
"list",
"of",
"available",
"flavors",
"(",
"nova",
"flavor",
"-",
"list",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nova.py#L484-L496 | train |
saltstack/salt | salt/modules/nova.py | flavor_create | def flavor_create(name, # pylint: disable=C0103
flavor_id=0, # pylint: disable=C0103
ram=0,
disk=0,
vcpus=1,
is_public=True,
profile=None, **kwargs):
'''
Add a flavor to nova (nova flavor-create... | python | def flavor_create(name, # pylint: disable=C0103
flavor_id=0, # pylint: disable=C0103
ram=0,
disk=0,
vcpus=1,
is_public=True,
profile=None, **kwargs):
'''
Add a flavor to nova (nova flavor-create... | [
"def",
"flavor_create",
"(",
"name",
",",
"# pylint: disable=C0103",
"flavor_id",
"=",
"0",
",",
"# pylint: disable=C0103",
"ram",
"=",
"0",
",",
"disk",
"=",
"0",
",",
"vcpus",
"=",
"1",
",",
"is_public",
"=",
"True",
",",
"profile",
"=",
"None",
",",
"... | Add a flavor to nova (nova flavor-create). The following parameters are
required:
name
Name of the new flavor (must be first)
flavor_id
Unique integer ID for the new flavor
ram
Memory size in MB
disk
Disk size in GB
vcpus
Number of vcpus
is_public
... | [
"Add",
"a",
"flavor",
"to",
"nova",
"(",
"nova",
"flavor",
"-",
"create",
")",
".",
"The",
"following",
"parameters",
"are",
"required",
":"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nova.py#L499-L537 | train |
saltstack/salt | salt/modules/nova.py | flavor_delete | def flavor_delete(flavor_id, profile=None, **kwargs): # pylint: disable=C0103
'''
Delete a flavor from nova by id (nova flavor-delete)
CLI Example:
.. code-block:: bash
salt '*' nova.flavor_delete 7
'''
conn = _auth(profile, **kwargs)
return conn.flavor_delete(flavor_id) | python | def flavor_delete(flavor_id, profile=None, **kwargs): # pylint: disable=C0103
'''
Delete a flavor from nova by id (nova flavor-delete)
CLI Example:
.. code-block:: bash
salt '*' nova.flavor_delete 7
'''
conn = _auth(profile, **kwargs)
return conn.flavor_delete(flavor_id) | [
"def",
"flavor_delete",
"(",
"flavor_id",
",",
"profile",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"# pylint: disable=C0103",
"conn",
"=",
"_auth",
"(",
"profile",
",",
"*",
"*",
"kwargs",
")",
"return",
"conn",
".",
"flavor_delete",
"(",
"flavor_id... | Delete a flavor from nova by id (nova flavor-delete)
CLI Example:
.. code-block:: bash
salt '*' nova.flavor_delete 7 | [
"Delete",
"a",
"flavor",
"from",
"nova",
"by",
"id",
"(",
"nova",
"flavor",
"-",
"delete",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nova.py#L540-L551 | train |
saltstack/salt | salt/modules/nova.py | flavor_access_list | def flavor_access_list(flavor_id, profile=None, **kwargs):
'''
Return a list of project IDs assigned to flavor ID
CLI Example:
.. code-block:: bash
salt '*' nova.flavor_access_list flavor_id=ID
'''
conn = _auth(profile, **kwargs)
return conn.flavor_access_list(flavor_id=flavor_id,... | python | def flavor_access_list(flavor_id, profile=None, **kwargs):
'''
Return a list of project IDs assigned to flavor ID
CLI Example:
.. code-block:: bash
salt '*' nova.flavor_access_list flavor_id=ID
'''
conn = _auth(profile, **kwargs)
return conn.flavor_access_list(flavor_id=flavor_id,... | [
"def",
"flavor_access_list",
"(",
"flavor_id",
",",
"profile",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"conn",
"=",
"_auth",
"(",
"profile",
",",
"*",
"*",
"kwargs",
")",
"return",
"conn",
".",
"flavor_access_list",
"(",
"flavor_id",
"=",
"flavor... | Return a list of project IDs assigned to flavor ID
CLI Example:
.. code-block:: bash
salt '*' nova.flavor_access_list flavor_id=ID | [
"Return",
"a",
"list",
"of",
"project",
"IDs",
"assigned",
"to",
"flavor",
"ID"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nova.py#L554-L565 | train |
saltstack/salt | salt/modules/nova.py | flavor_access_add | def flavor_access_add(flavor_id, project_id, profile=None, **kwargs):
'''
Add a project to the flavor access list
CLI Example:
.. code-block:: bash
salt '*' nova.flavor_access_add flavor_id=fID project_id=pID
'''
conn = _auth(profile, **kwargs)
return conn.flavor_access_add(flavor... | python | def flavor_access_add(flavor_id, project_id, profile=None, **kwargs):
'''
Add a project to the flavor access list
CLI Example:
.. code-block:: bash
salt '*' nova.flavor_access_add flavor_id=fID project_id=pID
'''
conn = _auth(profile, **kwargs)
return conn.flavor_access_add(flavor... | [
"def",
"flavor_access_add",
"(",
"flavor_id",
",",
"project_id",
",",
"profile",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"conn",
"=",
"_auth",
"(",
"profile",
",",
"*",
"*",
"kwargs",
")",
"return",
"conn",
".",
"flavor_access_add",
"(",
"flavor_... | Add a project to the flavor access list
CLI Example:
.. code-block:: bash
salt '*' nova.flavor_access_add flavor_id=fID project_id=pID | [
"Add",
"a",
"project",
"to",
"the",
"flavor",
"access",
"list"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nova.py#L568-L579 | train |
saltstack/salt | salt/modules/nova.py | flavor_access_remove | def flavor_access_remove(flavor_id, project_id, profile=None, **kwargs):
'''
Remove a project from the flavor access list
CLI Example:
.. code-block:: bash
salt '*' nova.flavor_access_remove flavor_id=fID project_id=pID
'''
conn = _auth(profile, **kwargs)
return conn.flavor_access... | python | def flavor_access_remove(flavor_id, project_id, profile=None, **kwargs):
'''
Remove a project from the flavor access list
CLI Example:
.. code-block:: bash
salt '*' nova.flavor_access_remove flavor_id=fID project_id=pID
'''
conn = _auth(profile, **kwargs)
return conn.flavor_access... | [
"def",
"flavor_access_remove",
"(",
"flavor_id",
",",
"project_id",
",",
"profile",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"conn",
"=",
"_auth",
"(",
"profile",
",",
"*",
"*",
"kwargs",
")",
"return",
"conn",
".",
"flavor_access_remove",
"(",
"f... | Remove a project from the flavor access list
CLI Example:
.. code-block:: bash
salt '*' nova.flavor_access_remove flavor_id=fID project_id=pID | [
"Remove",
"a",
"project",
"from",
"the",
"flavor",
"access",
"list"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nova.py#L582-L593 | train |
saltstack/salt | salt/modules/nova.py | keypair_add | def keypair_add(name, pubfile=None, pubkey=None, profile=None, **kwargs):
'''
Add a keypair to nova (nova keypair-add)
CLI Examples:
.. code-block:: bash
salt '*' nova.keypair_add mykey pubfile='/home/myuser/.ssh/id_rsa.pub'
salt '*' nova.keypair_add mykey pubkey='ssh-rsa <key> myuser... | python | def keypair_add(name, pubfile=None, pubkey=None, profile=None, **kwargs):
'''
Add a keypair to nova (nova keypair-add)
CLI Examples:
.. code-block:: bash
salt '*' nova.keypair_add mykey pubfile='/home/myuser/.ssh/id_rsa.pub'
salt '*' nova.keypair_add mykey pubkey='ssh-rsa <key> myuser... | [
"def",
"keypair_add",
"(",
"name",
",",
"pubfile",
"=",
"None",
",",
"pubkey",
"=",
"None",
",",
"profile",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"conn",
"=",
"_auth",
"(",
"profile",
",",
"*",
"*",
"kwargs",
")",
"return",
"conn",
".",
... | Add a keypair to nova (nova keypair-add)
CLI Examples:
.. code-block:: bash
salt '*' nova.keypair_add mykey pubfile='/home/myuser/.ssh/id_rsa.pub'
salt '*' nova.keypair_add mykey pubkey='ssh-rsa <key> myuser@mybox' | [
"Add",
"a",
"keypair",
"to",
"nova",
"(",
"nova",
"keypair",
"-",
"add",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nova.py#L610-L626 | train |
saltstack/salt | salt/modules/nova.py | keypair_delete | def keypair_delete(name, profile=None, **kwargs):
'''
Add a keypair to nova (nova keypair-delete)
CLI Example:
.. code-block:: bash
salt '*' nova.keypair_delete mykey
'''
conn = _auth(profile, **kwargs)
return conn.keypair_delete(name) | python | def keypair_delete(name, profile=None, **kwargs):
'''
Add a keypair to nova (nova keypair-delete)
CLI Example:
.. code-block:: bash
salt '*' nova.keypair_delete mykey
'''
conn = _auth(profile, **kwargs)
return conn.keypair_delete(name) | [
"def",
"keypair_delete",
"(",
"name",
",",
"profile",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"conn",
"=",
"_auth",
"(",
"profile",
",",
"*",
"*",
"kwargs",
")",
"return",
"conn",
".",
"keypair_delete",
"(",
"name",
")"
] | Add a keypair to nova (nova keypair-delete)
CLI Example:
.. code-block:: bash
salt '*' nova.keypair_delete mykey | [
"Add",
"a",
"keypair",
"to",
"nova",
"(",
"nova",
"keypair",
"-",
"delete",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nova.py#L629-L640 | train |
saltstack/salt | salt/modules/nova.py | image_list | def image_list(name=None, profile=None, **kwargs):
'''
Return a list of available images (nova images-list + nova image-show)
If a name is provided, only that image will be displayed.
CLI Examples:
.. code-block:: bash
salt '*' nova.image_list
salt '*' nova.image_list myimage
... | python | def image_list(name=None, profile=None, **kwargs):
'''
Return a list of available images (nova images-list + nova image-show)
If a name is provided, only that image will be displayed.
CLI Examples:
.. code-block:: bash
salt '*' nova.image_list
salt '*' nova.image_list myimage
... | [
"def",
"image_list",
"(",
"name",
"=",
"None",
",",
"profile",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"conn",
"=",
"_auth",
"(",
"profile",
",",
"*",
"*",
"kwargs",
")",
"return",
"conn",
".",
"image_list",
"(",
"name",
")"
] | Return a list of available images (nova images-list + nova image-show)
If a name is provided, only that image will be displayed.
CLI Examples:
.. code-block:: bash
salt '*' nova.image_list
salt '*' nova.image_list myimage | [
"Return",
"a",
"list",
"of",
"available",
"images",
"(",
"nova",
"images",
"-",
"list",
"+",
"nova",
"image",
"-",
"show",
")",
"If",
"a",
"name",
"is",
"provided",
"only",
"that",
"image",
"will",
"be",
"displayed",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nova.py#L643-L656 | train |
saltstack/salt | salt/modules/nova.py | image_meta_set | def image_meta_set(image_id=None,
name=None,
profile=None,
**kwargs): # pylint: disable=C0103
'''
Sets a key=value pair in the metadata for an image (nova image-meta set)
CLI Examples:
.. code-block:: bash
salt '*' nova.image_meta_set ... | python | def image_meta_set(image_id=None,
name=None,
profile=None,
**kwargs): # pylint: disable=C0103
'''
Sets a key=value pair in the metadata for an image (nova image-meta set)
CLI Examples:
.. code-block:: bash
salt '*' nova.image_meta_set ... | [
"def",
"image_meta_set",
"(",
"image_id",
"=",
"None",
",",
"name",
"=",
"None",
",",
"profile",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"# pylint: disable=C0103",
"conn",
"=",
"_auth",
"(",
"profile",
",",
"*",
"*",
"kwargs",
")",
"return",
"c... | Sets a key=value pair in the metadata for an image (nova image-meta set)
CLI Examples:
.. code-block:: bash
salt '*' nova.image_meta_set 6f52b2ff-0b31-4d84-8fd1-af45b84824f6 cheese=gruyere
salt '*' nova.image_meta_set name=myimage salad=pasta beans=baked | [
"Sets",
"a",
"key",
"=",
"value",
"pair",
"in",
"the",
"metadata",
"for",
"an",
"image",
"(",
"nova",
"image",
"-",
"meta",
"set",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nova.py#L659-L678 | train |
saltstack/salt | salt/modules/nova.py | image_meta_delete | def image_meta_delete(image_id=None, # pylint: disable=C0103
name=None,
keys=None,
profile=None, **kwargs):
'''
Delete a key=value pair from the metadata for an image
(nova image-meta set)
CLI Examples:
.. code-block:: bash
... | python | def image_meta_delete(image_id=None, # pylint: disable=C0103
name=None,
keys=None,
profile=None, **kwargs):
'''
Delete a key=value pair from the metadata for an image
(nova image-meta set)
CLI Examples:
.. code-block:: bash
... | [
"def",
"image_meta_delete",
"(",
"image_id",
"=",
"None",
",",
"# pylint: disable=C0103",
"name",
"=",
"None",
",",
"keys",
"=",
"None",
",",
"profile",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"conn",
"=",
"_auth",
"(",
"profile",
",",
"*",
"*"... | Delete a key=value pair from the metadata for an image
(nova image-meta set)
CLI Examples:
.. code-block:: bash
salt '*' nova.image_meta_delete 6f52b2ff-0b31-4d84-8fd1-af45b84824f6 keys=cheese
salt '*' nova.image_meta_delete name=myimage keys=salad,beans | [
"Delete",
"a",
"key",
"=",
"value",
"pair",
"from",
"the",
"metadata",
"for",
"an",
"image",
"(",
"nova",
"image",
"-",
"meta",
"set",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nova.py#L681-L701 | train |
saltstack/salt | salt/modules/nova.py | server_show | def server_show(server_id, profile=None, **kwargs):
'''
Return detailed information for an active server
CLI Example:
.. code-block:: bash
salt '*' nova.server_show <server_id>
'''
conn = _auth(profile, **kwargs)
return conn.server_show(server_id) | python | def server_show(server_id, profile=None, **kwargs):
'''
Return detailed information for an active server
CLI Example:
.. code-block:: bash
salt '*' nova.server_show <server_id>
'''
conn = _auth(profile, **kwargs)
return conn.server_show(server_id) | [
"def",
"server_show",
"(",
"server_id",
",",
"profile",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"conn",
"=",
"_auth",
"(",
"profile",
",",
"*",
"*",
"kwargs",
")",
"return",
"conn",
".",
"server_show",
"(",
"server_id",
")"
] | Return detailed information for an active server
CLI Example:
.. code-block:: bash
salt '*' nova.server_show <server_id> | [
"Return",
"detailed",
"information",
"for",
"an",
"active",
"server"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nova.py#L760-L771 | train |
saltstack/salt | salt/modules/nova.py | secgroup_create | def secgroup_create(name, description, profile=None, **kwargs):
'''
Add a secgroup to nova (nova secgroup-create)
CLI Example:
.. code-block:: bash
salt '*' nova.secgroup_create mygroup 'This is my security group'
'''
conn = _auth(profile, **kwargs)
return conn.secgroup_create(nam... | python | def secgroup_create(name, description, profile=None, **kwargs):
'''
Add a secgroup to nova (nova secgroup-create)
CLI Example:
.. code-block:: bash
salt '*' nova.secgroup_create mygroup 'This is my security group'
'''
conn = _auth(profile, **kwargs)
return conn.secgroup_create(nam... | [
"def",
"secgroup_create",
"(",
"name",
",",
"description",
",",
"profile",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"conn",
"=",
"_auth",
"(",
"profile",
",",
"*",
"*",
"kwargs",
")",
"return",
"conn",
".",
"secgroup_create",
"(",
"name",
",",
... | Add a secgroup to nova (nova secgroup-create)
CLI Example:
.. code-block:: bash
salt '*' nova.secgroup_create mygroup 'This is my security group' | [
"Add",
"a",
"secgroup",
"to",
"nova",
"(",
"nova",
"secgroup",
"-",
"create",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nova.py#L774-L785 | train |
saltstack/salt | salt/modules/nova.py | secgroup_delete | def secgroup_delete(name, profile=None, **kwargs):
'''
Delete a secgroup to nova (nova secgroup-delete)
CLI Example:
.. code-block:: bash
salt '*' nova.secgroup_delete mygroup
'''
conn = _auth(profile, **kwargs)
return conn.secgroup_delete(name) | python | def secgroup_delete(name, profile=None, **kwargs):
'''
Delete a secgroup to nova (nova secgroup-delete)
CLI Example:
.. code-block:: bash
salt '*' nova.secgroup_delete mygroup
'''
conn = _auth(profile, **kwargs)
return conn.secgroup_delete(name) | [
"def",
"secgroup_delete",
"(",
"name",
",",
"profile",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"conn",
"=",
"_auth",
"(",
"profile",
",",
"*",
"*",
"kwargs",
")",
"return",
"conn",
".",
"secgroup_delete",
"(",
"name",
")"
] | Delete a secgroup to nova (nova secgroup-delete)
CLI Example:
.. code-block:: bash
salt '*' nova.secgroup_delete mygroup | [
"Delete",
"a",
"secgroup",
"to",
"nova",
"(",
"nova",
"secgroup",
"-",
"delete",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nova.py#L788-L799 | train |
saltstack/salt | salt/modules/nova.py | server_by_name | def server_by_name(name, profile=None, **kwargs):
'''
Return information about a server
name
Server Name
CLI Example:
.. code-block:: bash
salt '*' nova.server_by_name myserver profile=openstack
'''
conn = _auth(profile, **kwargs)
return conn.server_by_name(name) | python | def server_by_name(name, profile=None, **kwargs):
'''
Return information about a server
name
Server Name
CLI Example:
.. code-block:: bash
salt '*' nova.server_by_name myserver profile=openstack
'''
conn = _auth(profile, **kwargs)
return conn.server_by_name(name) | [
"def",
"server_by_name",
"(",
"name",
",",
"profile",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"conn",
"=",
"_auth",
"(",
"profile",
",",
"*",
"*",
"kwargs",
")",
"return",
"conn",
".",
"server_by_name",
"(",
"name",
")"
] | Return information about a server
name
Server Name
CLI Example:
.. code-block:: bash
salt '*' nova.server_by_name myserver profile=openstack | [
"Return",
"information",
"about",
"a",
"server"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nova.py#L816-L830 | train |
saltstack/salt | salt/modules/napalm_yang_mod.py | _get_root_object | def _get_root_object(models):
'''
Read list of models and returns a Root object with the proper models added.
'''
root = napalm_yang.base.Root()
for model in models:
current = napalm_yang
for part in model.split('.'):
current = getattr(current, part)
root.add_mode... | python | def _get_root_object(models):
'''
Read list of models and returns a Root object with the proper models added.
'''
root = napalm_yang.base.Root()
for model in models:
current = napalm_yang
for part in model.split('.'):
current = getattr(current, part)
root.add_mode... | [
"def",
"_get_root_object",
"(",
"models",
")",
":",
"root",
"=",
"napalm_yang",
".",
"base",
".",
"Root",
"(",
")",
"for",
"model",
"in",
"models",
":",
"current",
"=",
"napalm_yang",
"for",
"part",
"in",
"model",
".",
"split",
"(",
"'.'",
")",
":",
... | Read list of models and returns a Root object with the proper models added. | [
"Read",
"list",
"of",
"models",
"and",
"returns",
"a",
"Root",
"object",
"with",
"the",
"proper",
"models",
"added",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/napalm_yang_mod.py#L55-L65 | train |
saltstack/salt | salt/modules/napalm_yang_mod.py | diff | def diff(candidate, running, *models):
'''
Returns the difference between two configuration entities structured
according to the YANG model.
.. note::
This function is recommended to be used mostly as a state helper.
candidate
First model to compare.
running
Second mod... | python | def diff(candidate, running, *models):
'''
Returns the difference between two configuration entities structured
according to the YANG model.
.. note::
This function is recommended to be used mostly as a state helper.
candidate
First model to compare.
running
Second mod... | [
"def",
"diff",
"(",
"candidate",
",",
"running",
",",
"*",
"models",
")",
":",
"if",
"isinstance",
"(",
"models",
",",
"tuple",
")",
"and",
"isinstance",
"(",
"models",
"[",
"0",
"]",
",",
"list",
")",
":",
"models",
"=",
"models",
"[",
"0",
"]",
... | Returns the difference between two configuration entities structured
according to the YANG model.
.. note::
This function is recommended to be used mostly as a state helper.
candidate
First model to compare.
running
Second model to compare.
models
A list of models... | [
"Returns",
"the",
"difference",
"between",
"two",
"configuration",
"entities",
"structured",
"according",
"to",
"the",
"YANG",
"model",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/napalm_yang_mod.py#L72-L129 | train |
saltstack/salt | salt/modules/napalm_yang_mod.py | parse | def parse(*models, **kwargs):
'''
Parse configuration from the device.
models
A list of models to be used when parsing.
config: ``False``
Parse config.
state: ``False``
Parse state.
profiles: ``None``
Use certain profiles to parse. If not specified, will use t... | python | def parse(*models, **kwargs):
'''
Parse configuration from the device.
models
A list of models to be used when parsing.
config: ``False``
Parse config.
state: ``False``
Parse state.
profiles: ``None``
Use certain profiles to parse. If not specified, will use t... | [
"def",
"parse",
"(",
"*",
"models",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"isinstance",
"(",
"models",
",",
"tuple",
")",
"and",
"isinstance",
"(",
"models",
"[",
"0",
"]",
",",
"list",
")",
":",
"models",
"=",
"models",
"[",
"0",
"]",
"config... | Parse configuration from the device.
models
A list of models to be used when parsing.
config: ``False``
Parse config.
state: ``False``
Parse state.
profiles: ``None``
Use certain profiles to parse. If not specified, will use the device
default profile(s).
... | [
"Parse",
"configuration",
"from",
"the",
"device",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/napalm_yang_mod.py#L133-L364 | train |
saltstack/salt | salt/modules/napalm_yang_mod.py | get_config | def get_config(data, *models, **kwargs):
'''
Return the native config.
data
Dictionary structured with respect to the models referenced.
models
A list of models to be used when generating the config.
profiles: ``None``
Use certain profiles to generate the config.
I... | python | def get_config(data, *models, **kwargs):
'''
Return the native config.
data
Dictionary structured with respect to the models referenced.
models
A list of models to be used when generating the config.
profiles: ``None``
Use certain profiles to generate the config.
I... | [
"def",
"get_config",
"(",
"data",
",",
"*",
"models",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"isinstance",
"(",
"models",
",",
"tuple",
")",
"and",
"isinstance",
"(",
"models",
"[",
"0",
"]",
",",
"list",
")",
":",
"models",
"=",
"models",
"[",
... | Return the native config.
data
Dictionary structured with respect to the models referenced.
models
A list of models to be used when generating the config.
profiles: ``None``
Use certain profiles to generate the config.
If not specified, will use the platform default profil... | [
"Return",
"the",
"native",
"config",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/napalm_yang_mod.py#L368-L416 | train |
saltstack/salt | salt/modules/napalm_yang_mod.py | load_config | def load_config(data, *models, **kwargs):
'''
Generate and load the config on the device using the OpenConfig or IETF
models and device profiles.
data
Dictionary structured with respect to the models referenced.
models
A list of models to be used when generating the config.
pr... | python | def load_config(data, *models, **kwargs):
'''
Generate and load the config on the device using the OpenConfig or IETF
models and device profiles.
data
Dictionary structured with respect to the models referenced.
models
A list of models to be used when generating the config.
pr... | [
"def",
"load_config",
"(",
"data",
",",
"*",
"models",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"isinstance",
"(",
"models",
",",
"tuple",
")",
"and",
"isinstance",
"(",
"models",
"[",
"0",
"]",
",",
"list",
")",
":",
"models",
"=",
"models",
"[",
... | Generate and load the config on the device using the OpenConfig or IETF
models and device profiles.
data
Dictionary structured with respect to the models referenced.
models
A list of models to be used when generating the config.
profiles: ``None``
Use certain profiles to gener... | [
"Generate",
"and",
"load",
"the",
"config",
"on",
"the",
"device",
"using",
"the",
"OpenConfig",
"or",
"IETF",
"models",
"and",
"device",
"profiles",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/napalm_yang_mod.py#L420-L567 | train |
saltstack/salt | salt/modules/napalm_yang_mod.py | compliance_report | def compliance_report(data, *models, **kwargs):
'''
Return the compliance report using YANG objects.
data
Dictionary structured with respect to the models referenced.
models
A list of models to be used when generating the config.
filepath
The absolute path to the validatio... | python | def compliance_report(data, *models, **kwargs):
'''
Return the compliance report using YANG objects.
data
Dictionary structured with respect to the models referenced.
models
A list of models to be used when generating the config.
filepath
The absolute path to the validatio... | [
"def",
"compliance_report",
"(",
"data",
",",
"*",
"models",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"isinstance",
"(",
"models",
",",
"tuple",
")",
"and",
"isinstance",
"(",
"models",
"[",
"0",
"]",
",",
"list",
")",
":",
"models",
"=",
"models",
... | Return the compliance report using YANG objects.
data
Dictionary structured with respect to the models referenced.
models
A list of models to be used when generating the config.
filepath
The absolute path to the validation file.
CLI Example:
.. code-block:: bash
... | [
"Return",
"the",
"compliance",
"report",
"using",
"YANG",
"objects",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/napalm_yang_mod.py#L571-L615 | train |
saltstack/salt | salt/states/cisconso.py | value_present | def value_present(name, datastore, path, config):
'''
Ensure a specific value exists at a given path
:param name: The name for this rule
:type name: ``str``
:param datastore: The datastore, e.g. running, operational.
One of the NETCONF store IETF types
:type datastore: :class:`Datast... | python | def value_present(name, datastore, path, config):
'''
Ensure a specific value exists at a given path
:param name: The name for this rule
:type name: ``str``
:param datastore: The datastore, e.g. running, operational.
One of the NETCONF store IETF types
:type datastore: :class:`Datast... | [
"def",
"value_present",
"(",
"name",
",",
"datastore",
",",
"path",
",",
"config",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",
"False",
",",
"'changes'",
":",
"{",
"}",
",",
"'comment'",
":",
"''",
"}",
"existing",
"=",
... | Ensure a specific value exists at a given path
:param name: The name for this rule
:type name: ``str``
:param datastore: The datastore, e.g. running, operational.
One of the NETCONF store IETF types
:type datastore: :class:`DatastoreType` (``str`` enum).
:param path: The device path to ... | [
"Ensure",
"a",
"specific",
"value",
"exists",
"at",
"a",
"given",
"path"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/cisconso.py#L22-L83 | train |
saltstack/salt | salt/states/rbac_solaris.py | managed | def managed(name, roles=None, profiles=None, authorizations=None):
'''
Manage RBAC properties for user
name : string
username
roles : list
list of roles for user
profiles : list
list of profiles for user
authorizations : list
list of authorizations for user
... | python | def managed(name, roles=None, profiles=None, authorizations=None):
'''
Manage RBAC properties for user
name : string
username
roles : list
list of roles for user
profiles : list
list of profiles for user
authorizations : list
list of authorizations for user
... | [
"def",
"managed",
"(",
"name",
",",
"roles",
"=",
"None",
",",
"profiles",
"=",
"None",
",",
"authorizations",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"True",
",",
"'comm... | Manage RBAC properties for user
name : string
username
roles : list
list of roles for user
profiles : list
list of profiles for user
authorizations : list
list of authorizations for user
.. warning::
All existing roles, profiles and authorizations will be re... | [
"Manage",
"RBAC",
"properties",
"for",
"user"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/rbac_solaris.py#L51-L184 | train |
saltstack/salt | salt/modules/match.py | pillar | def pillar(tgt, delimiter=DEFAULT_TARGET_DELIM):
'''
Return True if the minion matches the given pillar target. The
``delimiter`` argument can be used to specify a different delimiter.
CLI Example:
.. code-block:: bash
salt '*' match.pillar 'cheese:foo'
salt '*' match.pillar 'clon... | python | def pillar(tgt, delimiter=DEFAULT_TARGET_DELIM):
'''
Return True if the minion matches the given pillar target. The
``delimiter`` argument can be used to specify a different delimiter.
CLI Example:
.. code-block:: bash
salt '*' match.pillar 'cheese:foo'
salt '*' match.pillar 'clon... | [
"def",
"pillar",
"(",
"tgt",
",",
"delimiter",
"=",
"DEFAULT_TARGET_DELIM",
")",
":",
"matchers",
"=",
"salt",
".",
"loader",
".",
"matchers",
"(",
"__opts__",
")",
"try",
":",
"return",
"matchers",
"[",
"'pillar_match.match'",
"]",
"(",
"tgt",
",",
"delim... | Return True if the minion matches the given pillar target. The
``delimiter`` argument can be used to specify a different delimiter.
CLI Example:
.. code-block:: bash
salt '*' match.pillar 'cheese:foo'
salt '*' match.pillar 'clone_url|https://github.com/saltstack/salt.git' delimiter='|'
... | [
"Return",
"True",
"if",
"the",
"minion",
"matches",
"the",
"given",
"pillar",
"target",
".",
"The",
"delimiter",
"argument",
"can",
"be",
"used",
"to",
"specify",
"a",
"different",
"delimiter",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/match.py#L117-L145 | train |
saltstack/salt | salt/modules/match.py | data | def data(tgt):
'''
Return True if the minion matches the given data target
CLI Example:
.. code-block:: bash
salt '*' match.data 'spam:eggs'
'''
matchers = salt.loader.matchers(__opts__)
try:
return matchers['data_match.match'](tgt, opts=__opts__)
except Exception as e... | python | def data(tgt):
'''
Return True if the minion matches the given data target
CLI Example:
.. code-block:: bash
salt '*' match.data 'spam:eggs'
'''
matchers = salt.loader.matchers(__opts__)
try:
return matchers['data_match.match'](tgt, opts=__opts__)
except Exception as e... | [
"def",
"data",
"(",
"tgt",
")",
":",
"matchers",
"=",
"salt",
".",
"loader",
".",
"matchers",
"(",
"__opts__",
")",
"try",
":",
"return",
"matchers",
"[",
"'data_match.match'",
"]",
"(",
"tgt",
",",
"opts",
"=",
"__opts__",
")",
"except",
"Exception",
... | Return True if the minion matches the given data target
CLI Example:
.. code-block:: bash
salt '*' match.data 'spam:eggs' | [
"Return",
"True",
"if",
"the",
"minion",
"matches",
"the",
"given",
"data",
"target"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/match.py#L148-L163 | train |
saltstack/salt | salt/modules/match.py | pcre | def pcre(tgt, minion_id=None):
'''
Return True if the minion ID matches the given pcre target
minion_id
Specify the minion ID to match against the target expression
.. versionadded:: 2014.7.0
CLI Example:
.. code-block:: bash
salt '*' match.pcre '.*'
'''
if minio... | python | def pcre(tgt, minion_id=None):
'''
Return True if the minion ID matches the given pcre target
minion_id
Specify the minion ID to match against the target expression
.. versionadded:: 2014.7.0
CLI Example:
.. code-block:: bash
salt '*' match.pcre '.*'
'''
if minio... | [
"def",
"pcre",
"(",
"tgt",
",",
"minion_id",
"=",
"None",
")",
":",
"if",
"minion_id",
"is",
"not",
"None",
":",
"opts",
"=",
"copy",
".",
"copy",
"(",
"__opts__",
")",
"if",
"not",
"isinstance",
"(",
"minion_id",
",",
"six",
".",
"string_types",
")"... | Return True if the minion ID matches the given pcre target
minion_id
Specify the minion ID to match against the target expression
.. versionadded:: 2014.7.0
CLI Example:
.. code-block:: bash
salt '*' match.pcre '.*' | [
"Return",
"True",
"if",
"the",
"minion",
"ID",
"matches",
"the",
"given",
"pcre",
"target"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/match.py#L258-L285 | train |
saltstack/salt | salt/modules/match.py | filter_by | def filter_by(lookup,
tgt_type='compound',
minion_id=None,
merge=None,
merge_lists=False,
default='default'):
'''
Return the first match in a dictionary of target patterns
.. versionadded:: 2014.7.0
CLI Example:
.. code-block::... | python | def filter_by(lookup,
tgt_type='compound',
minion_id=None,
merge=None,
merge_lists=False,
default='default'):
'''
Return the first match in a dictionary of target patterns
.. versionadded:: 2014.7.0
CLI Example:
.. code-block::... | [
"def",
"filter_by",
"(",
"lookup",
",",
"tgt_type",
"=",
"'compound'",
",",
"minion_id",
"=",
"None",
",",
"merge",
"=",
"None",
",",
"merge_lists",
"=",
"False",
",",
"default",
"=",
"'default'",
")",
":",
"expr_funcs",
"=",
"dict",
"(",
"inspect",
".",... | Return the first match in a dictionary of target patterns
.. versionadded:: 2014.7.0
CLI Example:
.. code-block:: bash
salt '*' match.filter_by '{foo*: Foo!, bar*: Bar!}' minion_id=bar03
Pillar Example:
.. code-block:: jinja
# Filter the data for the current minion into a vari... | [
"Return",
"the",
"first",
"match",
"in",
"a",
"dictionary",
"of",
"target",
"patterns"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/match.py#L319-L367 | train |
saltstack/salt | salt/modules/match.py | search_by | def search_by(lookup, tgt_type='compound', minion_id=None):
'''
Search a dictionary of target strings for matching targets
This is the inverse of :py:func:`match.filter_by
<salt.modules.match.filter_by>` and allows matching values instead of
matching keys. A minion can be matched by multiple entrie... | python | def search_by(lookup, tgt_type='compound', minion_id=None):
'''
Search a dictionary of target strings for matching targets
This is the inverse of :py:func:`match.filter_by
<salt.modules.match.filter_by>` and allows matching values instead of
matching keys. A minion can be matched by multiple entrie... | [
"def",
"search_by",
"(",
"lookup",
",",
"tgt_type",
"=",
"'compound'",
",",
"minion_id",
"=",
"None",
")",
":",
"expr_funcs",
"=",
"dict",
"(",
"inspect",
".",
"getmembers",
"(",
"sys",
".",
"modules",
"[",
"__name__",
"]",
",",
"predicate",
"=",
"inspec... | Search a dictionary of target strings for matching targets
This is the inverse of :py:func:`match.filter_by
<salt.modules.match.filter_by>` and allows matching values instead of
matching keys. A minion can be matched by multiple entries.
.. versionadded:: 2017.7.0
CLI Example:
.. code-block:... | [
"Search",
"a",
"dictionary",
"of",
"target",
"strings",
"for",
"matching",
"targets"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/match.py#L370-L409 | train |
saltstack/salt | salt/modules/varnish.py | _run_varnishadm | def _run_varnishadm(cmd, params=(), **kwargs):
'''
Execute varnishadm command
return the output of the command
cmd
The command to run in varnishadm
params
Any additional args to add to the command line
kwargs
Additional options to pass to the salt cmd.run_all function
... | python | def _run_varnishadm(cmd, params=(), **kwargs):
'''
Execute varnishadm command
return the output of the command
cmd
The command to run in varnishadm
params
Any additional args to add to the command line
kwargs
Additional options to pass to the salt cmd.run_all function
... | [
"def",
"_run_varnishadm",
"(",
"cmd",
",",
"params",
"=",
"(",
")",
",",
"*",
"*",
"kwargs",
")",
":",
"cmd",
"=",
"[",
"'varnishadm'",
",",
"cmd",
"]",
"cmd",
".",
"extend",
"(",
"[",
"param",
"for",
"param",
"in",
"params",
"if",
"param",
"is",
... | Execute varnishadm command
return the output of the command
cmd
The command to run in varnishadm
params
Any additional args to add to the command line
kwargs
Additional options to pass to the salt cmd.run_all function | [
"Execute",
"varnishadm",
"command",
"return",
"the",
"output",
"of",
"the",
"command"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/varnish.py#L37-L54 | train |
saltstack/salt | salt/modules/varnish.py | version | def version():
'''
Return server version from varnishd -V
CLI Example:
.. code-block:: bash
salt '*' varnish.version
'''
cmd = ['varnishd', '-V']
out = __salt__['cmd.run'](cmd, python_shell=False)
ret = re.search(r'\(varnish-([^\)]+)\)', out).group(1)
return ret | python | def version():
'''
Return server version from varnishd -V
CLI Example:
.. code-block:: bash
salt '*' varnish.version
'''
cmd = ['varnishd', '-V']
out = __salt__['cmd.run'](cmd, python_shell=False)
ret = re.search(r'\(varnish-([^\)]+)\)', out).group(1)
return ret | [
"def",
"version",
"(",
")",
":",
"cmd",
"=",
"[",
"'varnishd'",
",",
"'-V'",
"]",
"out",
"=",
"__salt__",
"[",
"'cmd.run'",
"]",
"(",
"cmd",
",",
"python_shell",
"=",
"False",
")",
"ret",
"=",
"re",
".",
"search",
"(",
"r'\\(varnish-([^\\)]+)\\)'",
","... | Return server version from varnishd -V
CLI Example:
.. code-block:: bash
salt '*' varnish.version | [
"Return",
"server",
"version",
"from",
"varnishd",
"-",
"V"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/varnish.py#L57-L70 | train |
saltstack/salt | salt/modules/varnish.py | param_show | def param_show(param=None):
'''
Show params of varnish cache
CLI Example:
.. code-block:: bash
salt '*' varnish.param_show param
'''
ret = _run_varnishadm('param.show', [param])
if ret['retcode']:
return False
else:
result = {}
for line in ret['stdout']... | python | def param_show(param=None):
'''
Show params of varnish cache
CLI Example:
.. code-block:: bash
salt '*' varnish.param_show param
'''
ret = _run_varnishadm('param.show', [param])
if ret['retcode']:
return False
else:
result = {}
for line in ret['stdout']... | [
"def",
"param_show",
"(",
"param",
"=",
"None",
")",
":",
"ret",
"=",
"_run_varnishadm",
"(",
"'param.show'",
",",
"[",
"param",
"]",
")",
"if",
"ret",
"[",
"'retcode'",
"]",
":",
"return",
"False",
"else",
":",
"result",
"=",
"{",
"}",
"for",
"line"... | Show params of varnish cache
CLI Example:
.. code-block:: bash
salt '*' varnish.param_show param | [
"Show",
"params",
"of",
"varnish",
"cache"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/varnish.py#L129-L152 | train |
saltstack/salt | salt/proxy/panos.py | _strip_dirty | def _strip_dirty(xmltree):
'''
Removes dirtyID tags from the candidate config result. Palo Alto devices will make the candidate configuration with
a dirty ID after a change. This can cause unexpected results when parsing.
'''
dirty = xmltree.attrib.pop('dirtyId', None)
if dirty:
xmltree.... | python | def _strip_dirty(xmltree):
'''
Removes dirtyID tags from the candidate config result. Palo Alto devices will make the candidate configuration with
a dirty ID after a change. This can cause unexpected results when parsing.
'''
dirty = xmltree.attrib.pop('dirtyId', None)
if dirty:
xmltree.... | [
"def",
"_strip_dirty",
"(",
"xmltree",
")",
":",
"dirty",
"=",
"xmltree",
".",
"attrib",
".",
"pop",
"(",
"'dirtyId'",
",",
"None",
")",
"if",
"dirty",
":",
"xmltree",
".",
"attrib",
".",
"pop",
"(",
"'admin'",
",",
"None",
")",
"xmltree",
".",
"attr... | Removes dirtyID tags from the candidate config result. Palo Alto devices will make the candidate configuration with
a dirty ID after a change. This can cause unexpected results when parsing. | [
"Removes",
"dirtyID",
"tags",
"from",
"the",
"candidate",
"config",
"result",
".",
"Palo",
"Alto",
"devices",
"will",
"make",
"the",
"candidate",
"configuration",
"with",
"a",
"dirty",
"ID",
"after",
"a",
"change",
".",
"This",
"can",
"cause",
"unexpected",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/panos.py#L238-L251 | train |
saltstack/salt | salt/proxy/panos.py | init | def init(opts):
'''
This function gets called when the proxy starts up. For
panos devices, a determination is made on the connection type
and the appropriate connection details that must be cached.
'''
if 'host' not in opts['proxy']:
log.critical('No \'host\' key found in pillar for this... | python | def init(opts):
'''
This function gets called when the proxy starts up. For
panos devices, a determination is made on the connection type
and the appropriate connection details that must be cached.
'''
if 'host' not in opts['proxy']:
log.critical('No \'host\' key found in pillar for this... | [
"def",
"init",
"(",
"opts",
")",
":",
"if",
"'host'",
"not",
"in",
"opts",
"[",
"'proxy'",
"]",
":",
"log",
".",
"critical",
"(",
"'No \\'host\\' key found in pillar for this proxy.'",
")",
"return",
"False",
"if",
"'apikey'",
"not",
"in",
"opts",
"[",
"'pro... | This function gets called when the proxy starts up. For
panos devices, a determination is made on the connection type
and the appropriate connection details that must be cached. | [
"This",
"function",
"gets",
"called",
"when",
"the",
"proxy",
"starts",
"up",
".",
"For",
"panos",
"devices",
"a",
"determination",
"is",
"made",
"on",
"the",
"connection",
"type",
"and",
"the",
"appropriate",
"connection",
"details",
"that",
"must",
"be",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/panos.py#L254-L304 | train |
saltstack/salt | salt/proxy/panos.py | call | def call(payload=None):
'''
This function captures the query string and sends it to the Palo Alto device.
'''
r = None
try:
if DETAILS['method'] == 'dev_key':
# Pass the api key without the target declaration
conditional_payload = {'key': DETAILS['apikey']}
... | python | def call(payload=None):
'''
This function captures the query string and sends it to the Palo Alto device.
'''
r = None
try:
if DETAILS['method'] == 'dev_key':
# Pass the api key without the target declaration
conditional_payload = {'key': DETAILS['apikey']}
... | [
"def",
"call",
"(",
"payload",
"=",
"None",
")",
":",
"r",
"=",
"None",
"try",
":",
"if",
"DETAILS",
"[",
"'method'",
"]",
"==",
"'dev_key'",
":",
"# Pass the api key without the target declaration",
"conditional_payload",
"=",
"{",
"'key'",
":",
"DETAILS",
"[... | This function captures the query string and sends it to the Palo Alto device. | [
"This",
"function",
"captures",
"the",
"query",
"string",
"and",
"sends",
"it",
"to",
"the",
"Palo",
"Alto",
"device",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/panos.py#L307-L394 | train |
saltstack/salt | salt/proxy/panos.py | is_required_version | def is_required_version(required_version='0.0.0'):
'''
Because different versions of Palo Alto support different command sets, this function
will return true if the current version of Palo Alto supports the required command.
'''
if 'sw-version' in DETAILS['grains_cache']:
current_version = D... | python | def is_required_version(required_version='0.0.0'):
'''
Because different versions of Palo Alto support different command sets, this function
will return true if the current version of Palo Alto supports the required command.
'''
if 'sw-version' in DETAILS['grains_cache']:
current_version = D... | [
"def",
"is_required_version",
"(",
"required_version",
"=",
"'0.0.0'",
")",
":",
"if",
"'sw-version'",
"in",
"DETAILS",
"[",
"'grains_cache'",
"]",
":",
"current_version",
"=",
"DETAILS",
"[",
"'grains_cache'",
"]",
"[",
"'sw-version'",
"]",
"else",
":",
"# If w... | Because different versions of Palo Alto support different command sets, this function
will return true if the current version of Palo Alto supports the required command. | [
"Because",
"different",
"versions",
"of",
"Palo",
"Alto",
"support",
"different",
"command",
"sets",
"this",
"function",
"will",
"return",
"true",
"if",
"the",
"current",
"version",
"of",
"Palo",
"Alto",
"supports",
"the",
"required",
"command",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/panos.py#L397-L430 | train |
saltstack/salt | salt/proxy/panos.py | grains | def grains():
'''
Get the grains from the proxied device
'''
if not DETAILS.get('grains_cache', {}):
DETAILS['grains_cache'] = GRAINS_CACHE
try:
query = {'type': 'op', 'cmd': '<show><system><info></info></system></show>'}
DETAILS['grains_cache'] = call(query)['res... | python | def grains():
'''
Get the grains from the proxied device
'''
if not DETAILS.get('grains_cache', {}):
DETAILS['grains_cache'] = GRAINS_CACHE
try:
query = {'type': 'op', 'cmd': '<show><system><info></info></system></show>'}
DETAILS['grains_cache'] = call(query)['res... | [
"def",
"grains",
"(",
")",
":",
"if",
"not",
"DETAILS",
".",
"get",
"(",
"'grains_cache'",
",",
"{",
"}",
")",
":",
"DETAILS",
"[",
"'grains_cache'",
"]",
"=",
"GRAINS_CACHE",
"try",
":",
"query",
"=",
"{",
"'type'",
":",
"'op'",
",",
"'cmd'",
":",
... | Get the grains from the proxied device | [
"Get",
"the",
"grains",
"from",
"the",
"proxied",
"device"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/panos.py#L442-L453 | train |
saltstack/salt | salt/states/kmod.py | _append_comment | def _append_comment(ret, comment):
'''
append ``comment`` to ``ret['comment']``
'''
if ret['comment']:
ret['comment'] = ret['comment'].rstrip() + '\n' + comment
else:
ret['comment'] = comment
return ret | python | def _append_comment(ret, comment):
'''
append ``comment`` to ``ret['comment']``
'''
if ret['comment']:
ret['comment'] = ret['comment'].rstrip() + '\n' + comment
else:
ret['comment'] = comment
return ret | [
"def",
"_append_comment",
"(",
"ret",
",",
"comment",
")",
":",
"if",
"ret",
"[",
"'comment'",
"]",
":",
"ret",
"[",
"'comment'",
"]",
"=",
"ret",
"[",
"'comment'",
"]",
".",
"rstrip",
"(",
")",
"+",
"'\\n'",
"+",
"comment",
"else",
":",
"ret",
"["... | append ``comment`` to ``ret['comment']`` | [
"append",
"comment",
"to",
"ret",
"[",
"comment",
"]"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/kmod.py#L43-L52 | train |
saltstack/salt | salt/states/kmod.py | present | def present(name, persist=False, mods=None):
'''
Ensure that the specified kernel module is loaded
name
The name of the kernel module to verify is loaded
persist
Also add module to ``/etc/modules``
mods
A list of modules to verify are loaded. If this argument is used, the... | python | def present(name, persist=False, mods=None):
'''
Ensure that the specified kernel module is loaded
name
The name of the kernel module to verify is loaded
persist
Also add module to ``/etc/modules``
mods
A list of modules to verify are loaded. If this argument is used, the... | [
"def",
"present",
"(",
"name",
",",
"persist",
"=",
"False",
",",
"mods",
"=",
"None",
")",
":",
"if",
"not",
"isinstance",
"(",
"mods",
",",
"(",
"list",
",",
"tuple",
")",
")",
":",
"mods",
"=",
"[",
"name",
"]",
"ret",
"=",
"{",
"'name'",
":... | Ensure that the specified kernel module is loaded
name
The name of the kernel module to verify is loaded
persist
Also add module to ``/etc/modules``
mods
A list of modules to verify are loaded. If this argument is used, the
``name`` argument, although still required, is n... | [
"Ensure",
"that",
"the",
"specified",
"kernel",
"module",
"is",
"loaded"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/kmod.py#L55-L159 | train |
saltstack/salt | salt/states/kmod.py | absent | def absent(name, persist=False, comment=True, mods=None):
'''
Verify that the named kernel module is not loaded
name
The name of the kernel module to verify is not loaded
persist
Remove module from ``/etc/modules``
comment
Comment out module in ``/etc/modules`` rather than... | python | def absent(name, persist=False, comment=True, mods=None):
'''
Verify that the named kernel module is not loaded
name
The name of the kernel module to verify is not loaded
persist
Remove module from ``/etc/modules``
comment
Comment out module in ``/etc/modules`` rather than... | [
"def",
"absent",
"(",
"name",
",",
"persist",
"=",
"False",
",",
"comment",
"=",
"True",
",",
"mods",
"=",
"None",
")",
":",
"if",
"not",
"isinstance",
"(",
"mods",
",",
"(",
"list",
",",
"tuple",
")",
")",
":",
"mods",
"=",
"[",
"name",
"]",
"... | Verify that the named kernel module is not loaded
name
The name of the kernel module to verify is not loaded
persist
Remove module from ``/etc/modules``
comment
Comment out module in ``/etc/modules`` rather than remove it
mods
A list of modules to verify are unloaded.... | [
"Verify",
"that",
"the",
"named",
"kernel",
"module",
"is",
"not",
"loaded"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/kmod.py#L162-L245 | train |
saltstack/salt | salt/runners/lxc.py | _do | def _do(name, fun, path=None):
'''
Invoke a function in the lxc module with no args
path
path to the container parent
default: /var/lib/lxc (system default)
.. versionadded:: 2015.8.0
'''
host = find_guest(name, quiet=True, path=path)
if not host:
return False
... | python | def _do(name, fun, path=None):
'''
Invoke a function in the lxc module with no args
path
path to the container parent
default: /var/lib/lxc (system default)
.. versionadded:: 2015.8.0
'''
host = find_guest(name, quiet=True, path=path)
if not host:
return False
... | [
"def",
"_do",
"(",
"name",
",",
"fun",
",",
"path",
"=",
"None",
")",
":",
"host",
"=",
"find_guest",
"(",
"name",
",",
"quiet",
"=",
"True",
",",
"path",
"=",
"path",
")",
"if",
"not",
"host",
":",
"return",
"False",
"client",
"=",
"salt",
".",
... | Invoke a function in the lxc module with no args
path
path to the container parent
default: /var/lib/lxc (system default)
.. versionadded:: 2015.8.0 | [
"Invoke",
"a",
"function",
"in",
"the",
"lxc",
"module",
"with",
"no",
"args"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/lxc.py#L36-L61 | train |
saltstack/salt | salt/runners/lxc.py | _do_names | def _do_names(names, fun, path=None):
'''
Invoke a function in the lxc module with no args
path
path to the container parent
default: /var/lib/lxc (system default)
.. versionadded:: 2015.8.0
'''
ret = {}
hosts = find_guests(names, path=path)
if not hosts:
re... | python | def _do_names(names, fun, path=None):
'''
Invoke a function in the lxc module with no args
path
path to the container parent
default: /var/lib/lxc (system default)
.. versionadded:: 2015.8.0
'''
ret = {}
hosts = find_guests(names, path=path)
if not hosts:
re... | [
"def",
"_do_names",
"(",
"names",
",",
"fun",
",",
"path",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"}",
"hosts",
"=",
"find_guests",
"(",
"names",
",",
"path",
"=",
"path",
")",
"if",
"not",
"hosts",
":",
"return",
"False",
"client",
"=",
"salt",
... | Invoke a function in the lxc module with no args
path
path to the container parent
default: /var/lib/lxc (system default)
.. versionadded:: 2015.8.0 | [
"Invoke",
"a",
"function",
"in",
"the",
"lxc",
"module",
"with",
"no",
"args"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/lxc.py#L64-L94 | train |
saltstack/salt | salt/runners/lxc.py | find_guest | def find_guest(name, quiet=False, path=None):
'''
Returns the host for a container.
path
path to the container parent
default: /var/lib/lxc (system default)
.. versionadded:: 2015.8.0
.. code-block:: bash
salt-run lxc.find_guest name
'''
if quiet:
log... | python | def find_guest(name, quiet=False, path=None):
'''
Returns the host for a container.
path
path to the container parent
default: /var/lib/lxc (system default)
.. versionadded:: 2015.8.0
.. code-block:: bash
salt-run lxc.find_guest name
'''
if quiet:
log... | [
"def",
"find_guest",
"(",
"name",
",",
"quiet",
"=",
"False",
",",
"path",
"=",
"None",
")",
":",
"if",
"quiet",
":",
"log",
".",
"warning",
"(",
"\"'quiet' argument is being deprecated.\"",
"' Please migrate to --quiet'",
")",
"for",
"data",
"in",
"_list_iter",... | Returns the host for a container.
path
path to the container parent
default: /var/lib/lxc (system default)
.. versionadded:: 2015.8.0
.. code-block:: bash
salt-run lxc.find_guest name | [
"Returns",
"the",
"host",
"for",
"a",
"container",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/lxc.py#L97-L125 | train |
saltstack/salt | salt/runners/lxc.py | find_guests | def find_guests(names, path=None):
'''
Return a dict of hosts and named guests
path
path to the container parent
default: /var/lib/lxc (system default)
.. versionadded:: 2015.8.0
'''
ret = {}
names = names.split(',')
for data in _list_iter(path=path):
host,... | python | def find_guests(names, path=None):
'''
Return a dict of hosts and named guests
path
path to the container parent
default: /var/lib/lxc (system default)
.. versionadded:: 2015.8.0
'''
ret = {}
names = names.split(',')
for data in _list_iter(path=path):
host,... | [
"def",
"find_guests",
"(",
"names",
",",
"path",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"}",
"names",
"=",
"names",
".",
"split",
"(",
"','",
")",
"for",
"data",
"in",
"_list_iter",
"(",
"path",
"=",
"path",
")",
":",
"host",
",",
"stat",
"=",
... | Return a dict of hosts and named guests
path
path to the container parent
default: /var/lib/lxc (system default)
.. versionadded:: 2015.8.0 | [
"Return",
"a",
"dict",
"of",
"hosts",
"and",
"named",
"guests"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/lxc.py#L128-L150 | train |
saltstack/salt | salt/runners/lxc.py | init | def init(names, host=None, saltcloud_mode=False, quiet=False, **kwargs):
'''
Initialize a new container
.. code-block:: bash
salt-run lxc.init name host=minion_id [cpuset=cgroups_cpuset] \\
[cpushare=cgroups_cpushare] [memory=cgroups_memory] \\
[template=lxc_templa... | python | def init(names, host=None, saltcloud_mode=False, quiet=False, **kwargs):
'''
Initialize a new container
.. code-block:: bash
salt-run lxc.init name host=minion_id [cpuset=cgroups_cpuset] \\
[cpushare=cgroups_cpushare] [memory=cgroups_memory] \\
[template=lxc_templa... | [
"def",
"init",
"(",
"names",
",",
"host",
"=",
"None",
",",
"saltcloud_mode",
"=",
"False",
",",
"quiet",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"path",
"=",
"kwargs",
".",
"get",
"(",
"'path'",
",",
"None",
")",
"if",
"quiet",
":",
"lo... | Initialize a new container
.. code-block:: bash
salt-run lxc.init name host=minion_id [cpuset=cgroups_cpuset] \\
[cpushare=cgroups_cpushare] [memory=cgroups_memory] \\
[template=lxc_template_name] [clone=original name] \\
[profile=lxc_profile] [network_prof... | [
"Initialize",
"a",
"new",
"container"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/lxc.py#L153-L405 | train |
saltstack/salt | salt/runners/lxc.py | cloud_init | def cloud_init(names, host=None, quiet=False, **kwargs):
'''
Wrapper for using lxc.init in saltcloud compatibility mode
names
Name of the containers, supports a single name or a comma delimited
list of names.
host
Minion to start the container on. Required.
path
pa... | python | def cloud_init(names, host=None, quiet=False, **kwargs):
'''
Wrapper for using lxc.init in saltcloud compatibility mode
names
Name of the containers, supports a single name or a comma delimited
list of names.
host
Minion to start the container on. Required.
path
pa... | [
"def",
"cloud_init",
"(",
"names",
",",
"host",
"=",
"None",
",",
"quiet",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"quiet",
":",
"log",
".",
"warning",
"(",
"\"'quiet' argument is being deprecated. Please migrate to --quiet\"",
")",
"return",
"_... | Wrapper for using lxc.init in saltcloud compatibility mode
names
Name of the containers, supports a single name or a comma delimited
list of names.
host
Minion to start the container on. Required.
path
path to the container parent
default: /var/lib/lxc (system defa... | [
"Wrapper",
"for",
"using",
"lxc",
".",
"init",
"in",
"saltcloud",
"compatibility",
"mode"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/lxc.py#L408-L431 | train |
saltstack/salt | salt/runners/lxc.py | _list_iter | def _list_iter(host=None, path=None):
'''
Return a generator iterating over hosts
path
path to the container parent
default: /var/lib/lxc (system default)
.. versionadded:: 2015.8.0
'''
tgt = host or '*'
client = salt.client.get_local_client(__opts__['conf_file'])
f... | python | def _list_iter(host=None, path=None):
'''
Return a generator iterating over hosts
path
path to the container parent
default: /var/lib/lxc (system default)
.. versionadded:: 2015.8.0
'''
tgt = host or '*'
client = salt.client.get_local_client(__opts__['conf_file'])
f... | [
"def",
"_list_iter",
"(",
"host",
"=",
"None",
",",
"path",
"=",
"None",
")",
":",
"tgt",
"=",
"host",
"or",
"'*'",
"client",
"=",
"salt",
".",
"client",
".",
"get_local_client",
"(",
"__opts__",
"[",
"'conf_file'",
"]",
")",
"for",
"container_info",
"... | Return a generator iterating over hosts
path
path to the container parent
default: /var/lib/lxc (system default)
.. versionadded:: 2015.8.0 | [
"Return",
"a",
"generator",
"iterating",
"over",
"hosts"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/lxc.py#L434-L464 | train |
saltstack/salt | salt/runners/lxc.py | list_ | def list_(host=None, quiet=False, path=None):
'''
List defined containers (running, stopped, and frozen) for the named
(or all) host(s).
path
path to the container parent
default: /var/lib/lxc (system default)
.. versionadded:: 2015.8.0
.. code-block:: bash
salt-r... | python | def list_(host=None, quiet=False, path=None):
'''
List defined containers (running, stopped, and frozen) for the named
(or all) host(s).
path
path to the container parent
default: /var/lib/lxc (system default)
.. versionadded:: 2015.8.0
.. code-block:: bash
salt-r... | [
"def",
"list_",
"(",
"host",
"=",
"None",
",",
"quiet",
"=",
"False",
",",
"path",
"=",
"None",
")",
":",
"it",
"=",
"_list_iter",
"(",
"host",
",",
"path",
"=",
"path",
")",
"ret",
"=",
"{",
"}",
"for",
"chunk",
"in",
"it",
":",
"ret",
".",
... | List defined containers (running, stopped, and frozen) for the named
(or all) host(s).
path
path to the container parent
default: /var/lib/lxc (system default)
.. versionadded:: 2015.8.0
.. code-block:: bash
salt-run lxc.list [host=minion_id] | [
"List",
"defined",
"containers",
"(",
"running",
"stopped",
"and",
"frozen",
")",
"for",
"the",
"named",
"(",
"or",
"all",
")",
"host",
"(",
"s",
")",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/lxc.py#L467-L489 | train |
saltstack/salt | salt/runners/lxc.py | purge | def purge(name, delete_key=True, quiet=False, path=None):
'''
Purge the named container and delete its minion key if present.
WARNING: Destroys all data associated with the container.
path
path to the container parent
default: /var/lib/lxc (system default)
.. versionadded:: 201... | python | def purge(name, delete_key=True, quiet=False, path=None):
'''
Purge the named container and delete its minion key if present.
WARNING: Destroys all data associated with the container.
path
path to the container parent
default: /var/lib/lxc (system default)
.. versionadded:: 201... | [
"def",
"purge",
"(",
"name",
",",
"delete_key",
"=",
"True",
",",
"quiet",
"=",
"False",
",",
"path",
"=",
"None",
")",
":",
"data",
"=",
"_do_names",
"(",
"name",
",",
"'destroy'",
",",
"path",
"=",
"path",
")",
"if",
"data",
"is",
"False",
":",
... | Purge the named container and delete its minion key if present.
WARNING: Destroys all data associated with the container.
path
path to the container parent
default: /var/lib/lxc (system default)
.. versionadded:: 2015.8.0
.. code-block:: bash
salt-run lxc.purge name | [
"Purge",
"the",
"named",
"container",
"and",
"delete",
"its",
"minion",
"key",
"if",
"present",
".",
"WARNING",
":",
"Destroys",
"all",
"data",
"associated",
"with",
"the",
"container",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/lxc.py#L492-L521 | train |
saltstack/salt | salt/runners/lxc.py | start | def start(name, quiet=False, path=None):
'''
Start the named container.
path
path to the container parent
default: /var/lib/lxc (system default)
.. versionadded:: 2015.8.0
.. code-block:: bash
salt-run lxc.start name
'''
data = _do_names(name, 'start', path=pa... | python | def start(name, quiet=False, path=None):
'''
Start the named container.
path
path to the container parent
default: /var/lib/lxc (system default)
.. versionadded:: 2015.8.0
.. code-block:: bash
salt-run lxc.start name
'''
data = _do_names(name, 'start', path=pa... | [
"def",
"start",
"(",
"name",
",",
"quiet",
"=",
"False",
",",
"path",
"=",
"None",
")",
":",
"data",
"=",
"_do_names",
"(",
"name",
",",
"'start'",
",",
"path",
"=",
"path",
")",
"if",
"data",
"and",
"not",
"quiet",
":",
"__jid_event__",
".",
"fire... | Start the named container.
path
path to the container parent
default: /var/lib/lxc (system default)
.. versionadded:: 2015.8.0
.. code-block:: bash
salt-run lxc.start name | [
"Start",
"the",
"named",
"container",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/lxc.py#L524-L542 | train |
saltstack/salt | salt/modules/selinux.py | selinux_fs_path | def selinux_fs_path():
'''
Return the location of the SELinux VFS directory
CLI Example:
.. code-block:: bash
salt '*' selinux.selinux_fs_path
'''
# systems running systemd (e.g. Fedora 15 and newer)
# have the selinux filesystem in a different location
try:
for direct... | python | def selinux_fs_path():
'''
Return the location of the SELinux VFS directory
CLI Example:
.. code-block:: bash
salt '*' selinux.selinux_fs_path
'''
# systems running systemd (e.g. Fedora 15 and newer)
# have the selinux filesystem in a different location
try:
for direct... | [
"def",
"selinux_fs_path",
"(",
")",
":",
"# systems running systemd (e.g. Fedora 15 and newer)",
"# have the selinux filesystem in a different location",
"try",
":",
"for",
"directory",
"in",
"(",
"'/sys/fs/selinux'",
",",
"'/selinux'",
")",
":",
"if",
"os",
".",
"path",
... | Return the location of the SELinux VFS directory
CLI Example:
.. code-block:: bash
salt '*' selinux.selinux_fs_path | [
"Return",
"the",
"location",
"of",
"the",
"SELinux",
"VFS",
"directory"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/selinux.py#L62-L82 | train |
saltstack/salt | salt/modules/selinux.py | getenforce | def getenforce():
'''
Return the mode selinux is running in
CLI Example:
.. code-block:: bash
salt '*' selinux.getenforce
'''
_selinux_fs_path = selinux_fs_path()
if _selinux_fs_path is None:
return 'Disabled'
try:
enforce = os.path.join(_selinux_fs_path, 'enfo... | python | def getenforce():
'''
Return the mode selinux is running in
CLI Example:
.. code-block:: bash
salt '*' selinux.getenforce
'''
_selinux_fs_path = selinux_fs_path()
if _selinux_fs_path is None:
return 'Disabled'
try:
enforce = os.path.join(_selinux_fs_path, 'enfo... | [
"def",
"getenforce",
"(",
")",
":",
"_selinux_fs_path",
"=",
"selinux_fs_path",
"(",
")",
"if",
"_selinux_fs_path",
"is",
"None",
":",
"return",
"'Disabled'",
"try",
":",
"enforce",
"=",
"os",
".",
"path",
".",
"join",
"(",
"_selinux_fs_path",
",",
"'enforce... | Return the mode selinux is running in
CLI Example:
.. code-block:: bash
salt '*' selinux.getenforce | [
"Return",
"the",
"mode",
"selinux",
"is",
"running",
"in"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/selinux.py#L85-L106 | train |
saltstack/salt | salt/modules/selinux.py | getconfig | def getconfig():
'''
Return the selinux mode from the config file
CLI Example:
.. code-block:: bash
salt '*' selinux.getconfig
'''
try:
config = '/etc/selinux/config'
with salt.utils.files.fopen(config, 'r') as _fp:
for line in _fp:
line = s... | python | def getconfig():
'''
Return the selinux mode from the config file
CLI Example:
.. code-block:: bash
salt '*' selinux.getconfig
'''
try:
config = '/etc/selinux/config'
with salt.utils.files.fopen(config, 'r') as _fp:
for line in _fp:
line = s... | [
"def",
"getconfig",
"(",
")",
":",
"try",
":",
"config",
"=",
"'/etc/selinux/config'",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"fopen",
"(",
"config",
",",
"'r'",
")",
"as",
"_fp",
":",
"for",
"line",
"in",
"_fp",
":",
"line",
"=",
"salt",
... | Return the selinux mode from the config file
CLI Example:
.. code-block:: bash
salt '*' selinux.getconfig | [
"Return",
"the",
"selinux",
"mode",
"from",
"the",
"config",
"file"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/selinux.py#L109-L128 | train |
saltstack/salt | salt/modules/selinux.py | setenforce | def setenforce(mode):
'''
Set the SELinux enforcing mode
CLI Example:
.. code-block:: bash
salt '*' selinux.setenforce enforcing
'''
if isinstance(mode, six.string_types):
if mode.lower() == 'enforcing':
mode = '1'
modestring = 'Enforcing'
elif ... | python | def setenforce(mode):
'''
Set the SELinux enforcing mode
CLI Example:
.. code-block:: bash
salt '*' selinux.setenforce enforcing
'''
if isinstance(mode, six.string_types):
if mode.lower() == 'enforcing':
mode = '1'
modestring = 'Enforcing'
elif ... | [
"def",
"setenforce",
"(",
"mode",
")",
":",
"if",
"isinstance",
"(",
"mode",
",",
"six",
".",
"string_types",
")",
":",
"if",
"mode",
".",
"lower",
"(",
")",
"==",
"'enforcing'",
":",
"mode",
"=",
"'1'",
"modestring",
"=",
"'Enforcing'",
"elif",
"mode"... | Set the SELinux enforcing mode
CLI Example:
.. code-block:: bash
salt '*' selinux.setenforce enforcing | [
"Set",
"the",
"SELinux",
"enforcing",
"mode"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/selinux.py#L131-L186 | train |
saltstack/salt | salt/modules/selinux.py | setsebool | def setsebool(boolean, value, persist=False):
'''
Set the value for a boolean
CLI Example:
.. code-block:: bash
salt '*' selinux.setsebool virt_use_usb off
'''
if persist:
cmd = 'setsebool -P {0} {1}'.format(boolean, value)
else:
cmd = 'setsebool {0} {1}'.format(bo... | python | def setsebool(boolean, value, persist=False):
'''
Set the value for a boolean
CLI Example:
.. code-block:: bash
salt '*' selinux.setsebool virt_use_usb off
'''
if persist:
cmd = 'setsebool -P {0} {1}'.format(boolean, value)
else:
cmd = 'setsebool {0} {1}'.format(bo... | [
"def",
"setsebool",
"(",
"boolean",
",",
"value",
",",
"persist",
"=",
"False",
")",
":",
"if",
"persist",
":",
"cmd",
"=",
"'setsebool -P {0} {1}'",
".",
"format",
"(",
"boolean",
",",
"value",
")",
"else",
":",
"cmd",
"=",
"'setsebool {0} {1}'",
".",
"... | Set the value for a boolean
CLI Example:
.. code-block:: bash
salt '*' selinux.setsebool virt_use_usb off | [
"Set",
"the",
"value",
"for",
"a",
"boolean"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/selinux.py#L202-L216 | train |
saltstack/salt | salt/modules/selinux.py | setsebools | def setsebools(pairs, persist=False):
'''
Set the value of multiple booleans
CLI Example:
.. code-block:: bash
salt '*' selinux.setsebools '{virt_use_usb: on, squid_use_tproxy: off}'
'''
if not isinstance(pairs, dict):
return {}
if persist:
cmd = 'setsebool -P '
... | python | def setsebools(pairs, persist=False):
'''
Set the value of multiple booleans
CLI Example:
.. code-block:: bash
salt '*' selinux.setsebools '{virt_use_usb: on, squid_use_tproxy: off}'
'''
if not isinstance(pairs, dict):
return {}
if persist:
cmd = 'setsebool -P '
... | [
"def",
"setsebools",
"(",
"pairs",
",",
"persist",
"=",
"False",
")",
":",
"if",
"not",
"isinstance",
"(",
"pairs",
",",
"dict",
")",
":",
"return",
"{",
"}",
"if",
"persist",
":",
"cmd",
"=",
"'setsebool -P '",
"else",
":",
"cmd",
"=",
"'setsebool '",... | Set the value of multiple booleans
CLI Example:
.. code-block:: bash
salt '*' selinux.setsebools '{virt_use_usb: on, squid_use_tproxy: off}' | [
"Set",
"the",
"value",
"of",
"multiple",
"booleans"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/selinux.py#L219-L237 | train |
saltstack/salt | salt/modules/selinux.py | list_sebool | def list_sebool():
'''
Return a structure listing all of the selinux booleans on the system and
what state they are in
CLI Example:
.. code-block:: bash
salt '*' selinux.list_sebool
'''
bdata = __salt__['cmd.run']('semanage boolean -l').splitlines()
ret = {}
for line in bd... | python | def list_sebool():
'''
Return a structure listing all of the selinux booleans on the system and
what state they are in
CLI Example:
.. code-block:: bash
salt '*' selinux.list_sebool
'''
bdata = __salt__['cmd.run']('semanage boolean -l').splitlines()
ret = {}
for line in bd... | [
"def",
"list_sebool",
"(",
")",
":",
"bdata",
"=",
"__salt__",
"[",
"'cmd.run'",
"]",
"(",
"'semanage boolean -l'",
")",
".",
"splitlines",
"(",
")",
"ret",
"=",
"{",
"}",
"for",
"line",
"in",
"bdata",
"[",
"1",
":",
"]",
":",
"if",
"not",
"line",
... | Return a structure listing all of the selinux booleans on the system and
what state they are in
CLI Example:
.. code-block:: bash
salt '*' selinux.list_sebool | [
"Return",
"a",
"structure",
"listing",
"all",
"of",
"the",
"selinux",
"booleans",
"on",
"the",
"system",
"and",
"what",
"state",
"they",
"are",
"in"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/selinux.py#L240-L260 | train |
saltstack/salt | salt/modules/selinux.py | setsemod | def setsemod(module, state):
'''
Enable or disable an SELinux module.
CLI Example:
.. code-block:: bash
salt '*' selinux.setsemod nagios Enabled
.. versionadded:: 2016.3.0
'''
if state.lower() == 'enabled':
cmd = 'semodule -e {0}'.format(module)
elif state.lower() == ... | python | def setsemod(module, state):
'''
Enable or disable an SELinux module.
CLI Example:
.. code-block:: bash
salt '*' selinux.setsemod nagios Enabled
.. versionadded:: 2016.3.0
'''
if state.lower() == 'enabled':
cmd = 'semodule -e {0}'.format(module)
elif state.lower() == ... | [
"def",
"setsemod",
"(",
"module",
",",
"state",
")",
":",
"if",
"state",
".",
"lower",
"(",
")",
"==",
"'enabled'",
":",
"cmd",
"=",
"'semodule -e {0}'",
".",
"format",
"(",
"module",
")",
"elif",
"state",
".",
"lower",
"(",
")",
"==",
"'disabled'",
... | Enable or disable an SELinux module.
CLI Example:
.. code-block:: bash
salt '*' selinux.setsemod nagios Enabled
.. versionadded:: 2016.3.0 | [
"Enable",
"or",
"disable",
"an",
"SELinux",
"module",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/selinux.py#L278-L294 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.