repo stringlengths 7 55 | path stringlengths 4 223 | func_name stringlengths 1 134 | original_string stringlengths 75 104k | language stringclasses 1
value | code stringlengths 75 104k | code_tokens listlengths 19 28.4k | docstring stringlengths 1 46.9k | docstring_tokens listlengths 1 1.97k | sha stringlengths 40 40 | url stringlengths 87 315 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
saltstack/salt | salt/wheel/config.py | apply | def apply(key, value):
'''
Set a single key
.. note::
This will strip comments from your config file
'''
path = __opts__['conf_file']
if os.path.isdir(path):
path = os.path.join(path, 'master')
data = values()
data[key] = value
with salt.utils.files.fopen(path, 'w+'... | python | def apply(key, value):
'''
Set a single key
.. note::
This will strip comments from your config file
'''
path = __opts__['conf_file']
if os.path.isdir(path):
path = os.path.join(path, 'master')
data = values()
data[key] = value
with salt.utils.files.fopen(path, 'w+'... | [
"def",
"apply",
"(",
"key",
",",
"value",
")",
":",
"path",
"=",
"__opts__",
"[",
"'conf_file'",
"]",
"if",
"os",
".",
"path",
".",
"isdir",
"(",
"path",
")",
":",
"path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"path",
",",
"'master'",
")",
... | Set a single key
.. note::
This will strip comments from your config file | [
"Set",
"a",
"single",
"key"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/wheel/config.py#L30-L44 | train |
saltstack/salt | salt/wheel/config.py | update_config | def update_config(file_name, yaml_contents):
'''
Update master config with
``yaml_contents``.
Writes ``yaml_contents`` to a file named
``file_name.conf`` under the folder
specified by ``default_include``.
This folder is named ``master.d`` by
default. Please look at
:conf_master:`inc... | python | def update_config(file_name, yaml_contents):
'''
Update master config with
``yaml_contents``.
Writes ``yaml_contents`` to a file named
``file_name.conf`` under the folder
specified by ``default_include``.
This folder is named ``master.d`` by
default. Please look at
:conf_master:`inc... | [
"def",
"update_config",
"(",
"file_name",
",",
"yaml_contents",
")",
":",
"file_name",
"=",
"'{0}{1}'",
".",
"format",
"(",
"file_name",
",",
"'.conf'",
")",
"dir_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"__opts__",
"[",
"'config_dir'",
"]",
",",
... | Update master config with
``yaml_contents``.
Writes ``yaml_contents`` to a file named
``file_name.conf`` under the folder
specified by ``default_include``.
This folder is named ``master.d`` by
default. Please look at
:conf_master:`include-configuration`
for more information.
Exampl... | [
"Update",
"master",
"config",
"with",
"yaml_contents",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/wheel/config.py#L47-L90 | train |
saltstack/salt | salt/modules/aptpkg.py | _get_ppa_info_from_launchpad | def _get_ppa_info_from_launchpad(owner_name, ppa_name):
'''
Idea from softwareproperties.ppa.
Uses urllib2 which sacrifices server cert verification.
This is used as fall-back code or for secure PPAs
:param owner_name:
:param ppa_name:
:return:
'''
lp_url = 'https://launchpad.net/... | python | def _get_ppa_info_from_launchpad(owner_name, ppa_name):
'''
Idea from softwareproperties.ppa.
Uses urllib2 which sacrifices server cert verification.
This is used as fall-back code or for secure PPAs
:param owner_name:
:param ppa_name:
:return:
'''
lp_url = 'https://launchpad.net/... | [
"def",
"_get_ppa_info_from_launchpad",
"(",
"owner_name",
",",
"ppa_name",
")",
":",
"lp_url",
"=",
"'https://launchpad.net/api/1.0/~{0}/+archive/{1}'",
".",
"format",
"(",
"owner_name",
",",
"ppa_name",
")",
"request",
"=",
"_Request",
"(",
"lp_url",
",",
"headers",
... | Idea from softwareproperties.ppa.
Uses urllib2 which sacrifices server cert verification.
This is used as fall-back code or for secure PPAs
:param owner_name:
:param ppa_name:
:return: | [
"Idea",
"from",
"softwareproperties",
".",
"ppa",
".",
"Uses",
"urllib2",
"which",
"sacrifices",
"server",
"cert",
"verification",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptpkg.py#L125-L141 | train |
saltstack/salt | salt/modules/aptpkg.py | _call_apt | def _call_apt(args, scope=True, **kwargs):
'''
Call apt* utilities.
'''
cmd = []
if scope and salt.utils.systemd.has_scope(__context__) and __salt__['config.get']('systemd.scope', True):
cmd.extend(['systemd-run', '--scope'])
cmd.extend(args)
params = {'output_loglevel': 'trace',
... | python | def _call_apt(args, scope=True, **kwargs):
'''
Call apt* utilities.
'''
cmd = []
if scope and salt.utils.systemd.has_scope(__context__) and __salt__['config.get']('systemd.scope', True):
cmd.extend(['systemd-run', '--scope'])
cmd.extend(args)
params = {'output_loglevel': 'trace',
... | [
"def",
"_call_apt",
"(",
"args",
",",
"scope",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"cmd",
"=",
"[",
"]",
"if",
"scope",
"and",
"salt",
".",
"utils",
".",
"systemd",
".",
"has_scope",
"(",
"__context__",
")",
"and",
"__salt__",
"[",
"'co... | Call apt* utilities. | [
"Call",
"apt",
"*",
"utilities",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptpkg.py#L161-L175 | train |
saltstack/salt | salt/modules/aptpkg.py | refresh_db | def refresh_db(cache_valid_time=0, failhard=False, **kwargs):
'''
Updates the APT database to latest packages based upon repositories
Returns a dict, with the keys being package databases and the values being
the result of the update attempt. Values can be one of the following:
- ``True``: Databas... | python | def refresh_db(cache_valid_time=0, failhard=False, **kwargs):
'''
Updates the APT database to latest packages based upon repositories
Returns a dict, with the keys being package databases and the values being
the result of the update attempt. Values can be one of the following:
- ``True``: Databas... | [
"def",
"refresh_db",
"(",
"cache_valid_time",
"=",
"0",
",",
"failhard",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"# Remove rtag file to keep multiple refreshes from happening in pkg states",
"salt",
".",
"utils",
".",
"pkg",
".",
"clear_rtag",
"(",
"__opts_... | Updates the APT database to latest packages based upon repositories
Returns a dict, with the keys being package databases and the values being
the result of the update attempt. Values can be one of the following:
- ``True``: Database updated successfully
- ``False``: Problem updating database
- ``... | [
"Updates",
"the",
"APT",
"database",
"to",
"latest",
"packages",
"based",
"upon",
"repositories"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptpkg.py#L297-L376 | train |
saltstack/salt | salt/modules/aptpkg.py | install | def install(name=None,
refresh=False,
fromrepo=None,
skip_verify=False,
debconf=None,
pkgs=None,
sources=None,
reinstall=False,
ignore_epoch=False,
**kwargs):
'''
.. versionchanged:: 2015.8.12,2016.3.3,20... | python | def install(name=None,
refresh=False,
fromrepo=None,
skip_verify=False,
debconf=None,
pkgs=None,
sources=None,
reinstall=False,
ignore_epoch=False,
**kwargs):
'''
.. versionchanged:: 2015.8.12,2016.3.3,20... | [
"def",
"install",
"(",
"name",
"=",
"None",
",",
"refresh",
"=",
"False",
",",
"fromrepo",
"=",
"None",
",",
"skip_verify",
"=",
"False",
",",
"debconf",
"=",
"None",
",",
"pkgs",
"=",
"None",
",",
"sources",
"=",
"None",
",",
"reinstall",
"=",
"Fals... | .. versionchanged:: 2015.8.12,2016.3.3,2016.11.0
On minions running systemd>=205, `systemd-run(1)`_ is now used to
isolate commands which modify installed packages from the
``salt-minion`` daemon's control group. This is done to keep systemd
from killing any apt-get/dpkg commands spawned... | [
"..",
"versionchanged",
"::",
"2015",
".",
"8",
".",
"12",
"2016",
".",
"3",
".",
"3",
"2016",
".",
"11",
".",
"0",
"On",
"minions",
"running",
"systemd",
">",
"=",
"205",
"systemd",
"-",
"run",
"(",
"1",
")",
"_",
"is",
"now",
"used",
"to",
"i... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptpkg.py#L379-L785 | train |
saltstack/salt | salt/modules/aptpkg.py | _uninstall | def _uninstall(action='remove', name=None, pkgs=None, **kwargs):
'''
remove and purge do identical things but with different apt-get commands,
this function performs the common logic.
'''
try:
pkg_params = __salt__['pkg_resource.parse_targets'](name, pkgs)[0]
except MinionError as exc:
... | python | def _uninstall(action='remove', name=None, pkgs=None, **kwargs):
'''
remove and purge do identical things but with different apt-get commands,
this function performs the common logic.
'''
try:
pkg_params = __salt__['pkg_resource.parse_targets'](name, pkgs)[0]
except MinionError as exc:
... | [
"def",
"_uninstall",
"(",
"action",
"=",
"'remove'",
",",
"name",
"=",
"None",
",",
"pkgs",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"pkg_params",
"=",
"__salt__",
"[",
"'pkg_resource.parse_targets'",
"]",
"(",
"name",
",",
"pkgs",
"... | remove and purge do identical things but with different apt-get commands,
this function performs the common logic. | [
"remove",
"and",
"purge",
"do",
"identical",
"things",
"but",
"with",
"different",
"apt",
"-",
"get",
"commands",
"this",
"function",
"performs",
"the",
"common",
"logic",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptpkg.py#L788-L834 | train |
saltstack/salt | salt/modules/aptpkg.py | autoremove | def autoremove(list_only=False, purge=False):
'''
.. versionadded:: 2015.5.0
Remove packages not required by another package using ``apt-get
autoremove``.
list_only : False
Only retrieve the list of packages to be auto-removed, do not actually
perform the auto-removal.
purge :... | python | def autoremove(list_only=False, purge=False):
'''
.. versionadded:: 2015.5.0
Remove packages not required by another package using ``apt-get
autoremove``.
list_only : False
Only retrieve the list of packages to be auto-removed, do not actually
perform the auto-removal.
purge :... | [
"def",
"autoremove",
"(",
"list_only",
"=",
"False",
",",
"purge",
"=",
"False",
")",
":",
"cmd",
"=",
"[",
"]",
"if",
"list_only",
":",
"ret",
"=",
"[",
"]",
"cmd",
".",
"extend",
"(",
"[",
"'apt-get'",
",",
"'--assume-no'",
"]",
")",
"if",
"purge... | .. versionadded:: 2015.5.0
Remove packages not required by another package using ``apt-get
autoremove``.
list_only : False
Only retrieve the list of packages to be auto-removed, do not actually
perform the auto-removal.
purge : False
Also remove package config data when autore... | [
"..",
"versionadded",
"::",
"2015",
".",
"5",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptpkg.py#L837-L889 | train |
saltstack/salt | salt/modules/aptpkg.py | remove | def remove(name=None, pkgs=None, **kwargs):
'''
.. versionchanged:: 2015.8.12,2016.3.3,2016.11.0
On minions running systemd>=205, `systemd-run(1)`_ is now used to
isolate commands which modify installed packages from the
``salt-minion`` daemon's control group. This is done to keep system... | python | def remove(name=None, pkgs=None, **kwargs):
'''
.. versionchanged:: 2015.8.12,2016.3.3,2016.11.0
On minions running systemd>=205, `systemd-run(1)`_ is now used to
isolate commands which modify installed packages from the
``salt-minion`` daemon's control group. This is done to keep system... | [
"def",
"remove",
"(",
"name",
"=",
"None",
",",
"pkgs",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_uninstall",
"(",
"action",
"=",
"'remove'",
",",
"name",
"=",
"name",
",",
"pkgs",
"=",
"pkgs",
",",
"*",
"*",
"kwargs",
")"
] | .. versionchanged:: 2015.8.12,2016.3.3,2016.11.0
On minions running systemd>=205, `systemd-run(1)`_ is now used to
isolate commands which modify installed packages from the
``salt-minion`` daemon's control group. This is done to keep systemd
from killing any apt-get/dpkg commands spawned... | [
"..",
"versionchanged",
"::",
"2015",
".",
"8",
".",
"12",
"2016",
".",
"3",
".",
"3",
"2016",
".",
"11",
".",
"0",
"On",
"minions",
"running",
"systemd",
">",
"=",
"205",
"systemd",
"-",
"run",
"(",
"1",
")",
"_",
"is",
"now",
"used",
"to",
"i... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptpkg.py#L892-L933 | train |
saltstack/salt | salt/modules/aptpkg.py | purge | def purge(name=None, pkgs=None, **kwargs):
'''
.. versionchanged:: 2015.8.12,2016.3.3,2016.11.0
On minions running systemd>=205, `systemd-run(1)`_ is now used to
isolate commands which modify installed packages from the
``salt-minion`` daemon's control group. This is done to keep systemd... | python | def purge(name=None, pkgs=None, **kwargs):
'''
.. versionchanged:: 2015.8.12,2016.3.3,2016.11.0
On minions running systemd>=205, `systemd-run(1)`_ is now used to
isolate commands which modify installed packages from the
``salt-minion`` daemon's control group. This is done to keep systemd... | [
"def",
"purge",
"(",
"name",
"=",
"None",
",",
"pkgs",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_uninstall",
"(",
"action",
"=",
"'purge'",
",",
"name",
"=",
"name",
",",
"pkgs",
"=",
"pkgs",
",",
"*",
"*",
"kwargs",
")"
] | .. versionchanged:: 2015.8.12,2016.3.3,2016.11.0
On minions running systemd>=205, `systemd-run(1)`_ is now used to
isolate commands which modify installed packages from the
``salt-minion`` daemon's control group. This is done to keep systemd
from killing any apt-get/dpkg commands spawned... | [
"..",
"versionchanged",
"::",
"2015",
".",
"8",
".",
"12",
"2016",
".",
"3",
".",
"3",
"2016",
".",
"11",
".",
"0",
"On",
"minions",
"running",
"systemd",
">",
"=",
"205",
"systemd",
"-",
"run",
"(",
"1",
")",
"_",
"is",
"now",
"used",
"to",
"i... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptpkg.py#L936-L977 | train |
saltstack/salt | salt/modules/aptpkg.py | upgrade | def upgrade(refresh=True, dist_upgrade=False, **kwargs):
'''
.. versionchanged:: 2015.8.12,2016.3.3,2016.11.0
On minions running systemd>=205, `systemd-run(1)`_ is now used to
isolate commands which modify installed packages from the
``salt-minion`` daemon's control group. This is done t... | python | def upgrade(refresh=True, dist_upgrade=False, **kwargs):
'''
.. versionchanged:: 2015.8.12,2016.3.3,2016.11.0
On minions running systemd>=205, `systemd-run(1)`_ is now used to
isolate commands which modify installed packages from the
``salt-minion`` daemon's control group. This is done t... | [
"def",
"upgrade",
"(",
"refresh",
"=",
"True",
",",
"dist_upgrade",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"cache_valid_time",
"=",
"kwargs",
".",
"pop",
"(",
"'cache_valid_time'",
",",
"0",
")",
"if",
"salt",
".",
"utils",
".",
"data",
".",
... | .. versionchanged:: 2015.8.12,2016.3.3,2016.11.0
On minions running systemd>=205, `systemd-run(1)`_ is now used to
isolate commands which modify installed packages from the
``salt-minion`` daemon's control group. This is done to keep systemd
from killing any apt-get/dpkg commands spawned... | [
"..",
"versionchanged",
"::",
"2015",
".",
"8",
".",
"12",
"2016",
".",
"3",
".",
"3",
"2016",
".",
"11",
".",
"0",
"On",
"minions",
"running",
"systemd",
">",
"=",
"205",
"systemd",
"-",
"run",
"(",
"1",
")",
"_",
"is",
"now",
"used",
"to",
"i... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptpkg.py#L980-L1066 | train |
saltstack/salt | salt/modules/aptpkg.py | hold | def hold(name=None, pkgs=None, sources=None, **kwargs): # pylint: disable=W0613
'''
.. versionadded:: 2014.7.0
Set package in 'hold' state, meaning it will not be upgraded.
name
The name of the package, e.g., 'tmux'
CLI Example:
.. code-block:: bash
salt '*' pkg... | python | def hold(name=None, pkgs=None, sources=None, **kwargs): # pylint: disable=W0613
'''
.. versionadded:: 2014.7.0
Set package in 'hold' state, meaning it will not be upgraded.
name
The name of the package, e.g., 'tmux'
CLI Example:
.. code-block:: bash
salt '*' pkg... | [
"def",
"hold",
"(",
"name",
"=",
"None",
",",
"pkgs",
"=",
"None",
",",
"sources",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"# pylint: disable=W0613",
"if",
"not",
"name",
"and",
"not",
"pkgs",
"and",
"not",
"sources",
":",
"raise",
"SaltInvocat... | .. versionadded:: 2014.7.0
Set package in 'hold' state, meaning it will not be upgraded.
name
The name of the package, e.g., 'tmux'
CLI Example:
.. code-block:: bash
salt '*' pkg.hold <package name>
pkgs
A list of packages to hold. Must be passed as a python... | [
"..",
"versionadded",
"::",
"2014",
".",
"7",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptpkg.py#L1069-L1139 | train |
saltstack/salt | salt/modules/aptpkg.py | list_pkgs | def list_pkgs(versions_as_list=False,
removed=False,
purge_desired=False,
**kwargs): # pylint: disable=W0613
'''
List the packages currently installed in a dict::
{'<package_name>': '<version>'}
removed
If ``True``, then only packages which have b... | python | def list_pkgs(versions_as_list=False,
removed=False,
purge_desired=False,
**kwargs): # pylint: disable=W0613
'''
List the packages currently installed in a dict::
{'<package_name>': '<version>'}
removed
If ``True``, then only packages which have b... | [
"def",
"list_pkgs",
"(",
"versions_as_list",
"=",
"False",
",",
"removed",
"=",
"False",
",",
"purge_desired",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"# pylint: disable=W0613",
"versions_as_list",
"=",
"salt",
".",
"utils",
".",
"data",
".",
"is_tr... | List the packages currently installed in a dict::
{'<package_name>': '<version>'}
removed
If ``True``, then only packages which have been removed (but not
purged) will be returned.
purge_desired
If ``True``, then only packages which have been marked to be purged,
but c... | [
"List",
"the",
"packages",
"currently",
"installed",
"in",
"a",
"dict",
"::"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptpkg.py#L1216-L1313 | train |
saltstack/salt | salt/modules/aptpkg.py | _get_upgradable | def _get_upgradable(dist_upgrade=True, **kwargs):
'''
Utility function to get upgradable packages
Sample return data:
{ 'pkgname': '1.2.3-45', ... }
'''
cmd = ['apt-get', '--just-print']
if dist_upgrade:
cmd.append('dist-upgrade')
else:
cmd.append('upgrade')
try:
... | python | def _get_upgradable(dist_upgrade=True, **kwargs):
'''
Utility function to get upgradable packages
Sample return data:
{ 'pkgname': '1.2.3-45', ... }
'''
cmd = ['apt-get', '--just-print']
if dist_upgrade:
cmd.append('dist-upgrade')
else:
cmd.append('upgrade')
try:
... | [
"def",
"_get_upgradable",
"(",
"dist_upgrade",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"cmd",
"=",
"[",
"'apt-get'",
",",
"'--just-print'",
"]",
"if",
"dist_upgrade",
":",
"cmd",
".",
"append",
"(",
"'dist-upgrade'",
")",
"else",
":",
"cmd",
".",... | Utility function to get upgradable packages
Sample return data:
{ 'pkgname': '1.2.3-45', ... } | [
"Utility",
"function",
"to",
"get",
"upgradable",
"packages"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptpkg.py#L1316-L1361 | train |
saltstack/salt | salt/modules/aptpkg.py | list_upgrades | def list_upgrades(refresh=True, dist_upgrade=True, **kwargs):
'''
List all available package upgrades.
refresh
Whether to refresh the package database before listing upgrades.
Default: True.
cache_valid_time
.. versionadded:: 2016.11.0
Skip refreshing the package data... | python | def list_upgrades(refresh=True, dist_upgrade=True, **kwargs):
'''
List all available package upgrades.
refresh
Whether to refresh the package database before listing upgrades.
Default: True.
cache_valid_time
.. versionadded:: 2016.11.0
Skip refreshing the package data... | [
"def",
"list_upgrades",
"(",
"refresh",
"=",
"True",
",",
"dist_upgrade",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"cache_valid_time",
"=",
"kwargs",
".",
"pop",
"(",
"'cache_valid_time'",
",",
"0",
")",
"if",
"salt",
".",
"utils",
".",
"data",
... | List all available package upgrades.
refresh
Whether to refresh the package database before listing upgrades.
Default: True.
cache_valid_time
.. versionadded:: 2016.11.0
Skip refreshing the package database if refresh has already occurred within
<value> seconds
d... | [
"List",
"all",
"available",
"package",
"upgrades",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptpkg.py#L1364-L1392 | train |
saltstack/salt | salt/modules/aptpkg.py | version_cmp | def version_cmp(pkg1, pkg2, ignore_epoch=False, **kwargs):
'''
Do a cmp-style comparison on two packages. Return -1 if pkg1 < pkg2, 0 if
pkg1 == pkg2, and 1 if pkg1 > pkg2. Return None if there was a problem
making the comparison.
ignore_epoch : False
Set to ``True`` to ignore the epoch whe... | python | def version_cmp(pkg1, pkg2, ignore_epoch=False, **kwargs):
'''
Do a cmp-style comparison on two packages. Return -1 if pkg1 < pkg2, 0 if
pkg1 == pkg2, and 1 if pkg1 > pkg2. Return None if there was a problem
making the comparison.
ignore_epoch : False
Set to ``True`` to ignore the epoch whe... | [
"def",
"version_cmp",
"(",
"pkg1",
",",
"pkg2",
",",
"ignore_epoch",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"normalize",
"=",
"lambda",
"x",
":",
"six",
".",
"text_type",
"(",
"x",
")",
".",
"split",
"(",
"':'",
",",
"1",
")",
"[",
"-",... | Do a cmp-style comparison on two packages. Return -1 if pkg1 < pkg2, 0 if
pkg1 == pkg2, and 1 if pkg1 > pkg2. Return None if there was a problem
making the comparison.
ignore_epoch : False
Set to ``True`` to ignore the epoch when comparing versions
.. versionadded:: 2015.8.10,2016.3.2
... | [
"Do",
"a",
"cmp",
"-",
"style",
"comparison",
"on",
"two",
"packages",
".",
"Return",
"-",
"1",
"if",
"pkg1",
"<",
"pkg2",
"0",
"if",
"pkg1",
"==",
"pkg2",
"and",
"1",
"if",
"pkg1",
">",
"pkg2",
".",
"Return",
"None",
"if",
"there",
"was",
"a",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptpkg.py#L1408-L1461 | train |
saltstack/salt | salt/modules/aptpkg.py | _split_repo_str | def _split_repo_str(repo):
'''
Return APT source entry as a tuple.
'''
split = sourceslist.SourceEntry(repo)
return split.type, split.architectures, split.uri, split.dist, split.comps | python | def _split_repo_str(repo):
'''
Return APT source entry as a tuple.
'''
split = sourceslist.SourceEntry(repo)
return split.type, split.architectures, split.uri, split.dist, split.comps | [
"def",
"_split_repo_str",
"(",
"repo",
")",
":",
"split",
"=",
"sourceslist",
".",
"SourceEntry",
"(",
"repo",
")",
"return",
"split",
".",
"type",
",",
"split",
".",
"architectures",
",",
"split",
".",
"uri",
",",
"split",
".",
"dist",
",",
"split",
"... | Return APT source entry as a tuple. | [
"Return",
"APT",
"source",
"entry",
"as",
"a",
"tuple",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptpkg.py#L1464-L1469 | train |
saltstack/salt | salt/modules/aptpkg.py | _consolidate_repo_sources | def _consolidate_repo_sources(sources):
'''
Consolidate APT sources.
'''
if not isinstance(sources, sourceslist.SourcesList):
raise TypeError(
'\'{0}\' not a \'{1}\''.format(
type(sources),
sourceslist.SourcesList
)
)
consolida... | python | def _consolidate_repo_sources(sources):
'''
Consolidate APT sources.
'''
if not isinstance(sources, sourceslist.SourcesList):
raise TypeError(
'\'{0}\' not a \'{1}\''.format(
type(sources),
sourceslist.SourcesList
)
)
consolida... | [
"def",
"_consolidate_repo_sources",
"(",
"sources",
")",
":",
"if",
"not",
"isinstance",
"(",
"sources",
",",
"sourceslist",
".",
"SourcesList",
")",
":",
"raise",
"TypeError",
"(",
"'\\'{0}\\' not a \\'{1}\\''",
".",
"format",
"(",
"type",
"(",
"sources",
")",
... | Consolidate APT sources. | [
"Consolidate",
"APT",
"sources",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptpkg.py#L1472-L1513 | train |
saltstack/salt | salt/modules/aptpkg.py | list_repo_pkgs | def list_repo_pkgs(*args, **kwargs): # pylint: disable=unused-import
'''
.. versionadded:: 2017.7.0
Returns all available packages. Optionally, package names (and name globs)
can be passed and the results will be filtered to packages matching those
names.
This function can be helpful in disco... | python | def list_repo_pkgs(*args, **kwargs): # pylint: disable=unused-import
'''
.. versionadded:: 2017.7.0
Returns all available packages. Optionally, package names (and name globs)
can be passed and the results will be filtered to packages matching those
names.
This function can be helpful in disco... | [
"def",
"list_repo_pkgs",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# pylint: disable=unused-import",
"if",
"args",
":",
"# Get only information about packages in args",
"cmd",
"=",
"[",
"'apt-cache'",
",",
"'show'",
"]",
"+",
"[",
"arg",
"for",
"arg"... | .. versionadded:: 2017.7.0
Returns all available packages. Optionally, package names (and name globs)
can be passed and the results will be filtered to packages matching those
names.
This function can be helpful in discovering the version or repo to specify
in a :mod:`pkg.installed <salt.states.pk... | [
"..",
"versionadded",
"::",
"2017",
".",
"7",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptpkg.py#L1516-L1574 | train |
saltstack/salt | salt/modules/aptpkg.py | _skip_source | def _skip_source(source):
'''
Decide to skip source or not.
:param source:
:return:
'''
if source.invalid:
if source.uri and source.type and source.type in ("deb", "deb-src", "rpm", "rpm-src"):
pieces = source.mysplit(source.line)
if pieces[1].strip()[0] == "[":
... | python | def _skip_source(source):
'''
Decide to skip source or not.
:param source:
:return:
'''
if source.invalid:
if source.uri and source.type and source.type in ("deb", "deb-src", "rpm", "rpm-src"):
pieces = source.mysplit(source.line)
if pieces[1].strip()[0] == "[":
... | [
"def",
"_skip_source",
"(",
"source",
")",
":",
"if",
"source",
".",
"invalid",
":",
"if",
"source",
".",
"uri",
"and",
"source",
".",
"type",
"and",
"source",
".",
"type",
"in",
"(",
"\"deb\"",
",",
"\"deb-src\"",
",",
"\"rpm\"",
",",
"\"rpm-src\"",
"... | Decide to skip source or not.
:param source:
:return: | [
"Decide",
"to",
"skip",
"source",
"or",
"not",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptpkg.py#L1577-L1595 | train |
saltstack/salt | salt/modules/aptpkg.py | list_repos | def list_repos(**kwargs):
'''
Lists all repos in the sources.list (and sources.lists.d) files
CLI Example:
.. code-block:: bash
salt '*' pkg.list_repos
salt '*' pkg.list_repos disabled=True
'''
_check_apt()
repos = {}
sources = sourceslist.SourcesList()
for source in... | python | def list_repos(**kwargs):
'''
Lists all repos in the sources.list (and sources.lists.d) files
CLI Example:
.. code-block:: bash
salt '*' pkg.list_repos
salt '*' pkg.list_repos disabled=True
'''
_check_apt()
repos = {}
sources = sourceslist.SourcesList()
for source in... | [
"def",
"list_repos",
"(",
"*",
"*",
"kwargs",
")",
":",
"_check_apt",
"(",
")",
"repos",
"=",
"{",
"}",
"sources",
"=",
"sourceslist",
".",
"SourcesList",
"(",
")",
"for",
"source",
"in",
"sources",
".",
"list",
":",
"if",
"_skip_source",
"(",
"source"... | Lists all repos in the sources.list (and sources.lists.d) files
CLI Example:
.. code-block:: bash
salt '*' pkg.list_repos
salt '*' pkg.list_repos disabled=True | [
"Lists",
"all",
"repos",
"in",
"the",
"sources",
".",
"list",
"(",
"and",
"sources",
".",
"lists",
".",
"d",
")",
"files"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptpkg.py#L1598-L1626 | train |
saltstack/salt | salt/modules/aptpkg.py | get_repo | def get_repo(repo, **kwargs):
'''
Display a repo from the sources.list / sources.list.d
The repo passed in needs to be a complete repo entry.
CLI Examples:
.. code-block:: bash
salt '*' pkg.get_repo "myrepo definition"
'''
_check_apt()
ppa_auth = kwargs.get('ppa_auth', None)
... | python | def get_repo(repo, **kwargs):
'''
Display a repo from the sources.list / sources.list.d
The repo passed in needs to be a complete repo entry.
CLI Examples:
.. code-block:: bash
salt '*' pkg.get_repo "myrepo definition"
'''
_check_apt()
ppa_auth = kwargs.get('ppa_auth', None)
... | [
"def",
"get_repo",
"(",
"repo",
",",
"*",
"*",
"kwargs",
")",
":",
"_check_apt",
"(",
")",
"ppa_auth",
"=",
"kwargs",
".",
"get",
"(",
"'ppa_auth'",
",",
"None",
")",
"# we have to be clever about this since the repo definition formats",
"# are a bit more \"loose\" th... | Display a repo from the sources.list / sources.list.d
The repo passed in needs to be a complete repo entry.
CLI Examples:
.. code-block:: bash
salt '*' pkg.get_repo "myrepo definition" | [
"Display",
"a",
"repo",
"from",
"the",
"sources",
".",
"list",
"/",
"sources",
".",
"list",
".",
"d"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptpkg.py#L1629-L1701 | train |
saltstack/salt | salt/modules/aptpkg.py | del_repo | def del_repo(repo, **kwargs):
'''
Delete a repo from the sources.list / sources.list.d
If the .list file is in the sources.list.d directory
and the file that the repo exists in does not contain any other
repo configuration, the file itself will be deleted.
The repo passed in must be a fully fo... | python | def del_repo(repo, **kwargs):
'''
Delete a repo from the sources.list / sources.list.d
If the .list file is in the sources.list.d directory
and the file that the repo exists in does not contain any other
repo configuration, the file itself will be deleted.
The repo passed in must be a fully fo... | [
"def",
"del_repo",
"(",
"repo",
",",
"*",
"*",
"kwargs",
")",
":",
"_check_apt",
"(",
")",
"is_ppa",
"=",
"False",
"if",
"repo",
".",
"startswith",
"(",
"'ppa:'",
")",
"and",
"__grains__",
"[",
"'os'",
"]",
"in",
"(",
"'Ubuntu'",
",",
"'Mint'",
",",
... | Delete a repo from the sources.list / sources.list.d
If the .list file is in the sources.list.d directory
and the file that the repo exists in does not contain any other
repo configuration, the file itself will be deleted.
The repo passed in must be a fully formed repository definition
string.
... | [
"Delete",
"a",
"repo",
"from",
"the",
"sources",
".",
"list",
"/",
"sources",
".",
"list",
".",
"d"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptpkg.py#L1704-L1814 | train |
saltstack/salt | salt/modules/aptpkg.py | get_repo_keys | def get_repo_keys():
'''
.. versionadded:: 2017.7.0
List known repo key details.
:return: A dictionary containing the repo keys.
:rtype: dict
CLI Examples:
.. code-block:: bash
salt '*' pkg.get_repo_keys
'''
ret = dict()
repo_keys = list()
# The double usage of ... | python | def get_repo_keys():
'''
.. versionadded:: 2017.7.0
List known repo key details.
:return: A dictionary containing the repo keys.
:rtype: dict
CLI Examples:
.. code-block:: bash
salt '*' pkg.get_repo_keys
'''
ret = dict()
repo_keys = list()
# The double usage of ... | [
"def",
"get_repo_keys",
"(",
")",
":",
"ret",
"=",
"dict",
"(",
")",
"repo_keys",
"=",
"list",
"(",
")",
"# The double usage of '--with-fingerprint' is necessary in order to",
"# retrieve the fingerprint of the subkey.",
"cmd",
"=",
"[",
"'apt-key'",
",",
"'adv'",
",",
... | .. versionadded:: 2017.7.0
List known repo key details.
:return: A dictionary containing the repo keys.
:rtype: dict
CLI Examples:
.. code-block:: bash
salt '*' pkg.get_repo_keys | [
"..",
"versionadded",
"::",
"2017",
".",
"7",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptpkg.py#L1835-L1904 | train |
saltstack/salt | salt/modules/aptpkg.py | add_repo_key | def add_repo_key(path=None, text=None, keyserver=None, keyid=None, saltenv='base'):
'''
.. versionadded:: 2017.7.0
Add a repo key using ``apt-key add``.
:param str path: The path of the key file to import.
:param str text: The key data to import, in string form.
:param str keyserver: The serve... | python | def add_repo_key(path=None, text=None, keyserver=None, keyid=None, saltenv='base'):
'''
.. versionadded:: 2017.7.0
Add a repo key using ``apt-key add``.
:param str path: The path of the key file to import.
:param str text: The key data to import, in string form.
:param str keyserver: The serve... | [
"def",
"add_repo_key",
"(",
"path",
"=",
"None",
",",
"text",
"=",
"None",
",",
"keyserver",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"saltenv",
"=",
"'base'",
")",
":",
"cmd",
"=",
"[",
"'apt-key'",
"]",
"kwargs",
"=",
"{",
"}",
"current_repo_ke... | .. versionadded:: 2017.7.0
Add a repo key using ``apt-key add``.
:param str path: The path of the key file to import.
:param str text: The key data to import, in string form.
:param str keyserver: The server to download the repo key specified by the keyid.
:param str keyid: The key id of the repo ... | [
"..",
"versionadded",
"::",
"2017",
".",
"7",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptpkg.py#L1907-L1975 | train |
saltstack/salt | salt/modules/aptpkg.py | del_repo_key | def del_repo_key(name=None, **kwargs):
'''
.. versionadded:: 2015.8.0
Remove a repo key using ``apt-key del``
name
Repo from which to remove the key. Unnecessary if ``keyid`` is passed.
keyid
The KeyID of the GPG key to remove
keyid_ppa : False
If set to ``True``, the... | python | def del_repo_key(name=None, **kwargs):
'''
.. versionadded:: 2015.8.0
Remove a repo key using ``apt-key del``
name
Repo from which to remove the key. Unnecessary if ``keyid`` is passed.
keyid
The KeyID of the GPG key to remove
keyid_ppa : False
If set to ``True``, the... | [
"def",
"del_repo_key",
"(",
"name",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"kwargs",
".",
"get",
"(",
"'keyid_ppa'",
",",
"False",
")",
":",
"if",
"isinstance",
"(",
"name",
",",
"six",
".",
"string_types",
")",
"and",
"name",
".",
"... | .. versionadded:: 2015.8.0
Remove a repo key using ``apt-key del``
name
Repo from which to remove the key. Unnecessary if ``keyid`` is passed.
keyid
The KeyID of the GPG key to remove
keyid_ppa : False
If set to ``True``, the repo's GPG key ID will be looked up from
p... | [
"..",
"versionadded",
"::",
"2015",
".",
"8",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptpkg.py#L1978-L2030 | train |
saltstack/salt | salt/modules/aptpkg.py | mod_repo | def mod_repo(repo, saltenv='base', **kwargs):
'''
Modify one or more values for a repo. If the repo does not exist, it will
be created, so long as the definition is well formed. For Ubuntu the
``ppa:<project>/repo`` format is acceptable. ``ppa:`` format can only be
used to create a new repository.... | python | def mod_repo(repo, saltenv='base', **kwargs):
'''
Modify one or more values for a repo. If the repo does not exist, it will
be created, so long as the definition is well formed. For Ubuntu the
``ppa:<project>/repo`` format is acceptable. ``ppa:`` format can only be
used to create a new repository.... | [
"def",
"mod_repo",
"(",
"repo",
",",
"saltenv",
"=",
"'base'",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"'refresh_db'",
"in",
"kwargs",
":",
"salt",
".",
"utils",
".",
"versions",
".",
"warn_until",
"(",
"'Neon'",
",",
"'The \\'refresh_db\\' argument to \\'p... | Modify one or more values for a repo. If the repo does not exist, it will
be created, so long as the definition is well formed. For Ubuntu the
``ppa:<project>/repo`` format is acceptable. ``ppa:`` format can only be
used to create a new repository.
The following options are available to modify a repo... | [
"Modify",
"one",
"or",
"more",
"values",
"for",
"a",
"repo",
".",
"If",
"the",
"repo",
"does",
"not",
"exist",
"it",
"will",
"be",
"created",
"so",
"long",
"as",
"the",
"definition",
"is",
"well",
"formed",
".",
"For",
"Ubuntu",
"the",
"ppa",
":",
"<... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptpkg.py#L2033-L2362 | train |
saltstack/salt | salt/modules/aptpkg.py | expand_repo_def | def expand_repo_def(**kwargs):
'''
Take a repository definition and expand it to the full pkg repository dict
that can be used for comparison. This is a helper function to make
the Debian/Ubuntu apt sources sane for comparison in the pkgrepo states.
This is designed to be called from pkgrepo state... | python | def expand_repo_def(**kwargs):
'''
Take a repository definition and expand it to the full pkg repository dict
that can be used for comparison. This is a helper function to make
the Debian/Ubuntu apt sources sane for comparison in the pkgrepo states.
This is designed to be called from pkgrepo state... | [
"def",
"expand_repo_def",
"(",
"*",
"*",
"kwargs",
")",
":",
"if",
"'repo'",
"not",
"in",
"kwargs",
":",
"raise",
"SaltInvocationError",
"(",
"'missing \\'repo\\' argument'",
")",
"_check_apt",
"(",
")",
"sanitized",
"=",
"{",
"}",
"repo",
"=",
"salt",
".",
... | Take a repository definition and expand it to the full pkg repository dict
that can be used for comparison. This is a helper function to make
the Debian/Ubuntu apt sources sane for comparison in the pkgrepo states.
This is designed to be called from pkgrepo states and will have little use
being called... | [
"Take",
"a",
"repository",
"definition",
"and",
"expand",
"it",
"to",
"the",
"full",
"pkg",
"repository",
"dict",
"that",
"can",
"be",
"used",
"for",
"comparison",
".",
"This",
"is",
"a",
"helper",
"function",
"to",
"make",
"the",
"Debian",
"/",
"Ubuntu",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptpkg.py#L2399-L2452 | train |
saltstack/salt | salt/modules/aptpkg.py | _parse_selections | def _parse_selections(dpkgselection):
'''
Parses the format from ``dpkg --get-selections`` and return a format that
pkg.get_selections and pkg.set_selections work with.
'''
ret = {}
if isinstance(dpkgselection, six.string_types):
dpkgselection = dpkgselection.split('\n')
for line in ... | python | def _parse_selections(dpkgselection):
'''
Parses the format from ``dpkg --get-selections`` and return a format that
pkg.get_selections and pkg.set_selections work with.
'''
ret = {}
if isinstance(dpkgselection, six.string_types):
dpkgselection = dpkgselection.split('\n')
for line in ... | [
"def",
"_parse_selections",
"(",
"dpkgselection",
")",
":",
"ret",
"=",
"{",
"}",
"if",
"isinstance",
"(",
"dpkgselection",
",",
"six",
".",
"string_types",
")",
":",
"dpkgselection",
"=",
"dpkgselection",
".",
"split",
"(",
"'\\n'",
")",
"for",
"line",
"i... | Parses the format from ``dpkg --get-selections`` and return a format that
pkg.get_selections and pkg.set_selections work with. | [
"Parses",
"the",
"format",
"from",
"dpkg",
"--",
"get",
"-",
"selections",
"and",
"return",
"a",
"format",
"that",
"pkg",
".",
"get_selections",
"and",
"pkg",
".",
"set_selections",
"work",
"with",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptpkg.py#L2455-L2470 | train |
saltstack/salt | salt/modules/aptpkg.py | get_selections | def get_selections(pattern=None, state=None):
'''
View package state from the dpkg database.
Returns a dict of dicts containing the state, and package names:
.. code-block:: python
{'<host>':
{'<state>': ['pkg1',
...
]
}... | python | def get_selections(pattern=None, state=None):
'''
View package state from the dpkg database.
Returns a dict of dicts containing the state, and package names:
.. code-block:: python
{'<host>':
{'<state>': ['pkg1',
...
]
}... | [
"def",
"get_selections",
"(",
"pattern",
"=",
"None",
",",
"state",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"}",
"cmd",
"=",
"[",
"'dpkg'",
",",
"'--get-selections'",
"]",
"cmd",
".",
"append",
"(",
"pattern",
"if",
"pattern",
"else",
"'*'",
")",
"st... | View package state from the dpkg database.
Returns a dict of dicts containing the state, and package names:
.. code-block:: python
{'<host>':
{'<state>': ['pkg1',
...
]
},
...
}
CLI Example:
.. code... | [
"View",
"package",
"state",
"from",
"the",
"dpkg",
"database",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptpkg.py#L2473-L2507 | train |
saltstack/salt | salt/modules/aptpkg.py | set_selections | def set_selections(path=None, selection=None, clear=False, saltenv='base'):
'''
Change package state in the dpkg database.
The state can be any one of, documented in ``dpkg(1)``:
- install
- hold
- deinstall
- purge
This command is commonly used to mark specific packages to be held fr... | python | def set_selections(path=None, selection=None, clear=False, saltenv='base'):
'''
Change package state in the dpkg database.
The state can be any one of, documented in ``dpkg(1)``:
- install
- hold
- deinstall
- purge
This command is commonly used to mark specific packages to be held fr... | [
"def",
"set_selections",
"(",
"path",
"=",
"None",
",",
"selection",
"=",
"None",
",",
"clear",
"=",
"False",
",",
"saltenv",
"=",
"'base'",
")",
":",
"ret",
"=",
"{",
"}",
"if",
"not",
"path",
"and",
"not",
"selection",
":",
"return",
"ret",
"if",
... | Change package state in the dpkg database.
The state can be any one of, documented in ``dpkg(1)``:
- install
- hold
- deinstall
- purge
This command is commonly used to mark specific packages to be held from
being upgraded, that is, to be kept at a certain version. When a state is
cha... | [
"Change",
"package",
"state",
"in",
"the",
"dpkg",
"database",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptpkg.py#L2516-L2618 | train |
saltstack/salt | salt/modules/aptpkg.py | _resolve_deps | def _resolve_deps(name, pkgs, **kwargs):
'''
Installs missing dependencies and marks them as auto installed so they
are removed when no more manually installed packages depend on them.
.. versionadded:: 2014.7.0
:depends: - python-apt module
'''
missing_deps = []
for pkg_file in pkgs... | python | def _resolve_deps(name, pkgs, **kwargs):
'''
Installs missing dependencies and marks them as auto installed so they
are removed when no more manually installed packages depend on them.
.. versionadded:: 2014.7.0
:depends: - python-apt module
'''
missing_deps = []
for pkg_file in pkgs... | [
"def",
"_resolve_deps",
"(",
"name",
",",
"pkgs",
",",
"*",
"*",
"kwargs",
")",
":",
"missing_deps",
"=",
"[",
"]",
"for",
"pkg_file",
"in",
"pkgs",
":",
"deb",
"=",
"apt",
".",
"debfile",
".",
"DebPackage",
"(",
"filename",
"=",
"pkg_file",
",",
"ca... | Installs missing dependencies and marks them as auto installed so they
are removed when no more manually installed packages depend on them.
.. versionadded:: 2014.7.0
:depends: - python-apt module | [
"Installs",
"missing",
"dependencies",
"and",
"marks",
"them",
"as",
"auto",
"installed",
"so",
"they",
"are",
"removed",
"when",
"no",
"more",
"manually",
"installed",
"packages",
"depend",
"on",
"them",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptpkg.py#L2621-L2663 | train |
saltstack/salt | salt/modules/aptpkg.py | show | def show(*names, **kwargs):
'''
.. versionadded:: 2019.2.0
Runs an ``apt-cache show`` on the passed package names, and returns the
results in a nested dictionary. The top level of the return data will be
the package name, with each package name mapping to a dictionary of version
numbers to any ... | python | def show(*names, **kwargs):
'''
.. versionadded:: 2019.2.0
Runs an ``apt-cache show`` on the passed package names, and returns the
results in a nested dictionary. The top level of the return data will be
the package name, with each package name mapping to a dictionary of version
numbers to any ... | [
"def",
"show",
"(",
"*",
"names",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"=",
"salt",
".",
"utils",
".",
"args",
".",
"clean_kwargs",
"(",
"*",
"*",
"kwargs",
")",
"refresh",
"=",
"kwargs",
".",
"pop",
"(",
"'refresh'",
",",
"False",
")",
"... | .. versionadded:: 2019.2.0
Runs an ``apt-cache show`` on the passed package names, and returns the
results in a nested dictionary. The top level of the return data will be
the package name, with each package name mapping to a dictionary of version
numbers to any additional information returned by ``apt... | [
"..",
"versionadded",
"::",
"2019",
".",
"2",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptpkg.py#L2701-L2782 | train |
saltstack/salt | salt/modules/aptpkg.py | info_installed | def info_installed(*names, **kwargs):
'''
Return the information of the named package(s) installed on the system.
.. versionadded:: 2015.8.1
names
The names of the packages for which to return information.
failhard
Whether to throw an exception if none of the packages are installe... | python | def info_installed(*names, **kwargs):
'''
Return the information of the named package(s) installed on the system.
.. versionadded:: 2015.8.1
names
The names of the packages for which to return information.
failhard
Whether to throw an exception if none of the packages are installe... | [
"def",
"info_installed",
"(",
"*",
"names",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"=",
"salt",
".",
"utils",
".",
"args",
".",
"clean_kwargs",
"(",
"*",
"*",
"kwargs",
")",
"failhard",
"=",
"kwargs",
".",
"pop",
"(",
"'failhard'",
",",
"True",... | Return the information of the named package(s) installed on the system.
.. versionadded:: 2015.8.1
names
The names of the packages for which to return information.
failhard
Whether to throw an exception if none of the packages are installed.
Defaults to True.
.. versionad... | [
"Return",
"the",
"information",
"of",
"the",
"named",
"package",
"(",
"s",
")",
"installed",
"on",
"the",
"system",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptpkg.py#L2785-L2853 | train |
saltstack/salt | salt/modules/aptpkg.py | _get_http_proxy_url | def _get_http_proxy_url():
'''
Returns the http_proxy_url if proxy_username, proxy_password, proxy_host, and proxy_port
config values are set.
Returns a string.
'''
http_proxy_url = ''
host = __salt__['config.option']('proxy_host')
port = __salt__['config.option']('proxy_port')
user... | python | def _get_http_proxy_url():
'''
Returns the http_proxy_url if proxy_username, proxy_password, proxy_host, and proxy_port
config values are set.
Returns a string.
'''
http_proxy_url = ''
host = __salt__['config.option']('proxy_host')
port = __salt__['config.option']('proxy_port')
user... | [
"def",
"_get_http_proxy_url",
"(",
")",
":",
"http_proxy_url",
"=",
"''",
"host",
"=",
"__salt__",
"[",
"'config.option'",
"]",
"(",
"'proxy_host'",
")",
"port",
"=",
"__salt__",
"[",
"'config.option'",
"]",
"(",
"'proxy_port'",
")",
"username",
"=",
"__salt__... | Returns the http_proxy_url if proxy_username, proxy_password, proxy_host, and proxy_port
config values are set.
Returns a string. | [
"Returns",
"the",
"http_proxy_url",
"if",
"proxy_username",
"proxy_password",
"proxy_host",
"and",
"proxy_port",
"config",
"values",
"are",
"set",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptpkg.py#L2856-L2884 | train |
saltstack/salt | salt/states/zabbix_template.py | _diff_and_merge_host_list | def _diff_and_merge_host_list(defined, existing):
'''
If Zabbix template is to be updated then list of assigned hosts must be provided in all or nothing manner to prevent
some externally assigned hosts to be detached.
:param defined: list of hosts defined in sls
:param existing: list of hosts taken... | python | def _diff_and_merge_host_list(defined, existing):
'''
If Zabbix template is to be updated then list of assigned hosts must be provided in all or nothing manner to prevent
some externally assigned hosts to be detached.
:param defined: list of hosts defined in sls
:param existing: list of hosts taken... | [
"def",
"_diff_and_merge_host_list",
"(",
"defined",
",",
"existing",
")",
":",
"try",
":",
"defined_host_ids",
"=",
"set",
"(",
"[",
"host",
"[",
"'hostid'",
"]",
"for",
"host",
"in",
"defined",
"]",
")",
"existing_host_ids",
"=",
"set",
"(",
"[",
"host",
... | If Zabbix template is to be updated then list of assigned hosts must be provided in all or nothing manner to prevent
some externally assigned hosts to be detached.
:param defined: list of hosts defined in sls
:param existing: list of hosts taken from live Zabbix
:return: list to be updated (combinated ... | [
"If",
"Zabbix",
"template",
"is",
"to",
"be",
"updated",
"then",
"list",
"of",
"assigned",
"hosts",
"must",
"be",
"provided",
"in",
"all",
"or",
"nothing",
"manner",
"to",
"prevent",
"some",
"externally",
"assigned",
"hosts",
"to",
"be",
"detached",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/zabbix_template.py#L217-L233 | train |
saltstack/salt | salt/states/zabbix_template.py | _get_existing_template_c_list | def _get_existing_template_c_list(component, parent_id, **kwargs):
'''
Make a list of given component type not inherited from other templates because Zabbix API returns only list of all
and list of inherited component items so we have to do a difference list.
:param component: Template component (appli... | python | def _get_existing_template_c_list(component, parent_id, **kwargs):
'''
Make a list of given component type not inherited from other templates because Zabbix API returns only list of all
and list of inherited component items so we have to do a difference list.
:param component: Template component (appli... | [
"def",
"_get_existing_template_c_list",
"(",
"component",
",",
"parent_id",
",",
"*",
"*",
"kwargs",
")",
":",
"c_def",
"=",
"TEMPLATE_COMPONENT_DEF",
"[",
"component",
"]",
"q_params",
"=",
"dict",
"(",
"c_def",
"[",
"'output'",
"]",
")",
"q_params",
".",
"... | Make a list of given component type not inherited from other templates because Zabbix API returns only list of all
and list of inherited component items so we have to do a difference list.
:param component: Template component (application, item, etc...)
:param parent_id: ID of existing template the compone... | [
"Make",
"a",
"list",
"of",
"given",
"component",
"type",
"not",
"inherited",
"from",
"other",
"templates",
"because",
"Zabbix",
"API",
"returns",
"only",
"list",
"of",
"all",
"and",
"list",
"of",
"inherited",
"component",
"items",
"so",
"we",
"have",
"to",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/zabbix_template.py#L236-L261 | train |
saltstack/salt | salt/states/zabbix_template.py | _adjust_object_lists | def _adjust_object_lists(obj):
'''
For creation or update of object that have attribute which contains a list Zabbix awaits plain list of IDs while
querying Zabbix for same object returns list of dicts
:param obj: Zabbix object parameters
'''
for subcomp in TEMPLATE_COMPONENT_DEF:
if su... | python | def _adjust_object_lists(obj):
'''
For creation or update of object that have attribute which contains a list Zabbix awaits plain list of IDs while
querying Zabbix for same object returns list of dicts
:param obj: Zabbix object parameters
'''
for subcomp in TEMPLATE_COMPONENT_DEF:
if su... | [
"def",
"_adjust_object_lists",
"(",
"obj",
")",
":",
"for",
"subcomp",
"in",
"TEMPLATE_COMPONENT_DEF",
":",
"if",
"subcomp",
"in",
"obj",
"and",
"TEMPLATE_COMPONENT_DEF",
"[",
"subcomp",
"]",
"[",
"'adjust'",
"]",
":",
"obj",
"[",
"subcomp",
"]",
"=",
"[",
... | For creation or update of object that have attribute which contains a list Zabbix awaits plain list of IDs while
querying Zabbix for same object returns list of dicts
:param obj: Zabbix object parameters | [
"For",
"creation",
"or",
"update",
"of",
"object",
"that",
"have",
"attribute",
"which",
"contains",
"a",
"list",
"Zabbix",
"awaits",
"plain",
"list",
"of",
"IDs",
"while",
"querying",
"Zabbix",
"for",
"same",
"object",
"returns",
"list",
"of",
"dicts"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/zabbix_template.py#L264-L273 | train |
saltstack/salt | salt/states/zabbix_template.py | _manage_component | def _manage_component(component, parent_id, defined, existing, template_id=None, **kwargs):
'''
Takes particular component list, compares it with existing, call appropriate API methods - create, update, delete.
:param component: component name
:param parent_id: ID of parent entity under which component... | python | def _manage_component(component, parent_id, defined, existing, template_id=None, **kwargs):
'''
Takes particular component list, compares it with existing, call appropriate API methods - create, update, delete.
:param component: component name
:param parent_id: ID of parent entity under which component... | [
"def",
"_manage_component",
"(",
"component",
",",
"parent_id",
",",
"defined",
",",
"existing",
",",
"template_id",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"zabbix_id_mapper",
"=",
"__salt__",
"[",
"'zabbix.get_zabbix_id_mapper'",
"]",
"(",
")",
"dry_... | Takes particular component list, compares it with existing, call appropriate API methods - create, update, delete.
:param component: component name
:param parent_id: ID of parent entity under which component should be created
:param defined: list of defined items of named component
:param existing: lis... | [
"Takes",
"particular",
"component",
"list",
"compares",
"it",
"with",
"existing",
"call",
"appropriate",
"API",
"methods",
"-",
"create",
"update",
"delete",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/zabbix_template.py#L276-L339 | train |
saltstack/salt | salt/states/zabbix_template.py | is_present | def is_present(name, **kwargs):
'''
Check if Zabbix Template already exists.
:param name: Zabbix Template name
:param _connection_user: Optional - zabbix user (can also be set in opts or pillar, see module's docstring)
:param _connection_password: Optional - zabbix password (can also be set in opts... | python | def is_present(name, **kwargs):
'''
Check if Zabbix Template already exists.
:param name: Zabbix Template name
:param _connection_user: Optional - zabbix user (can also be set in opts or pillar, see module's docstring)
:param _connection_password: Optional - zabbix password (can also be set in opts... | [
"def",
"is_present",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",
"False",
",",
"'comment'",
":",
"''",
",",
"'changes'",
":",
"{",
"}",
"}",
"try",
":",
"object_id",
"=",
"__salt__",... | Check if Zabbix Template already exists.
:param name: Zabbix Template name
:param _connection_user: Optional - zabbix user (can also be set in opts or pillar, see module's docstring)
:param _connection_password: Optional - zabbix password (can also be set in opts or pillar, see module's docstring)
:par... | [
"Check",
"if",
"Zabbix",
"Template",
"already",
"exists",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/zabbix_template.py#L342-L371 | train |
saltstack/salt | salt/states/zabbix_template.py | present | def present(name, params, static_host_list=True, **kwargs):
'''
Creates Zabbix Template object or if differs update it according defined parameters. See Zabbix API documentation.
Zabbix API version: >3.0
:param name: Zabbix Template name
:param params: Additional parameters according to Zabbix API... | python | def present(name, params, static_host_list=True, **kwargs):
'''
Creates Zabbix Template object or if differs update it according defined parameters. See Zabbix API documentation.
Zabbix API version: >3.0
:param name: Zabbix Template name
:param params: Additional parameters according to Zabbix API... | [
"def",
"present",
"(",
"name",
",",
"params",
",",
"static_host_list",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"zabbix_id_mapper",
"=",
"__salt__",
"[",
"'zabbix.get_zabbix_id_mapper'",
"]",
"(",
")",
"dry_run",
"=",
"__opts__",
"[",
"'test'",
"]",
... | Creates Zabbix Template object or if differs update it according defined parameters. See Zabbix API documentation.
Zabbix API version: >3.0
:param name: Zabbix Template name
:param params: Additional parameters according to Zabbix API documentation
:param static_host_list: If hosts assigned to the tem... | [
"Creates",
"Zabbix",
"Template",
"object",
"or",
"if",
"differs",
"update",
"it",
"according",
"defined",
"parameters",
".",
"See",
"Zabbix",
"API",
"documentation",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/zabbix_template.py#L375-L699 | train |
saltstack/salt | salt/states/zabbix_template.py | absent | def absent(name, **kwargs):
'''
Makes the Zabbix Template to be absent (either does not exist or delete it).
:param name: Zabbix Template name
:param _connection_user: Optional - zabbix user (can also be set in opts or pillar, see module's docstring)
:param _connection_password: Optional - zabbix p... | python | def absent(name, **kwargs):
'''
Makes the Zabbix Template to be absent (either does not exist or delete it).
:param name: Zabbix Template name
:param _connection_user: Optional - zabbix user (can also be set in opts or pillar, see module's docstring)
:param _connection_password: Optional - zabbix p... | [
"def",
"absent",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"dry_run",
"=",
"__opts__",
"[",
"'test'",
"]",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",
"False",
",",
"'comment'",
":",
"''",
",",
"'changes'",
":",
"{",
"}",
... | Makes the Zabbix Template to be absent (either does not exist or delete it).
:param name: Zabbix Template name
:param _connection_user: Optional - zabbix user (can also be set in opts or pillar, see module's docstring)
:param _connection_password: Optional - zabbix password (can also be set in opts or pill... | [
"Makes",
"the",
"Zabbix",
"Template",
"to",
"be",
"absent",
"(",
"either",
"does",
"not",
"exist",
"or",
"delete",
"it",
")",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/zabbix_template.py#L702-L742 | train |
saltstack/salt | salt/modules/solaris_group.py | chgid | def chgid(name, gid):
'''
Change the gid for a named group
CLI Example:
.. code-block:: bash
salt '*' group.chgid foo 4376
'''
pre_gid = __salt__['file.group_to_gid'](name)
if gid == pre_gid:
return True
cmd = 'groupmod -g {0} {1}'.format(gid, name)
__salt__['cmd.r... | python | def chgid(name, gid):
'''
Change the gid for a named group
CLI Example:
.. code-block:: bash
salt '*' group.chgid foo 4376
'''
pre_gid = __salt__['file.group_to_gid'](name)
if gid == pre_gid:
return True
cmd = 'groupmod -g {0} {1}'.format(gid, name)
__salt__['cmd.r... | [
"def",
"chgid",
"(",
"name",
",",
"gid",
")",
":",
"pre_gid",
"=",
"__salt__",
"[",
"'file.group_to_gid'",
"]",
"(",
"name",
")",
"if",
"gid",
"==",
"pre_gid",
":",
"return",
"True",
"cmd",
"=",
"'groupmod -g {0} {1}'",
".",
"format",
"(",
"gid",
",",
... | Change the gid for a named group
CLI Example:
.. code-block:: bash
salt '*' group.chgid foo 4376 | [
"Change",
"the",
"gid",
"for",
"a",
"named",
"group"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solaris_group.py#L125-L143 | train |
saltstack/salt | salt/runners/venafiapi.py | gen_key | def gen_key(minion_id, dns_name=None, zone='default', password=None):
'''
Generate and return an private_key. If a ``dns_name`` is passed in, the
private_key will be cached under that name. The type of key and the
parameters used to generate the key are based on the default certificate
use policy as... | python | def gen_key(minion_id, dns_name=None, zone='default', password=None):
'''
Generate and return an private_key. If a ``dns_name`` is passed in, the
private_key will be cached under that name. The type of key and the
parameters used to generate the key are based on the default certificate
use policy as... | [
"def",
"gen_key",
"(",
"minion_id",
",",
"dns_name",
"=",
"None",
",",
"zone",
"=",
"'default'",
",",
"password",
"=",
"None",
")",
":",
"# Get the default certificate use policy associated with the zone",
"# so we can generate keys that conform with policy",
"# The /v1/zones... | Generate and return an private_key. If a ``dns_name`` is passed in, the
private_key will be cached under that name. The type of key and the
parameters used to generate the key are based on the default certificate
use policy associated with the specified zone.
CLI Example:
.. code-block:: bash
... | [
"Generate",
"and",
"return",
"an",
"private_key",
".",
"If",
"a",
"dns_name",
"is",
"passed",
"in",
"the",
"private_key",
"will",
"be",
"cached",
"under",
"that",
"name",
".",
"The",
"type",
"of",
"key",
"and",
"the",
"parameters",
"used",
"to",
"generate"... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/venafiapi.py#L87-L167 | train |
saltstack/salt | salt/runners/venafiapi.py | gen_csr | def gen_csr(
minion_id,
dns_name,
zone='default',
country=None,
state=None,
loc=None,
org=None,
org_unit=None,
password=None,
):
'''
Generate a csr using the host's private_key.
Analogous to:
.. code-block:: bash
VCert... | python | def gen_csr(
minion_id,
dns_name,
zone='default',
country=None,
state=None,
loc=None,
org=None,
org_unit=None,
password=None,
):
'''
Generate a csr using the host's private_key.
Analogous to:
.. code-block:: bash
VCert... | [
"def",
"gen_csr",
"(",
"minion_id",
",",
"dns_name",
",",
"zone",
"=",
"'default'",
",",
"country",
"=",
"None",
",",
"state",
"=",
"None",
",",
"loc",
"=",
"None",
",",
"org",
"=",
"None",
",",
"org_unit",
"=",
"None",
",",
"password",
"=",
"None",
... | Generate a csr using the host's private_key.
Analogous to:
.. code-block:: bash
VCert gencsr -cn [CN Value] -o "Beta Organization" -ou "Beta Group" \
-l "Palo Alto" -st "California" -c US
CLI Example:
.. code-block:: bash
salt-run venafi.gen_csr <minion_id> <dns_name> | [
"Generate",
"a",
"csr",
"using",
"the",
"host",
"s",
"private_key",
".",
"Analogous",
"to",
":"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/venafiapi.py#L170-L259 | train |
saltstack/salt | salt/runners/venafiapi.py | request | def request(
minion_id,
dns_name=None,
zone='default',
request_id=None,
country='US',
state='California',
loc='Palo Alto',
org='Beta Organization',
org_unit='Beta Group',
password=None,
zone_id=None,
):
'''
Request a new... | python | def request(
minion_id,
dns_name=None,
zone='default',
request_id=None,
country='US',
state='California',
loc='Palo Alto',
org='Beta Organization',
org_unit='Beta Group',
password=None,
zone_id=None,
):
'''
Request a new... | [
"def",
"request",
"(",
"minion_id",
",",
"dns_name",
"=",
"None",
",",
"zone",
"=",
"'default'",
",",
"request_id",
"=",
"None",
",",
"country",
"=",
"'US'",
",",
"state",
"=",
"'California'",
",",
"loc",
"=",
"'Palo Alto'",
",",
"org",
"=",
"'Beta Organ... | Request a new certificate
Uses the following command:
.. code-block:: bash
VCert enroll -z <zone> -k <api key> -cn <domain name>
CLI Example:
.. code-block:: bash
salt-run venafi.request <minion_id> <dns_name> | [
"Request",
"a",
"new",
"certificate"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/venafiapi.py#L262-L361 | train |
saltstack/salt | salt/runners/venafiapi.py | register | def register(email):
'''
Register a new user account
CLI Example:
.. code-block:: bash
salt-run venafi.register email@example.com
'''
data = __utils__['http.query'](
'{0}/useraccounts'.format(_base_url()),
method='POST',
data=salt.utils.json.dumps({
... | python | def register(email):
'''
Register a new user account
CLI Example:
.. code-block:: bash
salt-run venafi.register email@example.com
'''
data = __utils__['http.query'](
'{0}/useraccounts'.format(_base_url()),
method='POST',
data=salt.utils.json.dumps({
... | [
"def",
"register",
"(",
"email",
")",
":",
"data",
"=",
"__utils__",
"[",
"'http.query'",
"]",
"(",
"'{0}/useraccounts'",
".",
"format",
"(",
"_base_url",
"(",
")",
")",
",",
"method",
"=",
"'POST'",
",",
"data",
"=",
"salt",
".",
"utils",
".",
"json",... | Register a new user account
CLI Example:
.. code-block:: bash
salt-run venafi.register email@example.com | [
"Register",
"a",
"new",
"user",
"account"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/venafiapi.py#L382-L411 | train |
saltstack/salt | salt/runners/venafiapi.py | show_company | def show_company(domain):
'''
Show company information, especially the company id
CLI Example:
.. code-block:: bash
salt-run venafi.show_company example.com
'''
data = __utils__['http.query'](
'{0}/companies/domain/{1}'.format(_base_url(), domain),
status=True,
... | python | def show_company(domain):
'''
Show company information, especially the company id
CLI Example:
.. code-block:: bash
salt-run venafi.show_company example.com
'''
data = __utils__['http.query'](
'{0}/companies/domain/{1}'.format(_base_url(), domain),
status=True,
... | [
"def",
"show_company",
"(",
"domain",
")",
":",
"data",
"=",
"__utils__",
"[",
"'http.query'",
"]",
"(",
"'{0}/companies/domain/{1}'",
".",
"format",
"(",
"_base_url",
"(",
")",
",",
"domain",
")",
",",
"status",
"=",
"True",
",",
"decode",
"=",
"True",
... | Show company information, especially the company id
CLI Example:
.. code-block:: bash
salt-run venafi.show_company example.com | [
"Show",
"company",
"information",
"especially",
"the",
"company",
"id"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/venafiapi.py#L414-L438 | train |
saltstack/salt | salt/runners/venafiapi.py | show_cert | def show_cert(id_):
'''
Show certificate requests for this API key
CLI Example:
.. code-block:: bash
salt-run venafi.show_cert 01234567-89ab-cdef-0123-456789abcdef
'''
data = __utils__['http.query'](
'{0}/certificaterequests/{1}/certificate'.format(_base_url(), id_),
p... | python | def show_cert(id_):
'''
Show certificate requests for this API key
CLI Example:
.. code-block:: bash
salt-run venafi.show_cert 01234567-89ab-cdef-0123-456789abcdef
'''
data = __utils__['http.query'](
'{0}/certificaterequests/{1}/certificate'.format(_base_url(), id_),
p... | [
"def",
"show_cert",
"(",
"id_",
")",
":",
"data",
"=",
"__utils__",
"[",
"'http.query'",
"]",
"(",
"'{0}/certificaterequests/{1}/certificate'",
".",
"format",
"(",
"_base_url",
"(",
")",
",",
"id_",
")",
",",
"params",
"=",
"{",
"'format'",
":",
"'PEM'",
"... | Show certificate requests for this API key
CLI Example:
.. code-block:: bash
salt-run venafi.show_cert 01234567-89ab-cdef-0123-456789abcdef | [
"Show",
"certificate",
"requests",
"for",
"this",
"API",
"key"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/venafiapi.py#L550-L605 | train |
saltstack/salt | salt/runners/venafiapi.py | list_domain_cache | def list_domain_cache():
'''
List domains that have been cached
CLI Example:
.. code-block:: bash
salt-run venafi.list_domain_cache
'''
cache = salt.cache.Cache(__opts__, syspaths.CACHE_DIR)
return cache.list('venafi/domains') | python | def list_domain_cache():
'''
List domains that have been cached
CLI Example:
.. code-block:: bash
salt-run venafi.list_domain_cache
'''
cache = salt.cache.Cache(__opts__, syspaths.CACHE_DIR)
return cache.list('venafi/domains') | [
"def",
"list_domain_cache",
"(",
")",
":",
"cache",
"=",
"salt",
".",
"cache",
".",
"Cache",
"(",
"__opts__",
",",
"syspaths",
".",
"CACHE_DIR",
")",
"return",
"cache",
".",
"list",
"(",
"'venafi/domains'",
")"
] | List domains that have been cached
CLI Example:
.. code-block:: bash
salt-run venafi.list_domain_cache | [
"List",
"domains",
"that",
"have",
"been",
"cached"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/venafiapi.py#L629-L640 | train |
saltstack/salt | salt/runners/venafiapi.py | del_cached_domain | def del_cached_domain(domains):
'''
Delete cached domains from the master
CLI Example:
.. code-block:: bash
salt-run venafi.del_cached_domain domain1.example.com,domain2.example.com
'''
cache = salt.cache.Cache(__opts__, syspaths.CACHE_DIR)
if isinstance(domains, six.string_types)... | python | def del_cached_domain(domains):
'''
Delete cached domains from the master
CLI Example:
.. code-block:: bash
salt-run venafi.del_cached_domain domain1.example.com,domain2.example.com
'''
cache = salt.cache.Cache(__opts__, syspaths.CACHE_DIR)
if isinstance(domains, six.string_types)... | [
"def",
"del_cached_domain",
"(",
"domains",
")",
":",
"cache",
"=",
"salt",
".",
"cache",
".",
"Cache",
"(",
"__opts__",
",",
"syspaths",
".",
"CACHE_DIR",
")",
"if",
"isinstance",
"(",
"domains",
",",
"six",
".",
"string_types",
")",
":",
"domains",
"="... | Delete cached domains from the master
CLI Example:
.. code-block:: bash
salt-run venafi.del_cached_domain domain1.example.com,domain2.example.com | [
"Delete",
"cached",
"domains",
"from",
"the",
"master"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/venafiapi.py#L643-L669 | train |
saltstack/salt | salt/states/onyx.py | user_present | def user_present(name, password=None, roles=None, encrypted=False, crypt_salt=None, algorithm='sha256'):
'''
Ensure a user is present with the specified groups
name
Name of user
password
Encrypted or Plain Text password for user
roles
List of roles the user should be assig... | python | def user_present(name, password=None, roles=None, encrypted=False, crypt_salt=None, algorithm='sha256'):
'''
Ensure a user is present with the specified groups
name
Name of user
password
Encrypted or Plain Text password for user
roles
List of roles the user should be assig... | [
"def",
"user_present",
"(",
"name",
",",
"password",
"=",
"None",
",",
"roles",
"=",
"None",
",",
"encrypted",
"=",
"False",
",",
"crypt_salt",
"=",
"None",
",",
"algorithm",
"=",
"'sha256'",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'r... | Ensure a user is present with the specified groups
name
Name of user
password
Encrypted or Plain Text password for user
roles
List of roles the user should be assigned. Any roles not in this list will be removed
encrypted
Whether the password is encrypted already or ... | [
"Ensure",
"a",
"user",
"is",
"present",
"with",
"the",
"specified",
"groups"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/onyx.py#L18-L150 | train |
saltstack/salt | salt/states/onyx.py | user_absent | def user_absent(name):
'''
Ensure a user is not present
name
username to remove if it exists
Examples:
.. code-block:: yaml
delete:
onyx.user_absent:
- name: daniel
'''
ret = {'name': name,
'result': False,
'changes': {},
... | python | def user_absent(name):
'''
Ensure a user is not present
name
username to remove if it exists
Examples:
.. code-block:: yaml
delete:
onyx.user_absent:
- name: daniel
'''
ret = {'name': name,
'result': False,
'changes': {},
... | [
"def",
"user_absent",
"(",
"name",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",
"False",
",",
"'changes'",
":",
"{",
"}",
",",
"'comment'",
":",
"''",
"}",
"old_user",
"=",
"__salt__",
"[",
"'onyx.cmd'",
"]",
"(",
"'get_use... | Ensure a user is not present
name
username to remove if it exists
Examples:
.. code-block:: yaml
delete:
onyx.user_absent:
- name: daniel | [
"Ensure",
"a",
"user",
"is",
"not",
"present"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/onyx.py#L153-L197 | train |
saltstack/salt | salt/states/onyx.py | config_present | def config_present(name):
'''
Ensure a specific configuration line exists in the running config
name
config line to set
Examples:
.. code-block:: yaml
add snmp group:
onyx.config_present:
- names:
- snmp-server community randoSNMPstringHERE gro... | python | def config_present(name):
'''
Ensure a specific configuration line exists in the running config
name
config line to set
Examples:
.. code-block:: yaml
add snmp group:
onyx.config_present:
- names:
- snmp-server community randoSNMPstringHERE gro... | [
"def",
"config_present",
"(",
"name",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",
"False",
",",
"'changes'",
":",
"{",
"}",
",",
"'comment'",
":",
"''",
"}",
"matches",
"=",
"__salt__",
"[",
"'onyx.cmd'",
"]",
"(",
"'find'... | Ensure a specific configuration line exists in the running config
name
config line to set
Examples:
.. code-block:: yaml
add snmp group:
onyx.config_present:
- names:
- snmp-server community randoSNMPstringHERE group network-operator
- sn... | [
"Ensure",
"a",
"specific",
"configuration",
"line",
"exists",
"in",
"the",
"running",
"config"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/onyx.py#L200-L250 | train |
saltstack/salt | salt/states/onyx.py | config_absent | def config_absent(name):
'''
Ensure a specific configuration line does not exist in the running config
name
config line to remove
Examples:
.. code-block:: yaml
add snmp group:
onyx.config_absent:
- names:
- snmp-server community randoSNMPstrin... | python | def config_absent(name):
'''
Ensure a specific configuration line does not exist in the running config
name
config line to remove
Examples:
.. code-block:: yaml
add snmp group:
onyx.config_absent:
- names:
- snmp-server community randoSNMPstrin... | [
"def",
"config_absent",
"(",
"name",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",
"False",
",",
"'changes'",
":",
"{",
"}",
",",
"'comment'",
":",
"''",
"}",
"matches",
"=",
"__salt__",
"[",
"'onyx.cmd'",
"]",
"(",
"'find'"... | Ensure a specific configuration line does not exist in the running config
name
config line to remove
Examples:
.. code-block:: yaml
add snmp group:
onyx.config_absent:
- names:
- snmp-server community randoSNMPstringHERE group network-operator
... | [
"Ensure",
"a",
"specific",
"configuration",
"line",
"does",
"not",
"exist",
"in",
"the",
"running",
"config"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/onyx.py#L253-L304 | train |
saltstack/salt | salt/states/onyx.py | replace | def replace(name, repl, full_match=False):
'''
Replace all instances of a string or full line in the running config
name
String to replace
repl
The replacement text
full_match
Whether `name` will match the full line or only a subset of the line.
Defaults to False. ... | python | def replace(name, repl, full_match=False):
'''
Replace all instances of a string or full line in the running config
name
String to replace
repl
The replacement text
full_match
Whether `name` will match the full line or only a subset of the line.
Defaults to False. ... | [
"def",
"replace",
"(",
"name",
",",
"repl",
",",
"full_match",
"=",
"False",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",
"False",
",",
"'changes'",
":",
"{",
"}",
",",
"'comment'",
":",
"''",
"}",
"if",
"full_match",
"is... | Replace all instances of a string or full line in the running config
name
String to replace
repl
The replacement text
full_match
Whether `name` will match the full line or only a subset of the line.
Defaults to False. When False, .* is added around `name` for matching
... | [
"Replace",
"all",
"instances",
"of",
"a",
"string",
"or",
"full",
"line",
"in",
"the",
"running",
"config"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/onyx.py#L307-L379 | train |
saltstack/salt | salt/states/mssql_login.py | present | def present(name, password=None, domain=None, server_roles=None, options=None, **kwargs):
'''
Checks existance of the named login.
If not present, creates the login with the specified roles and options.
name
The name of the login to manage
password
Creates a SQL Server authenticatio... | python | def present(name, password=None, domain=None, server_roles=None, options=None, **kwargs):
'''
Checks existance of the named login.
If not present, creates the login with the specified roles and options.
name
The name of the login to manage
password
Creates a SQL Server authenticatio... | [
"def",
"present",
"(",
"name",
",",
"password",
"=",
"None",
",",
"domain",
"=",
"None",
",",
"server_roles",
"=",
"None",
",",
"options",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":"... | Checks existance of the named login.
If not present, creates the login with the specified roles and options.
name
The name of the login to manage
password
Creates a SQL Server authentication login
Since hashed passwords are varbinary values, if the
new_login_password is 'lon... | [
"Checks",
"existance",
"of",
"the",
"named",
"login",
".",
"If",
"not",
"present",
"creates",
"the",
"login",
"with",
"the",
"specified",
"roles",
"and",
"options",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/mssql_login.py#L37-L87 | train |
saltstack/salt | salt/states/cmd.py | _reinterpreted_state | def _reinterpreted_state(state):
'''
Re-interpret the state returned by salt.state.run using our protocol.
'''
ret = state['changes']
state['changes'] = {}
state['comment'] = ''
out = ret.get('stdout')
if not out:
if ret.get('stderr'):
state['comment'] = ret['stderr'... | python | def _reinterpreted_state(state):
'''
Re-interpret the state returned by salt.state.run using our protocol.
'''
ret = state['changes']
state['changes'] = {}
state['comment'] = ''
out = ret.get('stdout')
if not out:
if ret.get('stderr'):
state['comment'] = ret['stderr'... | [
"def",
"_reinterpreted_state",
"(",
"state",
")",
":",
"ret",
"=",
"state",
"[",
"'changes'",
"]",
"state",
"[",
"'changes'",
"]",
"=",
"{",
"}",
"state",
"[",
"'comment'",
"]",
"=",
"''",
"out",
"=",
"ret",
".",
"get",
"(",
"'stdout'",
")",
"if",
... | Re-interpret the state returned by salt.state.run using our protocol. | [
"Re",
"-",
"interpret",
"the",
"state",
"returned",
"by",
"salt",
".",
"state",
".",
"run",
"using",
"our",
"protocol",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/cmd.py#L251-L310 | train |
saltstack/salt | salt/states/cmd.py | mod_run_check | def mod_run_check(cmd_kwargs, onlyif, unless, creates):
'''
Execute the onlyif and unless logic.
Return a result dict if:
* onlyif failed (onlyif != 0)
* unless succeeded (unless == 0)
else return True
'''
# never use VT for onlyif/unless executions because this will lead
# to quote ... | python | def mod_run_check(cmd_kwargs, onlyif, unless, creates):
'''
Execute the onlyif and unless logic.
Return a result dict if:
* onlyif failed (onlyif != 0)
* unless succeeded (unless == 0)
else return True
'''
# never use VT for onlyif/unless executions because this will lead
# to quote ... | [
"def",
"mod_run_check",
"(",
"cmd_kwargs",
",",
"onlyif",
",",
"unless",
",",
"creates",
")",
":",
"# never use VT for onlyif/unless executions because this will lead",
"# to quote problems",
"cmd_kwargs",
"=",
"copy",
".",
"deepcopy",
"(",
"cmd_kwargs",
")",
"cmd_kwargs"... | Execute the onlyif and unless logic.
Return a result dict if:
* onlyif failed (onlyif != 0)
* unless succeeded (unless == 0)
else return True | [
"Execute",
"the",
"onlyif",
"and",
"unless",
"logic",
".",
"Return",
"a",
"result",
"dict",
"if",
":",
"*",
"onlyif",
"failed",
"(",
"onlyif",
"!",
"=",
"0",
")",
"*",
"unless",
"succeeded",
"(",
"unless",
"==",
"0",
")",
"else",
"return",
"True"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/cmd.py#L327-L398 | train |
saltstack/salt | salt/states/cmd.py | wait | def wait(name,
onlyif=None,
unless=None,
creates=None,
cwd=None,
root=None,
runas=None,
shell=None,
env=(),
stateful=False,
umask=None,
output_loglevel='debug',
hide_output=False,
use_vt=False,
... | python | def wait(name,
onlyif=None,
unless=None,
creates=None,
cwd=None,
root=None,
runas=None,
shell=None,
env=(),
stateful=False,
umask=None,
output_loglevel='debug',
hide_output=False,
use_vt=False,
... | [
"def",
"wait",
"(",
"name",
",",
"onlyif",
"=",
"None",
",",
"unless",
"=",
"None",
",",
"creates",
"=",
"None",
",",
"cwd",
"=",
"None",
",",
"root",
"=",
"None",
",",
"runas",
"=",
"None",
",",
"shell",
"=",
"None",
",",
"env",
"=",
"(",
")",... | Run the given command only if the watch statement calls it.
.. note::
Use :mod:`cmd.run <salt.states.cmd.run>` together with :mod:`onchanges </ref/states/requisites#onchanges>`
instead of :mod:`cmd.wait <salt.states.cmd.wait>`.
name
The command to execute, remember that the command wi... | [
"Run",
"the",
"given",
"command",
"only",
"if",
"the",
"watch",
"statement",
"calls",
"it",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/cmd.py#L401-L554 | train |
saltstack/salt | salt/states/cmd.py | wait_script | def wait_script(name,
source=None,
template=None,
onlyif=None,
unless=None,
cwd=None,
runas=None,
shell=None,
env=None,
stateful=False,
umask=None,
... | python | def wait_script(name,
source=None,
template=None,
onlyif=None,
unless=None,
cwd=None,
runas=None,
shell=None,
env=None,
stateful=False,
umask=None,
... | [
"def",
"wait_script",
"(",
"name",
",",
"source",
"=",
"None",
",",
"template",
"=",
"None",
",",
"onlyif",
"=",
"None",
",",
"unless",
"=",
"None",
",",
"cwd",
"=",
"None",
",",
"runas",
"=",
"None",
",",
"shell",
"=",
"None",
",",
"env",
"=",
"... | Download a script from a remote source and execute it only if a watch
statement calls it.
source
The source script being downloaded to the minion, this source script is
hosted on the salt master server. If the file is located on the master
in the directory named spam, and is called egg... | [
"Download",
"a",
"script",
"from",
"a",
"remote",
"source",
"and",
"execute",
"it",
"only",
"if",
"a",
"watch",
"statement",
"calls",
"it",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/cmd.py#L561-L710 | train |
saltstack/salt | salt/states/cmd.py | run | def run(name,
onlyif=None,
unless=None,
creates=None,
cwd=None,
root=None,
runas=None,
shell=None,
env=None,
prepend_path=None,
stateful=False,
umask=None,
output_loglevel='debug',
hide_output=False,
timeout=... | python | def run(name,
onlyif=None,
unless=None,
creates=None,
cwd=None,
root=None,
runas=None,
shell=None,
env=None,
prepend_path=None,
stateful=False,
umask=None,
output_loglevel='debug',
hide_output=False,
timeout=... | [
"def",
"run",
"(",
"name",
",",
"onlyif",
"=",
"None",
",",
"unless",
"=",
"None",
",",
"creates",
"=",
"None",
",",
"cwd",
"=",
"None",
",",
"root",
"=",
"None",
",",
"runas",
"=",
"None",
",",
"shell",
"=",
"None",
",",
"env",
"=",
"None",
",... | Run a command if certain circumstances are met. Use ``cmd.wait`` if you
want to use the ``watch`` requisite.
name
The command to execute, remember that the command will execute with the
path and permissions of the salt-minion.
onlyif
A command to run as a check, run the named comm... | [
"Run",
"a",
"command",
"if",
"certain",
"circumstances",
"are",
"met",
".",
"Use",
"cmd",
".",
"wait",
"if",
"you",
"want",
"to",
"use",
"the",
"watch",
"requisite",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/cmd.py#L713-L1005 | train |
saltstack/salt | salt/states/cmd.py | script | def script(name,
source=None,
template=None,
onlyif=None,
unless=None,
creates=None,
cwd=None,
runas=None,
shell=None,
env=None,
stateful=False,
umask=None,
timeout=None,
use_vt... | python | def script(name,
source=None,
template=None,
onlyif=None,
unless=None,
creates=None,
cwd=None,
runas=None,
shell=None,
env=None,
stateful=False,
umask=None,
timeout=None,
use_vt... | [
"def",
"script",
"(",
"name",
",",
"source",
"=",
"None",
",",
"template",
"=",
"None",
",",
"onlyif",
"=",
"None",
",",
"unless",
"=",
"None",
",",
"creates",
"=",
"None",
",",
"cwd",
"=",
"None",
",",
"runas",
"=",
"None",
",",
"shell",
"=",
"N... | Download a script and execute it with specified arguments.
source
The location of the script to download. If the file is located on the
master in the directory named spam, and is called eggs, the source
string is salt://spam/eggs
template
If this setting is applied then the nam... | [
"Download",
"a",
"script",
"and",
"execute",
"it",
"with",
"specified",
"arguments",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/cmd.py#L1008-L1292 | train |
saltstack/salt | salt/states/cmd.py | call | def call(name,
func,
args=(),
kws=None,
onlyif=None,
unless=None,
creates=None,
output_loglevel='debug',
hide_output=False,
use_vt=False,
**kwargs):
'''
Invoke a pre-defined Python function with arguments specified in the ... | python | def call(name,
func,
args=(),
kws=None,
onlyif=None,
unless=None,
creates=None,
output_loglevel='debug',
hide_output=False,
use_vt=False,
**kwargs):
'''
Invoke a pre-defined Python function with arguments specified in the ... | [
"def",
"call",
"(",
"name",
",",
"func",
",",
"args",
"=",
"(",
")",
",",
"kws",
"=",
"None",
",",
"onlyif",
"=",
"None",
",",
"unless",
"=",
"None",
",",
"creates",
"=",
"None",
",",
"output_loglevel",
"=",
"'debug'",
",",
"hide_output",
"=",
"Fal... | Invoke a pre-defined Python function with arguments specified in the state
declaration. This function is mainly used by the
:mod:`salt.renderers.pydsl` renderer.
The interpretation of ``onlyif`` and ``unless`` arguments are identical to
those of :mod:`cmd.run <salt.states.cmd.run>`, and all other
a... | [
"Invoke",
"a",
"pre",
"-",
"defined",
"Python",
"function",
"with",
"arguments",
"specified",
"in",
"the",
"state",
"declaration",
".",
"This",
"function",
"is",
"mainly",
"used",
"by",
"the",
":",
"mod",
":",
"salt",
".",
"renderers",
".",
"pydsl",
"rende... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/cmd.py#L1295-L1369 | train |
saltstack/salt | salt/states/cmd.py | mod_watch | def mod_watch(name, **kwargs):
'''
Execute a cmd function based on a watch call
.. note::
This state exists to support special handling of the ``watch``
:ref:`requisite <requisites>`. It should not be called directly.
Parameters for this function should be set by the state being tr... | python | def mod_watch(name, **kwargs):
'''
Execute a cmd function based on a watch call
.. note::
This state exists to support special handling of the ``watch``
:ref:`requisite <requisites>`. It should not be called directly.
Parameters for this function should be set by the state being tr... | [
"def",
"mod_watch",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"kwargs",
"[",
"'sfun'",
"]",
"in",
"(",
"'wait'",
",",
"'run'",
",",
"'watch'",
")",
":",
"if",
"kwargs",
".",
"get",
"(",
"'stateful'",
")",
":",
"kwargs",
".",
"pop",
"(... | Execute a cmd function based on a watch call
.. note::
This state exists to support special handling of the ``watch``
:ref:`requisite <requisites>`. It should not be called directly.
Parameters for this function should be set by the state being triggered. | [
"Execute",
"a",
"cmd",
"function",
"based",
"on",
"a",
"watch",
"call"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/cmd.py#L1391-L1429 | train |
saltstack/salt | salt/utils/openstack/nova.py | check_nova | def check_nova():
'''
Check version of novaclient
'''
if HAS_NOVA:
novaclient_ver = _LooseVersion(novaclient.__version__)
min_ver = _LooseVersion(NOVACLIENT_MINVER)
if min_ver <= novaclient_ver:
return HAS_NOVA
log.debug('Newer novaclient version required. Mi... | python | def check_nova():
'''
Check version of novaclient
'''
if HAS_NOVA:
novaclient_ver = _LooseVersion(novaclient.__version__)
min_ver = _LooseVersion(NOVACLIENT_MINVER)
if min_ver <= novaclient_ver:
return HAS_NOVA
log.debug('Newer novaclient version required. Mi... | [
"def",
"check_nova",
"(",
")",
":",
"if",
"HAS_NOVA",
":",
"novaclient_ver",
"=",
"_LooseVersion",
"(",
"novaclient",
".",
"__version__",
")",
"min_ver",
"=",
"_LooseVersion",
"(",
"NOVACLIENT_MINVER",
")",
"if",
"min_ver",
"<=",
"novaclient_ver",
":",
"return",... | Check version of novaclient | [
"Check",
"version",
"of",
"novaclient"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/openstack/nova.py#L67-L77 | train |
saltstack/salt | salt/utils/openstack/nova.py | SaltNova._get_version_from_url | def _get_version_from_url(self, url):
'''
Exctract API version from provided URL
'''
regex = re.compile(r"^https?:\/\/.*\/(v[0-9])(\.[0-9])?(\/)?$")
try:
ver = regex.match(url)
if ver.group(1):
retver = ver.group(1)
if ver.g... | python | def _get_version_from_url(self, url):
'''
Exctract API version from provided URL
'''
regex = re.compile(r"^https?:\/\/.*\/(v[0-9])(\.[0-9])?(\/)?$")
try:
ver = regex.match(url)
if ver.group(1):
retver = ver.group(1)
if ver.g... | [
"def",
"_get_version_from_url",
"(",
"self",
",",
"url",
")",
":",
"regex",
"=",
"re",
".",
"compile",
"(",
"r\"^https?:\\/\\/.*\\/(v[0-9])(\\.[0-9])?(\\/)?$\"",
")",
"try",
":",
"ver",
"=",
"regex",
".",
"match",
"(",
"url",
")",
"if",
"ver",
".",
"group",
... | Exctract API version from provided URL | [
"Exctract",
"API",
"version",
"from",
"provided",
"URL"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/openstack/nova.py#L268-L281 | train |
saltstack/salt | salt/utils/openstack/nova.py | SaltNova._discover_ks_version | def _discover_ks_version(self, url):
'''
Keystone API version discovery
'''
result = salt.utils.http.query(url, backend='requests', status=True, decode=True, decode_type='json')
versions = json.loads(result['body'])
try:
links = [ver['links'] for ver in versio... | python | def _discover_ks_version(self, url):
'''
Keystone API version discovery
'''
result = salt.utils.http.query(url, backend='requests', status=True, decode=True, decode_type='json')
versions = json.loads(result['body'])
try:
links = [ver['links'] for ver in versio... | [
"def",
"_discover_ks_version",
"(",
"self",
",",
"url",
")",
":",
"result",
"=",
"salt",
".",
"utils",
".",
"http",
".",
"query",
"(",
"url",
",",
"backend",
"=",
"'requests'",
",",
"status",
"=",
"True",
",",
"decode",
"=",
"True",
",",
"decode_type",... | Keystone API version discovery | [
"Keystone",
"API",
"version",
"discovery"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/openstack/nova.py#L283-L295 | train |
saltstack/salt | salt/utils/openstack/nova.py | SaltNova.server_show_libcloud | def server_show_libcloud(self, uuid):
'''
Make output look like libcloud output for consistency
'''
server_info = self.server_show(uuid)
server = next(six.itervalues(server_info))
server_name = next(six.iterkeys(server_info))
if not hasattr(self, 'password'):
... | python | def server_show_libcloud(self, uuid):
'''
Make output look like libcloud output for consistency
'''
server_info = self.server_show(uuid)
server = next(six.itervalues(server_info))
server_name = next(six.iterkeys(server_info))
if not hasattr(self, 'password'):
... | [
"def",
"server_show_libcloud",
"(",
"self",
",",
"uuid",
")",
":",
"server_info",
"=",
"self",
".",
"server_show",
"(",
"uuid",
")",
"server",
"=",
"next",
"(",
"six",
".",
"itervalues",
"(",
"server_info",
")",
")",
"server_name",
"=",
"next",
"(",
"six... | Make output look like libcloud output for consistency | [
"Make",
"output",
"look",
"like",
"libcloud",
"output",
"for",
"consistency"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/openstack/nova.py#L483-L494 | train |
saltstack/salt | salt/utils/openstack/nova.py | SaltNova.boot | def boot(self, name, flavor_id=0, image_id=0, timeout=300, **kwargs):
'''
Boot a cloud server.
'''
nt_ks = self.compute_conn
kwargs['name'] = name
kwargs['flavor'] = flavor_id
kwargs['image'] = image_id or None
ephemeral = kwargs.pop('ephemeral', [])
... | python | def boot(self, name, flavor_id=0, image_id=0, timeout=300, **kwargs):
'''
Boot a cloud server.
'''
nt_ks = self.compute_conn
kwargs['name'] = name
kwargs['flavor'] = flavor_id
kwargs['image'] = image_id or None
ephemeral = kwargs.pop('ephemeral', [])
... | [
"def",
"boot",
"(",
"self",
",",
"name",
",",
"flavor_id",
"=",
"0",
",",
"image_id",
"=",
"0",
",",
"timeout",
"=",
"300",
",",
"*",
"*",
"kwargs",
")",
":",
"nt_ks",
"=",
"self",
".",
"compute_conn",
"kwargs",
"[",
"'name'",
"]",
"=",
"name",
"... | Boot a cloud server. | [
"Boot",
"a",
"cloud",
"server",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/openstack/nova.py#L496-L535 | train |
saltstack/salt | salt/utils/openstack/nova.py | SaltNova.root_password | def root_password(self, server_id, password):
'''
Change server(uuid's) root password
'''
nt_ks = self.compute_conn
nt_ks.servers.change_password(server_id, password) | python | def root_password(self, server_id, password):
'''
Change server(uuid's) root password
'''
nt_ks = self.compute_conn
nt_ks.servers.change_password(server_id, password) | [
"def",
"root_password",
"(",
"self",
",",
"server_id",
",",
"password",
")",
":",
"nt_ks",
"=",
"self",
".",
"compute_conn",
"nt_ks",
".",
"servers",
".",
"change_password",
"(",
"server_id",
",",
"password",
")"
] | Change server(uuid's) root password | [
"Change",
"server",
"(",
"uuid",
"s",
")",
"root",
"password"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/openstack/nova.py#L543-L548 | train |
saltstack/salt | salt/utils/openstack/nova.py | SaltNova.server_by_name | def server_by_name(self, name):
'''
Find a server by its name
'''
return self.server_show_libcloud(
self.server_list().get(name, {}).get('id', '')
) | python | def server_by_name(self, name):
'''
Find a server by its name
'''
return self.server_show_libcloud(
self.server_list().get(name, {}).get('id', '')
) | [
"def",
"server_by_name",
"(",
"self",
",",
"name",
")",
":",
"return",
"self",
".",
"server_show_libcloud",
"(",
"self",
".",
"server_list",
"(",
")",
".",
"get",
"(",
"name",
",",
"{",
"}",
")",
".",
"get",
"(",
"'id'",
",",
"''",
")",
")"
] | Find a server by its name | [
"Find",
"a",
"server",
"by",
"its",
"name"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/openstack/nova.py#L550-L556 | train |
saltstack/salt | salt/utils/openstack/nova.py | SaltNova._volume_get | def _volume_get(self, volume_id):
'''
Organize information about a volume from the volume_id
'''
if self.volume_conn is None:
raise SaltCloudSystemExit('No cinder endpoint available')
nt_ks = self.volume_conn
volume = nt_ks.volumes.get(volume_id)
respo... | python | def _volume_get(self, volume_id):
'''
Organize information about a volume from the volume_id
'''
if self.volume_conn is None:
raise SaltCloudSystemExit('No cinder endpoint available')
nt_ks = self.volume_conn
volume = nt_ks.volumes.get(volume_id)
respo... | [
"def",
"_volume_get",
"(",
"self",
",",
"volume_id",
")",
":",
"if",
"self",
".",
"volume_conn",
"is",
"None",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'No cinder endpoint available'",
")",
"nt_ks",
"=",
"self",
".",
"volume_conn",
"volume",
"=",
"nt_ks",
".... | Organize information about a volume from the volume_id | [
"Organize",
"information",
"about",
"a",
"volume",
"from",
"the",
"volume_id"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/openstack/nova.py#L558-L573 | train |
saltstack/salt | salt/utils/openstack/nova.py | SaltNova.volume_list | def volume_list(self, search_opts=None):
'''
List all block volumes
'''
if self.volume_conn is None:
raise SaltCloudSystemExit('No cinder endpoint available')
nt_ks = self.volume_conn
volumes = nt_ks.volumes.list(search_opts=search_opts)
response = {}
... | python | def volume_list(self, search_opts=None):
'''
List all block volumes
'''
if self.volume_conn is None:
raise SaltCloudSystemExit('No cinder endpoint available')
nt_ks = self.volume_conn
volumes = nt_ks.volumes.list(search_opts=search_opts)
response = {}
... | [
"def",
"volume_list",
"(",
"self",
",",
"search_opts",
"=",
"None",
")",
":",
"if",
"self",
".",
"volume_conn",
"is",
"None",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'No cinder endpoint available'",
")",
"nt_ks",
"=",
"self",
".",
"volume_conn",
"volumes",
... | List all block volumes | [
"List",
"all",
"block",
"volumes"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/openstack/nova.py#L575-L593 | train |
saltstack/salt | salt/utils/openstack/nova.py | SaltNova.volume_show | def volume_show(self, name):
'''
Show one volume
'''
if self.volume_conn is None:
raise SaltCloudSystemExit('No cinder endpoint available')
nt_ks = self.volume_conn
volumes = self.volume_list(
search_opts={'display_name': name},
)
v... | python | def volume_show(self, name):
'''
Show one volume
'''
if self.volume_conn is None:
raise SaltCloudSystemExit('No cinder endpoint available')
nt_ks = self.volume_conn
volumes = self.volume_list(
search_opts={'display_name': name},
)
v... | [
"def",
"volume_show",
"(",
"self",
",",
"name",
")",
":",
"if",
"self",
".",
"volume_conn",
"is",
"None",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'No cinder endpoint available'",
")",
"nt_ks",
"=",
"self",
".",
"volume_conn",
"volumes",
"=",
"self",
".",
... | Show one volume | [
"Show",
"one",
"volume"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/openstack/nova.py#L595-L611 | train |
saltstack/salt | salt/utils/openstack/nova.py | SaltNova.volume_create | def volume_create(self, name, size=100, snapshot=None, voltype=None,
availability_zone=None):
'''
Create a block device
'''
if self.volume_conn is None:
raise SaltCloudSystemExit('No cinder endpoint available')
nt_ks = self.volume_conn
re... | python | def volume_create(self, name, size=100, snapshot=None, voltype=None,
availability_zone=None):
'''
Create a block device
'''
if self.volume_conn is None:
raise SaltCloudSystemExit('No cinder endpoint available')
nt_ks = self.volume_conn
re... | [
"def",
"volume_create",
"(",
"self",
",",
"name",
",",
"size",
"=",
"100",
",",
"snapshot",
"=",
"None",
",",
"voltype",
"=",
"None",
",",
"availability_zone",
"=",
"None",
")",
":",
"if",
"self",
".",
"volume_conn",
"is",
"None",
":",
"raise",
"SaltCl... | Create a block device | [
"Create",
"a",
"block",
"device"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/openstack/nova.py#L613-L629 | train |
saltstack/salt | salt/utils/openstack/nova.py | SaltNova.volume_delete | def volume_delete(self, name):
'''
Delete a block device
'''
if self.volume_conn is None:
raise SaltCloudSystemExit('No cinder endpoint available')
nt_ks = self.volume_conn
try:
volume = self.volume_show(name)
except KeyError as exc:
... | python | def volume_delete(self, name):
'''
Delete a block device
'''
if self.volume_conn is None:
raise SaltCloudSystemExit('No cinder endpoint available')
nt_ks = self.volume_conn
try:
volume = self.volume_show(name)
except KeyError as exc:
... | [
"def",
"volume_delete",
"(",
"self",
",",
"name",
")",
":",
"if",
"self",
".",
"volume_conn",
"is",
"None",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'No cinder endpoint available'",
")",
"nt_ks",
"=",
"self",
".",
"volume_conn",
"try",
":",
"volume",
"=",
... | Delete a block device | [
"Delete",
"a",
"block",
"device"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/openstack/nova.py#L631-L645 | train |
saltstack/salt | salt/utils/openstack/nova.py | SaltNova.volume_detach | def volume_detach(self,
name,
timeout=300):
'''
Detach a block device
'''
try:
volume = self.volume_show(name)
except KeyError as exc:
raise SaltCloudSystemExit('Unable to find {0} volume: {1}'.format(name, exc))... | python | def volume_detach(self,
name,
timeout=300):
'''
Detach a block device
'''
try:
volume = self.volume_show(name)
except KeyError as exc:
raise SaltCloudSystemExit('Unable to find {0} volume: {1}'.format(name, exc))... | [
"def",
"volume_detach",
"(",
"self",
",",
"name",
",",
"timeout",
"=",
"300",
")",
":",
"try",
":",
"volume",
"=",
"self",
".",
"volume_show",
"(",
"name",
")",
"except",
"KeyError",
"as",
"exc",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'Unable to find {... | Detach a block device | [
"Detach",
"a",
"block",
"device"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/openstack/nova.py#L647-L681 | train |
saltstack/salt | salt/utils/openstack/nova.py | SaltNova.volume_attach | def volume_attach(self,
name,
server_name,
device='/dev/xvdb',
timeout=300):
'''
Attach a block device
'''
try:
volume = self.volume_show(name)
except KeyError as exc:
... | python | def volume_attach(self,
name,
server_name,
device='/dev/xvdb',
timeout=300):
'''
Attach a block device
'''
try:
volume = self.volume_show(name)
except KeyError as exc:
... | [
"def",
"volume_attach",
"(",
"self",
",",
"name",
",",
"server_name",
",",
"device",
"=",
"'/dev/xvdb'",
",",
"timeout",
"=",
"300",
")",
":",
"try",
":",
"volume",
"=",
"self",
".",
"volume_show",
"(",
"name",
")",
"except",
"KeyError",
"as",
"exc",
"... | Attach a block device | [
"Attach",
"a",
"block",
"device"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/openstack/nova.py#L683-L719 | train |
saltstack/salt | salt/utils/openstack/nova.py | SaltNova.suspend | def suspend(self, instance_id):
'''
Suspend a server
'''
nt_ks = self.compute_conn
response = nt_ks.servers.suspend(instance_id)
return True | python | def suspend(self, instance_id):
'''
Suspend a server
'''
nt_ks = self.compute_conn
response = nt_ks.servers.suspend(instance_id)
return True | [
"def",
"suspend",
"(",
"self",
",",
"instance_id",
")",
":",
"nt_ks",
"=",
"self",
".",
"compute_conn",
"response",
"=",
"nt_ks",
".",
"servers",
".",
"suspend",
"(",
"instance_id",
")",
"return",
"True"
] | Suspend a server | [
"Suspend",
"a",
"server"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/openstack/nova.py#L721-L727 | train |
saltstack/salt | salt/utils/openstack/nova.py | SaltNova.resume | def resume(self, instance_id):
'''
Resume a server
'''
nt_ks = self.compute_conn
response = nt_ks.servers.resume(instance_id)
return True | python | def resume(self, instance_id):
'''
Resume a server
'''
nt_ks = self.compute_conn
response = nt_ks.servers.resume(instance_id)
return True | [
"def",
"resume",
"(",
"self",
",",
"instance_id",
")",
":",
"nt_ks",
"=",
"self",
".",
"compute_conn",
"response",
"=",
"nt_ks",
".",
"servers",
".",
"resume",
"(",
"instance_id",
")",
"return",
"True"
] | Resume a server | [
"Resume",
"a",
"server"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/openstack/nova.py#L729-L735 | train |
saltstack/salt | salt/utils/openstack/nova.py | SaltNova.lock | def lock(self, instance_id):
'''
Lock an instance
'''
nt_ks = self.compute_conn
response = nt_ks.servers.lock(instance_id)
return True | python | def lock(self, instance_id):
'''
Lock an instance
'''
nt_ks = self.compute_conn
response = nt_ks.servers.lock(instance_id)
return True | [
"def",
"lock",
"(",
"self",
",",
"instance_id",
")",
":",
"nt_ks",
"=",
"self",
".",
"compute_conn",
"response",
"=",
"nt_ks",
".",
"servers",
".",
"lock",
"(",
"instance_id",
")",
"return",
"True"
] | Lock an instance | [
"Lock",
"an",
"instance"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/openstack/nova.py#L737-L743 | train |
saltstack/salt | salt/utils/openstack/nova.py | SaltNova.delete | def delete(self, instance_id):
'''
Delete a server
'''
nt_ks = self.compute_conn
response = nt_ks.servers.delete(instance_id)
return True | python | def delete(self, instance_id):
'''
Delete a server
'''
nt_ks = self.compute_conn
response = nt_ks.servers.delete(instance_id)
return True | [
"def",
"delete",
"(",
"self",
",",
"instance_id",
")",
":",
"nt_ks",
"=",
"self",
".",
"compute_conn",
"response",
"=",
"nt_ks",
".",
"servers",
".",
"delete",
"(",
"instance_id",
")",
"return",
"True"
] | Delete a server | [
"Delete",
"a",
"server"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/openstack/nova.py#L745-L751 | train |
saltstack/salt | salt/utils/openstack/nova.py | SaltNova.flavor_list | def flavor_list(self, **kwargs):
'''
Return a list of available flavors (nova flavor-list)
'''
nt_ks = self.compute_conn
ret = {}
for flavor in nt_ks.flavors.list(**kwargs):
links = {}
for link in flavor.links:
links[link['rel']] = ... | python | def flavor_list(self, **kwargs):
'''
Return a list of available flavors (nova flavor-list)
'''
nt_ks = self.compute_conn
ret = {}
for flavor in nt_ks.flavors.list(**kwargs):
links = {}
for link in flavor.links:
links[link['rel']] = ... | [
"def",
"flavor_list",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"nt_ks",
"=",
"self",
".",
"compute_conn",
"ret",
"=",
"{",
"}",
"for",
"flavor",
"in",
"nt_ks",
".",
"flavors",
".",
"list",
"(",
"*",
"*",
"kwargs",
")",
":",
"links",
"=",
"... | Return a list of available flavors (nova flavor-list) | [
"Return",
"a",
"list",
"of",
"available",
"flavors",
"(",
"nova",
"flavor",
"-",
"list",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/openstack/nova.py#L753-L774 | train |
saltstack/salt | salt/utils/openstack/nova.py | SaltNova.flavor_create | def flavor_create(self,
name, # pylint: disable=C0103
flavor_id=0, # pylint: disable=C0103
ram=0,
disk=0,
vcpus=1,
is_public=True):
'''
Create a flavor
... | python | def flavor_create(self,
name, # pylint: disable=C0103
flavor_id=0, # pylint: disable=C0103
ram=0,
disk=0,
vcpus=1,
is_public=True):
'''
Create a flavor
... | [
"def",
"flavor_create",
"(",
"self",
",",
"name",
",",
"# pylint: disable=C0103",
"flavor_id",
"=",
"0",
",",
"# pylint: disable=C0103",
"ram",
"=",
"0",
",",
"disk",
"=",
"0",
",",
"vcpus",
"=",
"1",
",",
"is_public",
"=",
"True",
")",
":",
"nt_ks",
"="... | Create a flavor | [
"Create",
"a",
"flavor"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/openstack/nova.py#L778-L797 | train |
saltstack/salt | salt/utils/openstack/nova.py | SaltNova.flavor_delete | def flavor_delete(self, flavor_id): # pylint: disable=C0103
'''
Delete a flavor
'''
nt_ks = self.compute_conn
nt_ks.flavors.delete(flavor_id)
return 'Flavor deleted: {0}'.format(flavor_id) | python | def flavor_delete(self, flavor_id): # pylint: disable=C0103
'''
Delete a flavor
'''
nt_ks = self.compute_conn
nt_ks.flavors.delete(flavor_id)
return 'Flavor deleted: {0}'.format(flavor_id) | [
"def",
"flavor_delete",
"(",
"self",
",",
"flavor_id",
")",
":",
"# pylint: disable=C0103",
"nt_ks",
"=",
"self",
".",
"compute_conn",
"nt_ks",
".",
"flavors",
".",
"delete",
"(",
"flavor_id",
")",
"return",
"'Flavor deleted: {0}'",
".",
"format",
"(",
"flavor_i... | Delete a flavor | [
"Delete",
"a",
"flavor"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/openstack/nova.py#L799-L805 | train |
saltstack/salt | salt/utils/openstack/nova.py | SaltNova.flavor_access_list | def flavor_access_list(self, **kwargs):
'''
Return a list of project IDs assigned to flavor ID
'''
flavor_id = kwargs.get('flavor_id')
nt_ks = self.compute_conn
ret = {flavor_id: []}
flavor_accesses = nt_ks.flavor_access.list(flavor=flavor_id, **kwargs)
fo... | python | def flavor_access_list(self, **kwargs):
'''
Return a list of project IDs assigned to flavor ID
'''
flavor_id = kwargs.get('flavor_id')
nt_ks = self.compute_conn
ret = {flavor_id: []}
flavor_accesses = nt_ks.flavor_access.list(flavor=flavor_id, **kwargs)
fo... | [
"def",
"flavor_access_list",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"flavor_id",
"=",
"kwargs",
".",
"get",
"(",
"'flavor_id'",
")",
"nt_ks",
"=",
"self",
".",
"compute_conn",
"ret",
"=",
"{",
"flavor_id",
":",
"[",
"]",
"}",
"flavor_accesses",
... | Return a list of project IDs assigned to flavor ID | [
"Return",
"a",
"list",
"of",
"project",
"IDs",
"assigned",
"to",
"flavor",
"ID"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/openstack/nova.py#L807-L817 | train |
saltstack/salt | salt/utils/openstack/nova.py | SaltNova.flavor_access_add | def flavor_access_add(self, flavor_id, project_id):
'''
Add a project to the flavor access list
'''
nt_ks = self.compute_conn
ret = {flavor_id: []}
flavor_accesses = nt_ks.flavor_access.add_tenant_access(flavor_id, project_id)
for project in flavor_accesses:
... | python | def flavor_access_add(self, flavor_id, project_id):
'''
Add a project to the flavor access list
'''
nt_ks = self.compute_conn
ret = {flavor_id: []}
flavor_accesses = nt_ks.flavor_access.add_tenant_access(flavor_id, project_id)
for project in flavor_accesses:
... | [
"def",
"flavor_access_add",
"(",
"self",
",",
"flavor_id",
",",
"project_id",
")",
":",
"nt_ks",
"=",
"self",
".",
"compute_conn",
"ret",
"=",
"{",
"flavor_id",
":",
"[",
"]",
"}",
"flavor_accesses",
"=",
"nt_ks",
".",
"flavor_access",
".",
"add_tenant_acces... | Add a project to the flavor access list | [
"Add",
"a",
"project",
"to",
"the",
"flavor",
"access",
"list"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/openstack/nova.py#L819-L828 | train |
saltstack/salt | salt/utils/openstack/nova.py | SaltNova.flavor_access_remove | def flavor_access_remove(self, flavor_id, project_id):
'''
Remove a project from the flavor access list
'''
nt_ks = self.compute_conn
ret = {flavor_id: []}
flavor_accesses = nt_ks.flavor_access.remove_tenant_access(flavor_id, project_id)
for project in flavor_acce... | python | def flavor_access_remove(self, flavor_id, project_id):
'''
Remove a project from the flavor access list
'''
nt_ks = self.compute_conn
ret = {flavor_id: []}
flavor_accesses = nt_ks.flavor_access.remove_tenant_access(flavor_id, project_id)
for project in flavor_acce... | [
"def",
"flavor_access_remove",
"(",
"self",
",",
"flavor_id",
",",
"project_id",
")",
":",
"nt_ks",
"=",
"self",
".",
"compute_conn",
"ret",
"=",
"{",
"flavor_id",
":",
"[",
"]",
"}",
"flavor_accesses",
"=",
"nt_ks",
".",
"flavor_access",
".",
"remove_tenant... | Remove a project from the flavor access list | [
"Remove",
"a",
"project",
"from",
"the",
"flavor",
"access",
"list"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/openstack/nova.py#L830-L839 | train |
saltstack/salt | salt/utils/openstack/nova.py | SaltNova.keypair_list | def keypair_list(self):
'''
List keypairs
'''
nt_ks = self.compute_conn
ret = {}
for keypair in nt_ks.keypairs.list():
ret[keypair.name] = {
'name': keypair.name,
'fingerprint': keypair.fingerprint,
'public_key':... | python | def keypair_list(self):
'''
List keypairs
'''
nt_ks = self.compute_conn
ret = {}
for keypair in nt_ks.keypairs.list():
ret[keypair.name] = {
'name': keypair.name,
'fingerprint': keypair.fingerprint,
'public_key':... | [
"def",
"keypair_list",
"(",
"self",
")",
":",
"nt_ks",
"=",
"self",
".",
"compute_conn",
"ret",
"=",
"{",
"}",
"for",
"keypair",
"in",
"nt_ks",
".",
"keypairs",
".",
"list",
"(",
")",
":",
"ret",
"[",
"keypair",
".",
"name",
"]",
"=",
"{",
"'name'"... | List keypairs | [
"List",
"keypairs"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/openstack/nova.py#L841-L853 | train |
saltstack/salt | salt/utils/openstack/nova.py | SaltNova.keypair_add | def keypair_add(self, name, pubfile=None, pubkey=None):
'''
Add a keypair
'''
nt_ks = self.compute_conn
if pubfile:
with salt.utils.files.fopen(pubfile, 'r') as fp_:
pubkey = salt.utils.stringutils.to_unicode(fp_.read())
if not pubkey:
... | python | def keypair_add(self, name, pubfile=None, pubkey=None):
'''
Add a keypair
'''
nt_ks = self.compute_conn
if pubfile:
with salt.utils.files.fopen(pubfile, 'r') as fp_:
pubkey = salt.utils.stringutils.to_unicode(fp_.read())
if not pubkey:
... | [
"def",
"keypair_add",
"(",
"self",
",",
"name",
",",
"pubfile",
"=",
"None",
",",
"pubkey",
"=",
"None",
")",
":",
"nt_ks",
"=",
"self",
".",
"compute_conn",
"if",
"pubfile",
":",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"fopen",
"(",
"pubfil... | Add a keypair | [
"Add",
"a",
"keypair"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/openstack/nova.py#L855-L867 | train |
saltstack/salt | salt/utils/openstack/nova.py | SaltNova.keypair_delete | def keypair_delete(self, name):
'''
Delete a keypair
'''
nt_ks = self.compute_conn
nt_ks.keypairs.delete(name)
return 'Keypair deleted: {0}'.format(name) | python | def keypair_delete(self, name):
'''
Delete a keypair
'''
nt_ks = self.compute_conn
nt_ks.keypairs.delete(name)
return 'Keypair deleted: {0}'.format(name) | [
"def",
"keypair_delete",
"(",
"self",
",",
"name",
")",
":",
"nt_ks",
"=",
"self",
".",
"compute_conn",
"nt_ks",
".",
"keypairs",
".",
"delete",
"(",
"name",
")",
"return",
"'Keypair deleted: {0}'",
".",
"format",
"(",
"name",
")"
] | Delete a keypair | [
"Delete",
"a",
"keypair"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/openstack/nova.py#L869-L875 | train |
saltstack/salt | salt/utils/openstack/nova.py | SaltNova.image_show | def image_show(self, image_id):
'''
Show image details and metadata
'''
nt_ks = self.compute_conn
image = nt_ks.images.get(image_id)
links = {}
for link in image.links:
links[link['rel']] = link['href']
ret = {
'name': image.name,
... | python | def image_show(self, image_id):
'''
Show image details and metadata
'''
nt_ks = self.compute_conn
image = nt_ks.images.get(image_id)
links = {}
for link in image.links:
links[link['rel']] = link['href']
ret = {
'name': image.name,
... | [
"def",
"image_show",
"(",
"self",
",",
"image_id",
")",
":",
"nt_ks",
"=",
"self",
".",
"compute_conn",
"image",
"=",
"nt_ks",
".",
"images",
".",
"get",
"(",
"image_id",
")",
"links",
"=",
"{",
"}",
"for",
"link",
"in",
"image",
".",
"links",
":",
... | Show image details and metadata | [
"Show",
"image",
"details",
"and",
"metadata"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/openstack/nova.py#L877-L901 | train |
saltstack/salt | salt/utils/openstack/nova.py | SaltNova.image_list | def image_list(self, name=None):
'''
List server images
'''
nt_ks = self.compute_conn
ret = {}
for image in nt_ks.images.list():
links = {}
for link in image.links:
links[link['rel']] = link['href']
ret[image.name] = {
... | python | def image_list(self, name=None):
'''
List server images
'''
nt_ks = self.compute_conn
ret = {}
for image in nt_ks.images.list():
links = {}
for link in image.links:
links[link['rel']] = link['href']
ret[image.name] = {
... | [
"def",
"image_list",
"(",
"self",
",",
"name",
"=",
"None",
")",
":",
"nt_ks",
"=",
"self",
".",
"compute_conn",
"ret",
"=",
"{",
"}",
"for",
"image",
"in",
"nt_ks",
".",
"images",
".",
"list",
"(",
")",
":",
"links",
"=",
"{",
"}",
"for",
"link"... | List server images | [
"List",
"server",
"images"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/openstack/nova.py#L903-L929 | train |
saltstack/salt | salt/utils/openstack/nova.py | SaltNova.image_meta_set | def image_meta_set(self,
image_id=None,
name=None,
**kwargs): # pylint: disable=C0103
'''
Set image metadata
'''
nt_ks = self.compute_conn
if name:
for image in nt_ks.images.list():
... | python | def image_meta_set(self,
image_id=None,
name=None,
**kwargs): # pylint: disable=C0103
'''
Set image metadata
'''
nt_ks = self.compute_conn
if name:
for image in nt_ks.images.list():
... | [
"def",
"image_meta_set",
"(",
"self",
",",
"image_id",
"=",
"None",
",",
"name",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"# pylint: disable=C0103",
"nt_ks",
"=",
"self",
".",
"compute_conn",
"if",
"name",
":",
"for",
"image",
"in",
"nt_ks",
".",
... | Set image metadata | [
"Set",
"image",
"metadata"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/openstack/nova.py#L933-L948 | train |
saltstack/salt | salt/utils/openstack/nova.py | SaltNova.image_meta_delete | def image_meta_delete(self,
image_id=None, # pylint: disable=C0103
name=None,
keys=None):
'''
Delete image metadata
'''
nt_ks = self.compute_conn
if name:
for image in nt_ks.images.list(... | python | def image_meta_delete(self,
image_id=None, # pylint: disable=C0103
name=None,
keys=None):
'''
Delete image metadata
'''
nt_ks = self.compute_conn
if name:
for image in nt_ks.images.list(... | [
"def",
"image_meta_delete",
"(",
"self",
",",
"image_id",
"=",
"None",
",",
"# pylint: disable=C0103",
"name",
"=",
"None",
",",
"keys",
"=",
"None",
")",
":",
"nt_ks",
"=",
"self",
".",
"compute_conn",
"if",
"name",
":",
"for",
"image",
"in",
"nt_ks",
"... | Delete image metadata | [
"Delete",
"image",
"metadata"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/openstack/nova.py#L950-L966 | train |
saltstack/salt | salt/utils/openstack/nova.py | SaltNova.server_list | def server_list(self):
'''
List servers
'''
nt_ks = self.compute_conn
ret = {}
for item in nt_ks.servers.list():
try:
ret[item.name] = {
'id': item.id,
'name': item.name,
'state': item... | python | def server_list(self):
'''
List servers
'''
nt_ks = self.compute_conn
ret = {}
for item in nt_ks.servers.list():
try:
ret[item.name] = {
'id': item.id,
'name': item.name,
'state': item... | [
"def",
"server_list",
"(",
"self",
")",
":",
"nt_ks",
"=",
"self",
".",
"compute_conn",
"ret",
"=",
"{",
"}",
"for",
"item",
"in",
"nt_ks",
".",
"servers",
".",
"list",
"(",
")",
":",
"try",
":",
"ret",
"[",
"item",
".",
"name",
"]",
"=",
"{",
... | List servers | [
"List",
"servers"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/openstack/nova.py#L968-L989 | train |
saltstack/salt | salt/utils/openstack/nova.py | SaltNova.server_list_min | def server_list_min(self):
'''
List minimal information about servers
'''
nt_ks = self.compute_conn
ret = {}
for item in nt_ks.servers.list(detailed=False):
try:
ret[item.name] = {
'id': item.id,
'state':... | python | def server_list_min(self):
'''
List minimal information about servers
'''
nt_ks = self.compute_conn
ret = {}
for item in nt_ks.servers.list(detailed=False):
try:
ret[item.name] = {
'id': item.id,
'state':... | [
"def",
"server_list_min",
"(",
"self",
")",
":",
"nt_ks",
"=",
"self",
".",
"compute_conn",
"ret",
"=",
"{",
"}",
"for",
"item",
"in",
"nt_ks",
".",
"servers",
".",
"list",
"(",
"detailed",
"=",
"False",
")",
":",
"try",
":",
"ret",
"[",
"item",
".... | List minimal information about servers | [
"List",
"minimal",
"information",
"about",
"servers"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/openstack/nova.py#L991-L1005 | train |
saltstack/salt | salt/utils/openstack/nova.py | SaltNova.server_list_detailed | def server_list_detailed(self):
'''
Detailed list of servers
'''
nt_ks = self.compute_conn
ret = {}
for item in nt_ks.servers.list():
try:
ret[item.name] = {
'OS-EXT-SRV-ATTR': {},
'OS-EXT-STS': {},
... | python | def server_list_detailed(self):
'''
Detailed list of servers
'''
nt_ks = self.compute_conn
ret = {}
for item in nt_ks.servers.list():
try:
ret[item.name] = {
'OS-EXT-SRV-ATTR': {},
'OS-EXT-STS': {},
... | [
"def",
"server_list_detailed",
"(",
"self",
")",
":",
"nt_ks",
"=",
"self",
".",
"compute_conn",
"ret",
"=",
"{",
"}",
"for",
"item",
"in",
"nt_ks",
".",
"servers",
".",
"list",
"(",
")",
":",
"try",
":",
"ret",
"[",
"item",
".",
"name",
"]",
"=",
... | Detailed list of servers | [
"Detailed",
"list",
"of",
"servers"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/openstack/nova.py#L1007-L1067 | train |
saltstack/salt | salt/utils/openstack/nova.py | SaltNova.server_show | def server_show(self, server_id):
'''
Show details of one server
'''
ret = {}
try:
servers = self.server_list_detailed()
except AttributeError:
raise SaltCloudSystemExit('Corrupt server in server_list_detailed. Remove corrupt servers.')
for... | python | def server_show(self, server_id):
'''
Show details of one server
'''
ret = {}
try:
servers = self.server_list_detailed()
except AttributeError:
raise SaltCloudSystemExit('Corrupt server in server_list_detailed. Remove corrupt servers.')
for... | [
"def",
"server_show",
"(",
"self",
",",
"server_id",
")",
":",
"ret",
"=",
"{",
"}",
"try",
":",
"servers",
"=",
"self",
".",
"server_list_detailed",
"(",
")",
"except",
"AttributeError",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'Corrupt server in server_list_... | Show details of one server | [
"Show",
"details",
"of",
"one",
"server"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/openstack/nova.py#L1069-L1081 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.