repository_name
stringclasses
316 values
func_path_in_repository
stringlengths
6
223
func_name
stringlengths
1
134
language
stringclasses
1 value
func_code_string
stringlengths
57
65.5k
func_documentation_string
stringlengths
1
46.3k
split_name
stringclasses
1 value
func_code_url
stringlengths
91
315
called_functions
listlengths
1
156
enclosing_scope
stringlengths
2
1.48M
saltstack/salt
salt/wheel/config.py
apply
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+'...
Set a single key .. note:: This will strip comments from your config file
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/wheel/config.py#L30-L44
[ "def values():\n '''\n Return the raw values of the config file\n '''\n data = salt.config.master_config(__opts__['conf_file'])\n return data\n", "def fopen(*args, **kwargs):\n '''\n Wrapper around open() built-in to set CLOEXEC on the fd.\n\n This flag specifies that the file descriptor s...
# -*- coding: utf-8 -*- ''' Manage the master configuration file ''' from __future__ import absolute_import, print_function, unicode_literals # Import python libs import logging import os # Import salt libs import salt.config import salt.utils.files import salt.utils.yaml # Import 3rd-party libs from salt.ext import...
saltstack/salt
salt/wheel/config.py
update_config
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...
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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/wheel/config.py#L47-L90
[ "def fopen(*args, **kwargs):\n '''\n Wrapper around open() built-in to set CLOEXEC on the fd.\n\n This flag specifies that the file descriptor should be closed when an exec\n function is invoked;\n\n When a file descriptor is allocated (as with open or dup), this bit is\n initially cleared on the ...
# -*- coding: utf-8 -*- ''' Manage the master configuration file ''' from __future__ import absolute_import, print_function, unicode_literals # Import python libs import logging import os # Import salt libs import salt.config import salt.utils.files import salt.utils.yaml # Import 3rd-party libs from salt.ext import...
saltstack/salt
salt/modules/aptpkg.py
_get_ppa_info_from_launchpad
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/...
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:
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptpkg.py#L125-L141
[ "def load(fp, **kwargs):\n '''\n .. versionadded:: 2018.3.0\n\n Wraps json.load\n\n You can pass an alternate json module (loaded via import_json() above)\n using the _json_module argument)\n '''\n return kwargs.pop('_json_module', json).load(fp, **kwargs)\n" ]
# -*- coding: utf-8 -*- ''' Support for APT (Advanced Packaging Tool) .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives an error similar to *'pkg.install' is not available*), see :ref:`here <module-provider-over...
saltstack/salt
salt/modules/aptpkg.py
_call_apt
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', ...
Call apt* utilities.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptpkg.py#L161-L175
[ "def has_scope(context=None):\n '''\n Scopes were introduced in systemd 205, this function returns a boolean\n which is true when the minion is systemd-booted and running systemd>=205.\n '''\n if not booted(context):\n return False\n _sd_version = version(context)\n if _sd_version is Non...
# -*- coding: utf-8 -*- ''' Support for APT (Advanced Packaging Tool) .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives an error similar to *'pkg.install' is not available*), see :ref:`here <module-provider-over...
saltstack/salt
salt/modules/aptpkg.py
refresh_db
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...
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 - ``...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptpkg.py#L297-L376
[ "def is_true(value=None):\n '''\n Returns a boolean value representing the \"truth\" of the value passed. The\n rules for what is a \"True\" value are:\n\n 1. Integer/float values greater than 0\n 2. The string values \"True\" and \"true\"\n 3. Any object for which bool(obj) returns Tr...
# -*- coding: utf-8 -*- ''' Support for APT (Advanced Packaging Tool) .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives an error similar to *'pkg.install' is not available*), see :ref:`here <module-provider-over...
saltstack/salt
salt/modules/aptpkg.py
install
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...
.. 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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptpkg.py#L379-L785
[ "def iteritems(d, **kw):\n return d.iteritems(**kw)\n", "def iterkeys(d, **kw):\n return d.iterkeys(**kw)\n", "def itervalues(d, **kw):\n return d.itervalues(**kw)\n", "def is_true(value=None):\n '''\n Returns a boolean value representing the \"truth\" of the value passed. The\n rules for wh...
# -*- coding: utf-8 -*- ''' Support for APT (Advanced Packaging Tool) .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives an error similar to *'pkg.install' is not available*), see :ref:`here <module-provider-over...
saltstack/salt
salt/modules/aptpkg.py
_uninstall
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: ...
remove and purge do identical things but with different apt-get commands, this function performs the common logic.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptpkg.py#L788-L834
[ "def list_pkgs(versions_as_list=False,\n removed=False,\n purge_desired=False,\n **kwargs): # pylint: disable=W0613\n '''\n List the packages currently installed in a dict::\n\n {'<package_name>': '<version>'}\n\n removed\n If ``True``, then only packag...
# -*- coding: utf-8 -*- ''' Support for APT (Advanced Packaging Tool) .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives an error similar to *'pkg.install' is not available*), see :ref:`here <module-provider-over...
saltstack/salt
salt/modules/aptpkg.py
autoremove
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 :...
.. 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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptpkg.py#L837-L889
[ "def list_pkgs(versions_as_list=False,\n removed=False,\n purge_desired=False,\n **kwargs): # pylint: disable=W0613\n '''\n List the packages currently installed in a dict::\n\n {'<package_name>': '<version>'}\n\n removed\n If ``True``, then only packag...
# -*- coding: utf-8 -*- ''' Support for APT (Advanced Packaging Tool) .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives an error similar to *'pkg.install' is not available*), see :ref:`here <module-provider-over...
saltstack/salt
salt/modules/aptpkg.py
remove
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...
.. 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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptpkg.py#L892-L933
[ "def _uninstall(action='remove', name=None, pkgs=None, **kwargs):\n '''\n remove and purge do identical things but with different apt-get commands,\n this function performs the common logic.\n '''\n try:\n pkg_params = __salt__['pkg_resource.parse_targets'](name, pkgs)[0]\n except MinionErr...
# -*- coding: utf-8 -*- ''' Support for APT (Advanced Packaging Tool) .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives an error similar to *'pkg.install' is not available*), see :ref:`here <module-provider-over...
saltstack/salt
salt/modules/aptpkg.py
purge
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...
.. 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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptpkg.py#L936-L977
[ "def _uninstall(action='remove', name=None, pkgs=None, **kwargs):\n '''\n remove and purge do identical things but with different apt-get commands,\n this function performs the common logic.\n '''\n try:\n pkg_params = __salt__['pkg_resource.parse_targets'](name, pkgs)[0]\n except MinionErr...
# -*- coding: utf-8 -*- ''' Support for APT (Advanced Packaging Tool) .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives an error similar to *'pkg.install' is not available*), see :ref:`here <module-provider-over...
saltstack/salt
salt/modules/aptpkg.py
upgrade
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...
.. 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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptpkg.py#L980-L1066
[ "def is_true(value=None):\n '''\n Returns a boolean value representing the \"truth\" of the value passed. The\n rules for what is a \"True\" value are:\n\n 1. Integer/float values greater than 0\n 2. The string values \"True\" and \"true\"\n 3. Any object for which bool(obj) returns Tr...
# -*- coding: utf-8 -*- ''' Support for APT (Advanced Packaging Tool) .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives an error similar to *'pkg.install' is not available*), see :ref:`here <module-provider-over...
saltstack/salt
salt/modules/aptpkg.py
hold
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...
.. 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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptpkg.py#L1069-L1139
[ "def is_true(value=None):\n '''\n Returns a boolean value representing the \"truth\" of the value passed. The\n rules for what is a \"True\" value are:\n\n 1. Integer/float values greater than 0\n 2. The string values \"True\" and \"true\"\n 3. Any object for which bool(obj) returns Tr...
# -*- coding: utf-8 -*- ''' Support for APT (Advanced Packaging Tool) .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives an error similar to *'pkg.install' is not available*), see :ref:`here <module-provider-over...
saltstack/salt
salt/modules/aptpkg.py
list_pkgs
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...
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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptpkg.py#L1216-L1313
[ "def is_true(value=None):\n '''\n Returns a boolean value representing the \"truth\" of the value passed. The\n rules for what is a \"True\" value are:\n\n 1. Integer/float values greater than 0\n 2. The string values \"True\" and \"true\"\n 3. Any object for which bool(obj) returns Tr...
# -*- coding: utf-8 -*- ''' Support for APT (Advanced Packaging Tool) .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives an error similar to *'pkg.install' is not available*), see :ref:`here <module-provider-over...
saltstack/salt
salt/modules/aptpkg.py
_get_upgradable
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: ...
Utility function to get upgradable packages Sample return data: { 'pkgname': '1.2.3-45', ... }
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptpkg.py#L1316-L1361
[ "def _call_apt(args, scope=True, **kwargs):\n '''\n Call apt* utilities.\n '''\n cmd = []\n if scope and salt.utils.systemd.has_scope(__context__) and __salt__['config.get']('systemd.scope', True):\n cmd.extend(['systemd-run', '--scope'])\n cmd.extend(args)\n\n params = {'output_loglevel...
# -*- coding: utf-8 -*- ''' Support for APT (Advanced Packaging Tool) .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives an error similar to *'pkg.install' is not available*), see :ref:`here <module-provider-over...
saltstack/salt
salt/modules/aptpkg.py
list_upgrades
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...
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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptpkg.py#L1364-L1392
[ "def is_true(value=None):\n '''\n Returns a boolean value representing the \"truth\" of the value passed. The\n rules for what is a \"True\" value are:\n\n 1. Integer/float values greater than 0\n 2. The string values \"True\" and \"true\"\n 3. Any object for which bool(obj) returns Tr...
# -*- coding: utf-8 -*- ''' Support for APT (Advanced Packaging Tool) .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives an error similar to *'pkg.install' is not available*), see :ref:`here <module-provider-over...
saltstack/salt
salt/modules/aptpkg.py
version_cmp
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...
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 ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptpkg.py#L1408-L1461
[ "normalize = lambda x: six.text_type(x).split(':', 1)[-1] \\\n if ignore_epoch else six.text_type(x)\n" ]
# -*- coding: utf-8 -*- ''' Support for APT (Advanced Packaging Tool) .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives an error similar to *'pkg.install' is not available*), see :ref:`here <module-provider-over...
saltstack/salt
salt/modules/aptpkg.py
_split_repo_str
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
Return APT source entry as a tuple.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptpkg.py#L1464-L1469
null
# -*- coding: utf-8 -*- ''' Support for APT (Advanced Packaging Tool) .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives an error similar to *'pkg.install' is not available*), see :ref:`here <module-provider-over...
saltstack/salt
salt/modules/aptpkg.py
_consolidate_repo_sources
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...
Consolidate APT sources.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptpkg.py#L1472-L1513
null
# -*- coding: utf-8 -*- ''' Support for APT (Advanced Packaging Tool) .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives an error similar to *'pkg.install' is not available*), see :ref:`here <module-provider-over...
saltstack/salt
salt/modules/aptpkg.py
list_repo_pkgs
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...
.. 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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptpkg.py#L1516-L1574
[ "def split(orig, sep=None):\n '''\n Generator function for iterating through large strings, particularly useful\n as a replacement for str.splitlines().\n\n See http://stackoverflow.com/a/3865367\n '''\n exp = re.compile(r'\\s+' if sep is None else re.escape(sep))\n pos = 0\n length = len(or...
# -*- coding: utf-8 -*- ''' Support for APT (Advanced Packaging Tool) .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives an error similar to *'pkg.install' is not available*), see :ref:`here <module-provider-over...
saltstack/salt
salt/modules/aptpkg.py
_skip_source
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] == "[": ...
Decide to skip source or not. :param source: :return:
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptpkg.py#L1577-L1595
null
# -*- coding: utf-8 -*- ''' Support for APT (Advanced Packaging Tool) .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives an error similar to *'pkg.install' is not available*), see :ref:`here <module-provider-over...
saltstack/salt
salt/modules/aptpkg.py
list_repos
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...
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
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptpkg.py#L1598-L1626
[ "def _check_apt():\n '''\n Abort if python-apt is not installed\n '''\n if not HAS_APT:\n raise CommandExecutionError(\n 'Error: \\'python-apt\\' package not installed'\n )\n", "def strip_uri(repo):\n '''\n Remove the trailing slash from the URI in a repo definition\n ...
# -*- coding: utf-8 -*- ''' Support for APT (Advanced Packaging Tool) .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives an error similar to *'pkg.install' is not available*), see :ref:`here <module-provider-over...
saltstack/salt
salt/modules/aptpkg.py
get_repo
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) ...
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"
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptpkg.py#L1629-L1701
[ "def itervalues(d, **kw):\n return d.itervalues(**kw)\n", "def list_repos(**kwargs):\n '''\n Lists all repos in the sources.list (and sources.lists.d) files\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' pkg.list_repos\n salt '*' pkg.list_repos disabled=True\n '''\n _check...
# -*- coding: utf-8 -*- ''' Support for APT (Advanced Packaging Tool) .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives an error similar to *'pkg.install' is not available*), see :ref:`here <module-provider-over...
saltstack/salt
salt/modules/aptpkg.py
del_repo
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...
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. ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptpkg.py#L1704-L1814
[ "def iteritems(d, **kw):\n return d.iteritems(**kw)\n", "def refresh_db(cache_valid_time=0, failhard=False, **kwargs):\n '''\n Updates the APT database to latest packages based upon repositories\n\n Returns a dict, with the keys being package databases and the values being\n the result of the updat...
# -*- coding: utf-8 -*- ''' Support for APT (Advanced Packaging Tool) .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives an error similar to *'pkg.install' is not available*), see :ref:`here <module-provider-over...
saltstack/salt
salt/modules/aptpkg.py
get_repo_keys
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 ...
.. 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
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptpkg.py#L1835-L1904
[ "def _call_apt(args, scope=True, **kwargs):\n '''\n Call apt* utilities.\n '''\n cmd = []\n if scope and salt.utils.systemd.has_scope(__context__) and __salt__['config.get']('systemd.scope', True):\n cmd.extend(['systemd-run', '--scope'])\n cmd.extend(args)\n\n params = {'output_loglevel...
# -*- coding: utf-8 -*- ''' Support for APT (Advanced Packaging Tool) .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives an error similar to *'pkg.install' is not available*), see :ref:`here <module-provider-over...
saltstack/salt
salt/modules/aptpkg.py
add_repo_key
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...
.. 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 ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptpkg.py#L1907-L1975
[ "def _call_apt(args, scope=True, **kwargs):\n '''\n Call apt* utilities.\n '''\n cmd = []\n if scope and salt.utils.systemd.has_scope(__context__) and __salt__['config.get']('systemd.scope', True):\n cmd.extend(['systemd-run', '--scope'])\n cmd.extend(args)\n\n params = {'output_loglevel...
# -*- coding: utf-8 -*- ''' Support for APT (Advanced Packaging Tool) .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives an error similar to *'pkg.install' is not available*), see :ref:`here <module-provider-over...
saltstack/salt
salt/modules/aptpkg.py
del_repo_key
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...
.. 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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptpkg.py#L1978-L2030
[ "def _get_ppa_info_from_launchpad(owner_name, ppa_name):\n '''\n Idea from softwareproperties.ppa.\n Uses urllib2 which sacrifices server cert verification.\n\n This is used as fall-back code or for secure PPAs\n\n :param owner_name:\n :param ppa_name:\n :return:\n '''\n\n lp_url = 'https...
# -*- coding: utf-8 -*- ''' Support for APT (Advanced Packaging Tool) .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives an error similar to *'pkg.install' is not available*), see :ref:`here <module-provider-over...
saltstack/salt
salt/modules/aptpkg.py
mod_repo
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....
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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptpkg.py#L2033-L2362
[ "def is_true(value=None):\n '''\n Returns a boolean value representing the \"truth\" of the value passed. The\n rules for what is a \"True\" value are:\n\n 1. Integer/float values greater than 0\n 2. The string values \"True\" and \"true\"\n 3. Any object for which bool(obj) returns Tr...
# -*- coding: utf-8 -*- ''' Support for APT (Advanced Packaging Tool) .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives an error similar to *'pkg.install' is not available*), see :ref:`here <module-provider-over...
saltstack/salt
salt/modules/aptpkg.py
expand_repo_def
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...
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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptpkg.py#L2399-L2452
[ "def _check_apt():\n '''\n Abort if python-apt is not installed\n '''\n if not HAS_APT:\n raise CommandExecutionError(\n 'Error: \\'python-apt\\' package not installed'\n )\n", "def strip_uri(repo):\n '''\n Remove the trailing slash from the URI in a repo definition\n ...
# -*- coding: utf-8 -*- ''' Support for APT (Advanced Packaging Tool) .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives an error similar to *'pkg.install' is not available*), see :ref:`here <module-provider-over...
saltstack/salt
salt/modules/aptpkg.py
_parse_selections
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 ...
Parses the format from ``dpkg --get-selections`` and return a format that pkg.get_selections and pkg.set_selections work with.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptpkg.py#L2455-L2470
null
# -*- coding: utf-8 -*- ''' Support for APT (Advanced Packaging Tool) .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives an error similar to *'pkg.install' is not available*), see :ref:`here <module-provider-over...
saltstack/salt
salt/modules/aptpkg.py
get_selections
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', ... ] }...
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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptpkg.py#L2473-L2507
[ "def _parse_selections(dpkgselection):\n '''\n Parses the format from ``dpkg --get-selections`` and return a format that\n pkg.get_selections and pkg.set_selections work with.\n '''\n ret = {}\n if isinstance(dpkgselection, six.string_types):\n dpkgselection = dpkgselection.split('\\n')\n ...
# -*- coding: utf-8 -*- ''' Support for APT (Advanced Packaging Tool) .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives an error similar to *'pkg.install' is not available*), see :ref:`here <module-provider-over...
saltstack/salt
salt/modules/aptpkg.py
set_selections
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...
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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptpkg.py#L2516-L2618
[ "def iteritems(d, **kw):\n return d.iteritems(**kw)\n", "def fopen(*args, **kwargs):\n '''\n Wrapper around open() built-in to set CLOEXEC on the fd.\n\n This flag specifies that the file descriptor should be closed when an exec\n function is invoked;\n\n When a file descriptor is allocated (as ...
# -*- coding: utf-8 -*- ''' Support for APT (Advanced Packaging Tool) .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives an error similar to *'pkg.install' is not available*), see :ref:`here <module-provider-over...
saltstack/salt
salt/modules/aptpkg.py
_resolve_deps
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...
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
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptpkg.py#L2621-L2663
null
# -*- coding: utf-8 -*- ''' Support for APT (Advanced Packaging Tool) .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives an error similar to *'pkg.install' is not available*), see :ref:`here <module-provider-over...
saltstack/salt
salt/modules/aptpkg.py
show
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 ...
.. 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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptpkg.py#L2701-L2782
[ "def split(orig, sep=None):\n '''\n Generator function for iterating through large strings, particularly useful\n as a replacement for str.splitlines().\n\n See http://stackoverflow.com/a/3865367\n '''\n exp = re.compile(r'\\s+' if sep is None else re.escape(sep))\n pos = 0\n length = len(or...
# -*- coding: utf-8 -*- ''' Support for APT (Advanced Packaging Tool) .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives an error similar to *'pkg.install' is not available*), see :ref:`here <module-provider-over...
saltstack/salt
salt/modules/aptpkg.py
info_installed
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...
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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptpkg.py#L2785-L2853
[ "def clean_kwargs(**kwargs):\n '''\n Return a dict without any of the __pub* keys (or any other keys starting\n with a dunder) from the kwargs dict passed into the execution module\n functions. These keys are useful for tracking what was used to invoke\n the function call, but they may not be desirab...
# -*- coding: utf-8 -*- ''' Support for APT (Advanced Packaging Tool) .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives an error similar to *'pkg.install' is not available*), see :ref:`here <module-provider-over...
saltstack/salt
salt/modules/aptpkg.py
_get_http_proxy_url
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...
Returns the http_proxy_url if proxy_username, proxy_password, proxy_host, and proxy_port config values are set. Returns a string.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptpkg.py#L2856-L2884
null
# -*- coding: utf-8 -*- ''' Support for APT (Advanced Packaging Tool) .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives an error similar to *'pkg.install' is not available*), see :ref:`here <module-provider-over...
saltstack/salt
salt/states/zabbix_template.py
_diff_and_merge_host_list
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...
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 ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/zabbix_template.py#L217-L233
null
# -*- coding: utf-8 -*- ''' .. versionadded:: 2017.7 Management of Zabbix Template object over Zabbix API. :codeauthor: Jakub Sliva <jakub.sliva@ultimum.io> ''' from __future__ import absolute_import from __future__ import unicode_literals import logging import json try: from salt.ext import six from salt.ex...
saltstack/salt
salt/states/zabbix_template.py
_get_existing_template_c_list
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...
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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/zabbix_template.py#L236-L261
null
# -*- coding: utf-8 -*- ''' .. versionadded:: 2017.7 Management of Zabbix Template object over Zabbix API. :codeauthor: Jakub Sliva <jakub.sliva@ultimum.io> ''' from __future__ import absolute_import from __future__ import unicode_literals import logging import json try: from salt.ext import six from salt.ex...
saltstack/salt
salt/states/zabbix_template.py
_adjust_object_lists
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...
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
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/zabbix_template.py#L264-L273
null
# -*- coding: utf-8 -*- ''' .. versionadded:: 2017.7 Management of Zabbix Template object over Zabbix API. :codeauthor: Jakub Sliva <jakub.sliva@ultimum.io> ''' from __future__ import absolute_import from __future__ import unicode_literals import logging import json try: from salt.ext import six from salt.ex...
saltstack/salt
salt/states/zabbix_template.py
_manage_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...
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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/zabbix_template.py#L276-L339
null
# -*- coding: utf-8 -*- ''' .. versionadded:: 2017.7 Management of Zabbix Template object over Zabbix API. :codeauthor: Jakub Sliva <jakub.sliva@ultimum.io> ''' from __future__ import absolute_import from __future__ import unicode_literals import logging import json try: from salt.ext import six from salt.ex...
saltstack/salt
salt/states/zabbix_template.py
is_present
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...
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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/zabbix_template.py#L342-L371
null
# -*- coding: utf-8 -*- ''' .. versionadded:: 2017.7 Management of Zabbix Template object over Zabbix API. :codeauthor: Jakub Sliva <jakub.sliva@ultimum.io> ''' from __future__ import absolute_import from __future__ import unicode_literals import logging import json try: from salt.ext import six from salt.ex...
saltstack/salt
salt/states/zabbix_template.py
present
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...
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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/zabbix_template.py#L375-L699
[ "def _diff_and_merge_host_list(defined, existing):\n '''\n If Zabbix template is to be updated then list of assigned hosts must be provided in all or nothing manner to prevent\n some externally assigned hosts to be detached.\n\n :param defined: list of hosts defined in sls\n :param existing: list of ...
# -*- coding: utf-8 -*- ''' .. versionadded:: 2017.7 Management of Zabbix Template object over Zabbix API. :codeauthor: Jakub Sliva <jakub.sliva@ultimum.io> ''' from __future__ import absolute_import from __future__ import unicode_literals import logging import json try: from salt.ext import six from salt.ex...
saltstack/salt
salt/states/zabbix_template.py
absent
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...
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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/zabbix_template.py#L702-L742
null
# -*- coding: utf-8 -*- ''' .. versionadded:: 2017.7 Management of Zabbix Template object over Zabbix API. :codeauthor: Jakub Sliva <jakub.sliva@ultimum.io> ''' from __future__ import absolute_import from __future__ import unicode_literals import logging import json try: from salt.ext import six from salt.ex...
saltstack/salt
salt/modules/solaris_group.py
chgid
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...
Change the gid for a named group CLI Example: .. code-block:: bash salt '*' group.chgid foo 4376
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solaris_group.py#L125-L143
null
# -*- coding: utf-8 -*- ''' Manage groups on Solaris .. important:: If you feel that Salt should be using this module to manage groups on a minion, and it is using a different module (or gives an error similar to *'group.info' is not available*), see :ref:`here <module-provider-override>`. ''' from __f...
saltstack/salt
salt/runners/venafiapi.py
gen_key
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...
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 ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/venafiapi.py#L87-L167
[ "def _base_url():\n '''\n Return the base_url\n '''\n return __opts__.get('venafi', {}).get(\n 'base_url', 'https://api.venafi.cloud/v1'\n )\n", "def _api_key():\n '''\n Return the API key\n '''\n return __opts__.get('venafi', {}).get('api_key', '')\n", "def store(self, bank, k...
# -*- coding: utf-8 -*- ''' Support for Venafi Before using this module you need to register an account with Venafi, and configure it in your ``master`` configuration file. First, you need to add a placeholder to the ``master`` file. This is because the module will not load unless it finds an ``api_key`` setting, val...
saltstack/salt
salt/runners/venafiapi.py
gen_csr
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...
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>
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/venafiapi.py#L170-L259
[ "def fopen(*args, **kwargs):\n '''\n Wrapper around open() built-in to set CLOEXEC on the fd.\n\n This flag specifies that the file descriptor should be closed when an exec\n function is invoked;\n\n When a file descriptor is allocated (as with open or dup), this bit is\n initially cleared on the ...
# -*- coding: utf-8 -*- ''' Support for Venafi Before using this module you need to register an account with Venafi, and configure it in your ``master`` configuration file. First, you need to add a placeholder to the ``master`` file. This is because the module will not load unless it finds an ``api_key`` setting, val...
saltstack/salt
salt/runners/venafiapi.py
request
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...
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>
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/venafiapi.py#L262-L361
[ "def dumps(obj, **kwargs):\n '''\n .. versionadded:: 2018.3.0\n\n Wraps json.dumps, and assumes that ensure_ascii is False (unless explicitly\n passed as True) for unicode compatibility. Note that setting it to True\n will mess up any unicode characters, as they will be dumped as the string\n lite...
# -*- coding: utf-8 -*- ''' Support for Venafi Before using this module you need to register an account with Venafi, and configure it in your ``master`` configuration file. First, you need to add a placeholder to the ``master`` file. This is because the module will not load unless it finds an ``api_key`` setting, val...
saltstack/salt
salt/runners/venafiapi.py
register
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({ ...
Register a new user account CLI Example: .. code-block:: bash salt-run venafi.register email@example.com
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/venafiapi.py#L382-L411
[ "def dumps(obj, **kwargs):\n '''\n .. versionadded:: 2018.3.0\n\n Wraps json.dumps, and assumes that ensure_ascii is False (unless explicitly\n passed as True) for unicode compatibility. Note that setting it to True\n will mess up any unicode characters, as they will be dumped as the string\n lite...
# -*- coding: utf-8 -*- ''' Support for Venafi Before using this module you need to register an account with Venafi, and configure it in your ``master`` configuration file. First, you need to add a placeholder to the ``master`` file. This is because the module will not load unless it finds an ``api_key`` setting, val...
saltstack/salt
salt/runners/venafiapi.py
show_company
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, ...
Show company information, especially the company id CLI Example: .. code-block:: bash salt-run venafi.show_company example.com
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/venafiapi.py#L414-L438
[ "def _base_url():\n '''\n Return the base_url\n '''\n return __opts__.get('venafi', {}).get(\n 'base_url', 'https://api.venafi.cloud/v1'\n )\n", "def _api_key():\n '''\n Return the API key\n '''\n return __opts__.get('venafi', {}).get('api_key', '')\n" ]
# -*- coding: utf-8 -*- ''' Support for Venafi Before using this module you need to register an account with Venafi, and configure it in your ``master`` configuration file. First, you need to add a placeholder to the ``master`` file. This is because the module will not load unless it finds an ``api_key`` setting, val...
saltstack/salt
salt/runners/venafiapi.py
show_cert
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...
Show certificate requests for this API key CLI Example: .. code-block:: bash salt-run venafi.show_cert 01234567-89ab-cdef-0123-456789abcdef
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/venafiapi.py#L550-L605
[ "def _base_url():\n '''\n Return the base_url\n '''\n return __opts__.get('venafi', {}).get(\n 'base_url', 'https://api.venafi.cloud/v1'\n )\n", "def _api_key():\n '''\n Return the API key\n '''\n return __opts__.get('venafi', {}).get('api_key', '')\n" ]
# -*- coding: utf-8 -*- ''' Support for Venafi Before using this module you need to register an account with Venafi, and configure it in your ``master`` configuration file. First, you need to add a placeholder to the ``master`` file. This is because the module will not load unless it finds an ``api_key`` setting, val...
saltstack/salt
salt/runners/venafiapi.py
list_domain_cache
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')
List domains that have been cached CLI Example: .. code-block:: bash salt-run venafi.list_domain_cache
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/venafiapi.py#L629-L640
[ "def list(self, bank):\n '''\n Lists entries stored in the specified bank.\n\n :param bank:\n The name of the location inside the cache which will hold the key\n and its associated data.\n\n :return:\n An iterable object containing all bank entries. Returns an empty\n iterato...
# -*- coding: utf-8 -*- ''' Support for Venafi Before using this module you need to register an account with Venafi, and configure it in your ``master`` configuration file. First, you need to add a placeholder to the ``master`` file. This is because the module will not load unless it finds an ``api_key`` setting, val...
saltstack/salt
salt/runners/venafiapi.py
del_cached_domain
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)...
Delete cached domains from the master CLI Example: .. code-block:: bash salt-run venafi.del_cached_domain domain1.example.com,domain2.example.com
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/venafiapi.py#L643-L669
[ "def flush(self, bank, key=None):\n '''\n Remove the key from the cache bank with all the key content. If no key is specified remove\n the entire bank with all keys and sub-banks inside.\n\n :param bank:\n The name of the location inside the cache which will hold the key\n and its associat...
# -*- coding: utf-8 -*- ''' Support for Venafi Before using this module you need to register an account with Venafi, and configure it in your ``master`` configuration file. First, you need to add a placeholder to the ``master`` file. This is because the module will not load unless it finds an ``api_key`` setting, val...
saltstack/salt
salt/states/onyx.py
user_present
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...
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 ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/onyx.py#L18-L150
null
# -*- coding: utf-8 -*- ''' State module for Onyx OS Switches Proxy minions .. versionadded: Neon For documentation on setting up the onyx proxy minion look in the documentation for :mod:`salt.proxy.onyx<salt.proxy.onyx>`. ''' from __future__ import absolute_import, print_function, unicode_literals import re def __...
saltstack/salt
salt/states/onyx.py
user_absent
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': {}, ...
Ensure a user is not present name username to remove if it exists Examples: .. code-block:: yaml delete: onyx.user_absent: - name: daniel
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/onyx.py#L153-L197
null
# -*- coding: utf-8 -*- ''' State module for Onyx OS Switches Proxy minions .. versionadded: Neon For documentation on setting up the onyx proxy minion look in the documentation for :mod:`salt.proxy.onyx<salt.proxy.onyx>`. ''' from __future__ import absolute_import, print_function, unicode_literals import re def __...
saltstack/salt
salt/states/onyx.py
config_present
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...
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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/onyx.py#L200-L250
null
# -*- coding: utf-8 -*- ''' State module for Onyx OS Switches Proxy minions .. versionadded: Neon For documentation on setting up the onyx proxy minion look in the documentation for :mod:`salt.proxy.onyx<salt.proxy.onyx>`. ''' from __future__ import absolute_import, print_function, unicode_literals import re def __...
saltstack/salt
salt/states/onyx.py
config_absent
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...
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 ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/onyx.py#L253-L304
null
# -*- coding: utf-8 -*- ''' State module for Onyx OS Switches Proxy minions .. versionadded: Neon For documentation on setting up the onyx proxy minion look in the documentation for :mod:`salt.proxy.onyx<salt.proxy.onyx>`. ''' from __future__ import absolute_import, print_function, unicode_literals import re def __...
saltstack/salt
salt/states/onyx.py
replace
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. ...
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 ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/onyx.py#L307-L379
null
# -*- coding: utf-8 -*- ''' State module for Onyx OS Switches Proxy minions .. versionadded: Neon For documentation on setting up the onyx proxy minion look in the documentation for :mod:`salt.proxy.onyx<salt.proxy.onyx>`. ''' from __future__ import absolute_import, print_function, unicode_literals import re def __...
saltstack/salt
salt/states/mssql_login.py
present
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...
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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/mssql_login.py#L37-L87
[ "def _normalize_options(options):\n if type(options) in [dict, collections.OrderedDict]:\n return ['{0}={1}'.format(k, v) for k, v in options.items()]\n if type(options) is list and (not options or type(options[0]) is str):\n return options\n # Invalid options\n if type(options) is not lis...
# -*- coding: utf-8 -*- ''' Management of Microsoft SQLServer Logins ======================================== The mssql_login module is used to create and manage SQL Server Logins .. code-block:: yaml frank: mssql_login.present - domain: mydomain ''' from __future__ import absolute_import, print_fu...
saltstack/salt
salt/states/cmd.py
_reinterpreted_state
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'...
Re-interpret the state returned by salt.state.run using our protocol.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/cmd.py#L251-L310
null
# -*- coding: utf-8 -*- ''' Execution of arbitrary commands =============================== The cmd state module manages the enforcement of executed commands, this state can tell a command to run under certain circumstances. A simple example to execute a command: .. code-block:: yaml # Store the current date i...
saltstack/salt
salt/states/cmd.py
mod_run_check
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 ...
Execute the onlyif and unless logic. Return a result dict if: * onlyif failed (onlyif != 0) * unless succeeded (unless == 0) else return True
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/cmd.py#L327-L398
null
# -*- coding: utf-8 -*- ''' Execution of arbitrary commands =============================== The cmd state module manages the enforcement of executed commands, this state can tell a command to run under certain circumstances. A simple example to execute a command: .. code-block:: yaml # Store the current date i...
saltstack/salt
salt/states/cmd.py
wait
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, ...
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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/cmd.py#L401-L554
null
# -*- coding: utf-8 -*- ''' Execution of arbitrary commands =============================== The cmd state module manages the enforcement of executed commands, this state can tell a command to run under certain circumstances. A simple example to execute a command: .. code-block:: yaml # Store the current date i...
saltstack/salt
salt/states/cmd.py
wait_script
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, ...
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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/cmd.py#L561-L710
null
# -*- coding: utf-8 -*- ''' Execution of arbitrary commands =============================== The cmd state module manages the enforcement of executed commands, this state can tell a command to run under certain circumstances. A simple example to execute a command: .. code-block:: yaml # Store the current date i...
saltstack/salt
salt/states/cmd.py
run
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=...
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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/cmd.py#L713-L1005
[ "def warn_until(version,\n message,\n category=DeprecationWarning,\n stacklevel=None,\n _version_info_=None,\n _dont_call_warnings=False):\n '''\n Helper function to raise a warning, by default, a ``DeprecationWarning``,\n until the prov...
# -*- coding: utf-8 -*- ''' Execution of arbitrary commands =============================== The cmd state module manages the enforcement of executed commands, this state can tell a command to run under certain circumstances. A simple example to execute a command: .. code-block:: yaml # Store the current date i...
saltstack/salt
salt/states/cmd.py
script
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...
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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/cmd.py#L1008-L1292
[ "def _reinterpreted_state(state):\n '''\n Re-interpret the state returned by salt.state.run using our protocol.\n '''\n ret = state['changes']\n state['changes'] = {}\n state['comment'] = ''\n\n out = ret.get('stdout')\n if not out:\n if ret.get('stderr'):\n state['comment'...
# -*- coding: utf-8 -*- ''' Execution of arbitrary commands =============================== The cmd state module manages the enforcement of executed commands, this state can tell a command to run under certain circumstances. A simple example to execute a command: .. code-block:: yaml # Store the current date i...
saltstack/salt
salt/states/cmd.py
call
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 ...
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...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/cmd.py#L1295-L1369
[ "def mod_run_check(cmd_kwargs, onlyif, unless, creates):\n '''\n Execute the onlyif and unless logic.\n Return a result dict if:\n * onlyif failed (onlyif != 0)\n * unless succeeded (unless == 0)\n else return True\n '''\n # never use VT for onlyif/unless executions because this will lead\n ...
# -*- coding: utf-8 -*- ''' Execution of arbitrary commands =============================== The cmd state module manages the enforcement of executed commands, this state can tell a command to run under certain circumstances. A simple example to execute a command: .. code-block:: yaml # Store the current date i...
saltstack/salt
salt/states/cmd.py
mod_watch
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...
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.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/cmd.py#L1391-L1429
[ "def script(name,\n source=None,\n template=None,\n onlyif=None,\n unless=None,\n creates=None,\n cwd=None,\n runas=None,\n shell=None,\n env=None,\n stateful=False,\n umask=None,\n timeout=None,\...
# -*- coding: utf-8 -*- ''' Execution of arbitrary commands =============================== The cmd state module manages the enforcement of executed commands, this state can tell a command to run under certain circumstances. A simple example to execute a command: .. code-block:: yaml # Store the current date i...
saltstack/salt
salt/utils/openstack/nova.py
check_nova
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...
Check version of novaclient
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/openstack/nova.py#L67-L77
null
# -*- coding: utf-8 -*- ''' Nova class ''' # Import Python libs from __future__ import absolute_import, with_statement, unicode_literals, print_function import inspect import logging import time import re import json # Import third party libs from salt.ext import six HAS_NOVA = False # pylint: disable=import-error tr...
saltstack/salt
salt/utils/openstack/nova.py
SaltNova._get_version_from_url
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...
Exctract API version from provided URL
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/openstack/nova.py#L268-L281
null
class SaltNova(object): ''' Class for all novaclient functions ''' extensions = [] def __init__( self, username, project_id, auth_url, region_name=None, password=None, os_auth_plugin=None, use_keystoneauth=False, **kwargs )...
saltstack/salt
salt/utils/openstack/nova.py
SaltNova._discover_ks_version
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...
Keystone API version discovery
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/openstack/nova.py#L283-L295
null
class SaltNova(object): ''' Class for all novaclient functions ''' extensions = [] def __init__( self, username, project_id, auth_url, region_name=None, password=None, os_auth_plugin=None, use_keystoneauth=False, **kwargs )...
saltstack/salt
salt/utils/openstack/nova.py
SaltNova.server_show_libcloud
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'): ...
Make output look like libcloud output for consistency
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/openstack/nova.py#L483-L494
[ "def iterkeys(d, **kw):\n return d.iterkeys(**kw)\n", "def itervalues(d, **kw):\n return d.itervalues(**kw)\n", "def server_show(self, server_id):\n '''\n Show details of one server\n '''\n ret = {}\n try:\n servers = self.server_list_detailed()\n except AttributeError:\n r...
class SaltNova(object): ''' Class for all novaclient functions ''' extensions = [] def __init__( self, username, project_id, auth_url, region_name=None, password=None, os_auth_plugin=None, use_keystoneauth=False, **kwargs )...
saltstack/salt
salt/utils/openstack/nova.py
SaltNova.boot
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', []) ...
Boot a cloud server.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/openstack/nova.py#L496-L535
[ "def _parse_block_device_mapping_v2(block_device=None, boot_volume=None, snapshot=None, ephemeral=None, swap=None):\n bdm = []\n if block_device is None:\n block_device = []\n if ephemeral is None:\n ephemeral = []\n\n if boot_volume is not None:\n bdm_dict = {'uuid': boot_volume, '...
class SaltNova(object): ''' Class for all novaclient functions ''' extensions = [] def __init__( self, username, project_id, auth_url, region_name=None, password=None, os_auth_plugin=None, use_keystoneauth=False, **kwargs )...
saltstack/salt
salt/utils/openstack/nova.py
SaltNova.root_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)
Change server(uuid's) root password
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/openstack/nova.py#L543-L548
null
class SaltNova(object): ''' Class for all novaclient functions ''' extensions = [] def __init__( self, username, project_id, auth_url, region_name=None, password=None, os_auth_plugin=None, use_keystoneauth=False, **kwargs )...
saltstack/salt
salt/utils/openstack/nova.py
SaltNova.server_by_name
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', '') )
Find a server by its name
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/openstack/nova.py#L550-L556
[ "def server_show_libcloud(self, uuid):\n '''\n Make output look like libcloud output for consistency\n '''\n server_info = self.server_show(uuid)\n server = next(six.itervalues(server_info))\n server_name = next(six.iterkeys(server_info))\n if not hasattr(self, 'password'):\n self.passwo...
class SaltNova(object): ''' Class for all novaclient functions ''' extensions = [] def __init__( self, username, project_id, auth_url, region_name=None, password=None, os_auth_plugin=None, use_keystoneauth=False, **kwargs )...
saltstack/salt
salt/utils/openstack/nova.py
SaltNova._volume_get
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...
Organize information about a volume from the volume_id
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/openstack/nova.py#L558-L573
null
class SaltNova(object): ''' Class for all novaclient functions ''' extensions = [] def __init__( self, username, project_id, auth_url, region_name=None, password=None, os_auth_plugin=None, use_keystoneauth=False, **kwargs )...
saltstack/salt
salt/utils/openstack/nova.py
SaltNova.volume_list
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 = {} ...
List all block volumes
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/openstack/nova.py#L575-L593
null
class SaltNova(object): ''' Class for all novaclient functions ''' extensions = [] def __init__( self, username, project_id, auth_url, region_name=None, password=None, os_auth_plugin=None, use_keystoneauth=False, **kwargs )...
saltstack/salt
salt/utils/openstack/nova.py
SaltNova.volume_show
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...
Show one volume
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/openstack/nova.py#L595-L611
[ "def volume_list(self, search_opts=None):\n '''\n List all block volumes\n '''\n if self.volume_conn is None:\n raise SaltCloudSystemExit('No cinder endpoint available')\n nt_ks = self.volume_conn\n volumes = nt_ks.volumes.list(search_opts=search_opts)\n response = {}\n for volume in ...
class SaltNova(object): ''' Class for all novaclient functions ''' extensions = [] def __init__( self, username, project_id, auth_url, region_name=None, password=None, os_auth_plugin=None, use_keystoneauth=False, **kwargs )...
saltstack/salt
salt/utils/openstack/nova.py
SaltNova.volume_create
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...
Create a block device
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/openstack/nova.py#L613-L629
[ "def _volume_get(self, volume_id):\n '''\n Organize information about a volume from the volume_id\n '''\n if self.volume_conn is None:\n raise SaltCloudSystemExit('No cinder endpoint available')\n nt_ks = self.volume_conn\n volume = nt_ks.volumes.get(volume_id)\n response = {'name': volu...
class SaltNova(object): ''' Class for all novaclient functions ''' extensions = [] def __init__( self, username, project_id, auth_url, region_name=None, password=None, os_auth_plugin=None, use_keystoneauth=False, **kwargs )...
saltstack/salt
salt/utils/openstack/nova.py
SaltNova.volume_delete
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: ...
Delete a block device
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/openstack/nova.py#L631-L645
[ " def volume_show(self, name):\n '''\n Show one volume\n '''\n if self.volume_conn is None:\n raise SaltCloudSystemExit('No cinder endpoint available')\n nt_ks = self.volume_conn\n volumes = self.volume_list(\n search_opts={'display_name': name},\n ...
class SaltNova(object): ''' Class for all novaclient functions ''' extensions = [] def __init__( self, username, project_id, auth_url, region_name=None, password=None, os_auth_plugin=None, use_keystoneauth=False, **kwargs )...
saltstack/salt
salt/utils/openstack/nova.py
SaltNova.volume_detach
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))...
Detach a block device
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/openstack/nova.py#L647-L681
[ "def _volume_get(self, volume_id):\n '''\n Organize information about a volume from the volume_id\n '''\n if self.volume_conn is None:\n raise SaltCloudSystemExit('No cinder endpoint available')\n nt_ks = self.volume_conn\n volume = nt_ks.volumes.get(volume_id)\n response = {'name': volu...
class SaltNova(object): ''' Class for all novaclient functions ''' extensions = [] def __init__( self, username, project_id, auth_url, region_name=None, password=None, os_auth_plugin=None, use_keystoneauth=False, **kwargs )...
saltstack/salt
salt/utils/openstack/nova.py
SaltNova.volume_attach
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: ...
Attach a block device
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/openstack/nova.py#L683-L719
[ "def server_by_name(self, name):\n '''\n Find a server by its name\n '''\n return self.server_show_libcloud(\n self.server_list().get(name, {}).get('id', '')\n )\n", "def _volume_get(self, volume_id):\n '''\n Organize information about a volume from the volume_id\n '''\n if self....
class SaltNova(object): ''' Class for all novaclient functions ''' extensions = [] def __init__( self, username, project_id, auth_url, region_name=None, password=None, os_auth_plugin=None, use_keystoneauth=False, **kwargs )...
saltstack/salt
salt/utils/openstack/nova.py
SaltNova.suspend
python
def suspend(self, instance_id): ''' Suspend a server ''' nt_ks = self.compute_conn response = nt_ks.servers.suspend(instance_id) return True
Suspend a server
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/openstack/nova.py#L721-L727
null
class SaltNova(object): ''' Class for all novaclient functions ''' extensions = [] def __init__( self, username, project_id, auth_url, region_name=None, password=None, os_auth_plugin=None, use_keystoneauth=False, **kwargs )...
saltstack/salt
salt/utils/openstack/nova.py
SaltNova.resume
python
def resume(self, instance_id): ''' Resume a server ''' nt_ks = self.compute_conn response = nt_ks.servers.resume(instance_id) return True
Resume a server
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/openstack/nova.py#L729-L735
null
class SaltNova(object): ''' Class for all novaclient functions ''' extensions = [] def __init__( self, username, project_id, auth_url, region_name=None, password=None, os_auth_plugin=None, use_keystoneauth=False, **kwargs )...
saltstack/salt
salt/utils/openstack/nova.py
SaltNova.lock
python
def lock(self, instance_id): ''' Lock an instance ''' nt_ks = self.compute_conn response = nt_ks.servers.lock(instance_id) return True
Lock an instance
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/openstack/nova.py#L737-L743
null
class SaltNova(object): ''' Class for all novaclient functions ''' extensions = [] def __init__( self, username, project_id, auth_url, region_name=None, password=None, os_auth_plugin=None, use_keystoneauth=False, **kwargs )...
saltstack/salt
salt/utils/openstack/nova.py
SaltNova.delete
python
def delete(self, instance_id): ''' Delete a server ''' nt_ks = self.compute_conn response = nt_ks.servers.delete(instance_id) return True
Delete a server
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/openstack/nova.py#L745-L751
null
class SaltNova(object): ''' Class for all novaclient functions ''' extensions = [] def __init__( self, username, project_id, auth_url, region_name=None, password=None, os_auth_plugin=None, use_keystoneauth=False, **kwargs )...
saltstack/salt
salt/utils/openstack/nova.py
SaltNova.flavor_list
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']] = ...
Return a list of available flavors (nova flavor-list)
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/openstack/nova.py#L753-L774
null
class SaltNova(object): ''' Class for all novaclient functions ''' extensions = [] def __init__( self, username, project_id, auth_url, region_name=None, password=None, os_auth_plugin=None, use_keystoneauth=False, **kwargs )...
saltstack/salt
salt/utils/openstack/nova.py
SaltNova.flavor_create
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 ...
Create a flavor
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/openstack/nova.py#L778-L797
null
class SaltNova(object): ''' Class for all novaclient functions ''' extensions = [] def __init__( self, username, project_id, auth_url, region_name=None, password=None, os_auth_plugin=None, use_keystoneauth=False, **kwargs )...
saltstack/salt
salt/utils/openstack/nova.py
SaltNova.flavor_delete
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)
Delete a flavor
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/openstack/nova.py#L799-L805
null
class SaltNova(object): ''' Class for all novaclient functions ''' extensions = [] def __init__( self, username, project_id, auth_url, region_name=None, password=None, os_auth_plugin=None, use_keystoneauth=False, **kwargs )...
saltstack/salt
salt/utils/openstack/nova.py
SaltNova.flavor_access_list
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...
Return a list of project IDs assigned to flavor ID
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/openstack/nova.py#L807-L817
null
class SaltNova(object): ''' Class for all novaclient functions ''' extensions = [] def __init__( self, username, project_id, auth_url, region_name=None, password=None, os_auth_plugin=None, use_keystoneauth=False, **kwargs )...
saltstack/salt
salt/utils/openstack/nova.py
SaltNova.flavor_access_add
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: ...
Add a project to the flavor access list
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/openstack/nova.py#L819-L828
null
class SaltNova(object): ''' Class for all novaclient functions ''' extensions = [] def __init__( self, username, project_id, auth_url, region_name=None, password=None, os_auth_plugin=None, use_keystoneauth=False, **kwargs )...
saltstack/salt
salt/utils/openstack/nova.py
SaltNova.flavor_access_remove
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...
Remove a project from the flavor access list
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/openstack/nova.py#L830-L839
null
class SaltNova(object): ''' Class for all novaclient functions ''' extensions = [] def __init__( self, username, project_id, auth_url, region_name=None, password=None, os_auth_plugin=None, use_keystoneauth=False, **kwargs )...
saltstack/salt
salt/utils/openstack/nova.py
SaltNova.keypair_list
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':...
List keypairs
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/openstack/nova.py#L841-L853
null
class SaltNova(object): ''' Class for all novaclient functions ''' extensions = [] def __init__( self, username, project_id, auth_url, region_name=None, password=None, os_auth_plugin=None, use_keystoneauth=False, **kwargs )...
saltstack/salt
salt/utils/openstack/nova.py
SaltNova.keypair_add
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: ...
Add a keypair
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/openstack/nova.py#L855-L867
[ "def fopen(*args, **kwargs):\n '''\n Wrapper around open() built-in to set CLOEXEC on the fd.\n\n This flag specifies that the file descriptor should be closed when an exec\n function is invoked;\n\n When a file descriptor is allocated (as with open or dup), this bit is\n initially cleared on the ...
class SaltNova(object): ''' Class for all novaclient functions ''' extensions = [] def __init__( self, username, project_id, auth_url, region_name=None, password=None, os_auth_plugin=None, use_keystoneauth=False, **kwargs )...
saltstack/salt
salt/utils/openstack/nova.py
SaltNova.keypair_delete
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)
Delete a keypair
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/openstack/nova.py#L869-L875
null
class SaltNova(object): ''' Class for all novaclient functions ''' extensions = [] def __init__( self, username, project_id, auth_url, region_name=None, password=None, os_auth_plugin=None, use_keystoneauth=False, **kwargs )...
saltstack/salt
salt/utils/openstack/nova.py
SaltNova.image_show
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, ...
Show image details and metadata
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/openstack/nova.py#L877-L901
null
class SaltNova(object): ''' Class for all novaclient functions ''' extensions = [] def __init__( self, username, project_id, auth_url, region_name=None, password=None, os_auth_plugin=None, use_keystoneauth=False, **kwargs )...
saltstack/salt
salt/utils/openstack/nova.py
SaltNova.image_list
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] = { ...
List server images
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/openstack/nova.py#L903-L929
null
class SaltNova(object): ''' Class for all novaclient functions ''' extensions = [] def __init__( self, username, project_id, auth_url, region_name=None, password=None, os_auth_plugin=None, use_keystoneauth=False, **kwargs )...
saltstack/salt
salt/utils/openstack/nova.py
SaltNova.image_meta_set
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(): ...
Set image metadata
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/openstack/nova.py#L933-L948
null
class SaltNova(object): ''' Class for all novaclient functions ''' extensions = [] def __init__( self, username, project_id, auth_url, region_name=None, password=None, os_auth_plugin=None, use_keystoneauth=False, **kwargs )...
saltstack/salt
salt/utils/openstack/nova.py
SaltNova.image_meta_delete
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(...
Delete image metadata
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/openstack/nova.py#L950-L966
null
class SaltNova(object): ''' Class for all novaclient functions ''' extensions = [] def __init__( self, username, project_id, auth_url, region_name=None, password=None, os_auth_plugin=None, use_keystoneauth=False, **kwargs )...
saltstack/salt
salt/utils/openstack/nova.py
SaltNova.server_list
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...
List servers
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/openstack/nova.py#L968-L989
null
class SaltNova(object): ''' Class for all novaclient functions ''' extensions = [] def __init__( self, username, project_id, auth_url, region_name=None, password=None, os_auth_plugin=None, use_keystoneauth=False, **kwargs )...
saltstack/salt
salt/utils/openstack/nova.py
SaltNova.server_list_min
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':...
List minimal information about servers
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/openstack/nova.py#L991-L1005
null
class SaltNova(object): ''' Class for all novaclient functions ''' extensions = [] def __init__( self, username, project_id, auth_url, region_name=None, password=None, os_auth_plugin=None, use_keystoneauth=False, **kwargs )...
saltstack/salt
salt/utils/openstack/nova.py
SaltNova.server_list_detailed
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': {}, ...
Detailed list of servers
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/openstack/nova.py#L1007-L1067
null
class SaltNova(object): ''' Class for all novaclient functions ''' extensions = [] def __init__( self, username, project_id, auth_url, region_name=None, password=None, os_auth_plugin=None, use_keystoneauth=False, **kwargs )...
saltstack/salt
salt/utils/openstack/nova.py
SaltNova.server_show
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...
Show details of one server
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/openstack/nova.py#L1069-L1081
[ "def iteritems(d, **kw):\n return d.iteritems(**kw)\n", "def server_list_detailed(self):\n '''\n Detailed list of servers\n '''\n nt_ks = self.compute_conn\n ret = {}\n for item in nt_ks.servers.list():\n try:\n ret[item.name] = {\n 'OS-EXT-SRV-ATTR': {},\n ...
class SaltNova(object): ''' Class for all novaclient functions ''' extensions = [] def __init__( self, username, project_id, auth_url, region_name=None, password=None, os_auth_plugin=None, use_keystoneauth=False, **kwargs )...