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/proxy/philips_hue.py
call_brightness
python
def call_brightness(*args, **kwargs): ''' Set an effect to the lamp. Arguments: * **value**: 0~255 brightness of the lamp. Options: * **id**: Specifies a device ID. Can be a comma-separated values. All, if omitted. * **transition**: Transition 0~200. Default 0. CLI Example: .. ...
Set an effect to the lamp. Arguments: * **value**: 0~255 brightness of the lamp. Options: * **id**: Specifies a device ID. Can be a comma-separated values. All, if omitted. * **transition**: Transition 0~200. Default 0. CLI Example: .. code-block:: bash salt '*' hue.brightness...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/philips_hue.py#L457-L497
[ "def _set(lamp_id, state, method=\"state\"):\n '''\n Set state to the device by ID.\n\n :param lamp_id:\n :param state:\n :return:\n '''\n try:\n res = _query(lamp_id, state, action=method, method='PUT')\n except Exception as err:\n raise CommandExecutionError(err)\n\n res =...
# -*- coding: utf-8 -*- # # Copyright 2015 SUSE LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agr...
saltstack/salt
salt/proxy/philips_hue.py
call_temperature
python
def call_temperature(*args, **kwargs): ''' Set the mired color temperature. More: http://en.wikipedia.org/wiki/Mired Arguments: * **value**: 150~500. Options: * **id**: Specifies a device ID. Can be a comma-separated values. All, if omitted. CLI Example: .. code-block:: bash ...
Set the mired color temperature. More: http://en.wikipedia.org/wiki/Mired Arguments: * **value**: 150~500. Options: * **id**: Specifies a device ID. Can be a comma-separated values. All, if omitted. CLI Example: .. code-block:: bash salt '*' hue.temperature value=150 salt ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/philips_hue.py#L500-L533
[ "def _set(lamp_id, state, method=\"state\"):\n '''\n Set state to the device by ID.\n\n :param lamp_id:\n :param state:\n :return:\n '''\n try:\n res = _query(lamp_id, state, action=method, method='PUT')\n except Exception as err:\n raise CommandExecutionError(err)\n\n res =...
# -*- coding: utf-8 -*- # # Copyright 2015 SUSE LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agr...
saltstack/salt
salt/fileserver/hgfs.py
_get_branch
python
def _get_branch(repo, name): ''' Find the requested branch in the specified repo ''' try: return [x for x in _all_branches(repo) if x[0] == name][0] except IndexError: return False
Find the requested branch in the specified repo
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/hgfs.py#L111-L118
null
# -*- coding: utf-8 -*- ''' Mercurial Fileserver Backend To enable, add ``hgfs`` to the :conf_master:`fileserver_backend` option in the Master config file. .. code-block:: yaml fileserver_backend: - hgfs .. note:: ``hg`` also works here. Prior to the 2018.3.0 release, *only* ``hg`` would work. Af...
saltstack/salt
salt/fileserver/hgfs.py
_get_bookmark
python
def _get_bookmark(repo, name): ''' Find the requested bookmark in the specified repo ''' try: return [x for x in _all_bookmarks(repo) if x[0] == name][0] except IndexError: return False
Find the requested bookmark in the specified repo
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/hgfs.py#L132-L139
null
# -*- coding: utf-8 -*- ''' Mercurial Fileserver Backend To enable, add ``hgfs`` to the :conf_master:`fileserver_backend` option in the Master config file. .. code-block:: yaml fileserver_backend: - hgfs .. note:: ``hg`` also works here. Prior to the 2018.3.0 release, *only* ``hg`` would work. Af...
saltstack/salt
salt/fileserver/hgfs.py
_get_tag
python
def _get_tag(repo, name): ''' Find the requested tag in the specified repo ''' try: return [x for x in _all_tags(repo) if x[0] == name][0] except IndexError: return False
Find the requested tag in the specified repo
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/hgfs.py#L154-L161
null
# -*- coding: utf-8 -*- ''' Mercurial Fileserver Backend To enable, add ``hgfs`` to the :conf_master:`fileserver_backend` option in the Master config file. .. code-block:: yaml fileserver_backend: - hgfs .. note:: ``hg`` also works here. Prior to the 2018.3.0 release, *only* ``hg`` would work. Af...
saltstack/salt
salt/fileserver/hgfs.py
_get_ref
python
def _get_ref(repo, name): ''' Return ref tuple if ref is in the repo. ''' if name == 'base': name = repo['base'] if name == repo['base'] or name in envs(): if repo['branch_method'] == 'branches': return _get_branch(repo['repo'], name) \ or _get_tag(repo['r...
Return ref tuple if ref is in the repo.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/hgfs.py#L164-L181
null
# -*- coding: utf-8 -*- ''' Mercurial Fileserver Backend To enable, add ``hgfs`` to the :conf_master:`fileserver_backend` option in the Master config file. .. code-block:: yaml fileserver_backend: - hgfs .. note:: ``hg`` also works here. Prior to the 2018.3.0 release, *only* ``hg`` would work. Af...
saltstack/salt
salt/fileserver/hgfs.py
init
python
def init(): ''' Return a list of hglib objects for the various hgfs remotes ''' bp_ = os.path.join(__opts__['cachedir'], 'hgfs') new_remote = False repos = [] per_remote_defaults = {} for param in PER_REMOTE_OVERRIDES: per_remote_defaults[param] = \ six.text_type(__o...
Return a list of hglib objects for the various hgfs remotes
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/hgfs.py#L193-L341
[ "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 -*- ''' Mercurial Fileserver Backend To enable, add ``hgfs`` to the :conf_master:`fileserver_backend` option in the Master config file. .. code-block:: yaml fileserver_backend: - hgfs .. note:: ``hg`` also works here. Prior to the 2018.3.0 release, *only* ``hg`` would work. Af...
saltstack/salt
salt/fileserver/hgfs.py
lock
python
def lock(remote=None): ''' Place an update.lk ``remote`` can either be a dictionary containing repo configuration information, or a pattern. If the latter, then remotes for which the URL matches the pattern will be locked. ''' def _do_lock(repo): success = [] failed = [] ...
Place an update.lk ``remote`` can either be a dictionary containing repo configuration information, or a pattern. If the latter, then remotes for which the URL matches the pattern will be locked.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/hgfs.py#L457-L501
[ "def init():\n '''\n Return a list of hglib objects for the various hgfs remotes\n '''\n bp_ = os.path.join(__opts__['cachedir'], 'hgfs')\n new_remote = False\n repos = []\n\n per_remote_defaults = {}\n for param in PER_REMOTE_OVERRIDES:\n per_remote_defaults[param] = \\\n ...
# -*- coding: utf-8 -*- ''' Mercurial Fileserver Backend To enable, add ``hgfs`` to the :conf_master:`fileserver_backend` option in the Master config file. .. code-block:: yaml fileserver_backend: - hgfs .. note:: ``hg`` also works here. Prior to the 2018.3.0 release, *only* ``hg`` would work. Af...
saltstack/salt
salt/fileserver/hgfs.py
update
python
def update(): ''' Execute an hg pull on all of the repos ''' # data for the fileserver event data = {'changed': False, 'backend': 'hgfs'} # _clear_old_remotes runs init(), so use the value from there to avoid a # second init() data['changed'], repos = _clear_old_remotes() ...
Execute an hg pull on all of the repos
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/hgfs.py#L504-L575
[ "def get_event(\n node, sock_dir=None, transport='zeromq',\n opts=None, listen=True, io_loop=None, keep_loop=False, raise_errors=False):\n '''\n Return an event object suitable for the named transport\n\n :param IOLoop io_loop: Pass in an io_loop if you want asynchronous\n ...
# -*- coding: utf-8 -*- ''' Mercurial Fileserver Backend To enable, add ``hgfs`` to the :conf_master:`fileserver_backend` option in the Master config file. .. code-block:: yaml fileserver_backend: - hgfs .. note:: ``hg`` also works here. Prior to the 2018.3.0 release, *only* ``hg`` would work. Af...
saltstack/salt
salt/fileserver/hgfs.py
envs
python
def envs(ignore_cache=False): ''' Return a list of refs that can be used as environments ''' if not ignore_cache: env_cache = os.path.join(__opts__['cachedir'], 'hgfs/envs.p') cache_match = salt.fileserver.check_env_cache(__opts__, env_cache) if cache_match is not None: ...
Return a list of refs that can be used as environments
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/hgfs.py#L610-L636
[ "def init():\n '''\n Return a list of hglib objects for the various hgfs remotes\n '''\n bp_ = os.path.join(__opts__['cachedir'], 'hgfs')\n new_remote = False\n repos = []\n\n per_remote_defaults = {}\n for param in PER_REMOTE_OVERRIDES:\n per_remote_defaults[param] = \\\n ...
# -*- coding: utf-8 -*- ''' Mercurial Fileserver Backend To enable, add ``hgfs`` to the :conf_master:`fileserver_backend` option in the Master config file. .. code-block:: yaml fileserver_backend: - hgfs .. note:: ``hg`` also works here. Prior to the 2018.3.0 release, *only* ``hg`` would work. Af...
saltstack/salt
salt/fileserver/hgfs.py
find_file
python
def find_file(path, tgt_env='base', **kwargs): # pylint: disable=W0613 ''' Find the first file to match the path and ref, read the file out of hg and send the path to the newly cached file ''' fnd = {'path': '', 'rel': ''} if os.path.isabs(path) or tgt_env not in envs(): retu...
Find the first file to match the path and ref, read the file out of hg and send the path to the newly cached file
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/hgfs.py#L639-L742
[ "def init():\n '''\n Return a list of hglib objects for the various hgfs remotes\n '''\n bp_ = os.path.join(__opts__['cachedir'], 'hgfs')\n new_remote = False\n repos = []\n\n per_remote_defaults = {}\n for param in PER_REMOTE_OVERRIDES:\n per_remote_defaults[param] = \\\n ...
# -*- coding: utf-8 -*- ''' Mercurial Fileserver Backend To enable, add ``hgfs`` to the :conf_master:`fileserver_backend` option in the Master config file. .. code-block:: yaml fileserver_backend: - hgfs .. note:: ``hg`` also works here. Prior to the 2018.3.0 release, *only* ``hg`` would work. Af...
saltstack/salt
salt/fileserver/hgfs.py
file_hash
python
def file_hash(load, fnd): ''' Return a file hash, the hash type is set in the master config file ''' if 'env' in load: # "env" is not supported; Use "saltenv". load.pop('env') if not all(x in load for x in ('path', 'saltenv')): return '' ret = {'hash_type': __opts__['has...
Return a file hash, the hash type is set in the master config file
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/hgfs.py#L774-L800
[ "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 -*- ''' Mercurial Fileserver Backend To enable, add ``hgfs`` to the :conf_master:`fileserver_backend` option in the Master config file. .. code-block:: yaml fileserver_backend: - hgfs .. note:: ``hg`` also works here. Prior to the 2018.3.0 release, *only* ``hg`` would work. Af...
saltstack/salt
salt/fileserver/hgfs.py
_file_lists
python
def _file_lists(load, form): ''' Return a dict containing the file lists for files and dirs ''' if 'env' in load: # "env" is not supported; Use "saltenv". load.pop('env') list_cachedir = os.path.join(__opts__['cachedir'], 'file_lists/hgfs') if not os.path.isdir(list_cachedir): ...
Return a dict containing the file lists for files and dirs
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/hgfs.py#L803-L836
[ "def check_file_list_cache(opts, form, list_cache, w_lock):\n '''\n Checks the cache file to see if there is a new enough file list cache, and\n returns the match (if found, along with booleans used by the fileserver\n backend to determine if the cache needs to be refreshed/written).\n '''\n refre...
# -*- coding: utf-8 -*- ''' Mercurial Fileserver Backend To enable, add ``hgfs`` to the :conf_master:`fileserver_backend` option in the Master config file. .. code-block:: yaml fileserver_backend: - hgfs .. note:: ``hg`` also works here. Prior to the 2018.3.0 release, *only* ``hg`` would work. Af...
saltstack/salt
salt/fileserver/hgfs.py
_get_file_list
python
def _get_file_list(load): ''' Get a list of all files on the file server in a specified environment ''' if 'env' in load: # "env" is not supported; Use "saltenv". load.pop('env') if 'saltenv' not in load or load['saltenv'] not in envs(): return [] ret = set() for rep...
Get a list of all files on the file server in a specified environment
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/hgfs.py#L846-L868
null
# -*- coding: utf-8 -*- ''' Mercurial Fileserver Backend To enable, add ``hgfs`` to the :conf_master:`fileserver_backend` option in the Master config file. .. code-block:: yaml fileserver_backend: - hgfs .. note:: ``hg`` also works here. Prior to the 2018.3.0 release, *only* ``hg`` would work. Af...
saltstack/salt
salt/fileserver/hgfs.py
_get_dir_list
python
def _get_dir_list(load): ''' Get a list of all directories on the master ''' if 'env' in load: # "env" is not supported; Use "saltenv". load.pop('env') if 'saltenv' not in load or load['saltenv'] not in envs(): return [] ret = set() for repo in init(): repo['...
Get a list of all directories on the master
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/hgfs.py#L886-L916
null
# -*- coding: utf-8 -*- ''' Mercurial Fileserver Backend To enable, add ``hgfs`` to the :conf_master:`fileserver_backend` option in the Master config file. .. code-block:: yaml fileserver_backend: - hgfs .. note:: ``hg`` also works here. Prior to the 2018.3.0 release, *only* ``hg`` would work. Af...
saltstack/salt
salt/cache/__init__.py
factory
python
def factory(opts, **kwargs): ''' Creates and returns the cache class. If memory caching is enabled by opts MemCache class will be instantiated. If not Cache class will be returned. ''' if opts.get('memcache_expire_seconds', 0): cls = MemCache else: cls = Cache return cls(...
Creates and returns the cache class. If memory caching is enabled by opts MemCache class will be instantiated. If not Cache class will be returned.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cache/__init__.py#L24-L34
null
# -*- coding: utf-8 -*- ''' Loader mechanism for caching data, with data expiration, etc. .. versionadded:: 2016.11.0 ''' # Import Python libs from __future__ import absolute_import, print_function, unicode_literals import logging import time # Import Salt libs import salt.config from salt.ext import six from salt.p...
saltstack/salt
salt/cache/__init__.py
Cache.cache
python
def cache(self, bank, key, fun, loop_fun=None, **kwargs): ''' Check cache for the data. If it is there, check to see if it needs to be refreshed. If the data is not there, or it needs to be refreshed, then call the callback function (``fun``) with any given ``**kwargs``. ...
Check cache for the data. If it is there, check to see if it needs to be refreshed. If the data is not there, or it needs to be refreshed, then call the callback function (``fun``) with any given ``**kwargs``. In some cases, the callback function returns a list of objects which ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cache/__init__.py#L96-L132
[ "def store(self, bank, key, data):\n '''\n Store data using the specified module\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 :param key:\n The name of the key (or file inside a directory) which will hold\n ...
class Cache(object): ''' Base caching object providing access to the modular cache subsystem. Related configuration options: :param cache: The name of the cache driver to use. This is the name of the python module of the `salt.cache` package. Default is `localfs`. :param serial: ...
saltstack/salt
salt/cache/__init__.py
Cache.store
python
def store(self, bank, key, data): ''' Store data using the specified module :param bank: The name of the location inside the cache which will hold the key and its associated data. :param key: The name of the key (or file inside a directory) which wil...
Store data using the specified module :param bank: The name of the location inside the cache which will hold the key and its associated data. :param key: The name of the key (or file inside a directory) which will hold the data. File extensions should no...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cache/__init__.py#L134-L156
null
class Cache(object): ''' Base caching object providing access to the modular cache subsystem. Related configuration options: :param cache: The name of the cache driver to use. This is the name of the python module of the `salt.cache` package. Default is `localfs`. :param serial: ...
saltstack/salt
salt/cache/__init__.py
Cache.fetch
python
def fetch(self, bank, key): ''' Fetch data using the specified module :param bank: The name of the location inside the cache which will hold the key and its associated data. :param key: The name of the key (or file inside a directory) which will hold...
Fetch data using the specified module :param bank: The name of the location inside the cache which will hold the key and its associated data. :param key: The name of the key (or file inside a directory) which will hold the data. File extensions should no...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cache/__init__.py#L158-L180
null
class Cache(object): ''' Base caching object providing access to the modular cache subsystem. Related configuration options: :param cache: The name of the cache driver to use. This is the name of the python module of the `salt.cache` package. Default is `localfs`. :param serial: ...
saltstack/salt
salt/cache/__init__.py
Cache.list
python
def list(self, bank): ''' Lists entries stored in the specified bank. :param bank: The name of the location inside the cache which will hold the key and its associated data. :return: An iterable object containing all bank entries. Returns an empty ...
Lists entries stored in the specified bank. :param bank: The name of the location inside the cache which will hold the key and its associated data. :return: An iterable object containing all bank entries. Returns an empty iterator if the bank doesn't exi...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cache/__init__.py#L227-L244
null
class Cache(object): ''' Base caching object providing access to the modular cache subsystem. Related configuration options: :param cache: The name of the cache driver to use. This is the name of the python module of the `salt.cache` package. Default is `localfs`. :param serial: ...
saltstack/salt
salt/wheel/error.py
error
python
def error(name=None, message=''): ''' If name is None Then return empty dict Otherwise raise an exception with __name__ from name, message from message CLI Example: .. code-block:: bash salt-wheel error salt-wheel error.error name="Exception" message="This is an error." ''' ...
If name is None Then return empty dict Otherwise raise an exception with __name__ from name, message from message CLI Example: .. code-block:: bash salt-wheel error salt-wheel error.error name="Exception" message="This is an error."
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/wheel/error.py#L15-L31
[ "def raise_error(name=None, args=None, message=''):\n '''\n Raise an exception with __name__ from name, args from args\n If args is None Otherwise message from message\\\n If name is empty then use \"Exception\"\n '''\n name = name or 'Exception'\n if hasattr(salt.exceptions, name):\n ex...
# -*- coding: utf-8 -*- ''' Error generator to enable integration testing of salt wheel error handling ''' from __future__ import absolute_import, print_function, unicode_literals # Import python libs # Import salt libs import salt.utils.error
saltstack/salt
salt/states/boto_asg.py
present
python
def present( name, launch_config_name, availability_zones, min_size, max_size, launch_config=None, desired_capacity=None, load_balancers=None, default_cooldown=None, health_check_type=None, health_check_period=None, placemen...
Ensure the autoscale group exists. name Name of the autoscale group. launch_config_name Name of the launch config to use for the group. Or, if ``launch_config`` is specified, this will be the launch config name's prefix. (see below) launch_config A dictionary of ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_asg.py#L217-L709
[ "def iteritems(d, **kw):\n return d.iteritems(**kw)\n", "def update(dest, upd, recursive_update=True, merge_lists=False):\n '''\n Recursive version of the default dict.update\n\n Merges upd recursively into dest\n\n If recursive_update=False, will use the classic dict.update, or fall back\n on a...
# -*- coding: utf-8 -*- ''' Manage Autoscale Groups ======================= .. versionadded:: 2014.7.0 Create and destroy autoscale groups. Be aware that this interacts with Amazon's services, and so may incur charges. This module uses boto, which can be installed via package, or pip. This module accepts explicit a...
saltstack/salt
salt/states/boto_asg.py
_determine_termination_policies
python
def _determine_termination_policies(termination_policies, termination_policies_from_pillar): ''' helper method for present. ensure that termination_policies are set ''' pillar_termination_policies = copy.deepcopy( __salt__['config.option'](termination_policies_from_pillar, []) ) if not ...
helper method for present. ensure that termination_policies are set
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_asg.py#L712-L721
null
# -*- coding: utf-8 -*- ''' Manage Autoscale Groups ======================= .. versionadded:: 2014.7.0 Create and destroy autoscale groups. Be aware that this interacts with Amazon's services, and so may incur charges. This module uses boto, which can be installed via package, or pip. This module accepts explicit a...
saltstack/salt
salt/states/boto_asg.py
_determine_scaling_policies
python
def _determine_scaling_policies(scaling_policies, scaling_policies_from_pillar): ''' helper method for present. ensure that scaling_policies are set ''' pillar_scaling_policies = copy.deepcopy( __salt__['config.option'](scaling_policies_from_pillar, {}) ) if not scaling_policies and pil...
helper method for present. ensure that scaling_policies are set
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_asg.py#L724-L733
null
# -*- coding: utf-8 -*- ''' Manage Autoscale Groups ======================= .. versionadded:: 2014.7.0 Create and destroy autoscale groups. Be aware that this interacts with Amazon's services, and so may incur charges. This module uses boto, which can be installed via package, or pip. This module accepts explicit a...
saltstack/salt
salt/states/boto_asg.py
_determine_scheduled_actions
python
def _determine_scheduled_actions(scheduled_actions, scheduled_actions_from_pillar): ''' helper method for present, ensure scheduled actions are setup ''' tmp = copy.deepcopy( __salt__['config.option'](scheduled_actions_from_pillar, {}) ) # merge with data from state if scheduled_act...
helper method for present, ensure scheduled actions are setup
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_asg.py#L736-L746
null
# -*- coding: utf-8 -*- ''' Manage Autoscale Groups ======================= .. versionadded:: 2014.7.0 Create and destroy autoscale groups. Be aware that this interacts with Amazon's services, and so may incur charges. This module uses boto, which can be installed via package, or pip. This module accepts explicit a...
saltstack/salt
salt/states/boto_asg.py
_determine_notification_info
python
def _determine_notification_info(notification_arn, notification_arn_from_pillar, notification_types, notification_types_from_pillar): ''' helper method for present. ensure that notification_configs are set ''...
helper method for present. ensure that notification_configs are set
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_asg.py#L749-L767
null
# -*- coding: utf-8 -*- ''' Manage Autoscale Groups ======================= .. versionadded:: 2014.7.0 Create and destroy autoscale groups. Be aware that this interacts with Amazon's services, and so may incur charges. This module uses boto, which can be installed via package, or pip. This module accepts explicit a...
saltstack/salt
salt/states/boto_asg.py
_alarms_present
python
def _alarms_present(name, min_size_equals_max_size, alarms, alarms_from_pillar, region, key, keyid, profile): ''' helper method for present. ensure that cloudwatch_alarms are set ''' # load data from alarms_from_pillar tmp = copy.deepcopy(__salt__['config.option'](alarms_from_pillar, {})) # mer...
helper method for present. ensure that cloudwatch_alarms are set
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_asg.py#L770-L819
null
# -*- coding: utf-8 -*- ''' Manage Autoscale Groups ======================= .. versionadded:: 2014.7.0 Create and destroy autoscale groups. Be aware that this interacts with Amazon's services, and so may incur charges. This module uses boto, which can be installed via package, or pip. This module accepts explicit a...
saltstack/salt
salt/states/boto_asg.py
absent
python
def absent( name, force=False, region=None, key=None, keyid=None, profile=None, remove_lc=False): ''' Ensure the named autoscale group is deleted. name Name of the autoscale group. force Force deletion of autoscale group. rem...
Ensure the named autoscale group is deleted. name Name of the autoscale group. force Force deletion of autoscale group. remove_lc Delete the launch config as well. region The region to connect to. key Secret key to be used. keyid Access key t...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_asg.py#L822-L892
null
# -*- coding: utf-8 -*- ''' Manage Autoscale Groups ======================= .. versionadded:: 2014.7.0 Create and destroy autoscale groups. Be aware that this interacts with Amazon's services, and so may incur charges. This module uses boto, which can be installed via package, or pip. This module accepts explicit a...
saltstack/salt
salt/modules/kubernetesmod.py
_setup_conn_old
python
def _setup_conn_old(**kwargs): ''' Setup kubernetes API connection singleton the old way ''' host = __salt__['config.option']('kubernetes.api_url', 'http://localhost:8080') username = __salt__['config.option']('kubernetes.user') password = __salt__['config.op...
Setup kubernetes API connection singleton the old way
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kubernetesmod.py#L117-L188
null
# -*- coding: utf-8 -*- ''' Module for handling kubernetes calls. :optdepends: - kubernetes Python client :configuration: The k8s API settings are provided either in a pillar, in the minion's config file, or in master's config file:: kubernetes.kubeconfig: '/path/to/kubeconfig' kubernetes.kubec...
saltstack/salt
salt/modules/kubernetesmod.py
_setup_conn
python
def _setup_conn(**kwargs): ''' Setup kubernetes API connection singleton ''' kubeconfig = kwargs.get('kubeconfig') or __salt__['config.option']('kubernetes.kubeconfig') kubeconfig_data = kwargs.get('kubeconfig_data') or __salt__['config.option']('kubernetes.kubeconfig-data') context = kwargs.get...
Setup kubernetes API connection singleton
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kubernetesmod.py#L192-L219
null
# -*- coding: utf-8 -*- ''' Module for handling kubernetes calls. :optdepends: - kubernetes Python client :configuration: The k8s API settings are provided either in a pillar, in the minion's config file, or in master's config file:: kubernetes.kubeconfig: '/path/to/kubeconfig' kubernetes.kubec...
saltstack/salt
salt/modules/kubernetesmod.py
ping
python
def ping(**kwargs): ''' Checks connections with the kubernetes API server. Returns True if the connection can be established, False otherwise. CLI Example: salt '*' kubernetes.ping ''' status = True try: nodes(**kwargs) except CommandExecutionError: status = Fals...
Checks connections with the kubernetes API server. Returns True if the connection can be established, False otherwise. CLI Example: salt '*' kubernetes.ping
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kubernetesmod.py#L251-L265
[ "def nodes(**kwargs):\n '''\n Return the names of the nodes composing the kubernetes cluster\n\n CLI Examples::\n\n salt '*' kubernetes.nodes\n salt '*' kubernetes.nodes kubeconfig=/etc/salt/k8s/kubeconfig context=minikube\n '''\n cfg = _setup_conn(**kwargs)\n try:\n api_insta...
# -*- coding: utf-8 -*- ''' Module for handling kubernetes calls. :optdepends: - kubernetes Python client :configuration: The k8s API settings are provided either in a pillar, in the minion's config file, or in master's config file:: kubernetes.kubeconfig: '/path/to/kubeconfig' kubernetes.kubec...
saltstack/salt
salt/modules/kubernetesmod.py
nodes
python
def nodes(**kwargs): ''' Return the names of the nodes composing the kubernetes cluster CLI Examples:: salt '*' kubernetes.nodes salt '*' kubernetes.nodes kubeconfig=/etc/salt/k8s/kubeconfig context=minikube ''' cfg = _setup_conn(**kwargs) try: api_instance = kubernetes...
Return the names of the nodes composing the kubernetes cluster CLI Examples:: salt '*' kubernetes.nodes salt '*' kubernetes.nodes kubeconfig=/etc/salt/k8s/kubeconfig context=minikube
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kubernetesmod.py#L268-L290
[ "def _cleanup(**kwargs):\n if not kwargs:\n return _cleanup_old(**kwargs)\n\n if 'kubeconfig' in kwargs:\n kubeconfig = kwargs.get('kubeconfig')\n if kubeconfig and os.path.basename(kubeconfig).startswith('salt-kubeconfig-'):\n try:\n os.unlink(kubeconfig)\n ...
# -*- coding: utf-8 -*- ''' Module for handling kubernetes calls. :optdepends: - kubernetes Python client :configuration: The k8s API settings are provided either in a pillar, in the minion's config file, or in master's config file:: kubernetes.kubeconfig: '/path/to/kubeconfig' kubernetes.kubec...
saltstack/salt
salt/modules/kubernetesmod.py
node
python
def node(name, **kwargs): ''' Return the details of the node identified by the specified name CLI Examples:: salt '*' kubernetes.node name='minikube' ''' cfg = _setup_conn(**kwargs) try: api_instance = kubernetes.client.CoreV1Api() api_response = api_instance.list_node(...
Return the details of the node identified by the specified name CLI Examples:: salt '*' kubernetes.node name='minikube'
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kubernetesmod.py#L293-L318
[ "def _cleanup(**kwargs):\n if not kwargs:\n return _cleanup_old(**kwargs)\n\n if 'kubeconfig' in kwargs:\n kubeconfig = kwargs.get('kubeconfig')\n if kubeconfig and os.path.basename(kubeconfig).startswith('salt-kubeconfig-'):\n try:\n os.unlink(kubeconfig)\n ...
# -*- coding: utf-8 -*- ''' Module for handling kubernetes calls. :optdepends: - kubernetes Python client :configuration: The k8s API settings are provided either in a pillar, in the minion's config file, or in master's config file:: kubernetes.kubeconfig: '/path/to/kubeconfig' kubernetes.kubec...
saltstack/salt
salt/modules/kubernetesmod.py
node_add_label
python
def node_add_label(node_name, label_name, label_value, **kwargs): ''' Set the value of the label identified by `label_name` to `label_value` on the node identified by the name `node_name`. Creates the lable if not present. CLI Examples:: salt '*' kubernetes.node_add_label node_name="miniku...
Set the value of the label identified by `label_name` to `label_value` on the node identified by the name `node_name`. Creates the lable if not present. CLI Examples:: salt '*' kubernetes.node_add_label node_name="minikube" \ label_name="foo" label_value="bar"
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kubernetesmod.py#L337-L368
[ "def _cleanup(**kwargs):\n if not kwargs:\n return _cleanup_old(**kwargs)\n\n if 'kubeconfig' in kwargs:\n kubeconfig = kwargs.get('kubeconfig')\n if kubeconfig and os.path.basename(kubeconfig).startswith('salt-kubeconfig-'):\n try:\n os.unlink(kubeconfig)\n ...
# -*- coding: utf-8 -*- ''' Module for handling kubernetes calls. :optdepends: - kubernetes Python client :configuration: The k8s API settings are provided either in a pillar, in the minion's config file, or in master's config file:: kubernetes.kubeconfig: '/path/to/kubeconfig' kubernetes.kubec...
saltstack/salt
salt/modules/kubernetesmod.py
namespaces
python
def namespaces(**kwargs): ''' Return the names of the available namespaces CLI Examples:: salt '*' kubernetes.namespaces salt '*' kubernetes.namespaces kubeconfig=/etc/salt/k8s/kubeconfig context=minikube ''' cfg = _setup_conn(**kwargs) try: api_instance = kubernetes.cl...
Return the names of the available namespaces CLI Examples:: salt '*' kubernetes.namespaces salt '*' kubernetes.namespaces kubeconfig=/etc/salt/k8s/kubeconfig context=minikube
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kubernetesmod.py#L404-L426
[ "def _cleanup(**kwargs):\n if not kwargs:\n return _cleanup_old(**kwargs)\n\n if 'kubeconfig' in kwargs:\n kubeconfig = kwargs.get('kubeconfig')\n if kubeconfig and os.path.basename(kubeconfig).startswith('salt-kubeconfig-'):\n try:\n os.unlink(kubeconfig)\n ...
# -*- coding: utf-8 -*- ''' Module for handling kubernetes calls. :optdepends: - kubernetes Python client :configuration: The k8s API settings are provided either in a pillar, in the minion's config file, or in master's config file:: kubernetes.kubeconfig: '/path/to/kubeconfig' kubernetes.kubec...
saltstack/salt
salt/modules/kubernetesmod.py
deployments
python
def deployments(namespace='default', **kwargs): ''' Return a list of kubernetes deployments defined in the namespace CLI Examples:: salt '*' kubernetes.deployments salt '*' kubernetes.deployments namespace=default ''' cfg = _setup_conn(**kwargs) try: api_instance = kube...
Return a list of kubernetes deployments defined in the namespace CLI Examples:: salt '*' kubernetes.deployments salt '*' kubernetes.deployments namespace=default
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kubernetesmod.py#L429-L454
[ "def _cleanup(**kwargs):\n if not kwargs:\n return _cleanup_old(**kwargs)\n\n if 'kubeconfig' in kwargs:\n kubeconfig = kwargs.get('kubeconfig')\n if kubeconfig and os.path.basename(kubeconfig).startswith('salt-kubeconfig-'):\n try:\n os.unlink(kubeconfig)\n ...
# -*- coding: utf-8 -*- ''' Module for handling kubernetes calls. :optdepends: - kubernetes Python client :configuration: The k8s API settings are provided either in a pillar, in the minion's config file, or in master's config file:: kubernetes.kubeconfig: '/path/to/kubeconfig' kubernetes.kubec...
saltstack/salt
salt/modules/kubernetesmod.py
services
python
def services(namespace='default', **kwargs): ''' Return a list of kubernetes services defined in the namespace CLI Examples:: salt '*' kubernetes.services salt '*' kubernetes.services namespace=default ''' cfg = _setup_conn(**kwargs) try: api_instance = kubernetes.clien...
Return a list of kubernetes services defined in the namespace CLI Examples:: salt '*' kubernetes.services salt '*' kubernetes.services namespace=default
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kubernetesmod.py#L457-L482
[ "def _cleanup(**kwargs):\n if not kwargs:\n return _cleanup_old(**kwargs)\n\n if 'kubeconfig' in kwargs:\n kubeconfig = kwargs.get('kubeconfig')\n if kubeconfig and os.path.basename(kubeconfig).startswith('salt-kubeconfig-'):\n try:\n os.unlink(kubeconfig)\n ...
# -*- coding: utf-8 -*- ''' Module for handling kubernetes calls. :optdepends: - kubernetes Python client :configuration: The k8s API settings are provided either in a pillar, in the minion's config file, or in master's config file:: kubernetes.kubeconfig: '/path/to/kubeconfig' kubernetes.kubec...
saltstack/salt
salt/modules/kubernetesmod.py
pods
python
def pods(namespace='default', **kwargs): ''' Return a list of kubernetes pods defined in the namespace CLI Examples:: salt '*' kubernetes.pods salt '*' kubernetes.pods namespace=default ''' cfg = _setup_conn(**kwargs) try: api_instance = kubernetes.client.CoreV1Api() ...
Return a list of kubernetes pods defined in the namespace CLI Examples:: salt '*' kubernetes.pods salt '*' kubernetes.pods namespace=default
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kubernetesmod.py#L485-L510
[ "def _cleanup(**kwargs):\n if not kwargs:\n return _cleanup_old(**kwargs)\n\n if 'kubeconfig' in kwargs:\n kubeconfig = kwargs.get('kubeconfig')\n if kubeconfig and os.path.basename(kubeconfig).startswith('salt-kubeconfig-'):\n try:\n os.unlink(kubeconfig)\n ...
# -*- coding: utf-8 -*- ''' Module for handling kubernetes calls. :optdepends: - kubernetes Python client :configuration: The k8s API settings are provided either in a pillar, in the minion's config file, or in master's config file:: kubernetes.kubeconfig: '/path/to/kubeconfig' kubernetes.kubec...
saltstack/salt
salt/modules/kubernetesmod.py
configmaps
python
def configmaps(namespace='default', **kwargs): ''' Return a list of kubernetes configmaps defined in the namespace CLI Examples:: salt '*' kubernetes.configmaps salt '*' kubernetes.configmaps namespace=default ''' cfg = _setup_conn(**kwargs) try: api_instance = kubernet...
Return a list of kubernetes configmaps defined in the namespace CLI Examples:: salt '*' kubernetes.configmaps salt '*' kubernetes.configmaps namespace=default
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kubernetesmod.py#L541-L566
[ "def _cleanup(**kwargs):\n if not kwargs:\n return _cleanup_old(**kwargs)\n\n if 'kubeconfig' in kwargs:\n kubeconfig = kwargs.get('kubeconfig')\n if kubeconfig and os.path.basename(kubeconfig).startswith('salt-kubeconfig-'):\n try:\n os.unlink(kubeconfig)\n ...
# -*- coding: utf-8 -*- ''' Module for handling kubernetes calls. :optdepends: - kubernetes Python client :configuration: The k8s API settings are provided either in a pillar, in the minion's config file, or in master's config file:: kubernetes.kubeconfig: '/path/to/kubeconfig' kubernetes.kubec...
saltstack/salt
salt/modules/kubernetesmod.py
show_deployment
python
def show_deployment(name, namespace='default', **kwargs): ''' Return the kubernetes deployment defined by name and namespace CLI Examples:: salt '*' kubernetes.show_deployment my-nginx default salt '*' kubernetes.show_deployment name=my-nginx namespace=default ''' cfg = _setup_conn...
Return the kubernetes deployment defined by name and namespace CLI Examples:: salt '*' kubernetes.show_deployment my-nginx default salt '*' kubernetes.show_deployment name=my-nginx namespace=default
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kubernetesmod.py#L569-L594
[ "def _cleanup(**kwargs):\n if not kwargs:\n return _cleanup_old(**kwargs)\n\n if 'kubeconfig' in kwargs:\n kubeconfig = kwargs.get('kubeconfig')\n if kubeconfig and os.path.basename(kubeconfig).startswith('salt-kubeconfig-'):\n try:\n os.unlink(kubeconfig)\n ...
# -*- coding: utf-8 -*- ''' Module for handling kubernetes calls. :optdepends: - kubernetes Python client :configuration: The k8s API settings are provided either in a pillar, in the minion's config file, or in master's config file:: kubernetes.kubeconfig: '/path/to/kubeconfig' kubernetes.kubec...
saltstack/salt
salt/modules/kubernetesmod.py
show_namespace
python
def show_namespace(name, **kwargs): ''' Return information for a given namespace defined by the specified name CLI Examples:: salt '*' kubernetes.show_namespace kube-system ''' cfg = _setup_conn(**kwargs) try: api_instance = kubernetes.client.CoreV1Api() api_response = ...
Return information for a given namespace defined by the specified name CLI Examples:: salt '*' kubernetes.show_namespace kube-system
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kubernetesmod.py#L653-L677
[ "def _cleanup(**kwargs):\n if not kwargs:\n return _cleanup_old(**kwargs)\n\n if 'kubeconfig' in kwargs:\n kubeconfig = kwargs.get('kubeconfig')\n if kubeconfig and os.path.basename(kubeconfig).startswith('salt-kubeconfig-'):\n try:\n os.unlink(kubeconfig)\n ...
# -*- coding: utf-8 -*- ''' Module for handling kubernetes calls. :optdepends: - kubernetes Python client :configuration: The k8s API settings are provided either in a pillar, in the minion's config file, or in master's config file:: kubernetes.kubeconfig: '/path/to/kubeconfig' kubernetes.kubec...
saltstack/salt
salt/modules/kubernetesmod.py
show_secret
python
def show_secret(name, namespace='default', decode=False, **kwargs): ''' Return the kubernetes secret defined by name and namespace. The secrets can be decoded if specified by the user. Warning: this has security implications. CLI Examples:: salt '*' kubernetes.show_secret confidential defa...
Return the kubernetes secret defined by name and namespace. The secrets can be decoded if specified by the user. Warning: this has security implications. CLI Examples:: salt '*' kubernetes.show_secret confidential default salt '*' kubernetes.show_secret name=confidential namespace=default ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kubernetesmod.py#L680-L713
[ "def _cleanup(**kwargs):\n if not kwargs:\n return _cleanup_old(**kwargs)\n\n if 'kubeconfig' in kwargs:\n kubeconfig = kwargs.get('kubeconfig')\n if kubeconfig and os.path.basename(kubeconfig).startswith('salt-kubeconfig-'):\n try:\n os.unlink(kubeconfig)\n ...
# -*- coding: utf-8 -*- ''' Module for handling kubernetes calls. :optdepends: - kubernetes Python client :configuration: The k8s API settings are provided either in a pillar, in the minion's config file, or in master's config file:: kubernetes.kubeconfig: '/path/to/kubeconfig' kubernetes.kubec...
saltstack/salt
salt/modules/kubernetesmod.py
delete_deployment
python
def delete_deployment(name, namespace='default', **kwargs): ''' Deletes the kubernetes deployment defined by name and namespace CLI Examples:: salt '*' kubernetes.delete_deployment my-nginx salt '*' kubernetes.delete_deployment name=my-nginx namespace=default ''' cfg = _setup_conn(...
Deletes the kubernetes deployment defined by name and namespace CLI Examples:: salt '*' kubernetes.delete_deployment my-nginx salt '*' kubernetes.delete_deployment name=my-nginx namespace=default
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kubernetesmod.py#L746-L798
[ "def _cleanup(**kwargs):\n if not kwargs:\n return _cleanup_old(**kwargs)\n\n if 'kubeconfig' in kwargs:\n kubeconfig = kwargs.get('kubeconfig')\n if kubeconfig and os.path.basename(kubeconfig).startswith('salt-kubeconfig-'):\n try:\n os.unlink(kubeconfig)\n ...
# -*- coding: utf-8 -*- ''' Module for handling kubernetes calls. :optdepends: - kubernetes Python client :configuration: The k8s API settings are provided either in a pillar, in the minion's config file, or in master's config file:: kubernetes.kubeconfig: '/path/to/kubeconfig' kubernetes.kubec...
saltstack/salt
salt/modules/kubernetesmod.py
delete_service
python
def delete_service(name, namespace='default', **kwargs): ''' Deletes the kubernetes service defined by name and namespace CLI Examples:: salt '*' kubernetes.delete_service my-nginx default salt '*' kubernetes.delete_service name=my-nginx namespace=default ''' cfg = _setup_conn(**kw...
Deletes the kubernetes service defined by name and namespace CLI Examples:: salt '*' kubernetes.delete_service my-nginx default salt '*' kubernetes.delete_service name=my-nginx namespace=default
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kubernetesmod.py#L801-L828
[ "def _cleanup(**kwargs):\n if not kwargs:\n return _cleanup_old(**kwargs)\n\n if 'kubeconfig' in kwargs:\n kubeconfig = kwargs.get('kubeconfig')\n if kubeconfig and os.path.basename(kubeconfig).startswith('salt-kubeconfig-'):\n try:\n os.unlink(kubeconfig)\n ...
# -*- coding: utf-8 -*- ''' Module for handling kubernetes calls. :optdepends: - kubernetes Python client :configuration: The k8s API settings are provided either in a pillar, in the minion's config file, or in master's config file:: kubernetes.kubeconfig: '/path/to/kubeconfig' kubernetes.kubec...
saltstack/salt
salt/modules/kubernetesmod.py
delete_pod
python
def delete_pod(name, namespace='default', **kwargs): ''' Deletes the kubernetes pod defined by name and namespace CLI Examples:: salt '*' kubernetes.delete_pod guestbook-708336848-5nl8c default salt '*' kubernetes.delete_pod name=guestbook-708336848-5nl8c namespace=default ''' cfg ...
Deletes the kubernetes pod defined by name and namespace CLI Examples:: salt '*' kubernetes.delete_pod guestbook-708336848-5nl8c default salt '*' kubernetes.delete_pod name=guestbook-708336848-5nl8c namespace=default
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kubernetesmod.py#L831-L861
[ "def _cleanup(**kwargs):\n if not kwargs:\n return _cleanup_old(**kwargs)\n\n if 'kubeconfig' in kwargs:\n kubeconfig = kwargs.get('kubeconfig')\n if kubeconfig and os.path.basename(kubeconfig).startswith('salt-kubeconfig-'):\n try:\n os.unlink(kubeconfig)\n ...
# -*- coding: utf-8 -*- ''' Module for handling kubernetes calls. :optdepends: - kubernetes Python client :configuration: The k8s API settings are provided either in a pillar, in the minion's config file, or in master's config file:: kubernetes.kubeconfig: '/path/to/kubeconfig' kubernetes.kubec...
saltstack/salt
salt/modules/kubernetesmod.py
create_pod
python
def create_pod( name, namespace, metadata, spec, source, template, saltenv, **kwargs): ''' Creates the kubernetes deployment as defined by the user. ''' body = __create_object_body( kind='Pod', obj_class=kubernetes.client.V1...
Creates the kubernetes deployment as defined by the user.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kubernetesmod.py#L1003-L1045
[ "def _cleanup(**kwargs):\n if not kwargs:\n return _cleanup_old(**kwargs)\n\n if 'kubeconfig' in kwargs:\n kubeconfig = kwargs.get('kubeconfig')\n if kubeconfig and os.path.basename(kubeconfig).startswith('salt-kubeconfig-'):\n try:\n os.unlink(kubeconfig)\n ...
# -*- coding: utf-8 -*- ''' Module for handling kubernetes calls. :optdepends: - kubernetes Python client :configuration: The k8s API settings are provided either in a pillar, in the minion's config file, or in master's config file:: kubernetes.kubeconfig: '/path/to/kubeconfig' kubernetes.kubec...
saltstack/salt
salt/modules/kubernetesmod.py
create_secret
python
def create_secret( name, namespace='default', data=None, source=None, template=None, saltenv='base', **kwargs): ''' Creates the kubernetes secret as defined by the user. CLI Examples:: salt 'minion1' kubernetes.create_secret \ pas...
Creates the kubernetes secret as defined by the user. CLI Examples:: salt 'minion1' kubernetes.create_secret \ passwords default '{"db": "letmein"}' salt 'minion2' kubernetes.create_secret \ name=passwords namespace=default data='{"db": "letmein"}'
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kubernetesmod.py#L1093-L1145
[ "def _cleanup(**kwargs):\n if not kwargs:\n return _cleanup_old(**kwargs)\n\n if 'kubeconfig' in kwargs:\n kubeconfig = kwargs.get('kubeconfig')\n if kubeconfig and os.path.basename(kubeconfig).startswith('salt-kubeconfig-'):\n try:\n os.unlink(kubeconfig)\n ...
# -*- coding: utf-8 -*- ''' Module for handling kubernetes calls. :optdepends: - kubernetes Python client :configuration: The k8s API settings are provided either in a pillar, in the minion's config file, or in master's config file:: kubernetes.kubeconfig: '/path/to/kubeconfig' kubernetes.kubec...
saltstack/salt
salt/modules/kubernetesmod.py
create_configmap
python
def create_configmap( name, namespace, data, source=None, template=None, saltenv='base', **kwargs): ''' Creates the kubernetes configmap as defined by the user. CLI Examples:: salt 'minion1' kubernetes.create_configmap \ settings ...
Creates the kubernetes configmap as defined by the user. CLI Examples:: salt 'minion1' kubernetes.create_configmap \ settings default '{"example.conf": "# example file"}' salt 'minion2' kubernetes.create_configmap \ name=settings namespace=default data='{"example.conf": "#...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kubernetesmod.py#L1148-L1196
[ "def _cleanup(**kwargs):\n if not kwargs:\n return _cleanup_old(**kwargs)\n\n if 'kubeconfig' in kwargs:\n kubeconfig = kwargs.get('kubeconfig')\n if kubeconfig and os.path.basename(kubeconfig).startswith('salt-kubeconfig-'):\n try:\n os.unlink(kubeconfig)\n ...
# -*- coding: utf-8 -*- ''' Module for handling kubernetes calls. :optdepends: - kubernetes Python client :configuration: The k8s API settings are provided either in a pillar, in the minion's config file, or in master's config file:: kubernetes.kubeconfig: '/path/to/kubeconfig' kubernetes.kubec...
saltstack/salt
salt/modules/kubernetesmod.py
create_namespace
python
def create_namespace( name, **kwargs): ''' Creates a namespace with the specified name. CLI Example: salt '*' kubernetes.create_namespace salt salt '*' kubernetes.create_namespace name=salt ''' meta_obj = kubernetes.client.V1ObjectMeta(name=name) body = kubernet...
Creates a namespace with the specified name. CLI Example: salt '*' kubernetes.create_namespace salt salt '*' kubernetes.create_namespace name=salt
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kubernetesmod.py#L1199-L1231
[ "def _cleanup(**kwargs):\n if not kwargs:\n return _cleanup_old(**kwargs)\n\n if 'kubeconfig' in kwargs:\n kubeconfig = kwargs.get('kubeconfig')\n if kubeconfig and os.path.basename(kubeconfig).startswith('salt-kubeconfig-'):\n try:\n os.unlink(kubeconfig)\n ...
# -*- coding: utf-8 -*- ''' Module for handling kubernetes calls. :optdepends: - kubernetes Python client :configuration: The k8s API settings are provided either in a pillar, in the minion's config file, or in master's config file:: kubernetes.kubeconfig: '/path/to/kubeconfig' kubernetes.kubec...
saltstack/salt
salt/modules/kubernetesmod.py
replace_deployment
python
def replace_deployment(name, metadata, spec, source, template, saltenv, namespace='default', **kwargs): ''' Replaces an existing deployment with a new ...
Replaces an existing deployment with a new one defined by name and namespace, having the specificed metadata and spec.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kubernetesmod.py#L1234-L1276
[ "def _cleanup(**kwargs):\n if not kwargs:\n return _cleanup_old(**kwargs)\n\n if 'kubeconfig' in kwargs:\n kubeconfig = kwargs.get('kubeconfig')\n if kubeconfig and os.path.basename(kubeconfig).startswith('salt-kubeconfig-'):\n try:\n os.unlink(kubeconfig)\n ...
# -*- coding: utf-8 -*- ''' Module for handling kubernetes calls. :optdepends: - kubernetes Python client :configuration: The k8s API settings are provided either in a pillar, in the minion's config file, or in master's config file:: kubernetes.kubeconfig: '/path/to/kubeconfig' kubernetes.kubec...
saltstack/salt
salt/modules/kubernetesmod.py
replace_service
python
def replace_service(name, metadata, spec, source, template, old_service, saltenv, namespace='default', **kwargs): ''' Replaces an existing service with ...
Replaces an existing service with a new one defined by name and namespace, having the specificed metadata and spec.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kubernetesmod.py#L1279-L1327
[ "def _cleanup(**kwargs):\n if not kwargs:\n return _cleanup_old(**kwargs)\n\n if 'kubeconfig' in kwargs:\n kubeconfig = kwargs.get('kubeconfig')\n if kubeconfig and os.path.basename(kubeconfig).startswith('salt-kubeconfig-'):\n try:\n os.unlink(kubeconfig)\n ...
# -*- coding: utf-8 -*- ''' Module for handling kubernetes calls. :optdepends: - kubernetes Python client :configuration: The k8s API settings are provided either in a pillar, in the minion's config file, or in master's config file:: kubernetes.kubeconfig: '/path/to/kubeconfig' kubernetes.kubec...
saltstack/salt
salt/modules/kubernetesmod.py
__create_object_body
python
def __create_object_body(kind, obj_class, spec_creator, name, namespace, metadata, spec, source, template, ...
Create a Kubernetes Object body instance.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kubernetesmod.py#L1434-L1464
[ "def __dict_to_deployment_spec(spec):\n '''\n Converts a dictionary into kubernetes AppsV1beta1DeploymentSpec instance.\n '''\n spec_obj = AppsV1beta1DeploymentSpec(template=spec.get('template', ''))\n for key, value in iteritems(spec):\n if hasattr(spec_obj, key):\n setattr(spec_ob...
# -*- coding: utf-8 -*- ''' Module for handling kubernetes calls. :optdepends: - kubernetes Python client :configuration: The k8s API settings are provided either in a pillar, in the minion's config file, or in master's config file:: kubernetes.kubeconfig: '/path/to/kubeconfig' kubernetes.kubec...
saltstack/salt
salt/modules/kubernetesmod.py
__read_and_render_yaml_file
python
def __read_and_render_yaml_file(source, template, saltenv): ''' Read a yaml file and, if needed, renders that using the specifieds templating. Returns the python objects defined inside of the file. ''' sfn = __salt__['cp.cache_file'](so...
Read a yaml file and, if needed, renders that using the specifieds templating. Returns the python objects defined inside of the file.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kubernetesmod.py#L1467-L1510
[ "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 -*- ''' Module for handling kubernetes calls. :optdepends: - kubernetes Python client :configuration: The k8s API settings are provided either in a pillar, in the minion's config file, or in master's config file:: kubernetes.kubeconfig: '/path/to/kubeconfig' kubernetes.kubec...
saltstack/salt
salt/modules/kubernetesmod.py
__dict_to_object_meta
python
def __dict_to_object_meta(name, namespace, metadata): ''' Converts a dictionary into kubernetes ObjectMetaV1 instance. ''' meta_obj = kubernetes.client.V1ObjectMeta() meta_obj.namespace = namespace # Replicate `kubectl [create|replace|apply] --record` if 'annotations' not in metadata: ...
Converts a dictionary into kubernetes ObjectMetaV1 instance.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kubernetesmod.py#L1513-L1536
[ "def iteritems(d, **kw):\n return d.iteritems(**kw)\n" ]
# -*- coding: utf-8 -*- ''' Module for handling kubernetes calls. :optdepends: - kubernetes Python client :configuration: The k8s API settings are provided either in a pillar, in the minion's config file, or in master's config file:: kubernetes.kubeconfig: '/path/to/kubeconfig' kubernetes.kubec...
saltstack/salt
salt/modules/kubernetesmod.py
__dict_to_deployment_spec
python
def __dict_to_deployment_spec(spec): ''' Converts a dictionary into kubernetes AppsV1beta1DeploymentSpec instance. ''' spec_obj = AppsV1beta1DeploymentSpec(template=spec.get('template', '')) for key, value in iteritems(spec): if hasattr(spec_obj, key): setattr(spec_obj, key, valu...
Converts a dictionary into kubernetes AppsV1beta1DeploymentSpec instance.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kubernetesmod.py#L1539-L1548
null
# -*- coding: utf-8 -*- ''' Module for handling kubernetes calls. :optdepends: - kubernetes Python client :configuration: The k8s API settings are provided either in a pillar, in the minion's config file, or in master's config file:: kubernetes.kubeconfig: '/path/to/kubeconfig' kubernetes.kubec...
saltstack/salt
salt/modules/kubernetesmod.py
__dict_to_pod_spec
python
def __dict_to_pod_spec(spec): ''' Converts a dictionary into kubernetes V1PodSpec instance. ''' spec_obj = kubernetes.client.V1PodSpec() for key, value in iteritems(spec): if hasattr(spec_obj, key): setattr(spec_obj, key, value) return spec_obj
Converts a dictionary into kubernetes V1PodSpec instance.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kubernetesmod.py#L1551-L1560
null
# -*- coding: utf-8 -*- ''' Module for handling kubernetes calls. :optdepends: - kubernetes Python client :configuration: The k8s API settings are provided either in a pillar, in the minion's config file, or in master's config file:: kubernetes.kubeconfig: '/path/to/kubeconfig' kubernetes.kubec...
saltstack/salt
salt/modules/kubernetesmod.py
__dict_to_service_spec
python
def __dict_to_service_spec(spec): ''' Converts a dictionary into kubernetes V1ServiceSpec instance. ''' spec_obj = kubernetes.client.V1ServiceSpec() for key, value in iteritems(spec): # pylint: disable=too-many-nested-blocks if key == 'ports': spec_obj.ports = [] for...
Converts a dictionary into kubernetes V1ServiceSpec instance.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kubernetesmod.py#L1563-L1583
null
# -*- coding: utf-8 -*- ''' Module for handling kubernetes calls. :optdepends: - kubernetes Python client :configuration: The k8s API settings are provided either in a pillar, in the minion's config file, or in master's config file:: kubernetes.kubeconfig: '/path/to/kubeconfig' kubernetes.kubec...
saltstack/salt
salt/modules/kubernetesmod.py
__enforce_only_strings_dict
python
def __enforce_only_strings_dict(dictionary): ''' Returns a dictionary that has string keys and values. ''' ret = {} for key, value in iteritems(dictionary): ret[six.text_type(key)] = six.text_type(value) return ret
Returns a dictionary that has string keys and values.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kubernetesmod.py#L1586-L1595
[ "def iteritems(d, **kw):\n return d.iteritems(**kw)\n" ]
# -*- coding: utf-8 -*- ''' Module for handling kubernetes calls. :optdepends: - kubernetes Python client :configuration: The k8s API settings are provided either in a pillar, in the minion's config file, or in master's config file:: kubernetes.kubeconfig: '/path/to/kubeconfig' kubernetes.kubec...
saltstack/salt
salt/utils/virt.py
VirtKey.accept
python
def accept(self, pub): ''' Accept the provided key ''' try: with salt.utils.files.fopen(self.path, 'r') as fp_: expiry = int(fp_.read()) except (OSError, IOError): log.error( 'Request to sign key for minion \'%s\' on hyper \...
Accept the provided key
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/virt.py#L32-L64
[ "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 VirtKey(object): ''' Used to manage key signing requests. ''' def __init__(self, hyper, id_, opts): self.opts = opts self.hyper = hyper self.id = id_ path = os.path.join(self.opts['pki_dir'], 'virtkeys', hyper) if not os.path.isdir(path): os.make...
saltstack/salt
salt/utils/virt.py
VirtKey.authorize
python
def authorize(self): ''' Prepare the master to expect a signing request ''' with salt.utils.files.fopen(self.path, 'w+') as fp_: fp_.write(str(int(time.time()))) # future lint: disable=blacklisted-function return True
Prepare the master to expect a signing request
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/virt.py#L66-L72
[ "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 VirtKey(object): ''' Used to manage key signing requests. ''' def __init__(self, hyper, id_, opts): self.opts = opts self.hyper = hyper self.id = id_ path = os.path.join(self.opts['pki_dir'], 'virtkeys', hyper) if not os.path.isdir(path): os.make...
saltstack/salt
salt/ext/backports_abc.py
patch
python
def patch(patch_inspect=True): PATCHED['collections.abc.Generator'] = _collections_abc.Generator = Generator PATCHED['collections.abc.Coroutine'] = _collections_abc.Coroutine = Coroutine PATCHED['collections.abc.Awaitable'] = _collections_abc.Awaitable = Awaitable if patch_inspect: import inspe...
Main entry point for patching the ``collections.abc`` and ``inspect`` standard library modules.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/ext/backports_abc.py#L205-L216
null
""" Patch recently added ABCs into the standard lib module ``collections.abc`` (Py3) or ``collections`` (Py2). Usage:: import backports_abc backports_abc.patch() or:: try: from collections.abc import Generator except ImportError: from backports_abc import Generator """ try: impo...
saltstack/salt
salt/utils/kickstart.py
parse_auth
python
def parse_auth(rule): ''' Parses the auth/authconfig line ''' parser = argparse.ArgumentParser() rules = shlex.split(rule) rules.pop(0) noargs = ('back', 'test', 'nostart', 'kickstart', 'probe', 'enablecache', 'disablecache', 'disablenis', 'enableshadow', 'disableshadow', ...
Parses the auth/authconfig line
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/kickstart.py#L25-L83
[ "def clean_args(args):\n '''\n Cleans up the args that weren't passed in\n '''\n for arg in args:\n if not args[arg]:\n del args[arg]\n return args\n" ]
# -*- coding: utf-8 -*- ''' Utilities for managing kickstart .. versionadded:: Beryllium ''' from __future__ import absolute_import, unicode_literals import shlex import argparse # pylint: disable=minimum-python-version import salt.utils.files import salt.utils.yaml from salt.ext.six.moves import range def clean_ar...
saltstack/salt
salt/utils/kickstart.py
parse_iscsiname
python
def parse_iscsiname(rule): ''' Parse the iscsiname line ''' parser = argparse.ArgumentParser() rules = shlex.split(rule) rules.pop(0) #parser.add_argument('iqn') args = clean_args(vars(parser.parse_args(rules))) parser = None return args
Parse the iscsiname line
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/kickstart.py#L345-L356
[ "def clean_args(args):\n '''\n Cleans up the args that weren't passed in\n '''\n for arg in args:\n if not args[arg]:\n del args[arg]\n return args\n" ]
# -*- coding: utf-8 -*- ''' Utilities for managing kickstart .. versionadded:: Beryllium ''' from __future__ import absolute_import, unicode_literals import shlex import argparse # pylint: disable=minimum-python-version import salt.utils.files import salt.utils.yaml from salt.ext.six.moves import range def clean_ar...
saltstack/salt
salt/utils/kickstart.py
parse_partition
python
def parse_partition(rule): ''' Parse the partition line ''' parser = argparse.ArgumentParser() rules = shlex.split(rule) rules.pop(0) parser.add_argument('mntpoint') parser.add_argument('--size', dest='size', action='store') parser.add_argument('--grow', dest='grow', action='store_tr...
Parse the partition line
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/kickstart.py#L528-L557
[ "def clean_args(args):\n '''\n Cleans up the args that weren't passed in\n '''\n for arg in args:\n if not args[arg]:\n del args[arg]\n return args\n" ]
# -*- coding: utf-8 -*- ''' Utilities for managing kickstart .. versionadded:: Beryllium ''' from __future__ import absolute_import, unicode_literals import shlex import argparse # pylint: disable=minimum-python-version import salt.utils.files import salt.utils.yaml from salt.ext.six.moves import range def clean_ar...
saltstack/salt
salt/utils/kickstart.py
parse_raid
python
def parse_raid(rule): ''' Parse the raid line ''' parser = argparse.ArgumentParser() rules = shlex.split(rule) rules.pop(0) partitions = [] newrules = [] for count in range(0, len(rules)): if count == 0: newrules.append(rules[count]) continue ...
Parse the raid line
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/kickstart.py#L560-L601
[ "def clean_args(args):\n '''\n Cleans up the args that weren't passed in\n '''\n for arg in args:\n if not args[arg]:\n del args[arg]\n return args\n" ]
# -*- coding: utf-8 -*- ''' Utilities for managing kickstart .. versionadded:: Beryllium ''' from __future__ import absolute_import, unicode_literals import shlex import argparse # pylint: disable=minimum-python-version import salt.utils.files import salt.utils.yaml from salt.ext.six.moves import range def clean_ar...
saltstack/salt
salt/utils/kickstart.py
parse_services
python
def parse_services(rule): ''' Parse the services line ''' parser = argparse.ArgumentParser() rules = shlex.split(rule) rules.pop(0) parser.add_argument('--disabled', dest='disabled', action='store') parser.add_argument('--enabled', dest='enabled', action='store') args = clean_args(v...
Parse the services line
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/kickstart.py#L689-L701
[ "def clean_args(args):\n '''\n Cleans up the args that weren't passed in\n '''\n for arg in args:\n if not args[arg]:\n del args[arg]\n return args\n" ]
# -*- coding: utf-8 -*- ''' Utilities for managing kickstart .. versionadded:: Beryllium ''' from __future__ import absolute_import, unicode_literals import shlex import argparse # pylint: disable=minimum-python-version import salt.utils.files import salt.utils.yaml from salt.ext.six.moves import range def clean_ar...
saltstack/salt
salt/utils/kickstart.py
parse_updates
python
def parse_updates(rule): ''' Parse the updates line ''' rules = shlex.split(rule) rules.pop(0) return {'url': rules[0]} if rules else True
Parse the updates line
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/kickstart.py#L739-L745
null
# -*- coding: utf-8 -*- ''' Utilities for managing kickstart .. versionadded:: Beryllium ''' from __future__ import absolute_import, unicode_literals import shlex import argparse # pylint: disable=minimum-python-version import salt.utils.files import salt.utils.yaml from salt.ext.six.moves import range def clean_ar...
saltstack/salt
salt/utils/kickstart.py
parse_volgroup
python
def parse_volgroup(rule): ''' Parse the volgroup line ''' parser = argparse.ArgumentParser() rules = shlex.split(rule) rules.pop(0) partitions = [] newrules = [] for count in range(0, len(rules)): if count == 0: newrules.append(rules[count]) continue ...
Parse the volgroup line
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/kickstart.py#L820-L855
[ "def clean_args(args):\n '''\n Cleans up the args that weren't passed in\n '''\n for arg in args:\n if not args[arg]:\n del args[arg]\n return args\n" ]
# -*- coding: utf-8 -*- ''' Utilities for managing kickstart .. versionadded:: Beryllium ''' from __future__ import absolute_import, unicode_literals import shlex import argparse # pylint: disable=minimum-python-version import salt.utils.files import salt.utils.yaml from salt.ext.six.moves import range def clean_ar...
saltstack/salt
salt/utils/kickstart.py
mksls
python
def mksls(src, dst=None): ''' Convert a kickstart file to an SLS file ''' mode = 'command' sls = {} ks_opts = {} with salt.utils.files.fopen(src, 'r') as fh_: for line in fh_: if line.startswith('#'): continue if mode == 'command': ...
Convert a kickstart file to an SLS file
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/kickstart.py#L891-L1178
[ "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 -*- ''' Utilities for managing kickstart .. versionadded:: Beryllium ''' from __future__ import absolute_import, unicode_literals import shlex import argparse # pylint: disable=minimum-python-version import salt.utils.files import salt.utils.yaml from salt.ext.six.moves import range def clean_ar...
saltstack/salt
salt/modules/mac_power.py
_validate_sleep
python
def _validate_sleep(minutes): ''' Helper function that validates the minutes parameter. Can be any number between 1 and 180. Can also be the string values "Never" and "Off". Because "On" and "Off" get converted to boolean values on the command line it will error if "On" is passed Returns: The ...
Helper function that validates the minutes parameter. Can be any number between 1 and 180. Can also be the string values "Never" and "Off". Because "On" and "Off" get converted to boolean values on the command line it will error if "On" is passed Returns: The value to be passed to the command
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_power.py#L33-L72
null
# -*- coding: utf-8 -*- ''' Module for editing power settings on macOS .. versionadded:: 2016.3.0 ''' # Import python libs from __future__ import absolute_import, unicode_literals, print_function # Import Salt libs import salt.utils.mac_utils import salt.utils.platform from salt.exceptions import SaltInvocationError...
saltstack/salt
salt/modules/mac_power.py
set_sleep
python
def set_sleep(minutes): ''' Sets the amount of idle time until the machine sleeps. Sets the same value for Computer, Display, and Hard Disk. Pass "Never" or "Off" for computers that should never sleep. :param minutes: Can be an integer between 1 and 180 or "Never" or "Off" :ptype: int, str ...
Sets the amount of idle time until the machine sleeps. Sets the same value for Computer, Display, and Hard Disk. Pass "Never" or "Off" for computers that should never sleep. :param minutes: Can be an integer between 1 and 180 or "Never" or "Off" :ptype: int, str :return: True if successful, False ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_power.py#L96-L125
[ "def execute_return_success(cmd):\n '''\n Executes the passed command. Returns True if successful\n\n :param str cmd: The command to run\n\n :return: True if successful, otherwise False\n :rtype: bool\n\n :raises: Error if command fails or is not supported\n '''\n\n ret = _run_all(cmd)\n\n ...
# -*- coding: utf-8 -*- ''' Module for editing power settings on macOS .. versionadded:: 2016.3.0 ''' # Import python libs from __future__ import absolute_import, unicode_literals, print_function # Import Salt libs import salt.utils.mac_utils import salt.utils.platform from salt.exceptions import SaltInvocationError...
saltstack/salt
salt/modules/mac_power.py
get_computer_sleep
python
def get_computer_sleep(): ''' Display the amount of idle time until the computer sleeps. :return: A string representing the sleep settings for the computer :rtype: str CLI Example: ..code-block:: bash salt '*' power.get_computer_sleep ''' ret = salt.utils.mac_utils.execute_re...
Display the amount of idle time until the computer sleeps. :return: A string representing the sleep settings for the computer :rtype: str CLI Example: ..code-block:: bash salt '*' power.get_computer_sleep
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_power.py#L128-L143
[ "def execute_return_result(cmd):\n '''\n Executes the passed command. Returns the standard out if successful\n\n :param str cmd: The command to run\n\n :return: The standard out of the command if successful, otherwise returns\n an error\n :rtype: str\n\n :raises: Error if command fails or is no...
# -*- coding: utf-8 -*- ''' Module for editing power settings on macOS .. versionadded:: 2016.3.0 ''' # Import python libs from __future__ import absolute_import, unicode_literals, print_function # Import Salt libs import salt.utils.mac_utils import salt.utils.platform from salt.exceptions import SaltInvocationError...
saltstack/salt
salt/modules/mac_power.py
set_computer_sleep
python
def set_computer_sleep(minutes): ''' Set the amount of idle time until the computer sleeps. Pass "Never" of "Off" to never sleep. :param minutes: Can be an integer between 1 and 180 or "Never" or "Off" :ptype: int, str :return: True if successful, False if not :rtype: bool CLI Example...
Set the amount of idle time until the computer sleeps. Pass "Never" of "Off" to never sleep. :param minutes: Can be an integer between 1 and 180 or "Never" or "Off" :ptype: int, str :return: True if successful, False if not :rtype: bool CLI Example: .. code-block:: bash salt '*'...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_power.py#L146-L171
[ "def execute_return_success(cmd):\n '''\n Executes the passed command. Returns True if successful\n\n :param str cmd: The command to run\n\n :return: True if successful, otherwise False\n :rtype: bool\n\n :raises: Error if command fails or is not supported\n '''\n\n ret = _run_all(cmd)\n\n ...
# -*- coding: utf-8 -*- ''' Module for editing power settings on macOS .. versionadded:: 2016.3.0 ''' # Import python libs from __future__ import absolute_import, unicode_literals, print_function # Import Salt libs import salt.utils.mac_utils import salt.utils.platform from salt.exceptions import SaltInvocationError...
saltstack/salt
salt/modules/mac_power.py
get_display_sleep
python
def get_display_sleep(): ''' Display the amount of idle time until the display sleeps. :return: A string representing the sleep settings for the displey :rtype: str CLI Example: ..code-block:: bash salt '*' power.get_display_sleep ''' ret = salt.utils.mac_utils.execute_return...
Display the amount of idle time until the display sleeps. :return: A string representing the sleep settings for the displey :rtype: str CLI Example: ..code-block:: bash salt '*' power.get_display_sleep
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_power.py#L174-L189
[ "def execute_return_result(cmd):\n '''\n Executes the passed command. Returns the standard out if successful\n\n :param str cmd: The command to run\n\n :return: The standard out of the command if successful, otherwise returns\n an error\n :rtype: str\n\n :raises: Error if command fails or is no...
# -*- coding: utf-8 -*- ''' Module for editing power settings on macOS .. versionadded:: 2016.3.0 ''' # Import python libs from __future__ import absolute_import, unicode_literals, print_function # Import Salt libs import salt.utils.mac_utils import salt.utils.platform from salt.exceptions import SaltInvocationError...
saltstack/salt
salt/modules/mac_power.py
set_display_sleep
python
def set_display_sleep(minutes): ''' Set the amount of idle time until the display sleeps. Pass "Never" of "Off" to never sleep. :param minutes: Can be an integer between 1 and 180 or "Never" or "Off" :ptype: int, str :return: True if successful, False if not :rtype: bool CLI Example: ...
Set the amount of idle time until the display sleeps. Pass "Never" of "Off" to never sleep. :param minutes: Can be an integer between 1 and 180 or "Never" or "Off" :ptype: int, str :return: True if successful, False if not :rtype: bool CLI Example: .. code-block:: bash salt '*' ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_power.py#L192-L217
[ "def execute_return_success(cmd):\n '''\n Executes the passed command. Returns True if successful\n\n :param str cmd: The command to run\n\n :return: True if successful, otherwise False\n :rtype: bool\n\n :raises: Error if command fails or is not supported\n '''\n\n ret = _run_all(cmd)\n\n ...
# -*- coding: utf-8 -*- ''' Module for editing power settings on macOS .. versionadded:: 2016.3.0 ''' # Import python libs from __future__ import absolute_import, unicode_literals, print_function # Import Salt libs import salt.utils.mac_utils import salt.utils.platform from salt.exceptions import SaltInvocationError...
saltstack/salt
salt/modules/mac_power.py
get_harddisk_sleep
python
def get_harddisk_sleep(): ''' Display the amount of idle time until the hard disk sleeps. :return: A string representing the sleep settings for the hard disk :rtype: str CLI Example: ..code-block:: bash salt '*' power.get_harddisk_sleep ''' ret = salt.utils.mac_utils.execute_...
Display the amount of idle time until the hard disk sleeps. :return: A string representing the sleep settings for the hard disk :rtype: str CLI Example: ..code-block:: bash salt '*' power.get_harddisk_sleep
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_power.py#L220-L235
[ "def execute_return_result(cmd):\n '''\n Executes the passed command. Returns the standard out if successful\n\n :param str cmd: The command to run\n\n :return: The standard out of the command if successful, otherwise returns\n an error\n :rtype: str\n\n :raises: Error if command fails or is no...
# -*- coding: utf-8 -*- ''' Module for editing power settings on macOS .. versionadded:: 2016.3.0 ''' # Import python libs from __future__ import absolute_import, unicode_literals, print_function # Import Salt libs import salt.utils.mac_utils import salt.utils.platform from salt.exceptions import SaltInvocationError...
saltstack/salt
salt/modules/mac_power.py
set_harddisk_sleep
python
def set_harddisk_sleep(minutes): ''' Set the amount of idle time until the harddisk sleeps. Pass "Never" of "Off" to never sleep. :param minutes: Can be an integer between 1 and 180 or "Never" or "Off" :ptype: int, str :return: True if successful, False if not :rtype: bool CLI Example...
Set the amount of idle time until the harddisk sleeps. Pass "Never" of "Off" to never sleep. :param minutes: Can be an integer between 1 and 180 or "Never" or "Off" :ptype: int, str :return: True if successful, False if not :rtype: bool CLI Example: .. code-block:: bash salt '*'...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_power.py#L238-L263
[ "def execute_return_success(cmd):\n '''\n Executes the passed command. Returns True if successful\n\n :param str cmd: The command to run\n\n :return: True if successful, otherwise False\n :rtype: bool\n\n :raises: Error if command fails or is not supported\n '''\n\n ret = _run_all(cmd)\n\n ...
# -*- coding: utf-8 -*- ''' Module for editing power settings on macOS .. versionadded:: 2016.3.0 ''' # Import python libs from __future__ import absolute_import, unicode_literals, print_function # Import Salt libs import salt.utils.mac_utils import salt.utils.platform from salt.exceptions import SaltInvocationError...
saltstack/salt
salt/modules/mac_power.py
get_wake_on_modem
python
def get_wake_on_modem(): ''' Displays whether 'wake on modem' is on or off if supported :return: A string value representing the "wake on modem" settings :rtype: str CLI Example: .. code-block:: bash salt '*' power.get_wake_on_modem ''' ret = salt.utils.mac_utils.execute_retu...
Displays whether 'wake on modem' is on or off if supported :return: A string value representing the "wake on modem" settings :rtype: str CLI Example: .. code-block:: bash salt '*' power.get_wake_on_modem
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_power.py#L266-L282
[ "def execute_return_result(cmd):\n '''\n Executes the passed command. Returns the standard out if successful\n\n :param str cmd: The command to run\n\n :return: The standard out of the command if successful, otherwise returns\n an error\n :rtype: str\n\n :raises: Error if command fails or is no...
# -*- coding: utf-8 -*- ''' Module for editing power settings on macOS .. versionadded:: 2016.3.0 ''' # Import python libs from __future__ import absolute_import, unicode_literals, print_function # Import Salt libs import salt.utils.mac_utils import salt.utils.platform from salt.exceptions import SaltInvocationError...
saltstack/salt
salt/modules/mac_power.py
set_wake_on_modem
python
def set_wake_on_modem(enabled): ''' Set whether or not the computer will wake from sleep when modem activity is detected. :param bool enabled: True to enable, False to disable. "On" and "Off" are also acceptable values. Additionally you can pass 1 and 0 to represent True and False respe...
Set whether or not the computer will wake from sleep when modem activity is detected. :param bool enabled: True to enable, False to disable. "On" and "Off" are also acceptable values. Additionally you can pass 1 and 0 to represent True and False respectively :return: True if successful, Fa...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_power.py#L285-L310
[ "def execute_return_success(cmd):\n '''\n Executes the passed command. Returns True if successful\n\n :param str cmd: The command to run\n\n :return: True if successful, otherwise False\n :rtype: bool\n\n :raises: Error if command fails or is not supported\n '''\n\n ret = _run_all(cmd)\n\n ...
# -*- coding: utf-8 -*- ''' Module for editing power settings on macOS .. versionadded:: 2016.3.0 ''' # Import python libs from __future__ import absolute_import, unicode_literals, print_function # Import Salt libs import salt.utils.mac_utils import salt.utils.platform from salt.exceptions import SaltInvocationError...
saltstack/salt
salt/modules/mac_power.py
get_wake_on_network
python
def get_wake_on_network(): ''' Displays whether 'wake on network' is on or off if supported :return: A string value representing the "wake on network" settings :rtype: string CLI Example: .. code-block:: bash salt '*' power.get_wake_on_network ''' ret = salt.utils.mac_utils.e...
Displays whether 'wake on network' is on or off if supported :return: A string value representing the "wake on network" settings :rtype: string CLI Example: .. code-block:: bash salt '*' power.get_wake_on_network
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_power.py#L313-L329
[ "def execute_return_result(cmd):\n '''\n Executes the passed command. Returns the standard out if successful\n\n :param str cmd: The command to run\n\n :return: The standard out of the command if successful, otherwise returns\n an error\n :rtype: str\n\n :raises: Error if command fails or is no...
# -*- coding: utf-8 -*- ''' Module for editing power settings on macOS .. versionadded:: 2016.3.0 ''' # Import python libs from __future__ import absolute_import, unicode_literals, print_function # Import Salt libs import salt.utils.mac_utils import salt.utils.platform from salt.exceptions import SaltInvocationError...
saltstack/salt
salt/modules/mac_power.py
set_wake_on_network
python
def set_wake_on_network(enabled): ''' Set whether or not the computer will wake from sleep when network activity is detected. :param bool enabled: True to enable, False to disable. "On" and "Off" are also acceptable values. Additionally you can pass 1 and 0 to represent True and False r...
Set whether or not the computer will wake from sleep when network activity is detected. :param bool enabled: True to enable, False to disable. "On" and "Off" are also acceptable values. Additionally you can pass 1 and 0 to represent True and False respectively :return: True if successful, ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_power.py#L332-L357
[ "def execute_return_success(cmd):\n '''\n Executes the passed command. Returns True if successful\n\n :param str cmd: The command to run\n\n :return: True if successful, otherwise False\n :rtype: bool\n\n :raises: Error if command fails or is not supported\n '''\n\n ret = _run_all(cmd)\n\n ...
# -*- coding: utf-8 -*- ''' Module for editing power settings on macOS .. versionadded:: 2016.3.0 ''' # Import python libs from __future__ import absolute_import, unicode_literals, print_function # Import Salt libs import salt.utils.mac_utils import salt.utils.platform from salt.exceptions import SaltInvocationError...
saltstack/salt
salt/modules/mac_power.py
get_restart_power_failure
python
def get_restart_power_failure(): ''' Displays whether 'restart on power failure' is on or off if supported :return: A string value representing the "restart on power failure" settings :rtype: string CLI Example: .. code-block:: bash salt '*' power.get_restart_power_failure ''' ...
Displays whether 'restart on power failure' is on or off if supported :return: A string value representing the "restart on power failure" settings :rtype: string CLI Example: .. code-block:: bash salt '*' power.get_restart_power_failure
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_power.py#L360-L376
[ "def execute_return_result(cmd):\n '''\n Executes the passed command. Returns the standard out if successful\n\n :param str cmd: The command to run\n\n :return: The standard out of the command if successful, otherwise returns\n an error\n :rtype: str\n\n :raises: Error if command fails or is no...
# -*- coding: utf-8 -*- ''' Module for editing power settings on macOS .. versionadded:: 2016.3.0 ''' # Import python libs from __future__ import absolute_import, unicode_literals, print_function # Import Salt libs import salt.utils.mac_utils import salt.utils.platform from salt.exceptions import SaltInvocationError...
saltstack/salt
salt/modules/mac_power.py
set_restart_power_failure
python
def set_restart_power_failure(enabled): ''' Set whether or not the computer will automatically restart after a power failure. :param bool enabled: True to enable, False to disable. "On" and "Off" are also acceptable values. Additionally you can pass 1 and 0 to represent True and False r...
Set whether or not the computer will automatically restart after a power failure. :param bool enabled: True to enable, False to disable. "On" and "Off" are also acceptable values. Additionally you can pass 1 and 0 to represent True and False respectively :return: True if successful, False ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_power.py#L379-L404
[ "def execute_return_success(cmd):\n '''\n Executes the passed command. Returns True if successful\n\n :param str cmd: The command to run\n\n :return: True if successful, otherwise False\n :rtype: bool\n\n :raises: Error if command fails or is not supported\n '''\n\n ret = _run_all(cmd)\n\n ...
# -*- coding: utf-8 -*- ''' Module for editing power settings on macOS .. versionadded:: 2016.3.0 ''' # Import python libs from __future__ import absolute_import, unicode_literals, print_function # Import Salt libs import salt.utils.mac_utils import salt.utils.platform from salt.exceptions import SaltInvocationError...
saltstack/salt
salt/modules/mac_power.py
get_restart_freeze
python
def get_restart_freeze(): ''' Displays whether 'restart on freeze' is on or off if supported :return: A string value representing the "restart on freeze" settings :rtype: string CLI Example: .. code-block:: bash salt '*' power.get_restart_freeze ''' ret = salt.utils.mac_utils...
Displays whether 'restart on freeze' is on or off if supported :return: A string value representing the "restart on freeze" settings :rtype: string CLI Example: .. code-block:: bash salt '*' power.get_restart_freeze
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_power.py#L407-L423
[ "def execute_return_result(cmd):\n '''\n Executes the passed command. Returns the standard out if successful\n\n :param str cmd: The command to run\n\n :return: The standard out of the command if successful, otherwise returns\n an error\n :rtype: str\n\n :raises: Error if command fails or is no...
# -*- coding: utf-8 -*- ''' Module for editing power settings on macOS .. versionadded:: 2016.3.0 ''' # Import python libs from __future__ import absolute_import, unicode_literals, print_function # Import Salt libs import salt.utils.mac_utils import salt.utils.platform from salt.exceptions import SaltInvocationError...
saltstack/salt
salt/modules/mac_power.py
set_restart_freeze
python
def set_restart_freeze(enabled): ''' Specifies whether the server restarts automatically after a system freeze. This setting doesn't seem to be editable. The command completes successfully but the setting isn't actually updated. This is probably a macOS. The functions remains in case they ever fix t...
Specifies whether the server restarts automatically after a system freeze. This setting doesn't seem to be editable. The command completes successfully but the setting isn't actually updated. This is probably a macOS. The functions remains in case they ever fix the bug. :param bool enabled: True to ena...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_power.py#L426-L454
[ "def execute_return_success(cmd):\n '''\n Executes the passed command. Returns True if successful\n\n :param str cmd: The command to run\n\n :return: True if successful, otherwise False\n :rtype: bool\n\n :raises: Error if command fails or is not supported\n '''\n\n ret = _run_all(cmd)\n\n ...
# -*- coding: utf-8 -*- ''' Module for editing power settings on macOS .. versionadded:: 2016.3.0 ''' # Import python libs from __future__ import absolute_import, unicode_literals, print_function # Import Salt libs import salt.utils.mac_utils import salt.utils.platform from salt.exceptions import SaltInvocationError...
saltstack/salt
salt/modules/mac_power.py
get_sleep_on_power_button
python
def get_sleep_on_power_button(): ''' Displays whether 'allow power button to sleep computer' is on or off if supported :return: A string value representing the "allow power button to sleep computer" settings :rtype: string CLI Example: .. code-block:: bash salt '*' power...
Displays whether 'allow power button to sleep computer' is on or off if supported :return: A string value representing the "allow power button to sleep computer" settings :rtype: string CLI Example: .. code-block:: bash salt '*' power.get_sleep_on_power_button
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_power.py#L457-L476
[ "def execute_return_result(cmd):\n '''\n Executes the passed command. Returns the standard out if successful\n\n :param str cmd: The command to run\n\n :return: The standard out of the command if successful, otherwise returns\n an error\n :rtype: str\n\n :raises: Error if command fails or is no...
# -*- coding: utf-8 -*- ''' Module for editing power settings on macOS .. versionadded:: 2016.3.0 ''' # Import python libs from __future__ import absolute_import, unicode_literals, print_function # Import Salt libs import salt.utils.mac_utils import salt.utils.platform from salt.exceptions import SaltInvocationError...
saltstack/salt
salt/modules/mac_power.py
set_sleep_on_power_button
python
def set_sleep_on_power_button(enabled): ''' Set whether or not the power button can sleep the computer. :param bool enabled: True to enable, False to disable. "On" and "Off" are also acceptable values. Additionally you can pass 1 and 0 to represent True and False respectively :return: ...
Set whether or not the power button can sleep the computer. :param bool enabled: True to enable, False to disable. "On" and "Off" are also acceptable values. Additionally you can pass 1 and 0 to represent True and False respectively :return: True if successful, False if not :rtype: bool ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_power.py#L479-L503
[ "def execute_return_success(cmd):\n '''\n Executes the passed command. Returns True if successful\n\n :param str cmd: The command to run\n\n :return: True if successful, otherwise False\n :rtype: bool\n\n :raises: Error if command fails or is not supported\n '''\n\n ret = _run_all(cmd)\n\n ...
# -*- coding: utf-8 -*- ''' Module for editing power settings on macOS .. versionadded:: 2016.3.0 ''' # Import python libs from __future__ import absolute_import, unicode_literals, print_function # Import Salt libs import salt.utils.mac_utils import salt.utils.platform from salt.exceptions import SaltInvocationError...
saltstack/salt
salt/cloud/clouds/pyrax.py
get_conn
python
def get_conn(conn_type): ''' Return a conn object for the passed VM data ''' vm_ = get_configured_provider() kwargs = vm_.copy() # pylint: disable=E1103 kwargs['username'] = vm_['username'] kwargs['auth_endpoint'] = vm_.get('identity_url', None) kwargs['region'] = vm_['compute_region'...
Return a conn object for the passed VM data
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/pyrax.py#L63-L77
[ "def get_configured_provider():\n '''\n Return the first configured instance.\n '''\n return config.is_provider_configured(\n __opts__,\n __active_provider_name__ or __virtualname__,\n ('username', 'identity_url', 'compute_region',)\n )\n" ]
# -*- coding: utf-8 -*- ''' Pyrax Cloud Module ================== PLEASE NOTE: This module is currently in early development, and considered to be experimental and unstable. It is not recommended for production use. Unless you are actively developing code in this module, you should use the OpenStack module instead. ''...
saltstack/salt
salt/modules/swarm.py
swarm_init
python
def swarm_init(advertise_addr=str, listen_addr=int, force_new_cluster=bool): ''' Initalize Docker on Minion as a Swarm Manager advertise_addr The ip of the manager listen_addr Listen address used for inter-manager communication, as well as determin...
Initalize Docker on Minion as a Swarm Manager advertise_addr The ip of the manager listen_addr Listen address used for inter-manager communication, as well as determining the networking interface used for the VXLAN Tunnel Endpoint (VTEP). This can either be an address/p...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/swarm.py#L72-L112
[ "def swarm_tokens():\n '''\n Get the Docker Swarm Manager or Worker join tokens\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' swarm.swarm_tokens\n '''\n client = docker.APIClient(base_url='unix://var/run/docker.sock')\n service = client.inspect_swarm()\n return service['JoinT...
# -*- coding: utf-8 -*- ''' Docker Swarm Module using Docker's Python SDK ============================================= :codeauthor: Tyler Jones <jonestyler806@gmail.com> .. versionadded:: 2018.3.0 The Docker Swarm Module is used to manage and create Docker Swarms. Dependencies ------------ - Docker installed on t...
saltstack/salt
salt/modules/swarm.py
joinswarm
python
def joinswarm(remote_addr=int, listen_addr=int, token=str): ''' Join a Swarm Worker to the cluster remote_addr The manager node you want to connect to for the swarm listen_addr Listen address used for inter-manager communication if the node gets promoted to ...
Join a Swarm Worker to the cluster remote_addr The manager node you want to connect to for the swarm listen_addr Listen address used for inter-manager communication if the node gets promoted to manager, as well as determining the networking interface used for the VXLAN Tunnel Endpoint ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/swarm.py#L115-L150
null
# -*- coding: utf-8 -*- ''' Docker Swarm Module using Docker's Python SDK ============================================= :codeauthor: Tyler Jones <jonestyler806@gmail.com> .. versionadded:: 2018.3.0 The Docker Swarm Module is used to manage and create Docker Swarms. Dependencies ------------ - Docker installed on t...
saltstack/salt
salt/modules/swarm.py
leave_swarm
python
def leave_swarm(force=bool): ''' Force the minion to leave the swarm force Will force the minion/worker/manager to leave the swarm CLI Example: .. code-block:: bash salt '*' swarm.leave_swarm force=False ''' salt_return = {} __context__['client'].swarm.leave(force=for...
Force the minion to leave the swarm force Will force the minion/worker/manager to leave the swarm CLI Example: .. code-block:: bash salt '*' swarm.leave_swarm force=False
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/swarm.py#L153-L170
null
# -*- coding: utf-8 -*- ''' Docker Swarm Module using Docker's Python SDK ============================================= :codeauthor: Tyler Jones <jonestyler806@gmail.com> .. versionadded:: 2018.3.0 The Docker Swarm Module is used to manage and create Docker Swarms. Dependencies ------------ - Docker installed on t...
saltstack/salt
salt/modules/swarm.py
service_create
python
def service_create(image=str, name=str, command=str, hostname=str, replicas=int, target_port=int, published_port=int): ''' Create Docker Swarm Service Create image The docker image ...
Create Docker Swarm Service Create image The docker image name Is the service name command The docker command to run in the container at launch hostname The hostname of the containers replicas How many replicas you want running in the swarm target_po...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/swarm.py#L173-L234
null
# -*- coding: utf-8 -*- ''' Docker Swarm Module using Docker's Python SDK ============================================= :codeauthor: Tyler Jones <jonestyler806@gmail.com> .. versionadded:: 2018.3.0 The Docker Swarm Module is used to manage and create Docker Swarms. Dependencies ------------ - Docker installed on t...
saltstack/salt
salt/modules/swarm.py
swarm_service_info
python
def swarm_service_info(service_name=str): ''' Swarm Service Information service_name The name of the service that you want information on about the service CLI Example: .. code-block:: bash salt '*' swarm.swarm_service_info service_name=Test_Service ''' try: salt_...
Swarm Service Information service_name The name of the service that you want information on about the service CLI Example: .. code-block:: bash salt '*' swarm.swarm_service_info service_name=Test_Service
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/swarm.py#L237-L289
[ "def loads(s, **kwargs):\n '''\n .. versionadded:: 2018.3.0\n\n Wraps json.loads and prevents a traceback in the event that a bytestring is\n passed to the function. (Python < 3.6 cannot load bytestrings)\n\n You can pass an alternate json module (loaded via import_json() above)\n using the _json_...
# -*- coding: utf-8 -*- ''' Docker Swarm Module using Docker's Python SDK ============================================= :codeauthor: Tyler Jones <jonestyler806@gmail.com> .. versionadded:: 2018.3.0 The Docker Swarm Module is used to manage and create Docker Swarms. Dependencies ------------ - Docker installed on t...
saltstack/salt
salt/modules/swarm.py
remove_service
python
def remove_service(service=str): ''' Remove Swarm Service service The name of the service CLI Example: .. code-block:: bash salt '*' swarm.remove_service service=Test_Service ''' try: salt_return = {} client = docker.APIClient(base_url='unix://var/run/dock...
Remove Swarm Service service The name of the service CLI Example: .. code-block:: bash salt '*' swarm.remove_service service=Test_Service
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/swarm.py#L292-L314
null
# -*- coding: utf-8 -*- ''' Docker Swarm Module using Docker's Python SDK ============================================= :codeauthor: Tyler Jones <jonestyler806@gmail.com> .. versionadded:: 2018.3.0 The Docker Swarm Module is used to manage and create Docker Swarms. Dependencies ------------ - Docker installed on t...
saltstack/salt
salt/modules/swarm.py
node_ls
python
def node_ls(server=str): ''' Displays Information about Swarm Nodes with passing in the server server The minion/server name CLI Example: .. code-block:: bash salt '*' swarm.node_ls server=minion1 ''' try: salt_return = {} client = docker.APIClient(base_ur...
Displays Information about Swarm Nodes with passing in the server server The minion/server name CLI Example: .. code-block:: bash salt '*' swarm.node_ls server=minion1
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/swarm.py#L317-L356
[ "def loads(s, **kwargs):\n '''\n .. versionadded:: 2018.3.0\n\n Wraps json.loads and prevents a traceback in the event that a bytestring is\n passed to the function. (Python < 3.6 cannot load bytestrings)\n\n You can pass an alternate json module (loaded via import_json() above)\n using the _json_...
# -*- coding: utf-8 -*- ''' Docker Swarm Module using Docker's Python SDK ============================================= :codeauthor: Tyler Jones <jonestyler806@gmail.com> .. versionadded:: 2018.3.0 The Docker Swarm Module is used to manage and create Docker Swarms. Dependencies ------------ - Docker installed on t...
saltstack/salt
salt/modules/swarm.py
remove_node
python
def remove_node(node_id=str, force=bool): ''' Remove a node from a swarm and the target needs to be a swarm manager node_id The node id from the return of swarm.node_ls force Forcefully remove the node/minion from the service CLI Example: .. code-block:: bash salt '*...
Remove a node from a swarm and the target needs to be a swarm manager node_id The node id from the return of swarm.node_ls force Forcefully remove the node/minion from the service CLI Example: .. code-block:: bash salt '*' swarm.remove_node node_id=z4gjbe9rwmqahc2a91snvolm5 ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/swarm.py#L359-L386
null
# -*- coding: utf-8 -*- ''' Docker Swarm Module using Docker's Python SDK ============================================= :codeauthor: Tyler Jones <jonestyler806@gmail.com> .. versionadded:: 2018.3.0 The Docker Swarm Module is used to manage and create Docker Swarms. Dependencies ------------ - Docker installed on t...
saltstack/salt
salt/modules/swarm.py
update_node
python
def update_node(availability=str, node_name=str, role=str, node_id=str, version=int): ''' Updates docker swarm nodes/needs to target a manager node/minion availability Drain or Active node_name minion/node role ...
Updates docker swarm nodes/needs to target a manager node/minion availability Drain or Active node_name minion/node role role of manager or worker node_id The Id and that can be obtained via swarm.node_ls version Is obtained by swarm.node_ls CLI Exam...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/swarm.py#L389-L432
null
# -*- coding: utf-8 -*- ''' Docker Swarm Module using Docker's Python SDK ============================================= :codeauthor: Tyler Jones <jonestyler806@gmail.com> .. versionadded:: 2018.3.0 The Docker Swarm Module is used to manage and create Docker Swarms. Dependencies ------------ - Docker installed on t...
saltstack/salt
salt/states/boto_iam_role.py
present
python
def present( name, policy_document=None, policy_document_from_pillars=None, path=None, policies=None, policies_from_pillars=None, managed_policies=None, create_instance_profile=True, region=None, key=None, keyid=None, profil...
Ensure the IAM role exists. name Name of the IAM role. policy_document The policy that grants an entity permission to assume the role. (See https://boto.readthedocs.io/en/latest/ref/iam.html#boto.iam.connection.IAMConnection.create_role) policy_document_from_pillars A pill...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_iam_role.py#L106-L240
[ "def update(dest, upd, recursive_update=True, merge_lists=False):\n '''\n Recursive version of the default dict.update\n\n Merges upd recursively into dest\n\n If recursive_update=False, will use the classic dict.update, or fall back\n on a manual merge (helpful for non-dict types like FunctionWrappe...
# -*- coding: utf-8 -*- ''' Manage IAM roles ================ .. versionadded:: 2014.7.0 This module uses ``boto``, which can be installed via package, or pip. This module accepts explicit IAM credentials but can also utilize IAM roles assigned to the instance through Instance Profiles. Dynamic credentials are then ...
saltstack/salt
salt/states/boto_iam_role.py
_sort_policy
python
def _sort_policy(doc): ''' List-type sub-items in policies don't happen to be order-sensitive, but compare operations will render them unequal, leading to non-idempotent state runs. We'll sort any list-type subitems before comparison to reduce the likelihood of false negatives. ''' if isins...
List-type sub-items in policies don't happen to be order-sensitive, but compare operations will render them unequal, leading to non-idempotent state runs. We'll sort any list-type subitems before comparison to reduce the likelihood of false negatives.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_iam_role.py#L355-L366
[ "def iteritems(d, **kw):\n return d.iteritems(**kw)\n" ]
# -*- coding: utf-8 -*- ''' Manage IAM roles ================ .. versionadded:: 2014.7.0 This module uses ``boto``, which can be installed via package, or pip. This module accepts explicit IAM credentials but can also utilize IAM roles assigned to the instance through Instance Profiles. Dynamic credentials are then ...
saltstack/salt
salt/states/boto_iam_role.py
absent
python
def absent( name, region=None, key=None, keyid=None, profile=None): ''' Ensure the IAM role is deleted. name Name of the IAM role. region Region to connect to. key Secret key to be used. keyid Access key to be used. ...
Ensure the IAM role is deleted. name Name of the IAM role. region Region to connect to. key Secret key to be used. keyid Access key to be used. profile A dict with region, key and keyid, or a pillar key (string) that contains a dict with region, k...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_iam_role.py#L511-L570
[ "def update(dest, upd, recursive_update=True, merge_lists=False):\n '''\n Recursive version of the default dict.update\n\n Merges upd recursively into dest\n\n If recursive_update=False, will use the classic dict.update, or fall back\n on a manual merge (helpful for non-dict types like FunctionWrappe...
# -*- coding: utf-8 -*- ''' Manage IAM roles ================ .. versionadded:: 2014.7.0 This module uses ``boto``, which can be installed via package, or pip. This module accepts explicit IAM credentials but can also utilize IAM roles assigned to the instance through Instance Profiles. Dynamic credentials are then ...