partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
contains
Only succeed if the value in the given register location contains the given value USAGE: .. code-block:: yaml foo: check.contains: - value: itni run_remote_ex: local.cmd: - tgt: '*' - func: test.ping - require: ...
salt/thorium/check.py
def contains(name, value, count_lt=None, count_lte=None, count_eq=None, count_gte=None, count_gt=None, count_ne=None): ''' Only succeed if the value in the given register location contains the given value USAGE: ...
def contains(name, value, count_lt=None, count_lte=None, count_eq=None, count_gte=None, count_gt=None, count_ne=None): ''' Only succeed if the value in the given register location contains the given value USAGE: ...
[ "Only", "succeed", "if", "the", "value", "in", "the", "given", "register", "location", "contains", "the", "given", "value" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/thorium/check.py#L215-L274
[ "def", "contains", "(", "name", ",", "value", ",", "count_lt", "=", "None", ",", "count_lte", "=", "None", ",", "count_eq", "=", "None", ",", "count_gte", "=", "None", ",", "count_gt", "=", "None", ",", "count_ne", "=", "None", ")", ":", "ret", "=", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
event
Chekcs for a specific event match and returns result True if the match happens USAGE: .. code-block:: yaml salt/foo/*/bar: check.event run_remote_ex: local.cmd: - tgt: '*' - func: test.ping - require: - check: salt/foo...
salt/thorium/check.py
def event(name): ''' Chekcs for a specific event match and returns result True if the match happens USAGE: .. code-block:: yaml salt/foo/*/bar: check.event run_remote_ex: local.cmd: - tgt: '*' - func: test.ping - require: ...
def event(name): ''' Chekcs for a specific event match and returns result True if the match happens USAGE: .. code-block:: yaml salt/foo/*/bar: check.event run_remote_ex: local.cmd: - tgt: '*' - func: test.ping - require: ...
[ "Chekcs", "for", "a", "specific", "event", "match", "and", "returns", "result", "True", "if", "the", "match", "happens" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/thorium/check.py#L277-L305
[ "def", "event", "(", "name", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'comment'", ":", "''", ",", "'result'", ":", "False", "}", "for", "event", "in", "__events__", ":", "if", "salt", ".", "utils", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
len_gt
Only succeed if length of the given register location is greater than the given value. USAGE: .. code-block:: yaml foo: check.len_gt: - value: 42 run_remote_ex: local.cmd: - tgt: '*' - func: test.ping - require: ...
salt/thorium/check.py
def len_gt(name, value): ''' Only succeed if length of the given register location is greater than the given value. USAGE: .. code-block:: yaml foo: check.len_gt: - value: 42 run_remote_ex: local.cmd: - tgt: '*' - func: test...
def len_gt(name, value): ''' Only succeed if length of the given register location is greater than the given value. USAGE: .. code-block:: yaml foo: check.len_gt: - value: 42 run_remote_ex: local.cmd: - tgt: '*' - func: test...
[ "Only", "succeed", "if", "length", "of", "the", "given", "register", "location", "is", "greater", "than", "the", "given", "value", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/thorium/check.py#L308-L338
[ "def", "len_gt", "(", "name", ",", "value", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'result'", ":", "False", ",", "'comment'", ":", "''", ",", "'changes'", ":", "{", "}", "}", "if", "name", "not", "in", "__reg__", ":", "ret", "[",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
set_users
Configures users on network devices. :param users: Dictionary formatted as the output of the function config() :param test: Dry run? If set as True, will apply the config, discard and return the changes. Default: False :param commit: Commit? (default: True) Sometimes it is not needed to commit ...
salt/modules/napalm_users.py
def set_users(users, test=False, commit=True, **kwargs): # pylint: disable=unused-argument ''' Configures users on network devices. :param users: Dictionary formatted as the output of the function config() :param test: Dry run? If set as True, will apply the config, discard and return the ch...
def set_users(users, test=False, commit=True, **kwargs): # pylint: disable=unused-argument ''' Configures users on network devices. :param users: Dictionary formatted as the output of the function config() :param test: Dry run? If set as True, will apply the config, discard and return the ch...
[ "Configures", "users", "on", "network", "devices", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/napalm_users.py#L102-L141
[ "def", "set_users", "(", "users", ",", "test", "=", "False", ",", "commit", "=", "True", ",", "*", "*", "kwargs", ")", ":", "# pylint: disable=unused-argument", "return", "__salt__", "[", "'net.load_template'", "]", "(", "'set_users'", ",", "users", "=", "us...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
map_clonemode
Convert the virtualbox config file values for clone_mode into the integers the API requires
salt/cloud/clouds/virtualbox.py
def map_clonemode(vm_info): """ Convert the virtualbox config file values for clone_mode into the integers the API requires """ mode_map = { 'state': 0, 'child': 1, 'all': 2 } if not vm_info: return DEFAULT_CLONE_MODE if 'clonemode' not in vm_info: retur...
def map_clonemode(vm_info): """ Convert the virtualbox config file values for clone_mode into the integers the API requires """ mode_map = { 'state': 0, 'child': 1, 'all': 2 } if not vm_info: return DEFAULT_CLONE_MODE if 'clonemode' not in vm_info: retur...
[ "Convert", "the", "virtualbox", "config", "file", "values", "for", "clone_mode", "into", "the", "integers", "the", "API", "requires" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/virtualbox.py#L92-L113
[ "def", "map_clonemode", "(", "vm_info", ")", ":", "mode_map", "=", "{", "'state'", ":", "0", ",", "'child'", ":", "1", ",", "'all'", ":", "2", "}", "if", "not", "vm_info", ":", "return", "DEFAULT_CLONE_MODE", "if", "'clonemode'", "not", "in", "vm_info", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
create
Creates a virtual machine from the given VM information This is what is used to request a virtual machine to be created by the cloud provider, wait for it to become available, and then (optionally) log in and install Salt on it. Events fired: This function fires the event ``salt/cloud/vm_name/cre...
salt/cloud/clouds/virtualbox.py
def create(vm_info): ''' Creates a virtual machine from the given VM information This is what is used to request a virtual machine to be created by the cloud provider, wait for it to become available, and then (optionally) log in and install Salt on it. Events fired: This function fires t...
def create(vm_info): ''' Creates a virtual machine from the given VM information This is what is used to request a virtual machine to be created by the cloud provider, wait for it to become available, and then (optionally) log in and install Salt on it. Events fired: This function fires t...
[ "Creates", "a", "virtual", "machine", "from", "the", "given", "VM", "information" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/virtualbox.py#L116-L228
[ "def", "create", "(", "vm_info", ")", ":", "try", ":", "# Check for required profile parameters before sending any API calls.", "if", "vm_info", "[", "'profile'", "]", "and", "config", ".", "is_profile_configured", "(", "__opts__", ",", "__active_provider_name__", "or", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
list_nodes_full
All information available about all nodes should be returned in this function. The fields in the list_nodes() function should also be returned, even if they would not normally be provided by the cloud provider. This is because some functions both within Salt and 3rd party will break if an expected field is...
salt/cloud/clouds/virtualbox.py
def list_nodes_full(kwargs=None, call=None): """ All information available about all nodes should be returned in this function. The fields in the list_nodes() function should also be returned, even if they would not normally be provided by the cloud provider. This is because some functions both wit...
def list_nodes_full(kwargs=None, call=None): """ All information available about all nodes should be returned in this function. The fields in the list_nodes() function should also be returned, even if they would not normally be provided by the cloud provider. This is because some functions both wit...
[ "All", "information", "available", "about", "all", "nodes", "should", "be", "returned", "in", "this", "function", ".", "The", "fields", "in", "the", "list_nodes", "()", "function", "should", "also", "be", "returned", "even", "if", "they", "would", "not", "no...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/virtualbox.py#L231-L268
[ "def", "list_nodes_full", "(", "kwargs", "=", "None", ",", "call", "=", "None", ")", ":", "if", "call", "==", "'action'", ":", "raise", "SaltCloudSystemExit", "(", "'The list_nodes_full function must be called '", "'with -f or --function.'", ")", "machines", "=", "{...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
list_nodes
This function returns a list of nodes available on this cloud provider, using the following fields: id (str) image (str) size (str) state (str) private_ips (list) public_ips (list) No other fields should be returned in this function, and all of these fields should be returned, even if empt...
salt/cloud/clouds/virtualbox.py
def list_nodes(kwargs=None, call=None): """ This function returns a list of nodes available on this cloud provider, using the following fields: id (str) image (str) size (str) state (str) private_ips (list) public_ips (list) No other fields should be returned in this function, and ...
def list_nodes(kwargs=None, call=None): """ This function returns a list of nodes available on this cloud provider, using the following fields: id (str) image (str) size (str) state (str) private_ips (list) public_ips (list) No other fields should be returned in this function, and ...
[ "This", "function", "returns", "a", "list", "of", "nodes", "available", "on", "this", "cloud", "provider", "using", "the", "following", "fields", ":" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/virtualbox.py#L271-L315
[ "def", "list_nodes", "(", "kwargs", "=", "None", ",", "call", "=", "None", ")", ":", "if", "call", "==", "'action'", ":", "raise", "SaltCloudSystemExit", "(", "'The list_nodes function must be called '", "'with -f or --function.'", ")", "attributes", "=", "[", "\"...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
destroy
This function irreversibly destroys a virtual machine on the cloud provider. Before doing so, it should fire an event on the Salt event bus. The tag for this event is `salt/cloud/<vm name>/destroying`. Once the virtual machine has been destroyed, another event is fired. The tag for that event is `salt/...
salt/cloud/clouds/virtualbox.py
def destroy(name, call=None): """ This function irreversibly destroys a virtual machine on the cloud provider. Before doing so, it should fire an event on the Salt event bus. The tag for this event is `salt/cloud/<vm name>/destroying`. Once the virtual machine has been destroyed, another event is f...
def destroy(name, call=None): """ This function irreversibly destroys a virtual machine on the cloud provider. Before doing so, it should fire an event on the Salt event bus. The tag for this event is `salt/cloud/<vm name>/destroying`. Once the virtual machine has been destroyed, another event is f...
[ "This", "function", "irreversibly", "destroys", "a", "virtual", "machine", "on", "the", "cloud", "provider", ".", "Before", "doing", "so", "it", "should", "fire", "an", "event", "on", "the", "Salt", "event", "bus", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/virtualbox.py#L327-L368
[ "def", "destroy", "(", "name", ",", "call", "=", "None", ")", ":", "log", ".", "info", "(", "\"Attempting to delete instance %s\"", ",", "name", ")", "if", "not", "vb_machine_exists", "(", "name", ")", ":", "return", "\"{0} doesn't exist and can't be deleted\"", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
start
Start a machine. @param name: Machine to start @type name: str @param call: Must be "action" @type call: str
salt/cloud/clouds/virtualbox.py
def start(name, call=None): ''' Start a machine. @param name: Machine to start @type name: str @param call: Must be "action" @type call: str ''' if call != 'action': raise SaltCloudSystemExit( 'The instance action must be called with -a or --action.' ) lo...
def start(name, call=None): ''' Start a machine. @param name: Machine to start @type name: str @param call: Must be "action" @type call: str ''' if call != 'action': raise SaltCloudSystemExit( 'The instance action must be called with -a or --action.' ) lo...
[ "Start", "a", "machine", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/virtualbox.py#L371-L388
[ "def", "start", "(", "name", ",", "call", "=", "None", ")", ":", "if", "call", "!=", "'action'", ":", "raise", "SaltCloudSystemExit", "(", "'The instance action must be called with -a or --action.'", ")", "log", ".", "info", "(", "\"Starting machine: %s\"", ",", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
stop
Stop a running machine. @param name: Machine to stop @type name: str @param call: Must be "action" @type call: str
salt/cloud/clouds/virtualbox.py
def stop(name, call=None): """ Stop a running machine. @param name: Machine to stop @type name: str @param call: Must be "action" @type call: str """ if call != 'action': raise SaltCloudSystemExit( 'The instance action must be called with -a or --action.' ) ...
def stop(name, call=None): """ Stop a running machine. @param name: Machine to stop @type name: str @param call: Must be "action" @type call: str """ if call != 'action': raise SaltCloudSystemExit( 'The instance action must be called with -a or --action.' ) ...
[ "Stop", "a", "running", "machine", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/virtualbox.py#L391-L408
[ "def", "stop", "(", "name", ",", "call", "=", "None", ")", ":", "if", "call", "!=", "'action'", ":", "raise", "SaltCloudSystemExit", "(", "'The instance action must be called with -a or --action.'", ")", "log", ".", "info", "(", "\"Stopping machine: %s\"", ",", "n...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
show_image
Show the details of an image
salt/cloud/clouds/virtualbox.py
def show_image(kwargs, call=None): """ Show the details of an image """ if call != 'function': raise SaltCloudSystemExit( 'The show_image action must be called with -f or --function.' ) name = kwargs['image'] log.info("Showing image %s", name) machine = vb_get_ma...
def show_image(kwargs, call=None): """ Show the details of an image """ if call != 'function': raise SaltCloudSystemExit( 'The show_image action must be called with -f or --function.' ) name = kwargs['image'] log.info("Showing image %s", name) machine = vb_get_ma...
[ "Show", "the", "details", "of", "an", "image" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/virtualbox.py#L411-L428
[ "def", "show_image", "(", "kwargs", ",", "call", "=", "None", ")", ":", "if", "call", "!=", "'function'", ":", "raise", "SaltCloudSystemExit", "(", "'The show_image action must be called with -f or --function.'", ")", "name", "=", "kwargs", "[", "'image'", "]", "l...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
mapped
Verify that a device is mapped name The name under which the device is to be mapped device The device name, typically the device node, such as ``/dev/sdb1`` or ``UUID=066e0200-2867-4ebe-b9e6-f30026ca2314``. keyfile Either ``None`` if the password is to be entered manually ...
salt/states/cryptdev.py
def mapped(name, device, keyfile=None, opts=None, config='/etc/crypttab', persist=True, immediate=False, match_on='name'): ''' Verify that a device is mapped name The name under which the device is to be mapped device...
def mapped(name, device, keyfile=None, opts=None, config='/etc/crypttab', persist=True, immediate=False, match_on='name'): ''' Verify that a device is mapped name The name under which the device is to be mapped device...
[ "Verify", "that", "a", "device", "is", "mapped" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/cryptdev.py#L37-L134
[ "def", "mapped", "(", "name", ",", "device", ",", "keyfile", "=", "None", ",", "opts", "=", "None", ",", "config", "=", "'/etc/crypttab'", ",", "persist", "=", "True", ",", "immediate", "=", "False", ",", "match_on", "=", "'name'", ")", ":", "ret", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
unmapped
Ensure that a device is unmapped name The name to ensure is not mapped config Set an alternative location for the crypttab, if the map is persistent, Default is ``/etc/crypttab`` persist Set if the map should be removed from the crypttab. Default is ``True`` immediate...
salt/states/cryptdev.py
def unmapped(name, config='/etc/crypttab', persist=True, immediate=False): ''' Ensure that a device is unmapped name The name to ensure is not mapped config Set an alternative location for the crypttab, if the map is persistent, Default is...
def unmapped(name, config='/etc/crypttab', persist=True, immediate=False): ''' Ensure that a device is unmapped name The name to ensure is not mapped config Set an alternative location for the crypttab, if the map is persistent, Default is...
[ "Ensure", "that", "a", "device", "is", "unmapped" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/cryptdev.py#L137-L188
[ "def", "unmapped", "(", "name", ",", "config", "=", "'/etc/crypttab'", ",", "persist", "=", "True", ",", "immediate", "=", "False", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "True", ",", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
show_top
Returns the compiled top data for pillar for a specific minion. If no minion is specified, we use the first minion we find. CLI Example: .. code-block:: bash salt-run pillar.show_top
salt/runners/pillar.py
def show_top(minion=None, saltenv='base'): ''' Returns the compiled top data for pillar for a specific minion. If no minion is specified, we use the first minion we find. CLI Example: .. code-block:: bash salt-run pillar.show_top ''' id_, grains, _ = salt.utils.minions.get_minion...
def show_top(minion=None, saltenv='base'): ''' Returns the compiled top data for pillar for a specific minion. If no minion is specified, we use the first minion we find. CLI Example: .. code-block:: bash salt-run pillar.show_top ''' id_, grains, _ = salt.utils.minions.get_minion...
[ "Returns", "the", "compiled", "top", "data", "for", "pillar", "for", "a", "specific", "minion", ".", "If", "no", "minion", "is", "specified", "we", "use", "the", "first", "minion", "we", "find", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/pillar.py#L13-L43
[ "def", "show_top", "(", "minion", "=", "None", ",", "saltenv", "=", "'base'", ")", ":", "id_", ",", "grains", ",", "_", "=", "salt", ".", "utils", ".", "minions", ".", "get_minion_data", "(", "minion", ",", "__opts__", ")", "if", "not", "grains", "an...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
show_pillar
Returns the compiled pillar either of a specific minion or just the global available pillars. This function assumes that no minion has the id ``*``. Function also accepts pillarenv as attribute in order to limit to a specific pillar branch of git CLI Example: shows minion specific pillar: .. ...
salt/runners/pillar.py
def show_pillar(minion='*', **kwargs): ''' Returns the compiled pillar either of a specific minion or just the global available pillars. This function assumes that no minion has the id ``*``. Function also accepts pillarenv as attribute in order to limit to a specific pillar branch of git CLI E...
def show_pillar(minion='*', **kwargs): ''' Returns the compiled pillar either of a specific minion or just the global available pillars. This function assumes that no minion has the id ``*``. Function also accepts pillarenv as attribute in order to limit to a specific pillar branch of git CLI E...
[ "Returns", "the", "compiled", "pillar", "either", "of", "a", "specific", "minion", "or", "just", "the", "global", "available", "pillars", ".", "This", "function", "assumes", "that", "no", "minion", "has", "the", "id", "*", ".", "Function", "also", "accepts",...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/pillar.py#L46-L122
[ "def", "show_pillar", "(", "minion", "=", "'*'", ",", "*", "*", "kwargs", ")", ":", "pillarenv", "=", "None", "saltenv", "=", "'base'", "id_", ",", "grains", ",", "_", "=", "salt", ".", "utils", ".", "minions", ".", "get_minion_data", "(", "minion", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
install
Install RVM system-wide runas The user under which to run the rvm installer script. If not specified, then it be run as the user under which Salt is running. CLI Example: .. code-block:: bash salt '*' rvm.install
salt/modules/rvm.py
def install(runas=None): ''' Install RVM system-wide runas The user under which to run the rvm installer script. If not specified, then it be run as the user under which Salt is running. CLI Example: .. code-block:: bash salt '*' rvm.install ''' # RVM dependencies...
def install(runas=None): ''' Install RVM system-wide runas The user under which to run the rvm installer script. If not specified, then it be run as the user under which Salt is running. CLI Example: .. code-block:: bash salt '*' rvm.install ''' # RVM dependencies...
[ "Install", "RVM", "system", "-", "wide" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rvm.py#L79-L108
[ "def", "install", "(", "runas", "=", "None", ")", ":", "# RVM dependencies on Ubuntu 10.04:", "# bash coreutils gzip bzip2 gawk sed curl git-core subversion", "installer", "=", "'https://raw.githubusercontent.com/rvm/rvm/master/binscripts/rvm-installer'", "ret", "=", "__salt__", "[...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
install_ruby
Install a ruby implementation. ruby The version of ruby to install runas The user under which to run rvm. If not specified, then rvm will be run as the user under which Salt is running. env Environment to set for the install command. Useful for exporting compilation ...
salt/modules/rvm.py
def install_ruby(ruby, runas=None, opts=None, env=None): ''' Install a ruby implementation. ruby The version of ruby to install runas The user under which to run rvm. If not specified, then rvm will be run as the user under which Salt is running. env Environment to...
def install_ruby(ruby, runas=None, opts=None, env=None): ''' Install a ruby implementation. ruby The version of ruby to install runas The user under which to run rvm. If not specified, then rvm will be run as the user under which Salt is running. env Environment to...
[ "Install", "a", "ruby", "implementation", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rvm.py#L111-L146
[ "def", "install_ruby", "(", "ruby", ",", "runas", "=", "None", ",", "opts", "=", "None", ",", "env", "=", "None", ")", ":", "# MRI/RBX/REE dependencies for Ubuntu 10.04:", "# build-essential openssl libreadline6 libreadline6-dev curl", "# git-core zlib1g zlib1g-dev libssl...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
reinstall_ruby
Reinstall a ruby implementation ruby The version of ruby to reinstall runas The user under which to run rvm. If not specified, then rvm will be run as the user under which Salt is running. CLI Example: .. code-block:: bash salt '*' rvm.reinstall_ruby 1.9.3-p385
salt/modules/rvm.py
def reinstall_ruby(ruby, runas=None, env=None): ''' Reinstall a ruby implementation ruby The version of ruby to reinstall runas The user under which to run rvm. If not specified, then rvm will be run as the user under which Salt is running. CLI Example: .. code-block:...
def reinstall_ruby(ruby, runas=None, env=None): ''' Reinstall a ruby implementation ruby The version of ruby to reinstall runas The user under which to run rvm. If not specified, then rvm will be run as the user under which Salt is running. CLI Example: .. code-block:...
[ "Reinstall", "a", "ruby", "implementation" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rvm.py#L149-L166
[ "def", "reinstall_ruby", "(", "ruby", ",", "runas", "=", "None", ",", "env", "=", "None", ")", ":", "return", "_rvm", "(", "[", "'reinstall'", ",", "ruby", "]", ",", "runas", "=", "runas", ",", "env", "=", "env", ")" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
train
list_
List all rvm-installed rubies runas The user under which to run rvm. If not specified, then rvm will be run as the user under which Salt is running. CLI Example: .. code-block:: bash salt '*' rvm.list
salt/modules/rvm.py
def list_(runas=None): ''' List all rvm-installed rubies runas The user under which to run rvm. If not specified, then rvm will be run as the user under which Salt is running. CLI Example: .. code-block:: bash salt '*' rvm.list ''' rubies = [] output = _rvm(['...
def list_(runas=None): ''' List all rvm-installed rubies runas The user under which to run rvm. If not specified, then rvm will be run as the user under which Salt is running. CLI Example: .. code-block:: bash salt '*' rvm.list ''' rubies = [] output = _rvm(['...
[ "List", "all", "rvm", "-", "installed", "rubies" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rvm.py#L169-L193
[ "def", "list_", "(", "runas", "=", "None", ")", ":", "rubies", "=", "[", "]", "output", "=", "_rvm", "(", "[", "'list'", "]", ",", "runas", "=", "runas", ")", "if", "output", ":", "regex", "=", "re", ".", "compile", "(", "r'^[= ]([*> ]) ([^- ]+)-([^ ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
wrapper
Install RVM wrapper scripts ruby_string Ruby/gemset to install wrappers for wrapper_prefix What to prepend to the name of the generated wrapper binaries runas The user under which to run rvm. If not specified, then rvm will be run as the user under which Salt is running. ...
salt/modules/rvm.py
def wrapper(ruby_string, wrapper_prefix, runas=None, *binaries): ''' Install RVM wrapper scripts ruby_string Ruby/gemset to install wrappers for wrapper_prefix What to prepend to the name of the generated wrapper binaries runas The user under which to run rvm. If not speci...
def wrapper(ruby_string, wrapper_prefix, runas=None, *binaries): ''' Install RVM wrapper scripts ruby_string Ruby/gemset to install wrappers for wrapper_prefix What to prepend to the name of the generated wrapper binaries runas The user under which to run rvm. If not speci...
[ "Install", "RVM", "wrapper", "scripts" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rvm.py#L232-L259
[ "def", "wrapper", "(", "ruby_string", ",", "wrapper_prefix", ",", "runas", "=", "None", ",", "*", "binaries", ")", ":", "cmd", "=", "[", "'wrapper'", ",", "ruby_string", ",", "wrapper_prefix", "]", "cmd", ".", "extend", "(", "binaries", ")", "return", "_...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
gemset_list
List all gemsets for the given ruby. ruby : default The ruby version for which to list the gemsets runas The user under which to run rvm. If not specified, then rvm will be run as the user under which Salt is running. CLI Example: .. code-block:: bash salt '*' rvm.ge...
salt/modules/rvm.py
def gemset_list(ruby='default', runas=None): ''' List all gemsets for the given ruby. ruby : default The ruby version for which to list the gemsets runas The user under which to run rvm. If not specified, then rvm will be run as the user under which Salt is running. CLI Ex...
def gemset_list(ruby='default', runas=None): ''' List all gemsets for the given ruby. ruby : default The ruby version for which to list the gemsets runas The user under which to run rvm. If not specified, then rvm will be run as the user under which Salt is running. CLI Ex...
[ "List", "all", "gemsets", "for", "the", "given", "ruby", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rvm.py#L309-L334
[ "def", "gemset_list", "(", "ruby", "=", "'default'", ",", "runas", "=", "None", ")", ":", "gemsets", "=", "[", "]", "output", "=", "_rvm_do", "(", "ruby", ",", "[", "'rvm'", ",", "'gemset'", ",", "'list'", "]", ",", "runas", "=", "runas", ")", "if"...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
gemset_list_all
List all gemsets for all installed rubies. Note that you must have set a default ruby before this can work. runas The user under which to run rvm. If not specified, then rvm will be run as the user under which Salt is running. CLI Example: .. code-block:: bash salt '*' rvm.g...
salt/modules/rvm.py
def gemset_list_all(runas=None): ''' List all gemsets for all installed rubies. Note that you must have set a default ruby before this can work. runas The user under which to run rvm. If not specified, then rvm will be run as the user under which Salt is running. CLI Example: ...
def gemset_list_all(runas=None): ''' List all gemsets for all installed rubies. Note that you must have set a default ruby before this can work. runas The user under which to run rvm. If not specified, then rvm will be run as the user under which Salt is running. CLI Example: ...
[ "List", "all", "gemsets", "for", "all", "installed", "rubies", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rvm.py#L410-L440
[ "def", "gemset_list_all", "(", "runas", "=", "None", ")", ":", "gemsets", "=", "{", "}", "current_ruby", "=", "None", "output", "=", "_rvm_do", "(", "'default'", ",", "[", "'rvm'", ",", "'gemset'", ",", "'list_all'", "]", ",", "runas", "=", "runas", ")...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
do
Execute a command in an RVM controlled environment. ruby Which ruby to use command The rvm command to execute runas The user under which to run rvm. If not specified, then rvm will be run as the user under which Salt is running. cwd The directory from which to...
salt/modules/rvm.py
def do(ruby, command, runas=None, cwd=None, env=None): # pylint: disable=C0103 ''' Execute a command in an RVM controlled environment. ruby Which ruby to use command The rvm command to execute runas The user under which to run rvm. If not specified, then rvm will be run ...
def do(ruby, command, runas=None, cwd=None, env=None): # pylint: disable=C0103 ''' Execute a command in an RVM controlled environment. ruby Which ruby to use command The rvm command to execute runas The user under which to run rvm. If not specified, then rvm will be run ...
[ "Execute", "a", "command", "in", "an", "RVM", "controlled", "environment", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rvm.py#L443-L471
[ "def", "do", "(", "ruby", ",", "command", ",", "runas", "=", "None", ",", "cwd", "=", "None", ",", "env", "=", "None", ")", ":", "# pylint: disable=C0103", "try", ":", "command", "=", "salt", ".", "utils", ".", "args", ".", "shlex_split", "(", "comma...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
LiterateCoding.parse_file
Read a file on the file system (relative to salt's base project dir) :returns: A file-like object. :raises IOError: If the file cannot be found or read.
doc/_ext/saltdomain.py
def parse_file(self, fpath): ''' Read a file on the file system (relative to salt's base project dir) :returns: A file-like object. :raises IOError: If the file cannot be found or read. ''' sdir = os.path.abspath(os.path.join(os.path.dirname(salt.__file__), ...
def parse_file(self, fpath): ''' Read a file on the file system (relative to salt's base project dir) :returns: A file-like object. :raises IOError: If the file cannot be found or read. ''' sdir = os.path.abspath(os.path.join(os.path.dirname(salt.__file__), ...
[ "Read", "a", "file", "on", "the", "file", "system", "(", "relative", "to", "salt", "s", "base", "project", "dir", ")" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/doc/_ext/saltdomain.py#L40-L50
[ "def", "parse_file", "(", "self", ",", "fpath", ")", ":", "sdir", "=", "os", ".", "path", ".", "abspath", "(", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "dirname", "(", "salt", ".", "__file__", ")", ",", "os", ".", "pardir", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
LiterateCoding.parse_lit
Parse a string line-by-line delineating comments and code :returns: An tuple of boolean/list-of-string pairs. True designates a comment; False designates code.
doc/_ext/saltdomain.py
def parse_lit(self, lines): ''' Parse a string line-by-line delineating comments and code :returns: An tuple of boolean/list-of-string pairs. True designates a comment; False designates code. ''' comment_char = '#' # TODO: move this into a directive option co...
def parse_lit(self, lines): ''' Parse a string line-by-line delineating comments and code :returns: An tuple of boolean/list-of-string pairs. True designates a comment; False designates code. ''' comment_char = '#' # TODO: move this into a directive option co...
[ "Parse", "a", "string", "line", "-", "by", "-", "line", "delineating", "comments", "and", "code" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/doc/_ext/saltdomain.py#L52-L72
[ "def", "parse_lit", "(", "self", ",", "lines", ")", ":", "comment_char", "=", "'#'", "# TODO: move this into a directive option", "comment", "=", "re", ".", "compile", "(", "r'^\\s*{0}[ \\n]'", ".", "format", "(", "comment_char", ")", ")", "section_test", "=", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
LiterateFormula.parse_file
Given a typical Salt SLS path (e.g.: apache.vhosts.standard), find the file on the file system and parse it
doc/_ext/saltdomain.py
def parse_file(self, sls_path): ''' Given a typical Salt SLS path (e.g.: apache.vhosts.standard), find the file on the file system and parse it ''' config = self.state.document.settings.env.config formulas_dirs = config.formulas_dirs fpath = sls_path.replace('.', ...
def parse_file(self, sls_path): ''' Given a typical Salt SLS path (e.g.: apache.vhosts.standard), find the file on the file system and parse it ''' config = self.state.document.settings.env.config formulas_dirs = config.formulas_dirs fpath = sls_path.replace('.', ...
[ "Given", "a", "typical", "Salt", "SLS", "path", "(", "e", ".", "g", ".", ":", "apache", ".", "vhosts", ".", "standard", ")", "find", "the", "file", "on", "the", "file", "system", "and", "parse", "it" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/doc/_ext/saltdomain.py#L134-L159
[ "def", "parse_file", "(", "self", ",", "sls_path", ")", ":", "config", "=", "self", ".", "state", ".", "document", ".", "settings", ".", "env", ".", "config", "formulas_dirs", "=", "config", ".", "formulas_dirs", "fpath", "=", "sls_path", ".", "replace", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
mmatch
Return the minions found by looking via pillar
salt/matchers/compound_pillar_exact_match.py
def mmatch(expr, delimiter, greedy, opts=None): ''' Return the minions found by looking via pillar ''' if not opts: opts = __opts__ ckminions = salt.utils.minions.CkMinions(opts) return ckminions._check_compound_minions(expr, delimiter, greedy, ...
def mmatch(expr, delimiter, greedy, opts=None): ''' Return the minions found by looking via pillar ''' if not opts: opts = __opts__ ckminions = salt.utils.minions.CkMinions(opts) return ckminions._check_compound_minions(expr, delimiter, greedy, ...
[ "Return", "the", "minions", "found", "by", "looking", "via", "pillar" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/matchers/compound_pillar_exact_match.py#L17-L26
[ "def", "mmatch", "(", "expr", ",", "delimiter", ",", "greedy", ",", "opts", "=", "None", ")", ":", "if", "not", "opts", ":", "opts", "=", "__opts__", "ckminions", "=", "salt", ".", "utils", ".", "minions", ".", "CkMinions", "(", "opts", ")", "return"...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
attr
Access/write a SysFS attribute. If the attribute is a symlink, it's destination is returned :return: value or bool CLI example: .. code-block:: bash salt '*' sysfs.attr block/sda/queue/logical_block_size
salt/modules/sysfs.py
def attr(key, value=None): ''' Access/write a SysFS attribute. If the attribute is a symlink, it's destination is returned :return: value or bool CLI example: .. code-block:: bash salt '*' sysfs.attr block/sda/queue/logical_block_size ''' key = target(key) if key is Fals...
def attr(key, value=None): ''' Access/write a SysFS attribute. If the attribute is a symlink, it's destination is returned :return: value or bool CLI example: .. code-block:: bash salt '*' sysfs.attr block/sda/queue/logical_block_size ''' key = target(key) if key is Fals...
[ "Access", "/", "write", "a", "SysFS", "attribute", ".", "If", "the", "attribute", "is", "a", "symlink", "it", "s", "destination", "is", "returned" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/sysfs.py#L32-L53
[ "def", "attr", "(", "key", ",", "value", "=", "None", ")", ":", "key", "=", "target", "(", "key", ")", "if", "key", "is", "False", ":", "return", "False", "elif", "os", ".", "path", ".", "isdir", "(", "key", ")", ":", "return", "key", "elif", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
write
Write a SysFS attribute/action CLI example: .. code-block:: bash salt '*' sysfs.write devices/system/cpu/cpu0/cpufreq/scaling_governor 'performance'
salt/modules/sysfs.py
def write(key, value): ''' Write a SysFS attribute/action CLI example: .. code-block:: bash salt '*' sysfs.write devices/system/cpu/cpu0/cpufreq/scaling_governor 'performance' ''' try: key = target(key) log.trace('Writing %s to %s', value, key) with salt.utils....
def write(key, value): ''' Write a SysFS attribute/action CLI example: .. code-block:: bash salt '*' sysfs.write devices/system/cpu/cpu0/cpufreq/scaling_governor 'performance' ''' try: key = target(key) log.trace('Writing %s to %s', value, key) with salt.utils....
[ "Write", "a", "SysFS", "attribute", "/", "action" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/sysfs.py#L56-L74
[ "def", "write", "(", "key", ",", "value", ")", ":", "try", ":", "key", "=", "target", "(", "key", ")", "log", ".", "trace", "(", "'Writing %s to %s'", ",", "value", ",", "key", ")", "with", "salt", ".", "utils", ".", "files", ".", "fopen", "(", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
read
Read from SysFS :param key: file or path in SysFS; if key is a list then root will be prefixed on each key :return: the full (tree of) SysFS attributes under key CLI example: .. code-block:: bash salt '*' sysfs.read class/net/em1/statistics
salt/modules/sysfs.py
def read(key, root=''): ''' Read from SysFS :param key: file or path in SysFS; if key is a list then root will be prefixed on each key :return: the full (tree of) SysFS attributes under key CLI example: .. code-block:: bash salt '*' sysfs.read class/net/em1/statistics ''' i...
def read(key, root=''): ''' Read from SysFS :param key: file or path in SysFS; if key is a list then root will be prefixed on each key :return: the full (tree of) SysFS attributes under key CLI example: .. code-block:: bash salt '*' sysfs.read class/net/em1/statistics ''' i...
[ "Read", "from", "SysFS" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/sysfs.py#L77-L139
[ "def", "read", "(", "key", ",", "root", "=", "''", ")", ":", "if", "not", "isinstance", "(", "key", ",", "six", ".", "string_types", ")", ":", "res", "=", "{", "}", "for", "akey", "in", "key", ":", "ares", "=", "read", "(", "os", ".", "path", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
target
Return the basename of a SysFS key path :param key: the location to resolve within SysFS :param full: full path instead of basename :return: fullpath or basename of path CLI example: .. code-block:: bash salt '*' sysfs.read class/ttyS0
salt/modules/sysfs.py
def target(key, full=True): ''' Return the basename of a SysFS key path :param key: the location to resolve within SysFS :param full: full path instead of basename :return: fullpath or basename of path CLI example: .. code-block:: bash salt '*' sysfs.read class/ttyS0 ''' ...
def target(key, full=True): ''' Return the basename of a SysFS key path :param key: the location to resolve within SysFS :param full: full path instead of basename :return: fullpath or basename of path CLI example: .. code-block:: bash salt '*' sysfs.read class/ttyS0 ''' ...
[ "Return", "the", "basename", "of", "a", "SysFS", "key", "path" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/sysfs.py#L142-L167
[ "def", "target", "(", "key", ",", "full", "=", "True", ")", ":", "if", "not", "key", ".", "startswith", "(", "'/sys'", ")", ":", "key", "=", "os", ".", "path", ".", "join", "(", "'/sys'", ",", "key", ")", "key", "=", "os", ".", "path", ".", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
interfaces
Generate a dictionary with all available interfaces relative to root. Symlinks are not followed. CLI example: .. code-block:: bash salt '*' sysfs.interfaces block/bcache0/bcache Output example: .. code-block:: json { "r": [ "state", "partial_str...
salt/modules/sysfs.py
def interfaces(root): ''' Generate a dictionary with all available interfaces relative to root. Symlinks are not followed. CLI example: .. code-block:: bash salt '*' sysfs.interfaces block/bcache0/bcache Output example: .. code-block:: json { "r": [ ...
def interfaces(root): ''' Generate a dictionary with all available interfaces relative to root. Symlinks are not followed. CLI example: .. code-block:: bash salt '*' sysfs.interfaces block/bcache0/bcache Output example: .. code-block:: json { "r": [ ...
[ "Generate", "a", "dictionary", "with", "all", "available", "interfaces", "relative", "to", "root", ".", "Symlinks", "are", "not", "followed", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/sysfs.py#L170-L263
[ "def", "interfaces", "(", "root", ")", ":", "root", "=", "target", "(", "root", ")", "if", "root", "is", "False", "or", "not", "os", ".", "path", ".", "isdir", "(", "root", ")", ":", "log", ".", "error", "(", "'SysFS %s not a dir'", ",", "root", ")...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_get_librato
Return a Librato connection object.
salt/returners/librato_return.py
def _get_librato(ret=None): ''' Return a Librato connection object. ''' _options = _get_options(ret) conn = librato.connect( _options.get('email'), _options.get('api_token'), sanitizer=librato.sanitize_metric_name, hostname=_options.get('api_url')) log.info("Conn...
def _get_librato(ret=None): ''' Return a Librato connection object. ''' _options = _get_options(ret) conn = librato.connect( _options.get('email'), _options.get('api_token'), sanitizer=librato.sanitize_metric_name, hostname=_options.get('api_url')) log.info("Conn...
[ "Return", "a", "Librato", "connection", "object", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/librato_return.py#L82-L94
[ "def", "_get_librato", "(", "ret", "=", "None", ")", ":", "_options", "=", "_get_options", "(", "ret", ")", "conn", "=", "librato", ".", "connect", "(", "_options", ".", "get", "(", "'email'", ")", ",", "_options", ".", "get", "(", "'api_token'", ")", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
returner
Parse the return data and return metrics to Librato.
salt/returners/librato_return.py
def returner(ret): ''' Parse the return data and return metrics to Librato. ''' librato_conn = _get_librato(ret) q = librato_conn.new_queue() if ret['fun'] == 'state.highstate': log.debug('Found returned Highstate data.') # Calculate the runtimes and number of failed states. ...
def returner(ret): ''' Parse the return data and return metrics to Librato. ''' librato_conn = _get_librato(ret) q = librato_conn.new_queue() if ret['fun'] == 'state.highstate': log.debug('Found returned Highstate data.') # Calculate the runtimes and number of failed states. ...
[ "Parse", "the", "return", "data", "and", "return", "metrics", "to", "Librato", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/librato_return.py#L119-L161
[ "def", "returner", "(", "ret", ")", ":", "librato_conn", "=", "_get_librato", "(", "ret", ")", "q", "=", "librato_conn", ".", "new_queue", "(", ")", "if", "ret", "[", "'fun'", "]", "==", "'state.highstate'", ":", "log", ".", "debug", "(", "'Found returne...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_common
Returns: tuple whose first element is a bool indicating success or failure and the second element is either a ret dict for salt or an object
salt/states/keystone_endpoint.py
def _common(ret, name, service_name, kwargs): ''' Returns: tuple whose first element is a bool indicating success or failure and the second element is either a ret dict for salt or an object ''' if 'interface' not in kwargs and 'public_url' not in kwargs: kwargs['interface'] = name ...
def _common(ret, name, service_name, kwargs): ''' Returns: tuple whose first element is a bool indicating success or failure and the second element is either a ret dict for salt or an object ''' if 'interface' not in kwargs and 'public_url' not in kwargs: kwargs['interface'] = name ...
[ "Returns", ":", "tuple", "whose", "first", "element", "is", "a", "bool", "indicating", "success", "or", "failure", "and", "the", "second", "element", "is", "either", "a", "ret", "dict", "for", "salt", "or", "an", "object" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/keystone_endpoint.py#L51-L77
[ "def", "_common", "(", "ret", ",", "name", ",", "service_name", ",", "kwargs", ")", ":", "if", "'interface'", "not", "in", "kwargs", "and", "'public_url'", "not", "in", "kwargs", ":", "kwargs", "[", "'interface'", "]", "=", "name", "service", "=", "__sal...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
present
Ensure an endpoint exists and is up-to-date name Interface name url URL of the endpoint service_name Service name or ID region The region name to assign the endpoint enabled Boolean to control if endpoint is enabled
salt/states/keystone_endpoint.py
def present(name, service_name, auth=None, **kwargs): ''' Ensure an endpoint exists and is up-to-date name Interface name url URL of the endpoint service_name Service name or ID region The region name to assign the endpoint enabled Boolean to cont...
def present(name, service_name, auth=None, **kwargs): ''' Ensure an endpoint exists and is up-to-date name Interface name url URL of the endpoint service_name Service name or ID region The region name to assign the endpoint enabled Boolean to cont...
[ "Ensure", "an", "endpoint", "exists", "and", "is", "up", "-", "to", "-", "date" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/keystone_endpoint.py#L80-L143
[ "def", "present", "(", "name", ",", "service_name", ",", "auth", "=", "None", ",", "*", "*", "kwargs", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "True", ",", "'comment'", ":", "''", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
absent
Ensure an endpoint does not exists name Interface name url URL of the endpoint service_name Service name or ID region The region name to assign the endpoint
salt/states/keystone_endpoint.py
def absent(name, service_name, auth=None, **kwargs): ''' Ensure an endpoint does not exists name Interface name url URL of the endpoint service_name Service name or ID region The region name to assign the endpoint ''' ret = {'name': name, 'c...
def absent(name, service_name, auth=None, **kwargs): ''' Ensure an endpoint does not exists name Interface name url URL of the endpoint service_name Service name or ID region The region name to assign the endpoint ''' ret = {'name': name, 'c...
[ "Ensure", "an", "endpoint", "does", "not", "exists" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/keystone_endpoint.py#L146-L184
[ "def", "absent", "(", "name", ",", "service_name", ",", "auth", "=", "None", ",", "*", "*", "kwargs", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "True", ",", "'comment'", ":", "''", "}...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_get_bgp_runner_opts
Return the bgp runner options.
salt/runners/bgp.py
def _get_bgp_runner_opts(): ''' Return the bgp runner options. ''' runner_opts = __opts__.get('runners', {}).get('bgp', {}) return { 'tgt': runner_opts.get('tgt', _DEFAULT_TARGET), 'tgt_type': runner_opts.get('tgt_type', _DEFAULT_EXPR_FORM), 'display': runner_opts.get('displa...
def _get_bgp_runner_opts(): ''' Return the bgp runner options. ''' runner_opts = __opts__.get('runners', {}).get('bgp', {}) return { 'tgt': runner_opts.get('tgt', _DEFAULT_TARGET), 'tgt_type': runner_opts.get('tgt_type', _DEFAULT_EXPR_FORM), 'display': runner_opts.get('displa...
[ "Return", "the", "bgp", "runner", "options", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/bgp.py#L167-L178
[ "def", "_get_bgp_runner_opts", "(", ")", ":", "runner_opts", "=", "__opts__", ".", "get", "(", "'runners'", ",", "{", "}", ")", ".", "get", "(", "'bgp'", ",", "{", "}", ")", "return", "{", "'tgt'", ":", "runner_opts", ".", "get", "(", "'tgt'", ",", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_compare_match
Compare two dictionaries and return a boolean value if their values match.
salt/runners/bgp.py
def _compare_match(dict1, dict2): ''' Compare two dictionaries and return a boolean value if their values match. ''' for karg, warg in six.iteritems(dict1): if karg in dict2 and dict2[karg] != warg: return False return True
def _compare_match(dict1, dict2): ''' Compare two dictionaries and return a boolean value if their values match. ''' for karg, warg in six.iteritems(dict1): if karg in dict2 and dict2[karg] != warg: return False return True
[ "Compare", "two", "dictionaries", "and", "return", "a", "boolean", "value", "if", "their", "values", "match", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/bgp.py#L193-L200
[ "def", "_compare_match", "(", "dict1", ",", "dict2", ")", ":", "for", "karg", ",", "warg", "in", "six", ".", "iteritems", "(", "dict1", ")", ":", "if", "karg", "in", "dict2", "and", "dict2", "[", "karg", "]", "!=", "warg", ":", "return", "False", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_display_runner
Display or return the rows.
salt/runners/bgp.py
def _display_runner(rows, labels, title, display=_DEFAULT_DISPLAY, outputter=_DEFAULT_OUTPUTTER): ''' Display or return the rows. ''' if display: if outputter == 'table': ret = salt.output.out_format({'ro...
def _display_runner(rows, labels, title, display=_DEFAULT_DISPLAY, outputter=_DEFAULT_OUTPUTTER): ''' Display or return the rows. ''' if display: if outputter == 'table': ret = salt.output.out_format({'ro...
[ "Display", "or", "return", "the", "rows", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/bgp.py#L203-L225
[ "def", "_display_runner", "(", "rows", ",", "labels", ",", "title", ",", "display", "=", "_DEFAULT_DISPLAY", ",", "outputter", "=", "_DEFAULT_OUTPUTTER", ")", ":", "if", "display", ":", "if", "outputter", "==", "'table'", ":", "ret", "=", "salt", ".", "out...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
neighbors
Search for BGP neighbors details in the mines of the ``bgp.neighbors`` function. Arguments: asns A list of AS numbers to search for. The runner will return only the neighbors of these AS numbers. device Filter by device name (minion ID). ip Search BGP neighbor using t...
salt/runners/bgp.py
def neighbors(*asns, **kwargs): ''' Search for BGP neighbors details in the mines of the ``bgp.neighbors`` function. Arguments: asns A list of AS numbers to search for. The runner will return only the neighbors of these AS numbers. device Filter by device name (minion ID)....
def neighbors(*asns, **kwargs): ''' Search for BGP neighbors details in the mines of the ``bgp.neighbors`` function. Arguments: asns A list of AS numbers to search for. The runner will return only the neighbors of these AS numbers. device Filter by device name (minion ID)....
[ "Search", "for", "BGP", "neighbors", "details", "in", "the", "mines", "of", "the", "bgp", ".", "neighbors", "function", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/bgp.py#L232-L409
[ "def", "neighbors", "(", "*", "asns", ",", "*", "*", "kwargs", ")", ":", "opts", "=", "_get_bgp_runner_opts", "(", ")", "title", "=", "kwargs", ".", "pop", "(", "'title'", ",", "None", ")", "display", "=", "kwargs", ".", "pop", "(", "'display'", ",",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_get_conn
Return a mongodb connection object
salt/returners/mongo_future_return.py
def _get_conn(ret): ''' Return a mongodb connection object ''' _options = _get_options(ret) host = _options.get('host') port = _options.get('port') uri = _options.get('uri') db_ = _options.get('db') user = _options.get('user') password = _options.get('password') indexes = _o...
def _get_conn(ret): ''' Return a mongodb connection object ''' _options = _get_options(ret) host = _options.get('host') port = _options.get('port') uri = _options.get('uri') db_ = _options.get('db') user = _options.get('user') password = _options.get('password') indexes = _o...
[ "Return", "a", "mongodb", "connection", "object" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/mongo_future_return.py#L158-L207
[ "def", "_get_conn", "(", "ret", ")", ":", "_options", "=", "_get_options", "(", "ret", ")", "host", "=", "_options", ".", "get", "(", "'host'", ")", "port", "=", "_options", ".", "get", "(", "'port'", ")", "uri", "=", "_options", ".", "get", "(", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
returner
Return data to a mongodb server
salt/returners/mongo_future_return.py
def returner(ret): ''' Return data to a mongodb server ''' conn, mdb = _get_conn(ret) if isinstance(ret['return'], dict): back = _remove_dots(ret['return']) else: back = ret['return'] if isinstance(ret, dict): full_ret = _remove_dots(ret) else: full_ret ...
def returner(ret): ''' Return data to a mongodb server ''' conn, mdb = _get_conn(ret) if isinstance(ret['return'], dict): back = _remove_dots(ret['return']) else: back = ret['return'] if isinstance(ret, dict): full_ret = _remove_dots(ret) else: full_ret ...
[ "Return", "data", "to", "a", "mongodb", "server" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/mongo_future_return.py#L210-L241
[ "def", "returner", "(", "ret", ")", ":", "conn", ",", "mdb", "=", "_get_conn", "(", "ret", ")", "if", "isinstance", "(", "ret", "[", "'return'", "]", ",", "dict", ")", ":", "back", "=", "_remove_dots", "(", "ret", "[", "'return'", "]", ")", "else",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_safe_copy
mongodb doesn't allow '.' in keys, but does allow unicode equivs. Apparently the docs suggest using escaped unicode full-width encodings. *sigh* \\ --> \\\\ $ --> \\\\u0024 . --> \\\\u002e Personally, I prefer URL encodings, \\ --> %5c ...
salt/returners/mongo_future_return.py
def _safe_copy(dat): ''' mongodb doesn't allow '.' in keys, but does allow unicode equivs. Apparently the docs suggest using escaped unicode full-width encodings. *sigh* \\ --> \\\\ $ --> \\\\u0024 . --> \\\\u002e Personally, I prefer URL encoding...
def _safe_copy(dat): ''' mongodb doesn't allow '.' in keys, but does allow unicode equivs. Apparently the docs suggest using escaped unicode full-width encodings. *sigh* \\ --> \\\\ $ --> \\\\u0024 . --> \\\\u002e Personally, I prefer URL encoding...
[ "mongodb", "doesn", "t", "allow", ".", "in", "keys", "but", "does", "allow", "unicode", "equivs", ".", "Apparently", "the", "docs", "suggest", "using", "escaped", "unicode", "full", "-", "width", "encodings", ".", "*", "sigh", "*" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/mongo_future_return.py#L244-L277
[ "def", "_safe_copy", "(", "dat", ")", ":", "if", "isinstance", "(", "dat", ",", "dict", ")", ":", "ret", "=", "{", "}", "for", "k", "in", "dat", ":", "r", "=", "k", ".", "replace", "(", "'%'", ",", "'%25'", ")", ".", "replace", "(", "'\\\\'", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
save_load
Save the load for a given job id
salt/returners/mongo_future_return.py
def save_load(jid, load, minions=None): ''' Save the load for a given job id ''' conn, mdb = _get_conn(ret=None) to_save = _safe_copy(load) if PYMONGO_VERSION > _LooseVersion('2.3'): #using .copy() to ensure original data for load is unchanged mdb.jobs.insert_one(to_save) el...
def save_load(jid, load, minions=None): ''' Save the load for a given job id ''' conn, mdb = _get_conn(ret=None) to_save = _safe_copy(load) if PYMONGO_VERSION > _LooseVersion('2.3'): #using .copy() to ensure original data for load is unchanged mdb.jobs.insert_one(to_save) el...
[ "Save", "the", "load", "for", "a", "given", "job", "id" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/mongo_future_return.py#L280-L291
[ "def", "save_load", "(", "jid", ",", "load", ",", "minions", "=", "None", ")", ":", "conn", ",", "mdb", "=", "_get_conn", "(", "ret", "=", "None", ")", "to_save", "=", "_safe_copy", "(", "load", ")", "if", "PYMONGO_VERSION", ">", "_LooseVersion", "(", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
get_load
Return the load associated with a given job id
salt/returners/mongo_future_return.py
def get_load(jid): ''' Return the load associated with a given job id ''' conn, mdb = _get_conn(ret=None) return mdb.jobs.find_one({'jid': jid}, {'_id': 0})
def get_load(jid): ''' Return the load associated with a given job id ''' conn, mdb = _get_conn(ret=None) return mdb.jobs.find_one({'jid': jid}, {'_id': 0})
[ "Return", "the", "load", "associated", "with", "a", "given", "job", "id" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/mongo_future_return.py#L301-L306
[ "def", "get_load", "(", "jid", ")", ":", "conn", ",", "mdb", "=", "_get_conn", "(", "ret", "=", "None", ")", "return", "mdb", ".", "jobs", ".", "find_one", "(", "{", "'jid'", ":", "jid", "}", ",", "{", "'_id'", ":", "0", "}", ")" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
train
get_minions
Return a list of minions
salt/returners/mongo_future_return.py
def get_minions(): ''' Return a list of minions ''' conn, mdb = _get_conn(ret=None) ret = [] name = mdb.saltReturns.distinct('minion') ret.append(name) return ret
def get_minions(): ''' Return a list of minions ''' conn, mdb = _get_conn(ret=None) ret = [] name = mdb.saltReturns.distinct('minion') ret.append(name) return ret
[ "Return", "a", "list", "of", "minions" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/mongo_future_return.py#L336-L344
[ "def", "get_minions", "(", ")", ":", "conn", ",", "mdb", "=", "_get_conn", "(", "ret", "=", "None", ")", "ret", "=", "[", "]", "name", "=", "mdb", ".", "saltReturns", ".", "distinct", "(", "'minion'", ")", "ret", ".", "append", "(", "name", ")", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
get_jids
Return a list of job ids
salt/returners/mongo_future_return.py
def get_jids(): ''' Return a list of job ids ''' conn, mdb = _get_conn(ret=None) map = "function() { emit(this.jid, this); }" reduce = "function (key, values) { return values[0]; }" result = mdb.jobs.inline_map_reduce(map, reduce) ret = {} for r in result: jid = r['_id'] ...
def get_jids(): ''' Return a list of job ids ''' conn, mdb = _get_conn(ret=None) map = "function() { emit(this.jid, this); }" reduce = "function (key, values) { return values[0]; }" result = mdb.jobs.inline_map_reduce(map, reduce) ret = {} for r in result: jid = r['_id'] ...
[ "Return", "a", "list", "of", "job", "ids" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/mongo_future_return.py#L347-L359
[ "def", "get_jids", "(", ")", ":", "conn", ",", "mdb", "=", "_get_conn", "(", "ret", "=", "None", ")", "map", "=", "\"function() { emit(this.jid, this); }\"", "reduce", "=", "\"function (key, values) { return values[0]; }\"", "result", "=", "mdb", ".", "jobs", ".",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
event_return
Return events to Mongodb server
salt/returners/mongo_future_return.py
def event_return(events): ''' Return events to Mongodb server ''' conn, mdb = _get_conn(ret=None) if isinstance(events, list): events = events[0] if isinstance(events, dict): log.debug(events) if PYMONGO_VERSION > _LooseVersion('2.3'): mdb.events.insert_one...
def event_return(events): ''' Return events to Mongodb server ''' conn, mdb = _get_conn(ret=None) if isinstance(events, list): events = events[0] if isinstance(events, dict): log.debug(events) if PYMONGO_VERSION > _LooseVersion('2.3'): mdb.events.insert_one...
[ "Return", "events", "to", "Mongodb", "server" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/mongo_future_return.py#L369-L384
[ "def", "event_return", "(", "events", ")", ":", "conn", ",", "mdb", "=", "_get_conn", "(", "ret", "=", "None", ")", "if", "isinstance", "(", "events", ",", "list", ")", ":", "events", "=", "events", "[", "0", "]", "if", "isinstance", "(", "events", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
lowstate_file_refs
Create a list of file ref objects to reconcile
salt/client/ssh/__init__.py
def lowstate_file_refs(chunks): ''' Create a list of file ref objects to reconcile ''' refs = {} for chunk in chunks: saltenv = 'base' crefs = [] for state in chunk: if state == '__env__': saltenv = chunk[state] elif state == 'saltenv':...
def lowstate_file_refs(chunks): ''' Create a list of file ref objects to reconcile ''' refs = {} for chunk in chunks: saltenv = 'base' crefs = [] for state in chunk: if state == '__env__': saltenv = chunk[state] elif state == 'saltenv':...
[ "Create", "a", "list", "of", "file", "ref", "objects", "to", "reconcile" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/__init__.py#L1535-L1555
[ "def", "lowstate_file_refs", "(", "chunks", ")", ":", "refs", "=", "{", "}", "for", "chunk", "in", "chunks", ":", "saltenv", "=", "'base'", "crefs", "=", "[", "]", "for", "state", "in", "chunk", ":", "if", "state", "==", "'__env__'", ":", "saltenv", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
salt_refs
Pull salt file references out of the states
salt/client/ssh/__init__.py
def salt_refs(data): ''' Pull salt file references out of the states ''' proto = 'salt://' ret = [] if isinstance(data, six.string_types): if data.startswith(proto): return [data] if isinstance(data, list): for comp in data: if isinstance(comp, six.str...
def salt_refs(data): ''' Pull salt file references out of the states ''' proto = 'salt://' ret = [] if isinstance(data, six.string_types): if data.startswith(proto): return [data] if isinstance(data, list): for comp in data: if isinstance(comp, six.str...
[ "Pull", "salt", "file", "references", "out", "of", "the", "states" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/__init__.py#L1558-L1572
[ "def", "salt_refs", "(", "data", ")", ":", "proto", "=", "'salt://'", "ret", "=", "[", "]", "if", "isinstance", "(", "data", ",", "six", ".", "string_types", ")", ":", "if", "data", ".", "startswith", "(", "proto", ")", ":", "return", "[", "data", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
mod_data
Generate the module arguments for the shim data
salt/client/ssh/__init__.py
def mod_data(fsclient): ''' Generate the module arguments for the shim data ''' # TODO, change out for a fileserver backend sync_refs = [ 'modules', 'states', 'grains', 'renderers', 'returners', ] ret = {} envs = fsclien...
def mod_data(fsclient): ''' Generate the module arguments for the shim data ''' # TODO, change out for a fileserver backend sync_refs = [ 'modules', 'states', 'grains', 'renderers', 'returners', ] ret = {} envs = fsclien...
[ "Generate", "the", "module", "arguments", "for", "the", "shim", "data" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/__init__.py#L1575-L1633
[ "def", "mod_data", "(", "fsclient", ")", ":", "# TODO, change out for a fileserver backend", "sync_refs", "=", "[", "'modules'", ",", "'states'", ",", "'grains'", ",", "'renderers'", ",", "'returners'", ",", "]", "ret", "=", "{", "}", "envs", "=", "fsclient", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
ssh_version
Returns the version of the installed ssh command
salt/client/ssh/__init__.py
def ssh_version(): ''' Returns the version of the installed ssh command ''' # This function needs more granular checks and to be validated against # older versions of ssh ret = subprocess.Popen( ['ssh', '-V'], stdout=subprocess.PIPE, stderr=subprocess.PIPE).co...
def ssh_version(): ''' Returns the version of the installed ssh command ''' # This function needs more granular checks and to be validated against # older versions of ssh ret = subprocess.Popen( ['ssh', '-V'], stdout=subprocess.PIPE, stderr=subprocess.PIPE).co...
[ "Returns", "the", "version", "of", "the", "installed", "ssh", "command" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/__init__.py#L1636-L1656
[ "def", "ssh_version", "(", ")", ":", "# This function needs more granular checks and to be validated against", "# older versions of ssh", "ret", "=", "subprocess", ".", "Popen", "(", "[", "'ssh'", ",", "'-V'", "]", ",", "stdout", "=", "subprocess", ".", "PIPE", ",", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_convert_args
Take a list of args, and convert any dicts inside the list to keyword args in the form of `key=value`, ready to be passed to salt-ssh
salt/client/ssh/__init__.py
def _convert_args(args): ''' Take a list of args, and convert any dicts inside the list to keyword args in the form of `key=value`, ready to be passed to salt-ssh ''' converted = [] for arg in args: if isinstance(arg, dict): for key in list(arg.keys()): if key...
def _convert_args(args): ''' Take a list of args, and convert any dicts inside the list to keyword args in the form of `key=value`, ready to be passed to salt-ssh ''' converted = [] for arg in args: if isinstance(arg, dict): for key in list(arg.keys()): if key...
[ "Take", "a", "list", "of", "args", "and", "convert", "any", "dicts", "inside", "the", "list", "to", "keyword", "args", "in", "the", "form", "of", "key", "=", "value", "ready", "to", "be", "passed", "to", "salt", "-", "ssh" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/__init__.py#L1659-L1673
[ "def", "_convert_args", "(", "args", ")", ":", "converted", "=", "[", "]", "for", "arg", "in", "args", ":", "if", "isinstance", "(", "arg", ",", "dict", ")", ":", "for", "key", "in", "list", "(", "arg", ".", "keys", "(", ")", ")", ":", "if", "k...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
SSH._get_roster
Read roster filename as a key to the data. :return:
salt/client/ssh/__init__.py
def _get_roster(self): ''' Read roster filename as a key to the data. :return: ''' roster_file = salt.roster.get_roster_file(self.opts) if roster_file not in self.__parsed_rosters: roster_data = compile_template(roster_file, salt.loader.render(self.opts, {}), ...
def _get_roster(self): ''' Read roster filename as a key to the data. :return: ''' roster_file = salt.roster.get_roster_file(self.opts) if roster_file not in self.__parsed_rosters: roster_data = compile_template(roster_file, salt.loader.render(self.opts, {}), ...
[ "Read", "roster", "filename", "as", "a", "key", "to", "the", "data", ".", ":", "return", ":" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/__init__.py#L330-L341
[ "def", "_get_roster", "(", "self", ")", ":", "roster_file", "=", "salt", ".", "roster", ".", "get_roster_file", "(", "self", ".", "opts", ")", "if", "roster_file", "not", "in", "self", ".", "__parsed_rosters", ":", "roster_data", "=", "compile_template", "("...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
SSH._expand_target
Figures out if the target is a reachable host without wildcards, expands if any. :return:
salt/client/ssh/__init__.py
def _expand_target(self): ''' Figures out if the target is a reachable host without wildcards, expands if any. :return: ''' # TODO: Support -L target = self.opts['tgt'] if isinstance(target, list): return hostname = self.opts['tgt'].split('@')...
def _expand_target(self): ''' Figures out if the target is a reachable host without wildcards, expands if any. :return: ''' # TODO: Support -L target = self.opts['tgt'] if isinstance(target, list): return hostname = self.opts['tgt'].split('@')...
[ "Figures", "out", "if", "the", "target", "is", "a", "reachable", "host", "without", "wildcards", "expands", "if", "any", ".", ":", "return", ":" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/__init__.py#L343-L371
[ "def", "_expand_target", "(", "self", ")", ":", "# TODO: Support -L", "target", "=", "self", ".", "opts", "[", "'tgt'", "]", "if", "isinstance", "(", "target", ",", "list", ")", ":", "return", "hostname", "=", "self", ".", "opts", "[", "'tgt'", "]", "....
e8541fd6e744ab0df786c0f76102e41631f45d46
train
SSH._update_roster
Update default flat roster with the passed in information. :return:
salt/client/ssh/__init__.py
def _update_roster(self): ''' Update default flat roster with the passed in information. :return: ''' roster_file = self._get_roster() if os.access(roster_file, os.W_OK): if self.__parsed_rosters[self.ROSTER_UPDATE_FLAG]: with salt.utils.files....
def _update_roster(self): ''' Update default flat roster with the passed in information. :return: ''' roster_file = self._get_roster() if os.access(roster_file, os.W_OK): if self.__parsed_rosters[self.ROSTER_UPDATE_FLAG]: with salt.utils.files....
[ "Update", "default", "flat", "roster", "with", "the", "passed", "in", "information", ".", ":", "return", ":" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/__init__.py#L373-L392
[ "def", "_update_roster", "(", "self", ")", ":", "roster_file", "=", "self", ".", "_get_roster", "(", ")", "if", "os", ".", "access", "(", "roster_file", ",", "os", ".", "W_OK", ")", ":", "if", "self", ".", "__parsed_rosters", "[", "self", ".", "ROSTER_...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
SSH._update_targets
Uptade targets in case hostname was directly passed without the roster. :return:
salt/client/ssh/__init__.py
def _update_targets(self): ''' Uptade targets in case hostname was directly passed without the roster. :return: ''' hostname = self.opts.get('tgt', '') if '@' in hostname: user, hostname = hostname.split('@', 1) else: user = self.opts.get(...
def _update_targets(self): ''' Uptade targets in case hostname was directly passed without the roster. :return: ''' hostname = self.opts.get('tgt', '') if '@' in hostname: user, hostname = hostname.split('@', 1) else: user = self.opts.get(...
[ "Uptade", "targets", "in", "case", "hostname", "was", "directly", "passed", "without", "the", "roster", ".", ":", "return", ":" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/__init__.py#L394-L417
[ "def", "_update_targets", "(", "self", ")", ":", "hostname", "=", "self", ".", "opts", ".", "get", "(", "'tgt'", ",", "''", ")", "if", "'@'", "in", "hostname", ":", "user", ",", "hostname", "=", "hostname", ".", "split", "(", "'@'", ",", "1", ")", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
SSH.get_pubkey
Return the key string for the SSH public key
salt/client/ssh/__init__.py
def get_pubkey(self): ''' Return the key string for the SSH public key ''' if '__master_opts__' in self.opts and \ self.opts['__master_opts__'].get('ssh_use_home_key') and \ os.path.isfile(os.path.expanduser('~/.ssh/id_rsa')): priv = os.path.ex...
def get_pubkey(self): ''' Return the key string for the SSH public key ''' if '__master_opts__' in self.opts and \ self.opts['__master_opts__'].get('ssh_use_home_key') and \ os.path.isfile(os.path.expanduser('~/.ssh/id_rsa')): priv = os.path.ex...
[ "Return", "the", "key", "string", "for", "the", "SSH", "public", "key" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/__init__.py#L419-L438
[ "def", "get_pubkey", "(", "self", ")", ":", "if", "'__master_opts__'", "in", "self", ".", "opts", "and", "self", ".", "opts", "[", "'__master_opts__'", "]", ".", "get", "(", "'ssh_use_home_key'", ")", "and", "os", ".", "path", ".", "isfile", "(", "os", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
SSH.key_deploy
Deploy the SSH key if the minions don't auth
salt/client/ssh/__init__.py
def key_deploy(self, host, ret): ''' Deploy the SSH key if the minions don't auth ''' if not isinstance(ret[host], dict) or self.opts.get('ssh_key_deploy'): target = self.targets[host] if target.get('passwd', False) or self.opts['ssh_passwd']: self...
def key_deploy(self, host, ret): ''' Deploy the SSH key if the minions don't auth ''' if not isinstance(ret[host], dict) or self.opts.get('ssh_key_deploy'): target = self.targets[host] if target.get('passwd', False) or self.opts['ssh_passwd']: self...
[ "Deploy", "the", "SSH", "key", "if", "the", "minions", "don", "t", "auth" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/__init__.py#L440-L461
[ "def", "key_deploy", "(", "self", ",", "host", ",", "ret", ")", ":", "if", "not", "isinstance", "(", "ret", "[", "host", "]", ",", "dict", ")", "or", "self", ".", "opts", ".", "get", "(", "'ssh_key_deploy'", ")", ":", "target", "=", "self", ".", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
SSH._key_deploy_run
The ssh-copy-id routine
salt/client/ssh/__init__.py
def _key_deploy_run(self, host, target, re_run=True): ''' The ssh-copy-id routine ''' argv = [ 'ssh.set_auth_key', target.get('user', 'root'), self.get_pubkey(), ] single = Single( self.opts, argv, ...
def _key_deploy_run(self, host, target, re_run=True): ''' The ssh-copy-id routine ''' argv = [ 'ssh.set_auth_key', target.get('user', 'root'), self.get_pubkey(), ] single = Single( self.opts, argv, ...
[ "The", "ssh", "-", "copy", "-", "id", "routine" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/__init__.py#L463-L506
[ "def", "_key_deploy_run", "(", "self", ",", "host", ",", "target", ",", "re_run", "=", "True", ")", ":", "argv", "=", "[", "'ssh.set_auth_key'", ",", "target", ".", "get", "(", "'user'", ",", "'root'", ")", ",", "self", ".", "get_pubkey", "(", ")", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
SSH.handle_routine
Run the routine in a "Thread", put a dict on the queue
salt/client/ssh/__init__.py
def handle_routine(self, que, opts, host, target, mine=False): ''' Run the routine in a "Thread", put a dict on the queue ''' opts = copy.deepcopy(opts) single = Single( opts, opts['argv'], host, mods=self.mods, ...
def handle_routine(self, que, opts, host, target, mine=False): ''' Run the routine in a "Thread", put a dict on the queue ''' opts = copy.deepcopy(opts) single = Single( opts, opts['argv'], host, mods=self.mods, ...
[ "Run", "the", "routine", "in", "a", "Thread", "put", "a", "dict", "on", "the", "queue" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/__init__.py#L508-L541
[ "def", "handle_routine", "(", "self", ",", "que", ",", "opts", ",", "host", ",", "target", ",", "mine", "=", "False", ")", ":", "opts", "=", "copy", ".", "deepcopy", "(", "opts", ")", "single", "=", "Single", "(", "opts", ",", "opts", "[", "'argv'"...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
SSH.handle_ssh
Spin up the needed threads or processes and execute the subsequent routines
salt/client/ssh/__init__.py
def handle_ssh(self, mine=False): ''' Spin up the needed threads or processes and execute the subsequent routines ''' que = multiprocessing.Queue() running = {} target_iter = self.targets.__iter__() returned = set() rets = set() init = Fals...
def handle_ssh(self, mine=False): ''' Spin up the needed threads or processes and execute the subsequent routines ''' que = multiprocessing.Queue() running = {} target_iter = self.targets.__iter__() returned = set() rets = set() init = Fals...
[ "Spin", "up", "the", "needed", "threads", "or", "processes", "and", "execute", "the", "subsequent", "routines" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/__init__.py#L543-L637
[ "def", "handle_ssh", "(", "self", ",", "mine", "=", "False", ")", ":", "que", "=", "multiprocessing", ".", "Queue", "(", ")", "running", "=", "{", "}", "target_iter", "=", "self", ".", "targets", ".", "__iter__", "(", ")", "returned", "=", "set", "("...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
SSH.run_iter
Execute and yield returns as they come in, do not print to the display mine The Single objects will use mine_functions defined in the roster, pillar, or master config (they will be checked in that order) and will modify the argv with the arguments from mine_functions
salt/client/ssh/__init__.py
def run_iter(self, mine=False, jid=None): ''' Execute and yield returns as they come in, do not print to the display mine The Single objects will use mine_functions defined in the roster, pillar, or master config (they will be checked in that order) and will ...
def run_iter(self, mine=False, jid=None): ''' Execute and yield returns as they come in, do not print to the display mine The Single objects will use mine_functions defined in the roster, pillar, or master config (they will be checked in that order) and will ...
[ "Execute", "and", "yield", "returns", "as", "they", "come", "in", "do", "not", "print", "to", "the", "display" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/__init__.py#L639-L691
[ "def", "run_iter", "(", "self", ",", "mine", "=", "False", ",", "jid", "=", "None", ")", ":", "fstr", "=", "'{0}.prep_jid'", ".", "format", "(", "self", ".", "opts", "[", "'master_job_cache'", "]", ")", "jid", "=", "self", ".", "returners", "[", "fst...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
SSH.cache_job
Cache the job information
salt/client/ssh/__init__.py
def cache_job(self, jid, id_, ret, fun): ''' Cache the job information ''' self.returners['{0}.returner'.format(self.opts['master_job_cache'])]({'jid': jid, 'id': id_, ...
def cache_job(self, jid, id_, ret, fun): ''' Cache the job information ''' self.returners['{0}.returner'.format(self.opts['master_job_cache'])]({'jid': jid, 'id': id_, ...
[ "Cache", "the", "job", "information" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/__init__.py#L693-L700
[ "def", "cache_job", "(", "self", ",", "jid", ",", "id_", ",", "ret", ",", "fun", ")", ":", "self", ".", "returners", "[", "'{0}.returner'", ".", "format", "(", "self", ".", "opts", "[", "'master_job_cache'", "]", ")", "]", "(", "{", "'jid'", ":", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
SSH.run
Execute the overall routine, print results via outputters
salt/client/ssh/__init__.py
def run(self, jid=None): ''' Execute the overall routine, print results via outputters ''' if self.opts.get('list_hosts'): self._get_roster() ret = {} for roster_file in self.__parsed_rosters: if roster_file.startswith('#'): ...
def run(self, jid=None): ''' Execute the overall routine, print results via outputters ''' if self.opts.get('list_hosts'): self._get_roster() ret = {} for roster_file in self.__parsed_rosters: if roster_file.startswith('#'): ...
[ "Execute", "the", "overall", "routine", "print", "results", "via", "outputters" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/__init__.py#L702-L812
[ "def", "run", "(", "self", ",", "jid", "=", "None", ")", ":", "if", "self", ".", "opts", ".", "get", "(", "'list_hosts'", ")", ":", "self", ".", "_get_roster", "(", ")", "ret", "=", "{", "}", "for", "roster_file", "in", "self", ".", "__parsed_roste...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
Single.__arg_comps
Return the function name and the arg list
salt/client/ssh/__init__.py
def __arg_comps(self): ''' Return the function name and the arg list ''' fun = self.argv[0] if self.argv else '' parsed = salt.utils.args.parse_input( self.argv[1:], condition=False, no_parse=self.opts.get('no_parse', [])) args = parsed...
def __arg_comps(self): ''' Return the function name and the arg list ''' fun = self.argv[0] if self.argv else '' parsed = salt.utils.args.parse_input( self.argv[1:], condition=False, no_parse=self.opts.get('no_parse', [])) args = parsed...
[ "Return", "the", "function", "name", "and", "the", "arg", "list" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/__init__.py#L932-L943
[ "def", "__arg_comps", "(", "self", ")", ":", "fun", "=", "self", ".", "argv", "[", "0", "]", "if", "self", ".", "argv", "else", "''", "parsed", "=", "salt", ".", "utils", ".", "args", ".", "parse_input", "(", "self", ".", "argv", "[", "1", ":", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
Single._escape_arg
Properly escape argument to protect special characters from shell interpretation. This avoids having to do tricky argument quoting. Effectively just escape all characters in the argument that are not alphanumeric!
salt/client/ssh/__init__.py
def _escape_arg(self, arg): ''' Properly escape argument to protect special characters from shell interpretation. This avoids having to do tricky argument quoting. Effectively just escape all characters in the argument that are not alphanumeric! ''' if self.winr...
def _escape_arg(self, arg): ''' Properly escape argument to protect special characters from shell interpretation. This avoids having to do tricky argument quoting. Effectively just escape all characters in the argument that are not alphanumeric! ''' if self.winr...
[ "Properly", "escape", "argument", "to", "protect", "special", "characters", "from", "shell", "interpretation", ".", "This", "avoids", "having", "to", "do", "tricky", "argument", "quoting", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/__init__.py#L945-L955
[ "def", "_escape_arg", "(", "self", ",", "arg", ")", ":", "if", "self", ".", "winrm", ":", "return", "arg", "return", "''", ".", "join", "(", "[", "'\\\\'", "+", "char", "if", "re", ".", "match", "(", "r'\\W'", ",", "char", ")", "else", "char", "f...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
Single.deploy
Deploy salt-thin
salt/client/ssh/__init__.py
def deploy(self): ''' Deploy salt-thin ''' self.shell.send( self.thin, os.path.join(self.thin_dir, 'salt-thin.tgz'), ) self.deploy_ext() return True
def deploy(self): ''' Deploy salt-thin ''' self.shell.send( self.thin, os.path.join(self.thin_dir, 'salt-thin.tgz'), ) self.deploy_ext() return True
[ "Deploy", "salt", "-", "thin" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/__init__.py#L957-L966
[ "def", "deploy", "(", "self", ")", ":", "self", ".", "shell", ".", "send", "(", "self", ".", "thin", ",", "os", ".", "path", ".", "join", "(", "self", ".", "thin_dir", ",", "'salt-thin.tgz'", ")", ",", ")", "self", ".", "deploy_ext", "(", ")", "r...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
Single.deploy_ext
Deploy the ext_mods tarball
salt/client/ssh/__init__.py
def deploy_ext(self): ''' Deploy the ext_mods tarball ''' if self.mods.get('file'): self.shell.send( self.mods['file'], os.path.join(self.thin_dir, 'salt-ext_mods.tgz'), ) return True
def deploy_ext(self): ''' Deploy the ext_mods tarball ''' if self.mods.get('file'): self.shell.send( self.mods['file'], os.path.join(self.thin_dir, 'salt-ext_mods.tgz'), ) return True
[ "Deploy", "the", "ext_mods", "tarball" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/__init__.py#L968-L977
[ "def", "deploy_ext", "(", "self", ")", ":", "if", "self", ".", "mods", ".", "get", "(", "'file'", ")", ":", "self", ".", "shell", ".", "send", "(", "self", ".", "mods", "[", "'file'", "]", ",", "os", ".", "path", ".", "join", "(", "self", ".", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
Single.run
Execute the routine, the routine can be either: 1. Execute a raw shell command 2. Execute a wrapper func 3. Execute a remote Salt command If a (re)deploy is needed, then retry the operation after a deploy attempt Returns tuple of (stdout, stderr, retcode)
salt/client/ssh/__init__.py
def run(self, deploy_attempted=False): ''' Execute the routine, the routine can be either: 1. Execute a raw shell command 2. Execute a wrapper func 3. Execute a remote Salt command If a (re)deploy is needed, then retry the operation after a deploy attempt ...
def run(self, deploy_attempted=False): ''' Execute the routine, the routine can be either: 1. Execute a raw shell command 2. Execute a wrapper func 3. Execute a remote Salt command If a (re)deploy is needed, then retry the operation after a deploy attempt ...
[ "Execute", "the", "routine", "the", "routine", "can", "be", "either", ":", "1", ".", "Execute", "a", "raw", "shell", "command", "2", ".", "Execute", "a", "wrapper", "func", "3", ".", "Execute", "a", "remote", "Salt", "command" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/__init__.py#L979-L1003
[ "def", "run", "(", "self", ",", "deploy_attempted", "=", "False", ")", ":", "stdout", "=", "stderr", "=", "retcode", "=", "None", "if", "self", ".", "opts", ".", "get", "(", "'raw_shell'", ",", "False", ")", ":", "cmd_str", "=", "' '", ".", "join", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
Single.run_wfunc
Execute a wrapper function Returns tuple of (json_data, '')
salt/client/ssh/__init__.py
def run_wfunc(self): ''' Execute a wrapper function Returns tuple of (json_data, '') ''' # Ensure that opts/grains are up to date # Execute routine data_cache = False data = None cdir = os.path.join(self.opts['cachedir'], 'minions', self.id) ...
def run_wfunc(self): ''' Execute a wrapper function Returns tuple of (json_data, '') ''' # Ensure that opts/grains are up to date # Execute routine data_cache = False data = None cdir = os.path.join(self.opts['cachedir'], 'minions', self.id) ...
[ "Execute", "a", "wrapper", "function" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/__init__.py#L1005-L1195
[ "def", "run_wfunc", "(", "self", ")", ":", "# Ensure that opts/grains are up to date", "# Execute routine", "data_cache", "=", "False", "data", "=", "None", "cdir", "=", "os", ".", "path", ".", "join", "(", "self", ".", "opts", "[", "'cachedir'", "]", ",", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
Single._cmd_str
Prepare the command string
salt/client/ssh/__init__.py
def _cmd_str(self): ''' Prepare the command string ''' sudo = 'sudo' if self.target['sudo'] else '' sudo_user = self.target['sudo_user'] if '_caller_cachedir' in self.opts: cachedir = self.opts['_caller_cachedir'] else: cachedir = self.opts...
def _cmd_str(self): ''' Prepare the command string ''' sudo = 'sudo' if self.target['sudo'] else '' sudo_user = self.target['sudo_user'] if '_caller_cachedir' in self.opts: cachedir = self.opts['_caller_cachedir'] else: cachedir = self.opts...
[ "Prepare", "the", "command", "string" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/__init__.py#L1197-L1256
[ "def", "_cmd_str", "(", "self", ")", ":", "sudo", "=", "'sudo'", "if", "self", ".", "target", "[", "'sudo'", "]", "else", "''", "sudo_user", "=", "self", ".", "target", "[", "'sudo_user'", "]", "if", "'_caller_cachedir'", "in", "self", ".", "opts", ":"...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
Single.shim_cmd
Run a shim command. If tty is enabled, we must scp the shim to the target system and execute it there
salt/client/ssh/__init__.py
def shim_cmd(self, cmd_str, extension='py'): ''' Run a shim command. If tty is enabled, we must scp the shim to the target system and execute it there ''' if not self.tty and not self.winrm: return self.shell.exec_cmd(cmd_str) # Write the shim to a t...
def shim_cmd(self, cmd_str, extension='py'): ''' Run a shim command. If tty is enabled, we must scp the shim to the target system and execute it there ''' if not self.tty and not self.winrm: return self.shell.exec_cmd(cmd_str) # Write the shim to a t...
[ "Run", "a", "shim", "command", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/__init__.py#L1258-L1304
[ "def", "shim_cmd", "(", "self", ",", "cmd_str", ",", "extension", "=", "'py'", ")", ":", "if", "not", "self", ".", "tty", "and", "not", "self", ".", "winrm", ":", "return", "self", ".", "shell", ".", "exec_cmd", "(", "cmd_str", ")", "# Write the shim t...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
Single.cmd_block
Prepare the pre-check command to send to the subsystem 1. execute SHIM + command 2. check if SHIM returns a master request or if it completed 3. handle any master request 4. re-execute SHIM + command 5. split SHIM results from command results 6. return command results
salt/client/ssh/__init__.py
def cmd_block(self, is_retry=False): ''' Prepare the pre-check command to send to the subsystem 1. execute SHIM + command 2. check if SHIM returns a master request or if it completed 3. handle any master request 4. re-execute SHIM + command 5. split SHIM results ...
def cmd_block(self, is_retry=False): ''' Prepare the pre-check command to send to the subsystem 1. execute SHIM + command 2. check if SHIM returns a master request or if it completed 3. handle any master request 4. re-execute SHIM + command 5. split SHIM results ...
[ "Prepare", "the", "pre", "-", "check", "command", "to", "send", "to", "the", "subsystem" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/__init__.py#L1306-L1408
[ "def", "cmd_block", "(", "self", ",", "is_retry", "=", "False", ")", ":", "self", ".", "argv", "=", "_convert_args", "(", "self", ".", "argv", ")", "log", ".", "debug", "(", "'Performing shimmed, blocking command as follows:\\n%s'", ",", "' '", ".", "join", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_lookup_style
Lookup style by either element name or the list of classes
salt/returners/highstate_return.py
def _lookup_style(element, names): ''' Lookup style by either element name or the list of classes ''' return _STYLES.get('_'+element, '') + \ ''.join([_STYLES.get(name, '') for name in names])
def _lookup_style(element, names): ''' Lookup style by either element name or the list of classes ''' return _STYLES.get('_'+element, '') + \ ''.join([_STYLES.get(name, '') for name in names])
[ "Lookup", "style", "by", "either", "element", "name", "or", "the", "list", "of", "classes" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/highstate_return.py#L168-L173
[ "def", "_lookup_style", "(", "element", ",", "names", ")", ":", "return", "_STYLES", ".", "get", "(", "'_'", "+", "element", ",", "''", ")", "+", "''", ".", "join", "(", "[", "_STYLES", ".", "get", "(", "name", ",", "''", ")", "for", "name", "in"...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_generate_html_table
Generate a single table of data
salt/returners/highstate_return.py
def _generate_html_table(data, out, level=0, extra_style=''): ''' Generate a single table of data ''' print('<table style="{0}">'.format( _lookup_style('table', ['table' + six.text_type(level)])), file=out) firstone = True row_style = 'row' + six.text_type(level) cell_style = 'cell...
def _generate_html_table(data, out, level=0, extra_style=''): ''' Generate a single table of data ''' print('<table style="{0}">'.format( _lookup_style('table', ['table' + six.text_type(level)])), file=out) firstone = True row_style = 'row' + six.text_type(level) cell_style = 'cell...
[ "Generate", "a", "single", "table", "of", "data" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/highstate_return.py#L176-L269
[ "def", "_generate_html_table", "(", "data", ",", "out", ",", "level", "=", "0", ",", "extra_style", "=", "''", ")", ":", "print", "(", "'<table style=\"{0}\">'", ".", "format", "(", "_lookup_style", "(", "'table'", ",", "[", "'table'", "+", "six", ".", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_generate_html
Generate report data as HTML
salt/returners/highstate_return.py
def _generate_html(data, out): ''' Generate report data as HTML ''' print('<html>', file=out) print('<body>', file=out) _generate_html_table(data, out, 0) print('</body>', file=out) print('</html>', file=out)
def _generate_html(data, out): ''' Generate report data as HTML ''' print('<html>', file=out) print('<body>', file=out) _generate_html_table(data, out, 0) print('</body>', file=out) print('</html>', file=out)
[ "Generate", "report", "data", "as", "HTML" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/highstate_return.py#L272-L280
[ "def", "_generate_html", "(", "data", ",", "out", ")", ":", "print", "(", "'<html>'", ",", "file", "=", "out", ")", "print", "(", "'<body>'", ",", "file", "=", "out", ")", "_generate_html_table", "(", "data", ",", "out", ",", "0", ")", "print", "(", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_dict_to_name_value
Convert a dictionary to a list of dictionaries to facilitate ordering
salt/returners/highstate_return.py
def _dict_to_name_value(data): ''' Convert a dictionary to a list of dictionaries to facilitate ordering ''' if isinstance(data, dict): sorted_data = sorted(data.items(), key=lambda s: s[0]) result = [] for name, value in sorted_data: if isinstance(value, dict): ...
def _dict_to_name_value(data): ''' Convert a dictionary to a list of dictionaries to facilitate ordering ''' if isinstance(data, dict): sorted_data = sorted(data.items(), key=lambda s: s[0]) result = [] for name, value in sorted_data: if isinstance(value, dict): ...
[ "Convert", "a", "dictionary", "to", "a", "list", "of", "dictionaries", "to", "facilitate", "ordering" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/highstate_return.py#L283-L297
[ "def", "_dict_to_name_value", "(", "data", ")", ":", "if", "isinstance", "(", "data", ",", "dict", ")", ":", "sorted_data", "=", "sorted", "(", "data", ".", "items", "(", ")", ",", "key", "=", "lambda", "s", ":", "s", "[", "0", "]", ")", "result", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_generate_states_report
Generate states report
salt/returners/highstate_return.py
def _generate_states_report(sorted_data): ''' Generate states report ''' states = [] for state, data in sorted_data: module, stateid, name, function = state.split('_|-') module_function = '.'.join((module, function)) result = data.get('result', '') single = [ ...
def _generate_states_report(sorted_data): ''' Generate states report ''' states = [] for state, data in sorted_data: module, stateid, name, function = state.split('_|-') module_function = '.'.join((module, function)) result = data.get('result', '') single = [ ...
[ "Generate", "states", "report" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/highstate_return.py#L300-L332
[ "def", "_generate_states_report", "(", "sorted_data", ")", ":", "states", "=", "[", "]", "for", "state", ",", "data", "in", "sorted_data", ":", "module", ",", "stateid", ",", "name", ",", "function", "=", "state", ".", "split", "(", "'_|-'", ")", "module...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_generate_report
Generate report dictionary
salt/returners/highstate_return.py
def _generate_report(ret, setup): ''' Generate report dictionary ''' retdata = ret.get('return', {}) sorted_data = sorted( retdata.items(), key=lambda s: s[1].get('__run_num__', 0) ) total = 0 failed = 0 changed = 0 duration = 0.0 # gather stats for _,...
def _generate_report(ret, setup): ''' Generate report dictionary ''' retdata = ret.get('return', {}) sorted_data = sorted( retdata.items(), key=lambda s: s[1].get('__run_num__', 0) ) total = 0 failed = 0 changed = 0 duration = 0.0 # gather stats for _,...
[ "Generate", "report", "dictionary" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/highstate_return.py#L335-L411
[ "def", "_generate_report", "(", "ret", ",", "setup", ")", ":", "retdata", "=", "ret", ".", "get", "(", "'return'", ",", "{", "}", ")", "sorted_data", "=", "sorted", "(", "retdata", ".", "items", "(", ")", ",", "key", "=", "lambda", "s", ":", "s", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_produce_output
Produce output from the report dictionary generated by _generate_report
salt/returners/highstate_return.py
def _produce_output(report, failed, setup): ''' Produce output from the report dictionary generated by _generate_report ''' report_format = setup.get('report_format', 'yaml') log.debug('highstate output format: %s', report_format) if report_format == 'json': report_text = salt.utils.js...
def _produce_output(report, failed, setup): ''' Produce output from the report dictionary generated by _generate_report ''' report_format = setup.get('report_format', 'yaml') log.debug('highstate output format: %s', report_format) if report_format == 'json': report_text = salt.utils.js...
[ "Produce", "output", "from", "the", "report", "dictionary", "generated", "by", "_generate_report" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/highstate_return.py#L425-L493
[ "def", "_produce_output", "(", "report", ",", "failed", ",", "setup", ")", ":", "report_format", "=", "setup", ".", "get", "(", "'report_format'", ",", "'yaml'", ")", "log", ".", "debug", "(", "'highstate output format: %s'", ",", "report_format", ")", "if", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
returner
Check highstate return information and possibly fire off an email or save a file.
salt/returners/highstate_return.py
def returner(ret): ''' Check highstate return information and possibly fire off an email or save a file. ''' setup = _get_options(ret) log.debug('highstate setup %s', setup) report, failed = _generate_report(ret, setup) if report: _produce_output(report, failed, setup)
def returner(ret): ''' Check highstate return information and possibly fire off an email or save a file. ''' setup = _get_options(ret) log.debug('highstate setup %s', setup) report, failed = _generate_report(ret, setup) if report: _produce_output(report, failed, setup)
[ "Check", "highstate", "return", "information", "and", "possibly", "fire", "off", "an", "email", "or", "save", "a", "file", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/highstate_return.py#L496-L507
[ "def", "returner", "(", "ret", ")", ":", "setup", "=", "_get_options", "(", "ret", ")", "log", ".", "debug", "(", "'highstate setup %s'", ",", "setup", ")", "report", ",", "failed", "=", "_generate_report", "(", "ret", ",", "setup", ")", "if", "report", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
out_format
Return the formatted outputter string for the Python object. data The JSON serializable object. out: ``nested`` The name of the output to use to transform the data. Default: ``nested``. opts Dictionary of configuration options. Default: ``__opts__``. kwargs Arguments ...
salt/modules/out.py
def out_format(data, out='nested', opts=None, **kwargs): ''' Return the formatted outputter string for the Python object. data The JSON serializable object. out: ``nested`` The name of the output to use to transform the data. Default: ``nested``. opts Dictionary of configu...
def out_format(data, out='nested', opts=None, **kwargs): ''' Return the formatted outputter string for the Python object. data The JSON serializable object. out: ``nested`` The name of the output to use to transform the data. Default: ``nested``. opts Dictionary of configu...
[ "Return", "the", "formatted", "outputter", "string", "for", "the", "Python", "object", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/out.py#L37-L61
[ "def", "out_format", "(", "data", ",", "out", "=", "'nested'", ",", "opts", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "not", "opts", ":", "opts", "=", "__opts__", "return", "salt", ".", "output", ".", "out_format", "(", "data", ",", "ou...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
string_format
Return the outputter formatted string, removing the ANSI escape sequences. data The JSON serializable object. out: ``nested`` The name of the output to use to transform the data. Default: ``nested``. opts Dictionary of configuration options. Default: ``__opts__``. kwargs ...
salt/modules/out.py
def string_format(data, out='nested', opts=None, **kwargs): ''' Return the outputter formatted string, removing the ANSI escape sequences. data The JSON serializable object. out: ``nested`` The name of the output to use to transform the data. Default: ``nested``. opts Dict...
def string_format(data, out='nested', opts=None, **kwargs): ''' Return the outputter formatted string, removing the ANSI escape sequences. data The JSON serializable object. out: ``nested`` The name of the output to use to transform the data. Default: ``nested``. opts Dict...
[ "Return", "the", "outputter", "formatted", "string", "removing", "the", "ANSI", "escape", "sequences", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/out.py#L64-L88
[ "def", "string_format", "(", "data", ",", "out", "=", "'nested'", ",", "opts", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "not", "opts", ":", "opts", "=", "__opts__", "return", "salt", ".", "output", ".", "string_format", "(", "data", ",",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
html_format
Return the formatted string as HTML. data The JSON serializable object. out: ``nested`` The name of the output to use to transform the data. Default: ``nested``. opts Dictionary of configuration options. Default: ``__opts__``. kwargs Arguments to sent to the outputter...
salt/modules/out.py
def html_format(data, out='nested', opts=None, **kwargs): ''' Return the formatted string as HTML. data The JSON serializable object. out: ``nested`` The name of the output to use to transform the data. Default: ``nested``. opts Dictionary of configuration options. Default...
def html_format(data, out='nested', opts=None, **kwargs): ''' Return the formatted string as HTML. data The JSON serializable object. out: ``nested`` The name of the output to use to transform the data. Default: ``nested``. opts Dictionary of configuration options. Default...
[ "Return", "the", "formatted", "string", "as", "HTML", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/out.py#L91-L115
[ "def", "html_format", "(", "data", ",", "out", "=", "'nested'", ",", "opts", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "not", "opts", ":", "opts", "=", "__opts__", "return", "salt", ".", "output", ".", "html_format", "(", "data", ",", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
installed
Install buildout in a specific directory It is a thin wrapper to modules.buildout.buildout name directory to execute in quiet do not output console & logs config buildout config to use (default: buildout.cfg) parts specific buildout parts to run user ...
salt/states/zcbuildout.py
def installed(name, config='buildout.cfg', quiet=False, parts=None, user=None, env=(), buildout_ver=None, test_release=False, distribute=None, new_st=None, offline=False, ...
def installed(name, config='buildout.cfg', quiet=False, parts=None, user=None, env=(), buildout_ver=None, test_release=False, distribute=None, new_st=None, offline=False, ...
[ "Install", "buildout", "in", "a", "specific", "directory" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/zcbuildout.py#L121-L241
[ "def", "installed", "(", "name", ",", "config", "=", "'buildout.cfg'", ",", "quiet", "=", "False", ",", "parts", "=", "None", ",", "user", "=", "None", ",", "env", "=", "(", ")", ",", "buildout_ver", "=", "None", ",", "test_release", "=", "False", ",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
version
Returns a string representing the package version or an empty string if not installed. If more than one package name is specified, a dict of name/version pairs is returned. CLI Example: .. code-block:: bash salt '*' pkg.version <package name> salt '*' pkg.version <package1> <package2>...
salt/modules/dummyproxy_pkg.py
def version(*names, **kwargs): ''' Returns a string representing the package version or an empty string if not installed. If more than one package name is specified, a dict of name/version pairs is returned. CLI Example: .. code-block:: bash salt '*' pkg.version <package name> ...
def version(*names, **kwargs): ''' Returns a string representing the package version or an empty string if not installed. If more than one package name is specified, a dict of name/version pairs is returned. CLI Example: .. code-block:: bash salt '*' pkg.version <package name> ...
[ "Returns", "a", "string", "representing", "the", "package", "version", "or", "an", "empty", "string", "if", "not", "installed", ".", "If", "more", "than", "one", "package", "name", "is", "specified", "a", "dict", "of", "name", "/", "version", "pairs", "is"...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dummyproxy_pkg.py#L55-L76
[ "def", "version", "(", "*", "names", ",", "*", "*", "kwargs", ")", ":", "if", "len", "(", "names", ")", "==", "1", ":", "vers", "=", "__proxy__", "[", "'dummy.package_status'", "]", "(", "names", "[", "0", "]", ")", "return", "vers", "[", "names", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
set_user_perm
Set an object permission for the given user sid
salt/platform/win.py
def set_user_perm(obj, perm, sid): ''' Set an object permission for the given user sid ''' info = ( win32security.OWNER_SECURITY_INFORMATION | win32security.GROUP_SECURITY_INFORMATION | win32security.DACL_SECURITY_INFORMATION ) sd = win32security.GetUserObjectSecurity(obj...
def set_user_perm(obj, perm, sid): ''' Set an object permission for the given user sid ''' info = ( win32security.OWNER_SECURITY_INFORMATION | win32security.GROUP_SECURITY_INFORMATION | win32security.DACL_SECURITY_INFORMATION ) sd = win32security.GetUserObjectSecurity(obj...
[ "Set", "an", "object", "permission", "for", "the", "given", "user", "sid" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/platform/win.py#L972-L998
[ "def", "set_user_perm", "(", "obj", ",", "perm", ",", "sid", ")", ":", "info", "=", "(", "win32security", ".", "OWNER_SECURITY_INFORMATION", "|", "win32security", ".", "GROUP_SECURITY_INFORMATION", "|", "win32security", ".", "DACL_SECURITY_INFORMATION", ")", "sd", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
grant_winsta_and_desktop
Grant the token's user access to the current process's window station and desktop.
salt/platform/win.py
def grant_winsta_and_desktop(th): ''' Grant the token's user access to the current process's window station and desktop. ''' current_sid = win32security.GetTokenInformation(th, win32security.TokenUser)[0] # Add permissions for the sid to the current windows station and thread id. # This prev...
def grant_winsta_and_desktop(th): ''' Grant the token's user access to the current process's window station and desktop. ''' current_sid = win32security.GetTokenInformation(th, win32security.TokenUser)[0] # Add permissions for the sid to the current windows station and thread id. # This prev...
[ "Grant", "the", "token", "s", "user", "access", "to", "the", "current", "process", "s", "window", "station", "and", "desktop", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/platform/win.py#L1001-L1012
[ "def", "grant_winsta_and_desktop", "(", "th", ")", ":", "current_sid", "=", "win32security", ".", "GetTokenInformation", "(", "th", ",", "win32security", ".", "TokenUser", ")", "[", "0", "]", "# Add permissions for the sid to the current windows station and thread id.", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
enumerate_tokens
Enumerate tokens from any existing processes that can be accessed. Optionally filter by sid.
salt/platform/win.py
def enumerate_tokens(sid=None, session_id=None, privs=None): ''' Enumerate tokens from any existing processes that can be accessed. Optionally filter by sid. ''' for p in psutil.process_iter(): if p.pid == 0: continue try: ph = win32api.OpenProcess(win32con.PR...
def enumerate_tokens(sid=None, session_id=None, privs=None): ''' Enumerate tokens from any existing processes that can be accessed. Optionally filter by sid. ''' for p in psutil.process_iter(): if p.pid == 0: continue try: ph = win32api.OpenProcess(win32con.PR...
[ "Enumerate", "tokens", "from", "any", "existing", "processes", "that", "can", "be", "accessed", ".", "Optionally", "filter", "by", "sid", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/platform/win.py#L1062-L1115
[ "def", "enumerate_tokens", "(", "sid", "=", "None", ",", "session_id", "=", "None", ",", "privs", "=", "None", ")", ":", "for", "p", "in", "psutil", ".", "process_iter", "(", ")", ":", "if", "p", ".", "pid", "==", "0", ":", "continue", "try", ":", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
impersonate_sid
Find an existing process token for the given sid and impersonate the token.
salt/platform/win.py
def impersonate_sid(sid, session_id=None, privs=None): ''' Find an existing process token for the given sid and impersonate the token. ''' for tok in enumerate_tokens(sid, session_id, privs): tok = dup_token(tok) elevate_token(tok) if win32security.ImpersonateLoggedOnUser(tok) ==...
def impersonate_sid(sid, session_id=None, privs=None): ''' Find an existing process token for the given sid and impersonate the token. ''' for tok in enumerate_tokens(sid, session_id, privs): tok = dup_token(tok) elevate_token(tok) if win32security.ImpersonateLoggedOnUser(tok) ==...
[ "Find", "an", "existing", "process", "token", "for", "the", "given", "sid", "and", "impersonate", "the", "token", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/platform/win.py#L1118-L1128
[ "def", "impersonate_sid", "(", "sid", ",", "session_id", "=", "None", ",", "privs", "=", "None", ")", ":", "for", "tok", "in", "enumerate_tokens", "(", "sid", ",", "session_id", ",", "privs", ")", ":", "tok", "=", "dup_token", "(", "tok", ")", "elevate...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
dup_token
duplicate the access token
salt/platform/win.py
def dup_token(th): ''' duplicate the access token ''' # TODO: is `duplicate_token` the same? sec_attr = win32security.SECURITY_ATTRIBUTES() sec_attr.bInheritHandle = True return win32security.DuplicateTokenEx( th, win32security.SecurityImpersonation, win32con.MAXIMUM_ALL...
def dup_token(th): ''' duplicate the access token ''' # TODO: is `duplicate_token` the same? sec_attr = win32security.SECURITY_ATTRIBUTES() sec_attr.bInheritHandle = True return win32security.DuplicateTokenEx( th, win32security.SecurityImpersonation, win32con.MAXIMUM_ALL...
[ "duplicate", "the", "access", "token" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/platform/win.py#L1131-L1144
[ "def", "dup_token", "(", "th", ")", ":", "# TODO: is `duplicate_token` the same?", "sec_attr", "=", "win32security", ".", "SECURITY_ATTRIBUTES", "(", ")", "sec_attr", ".", "bInheritHandle", "=", "True", "return", "win32security", ".", "DuplicateTokenEx", "(", "th", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
elevate_token
Set all token priviledges to enabled
salt/platform/win.py
def elevate_token(th): ''' Set all token priviledges to enabled ''' # Get list of privileges this token contains privileges = win32security.GetTokenInformation( th, win32security.TokenPrivileges) # Create a set of all privileges to be enabled enable_privs = set() for luid, flags...
def elevate_token(th): ''' Set all token priviledges to enabled ''' # Get list of privileges this token contains privileges = win32security.GetTokenInformation( th, win32security.TokenPrivileges) # Create a set of all privileges to be enabled enable_privs = set() for luid, flags...
[ "Set", "all", "token", "priviledges", "to", "enabled" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/platform/win.py#L1147-L1162
[ "def", "elevate_token", "(", "th", ")", ":", "# Get list of privileges this token contains", "privileges", "=", "win32security", ".", "GetTokenInformation", "(", "th", ",", "win32security", ".", "TokenPrivileges", ")", "# Create a set of all privileges to be enabled", "enable...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
make_inheritable
Create an inheritable handle
salt/platform/win.py
def make_inheritable(token): '''Create an inheritable handle''' return win32api.DuplicateHandle( win32api.GetCurrentProcess(), token, win32api.GetCurrentProcess(), 0, 1, win32con.DUPLICATE_SAME_ACCESS )
def make_inheritable(token): '''Create an inheritable handle''' return win32api.DuplicateHandle( win32api.GetCurrentProcess(), token, win32api.GetCurrentProcess(), 0, 1, win32con.DUPLICATE_SAME_ACCESS )
[ "Create", "an", "inheritable", "handle" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/platform/win.py#L1165-L1174
[ "def", "make_inheritable", "(", "token", ")", ":", "return", "win32api", ".", "DuplicateHandle", "(", "win32api", ".", "GetCurrentProcess", "(", ")", ",", "token", ",", "win32api", ".", "GetCurrentProcess", "(", ")", ",", "0", ",", "1", ",", "win32con", "....
e8541fd6e744ab0df786c0f76102e41631f45d46
train
present
Ensure the CloudFront distribution is present. name (string) Name of the CloudFront distribution config (dict) Configuration for the distribution tags (dict) Tags to associate with the distribution region (string) Region to connect to key (string) Secret ...
salt/states/boto_cloudfront.py
def present( name, config, tags, region=None, key=None, keyid=None, profile=None, ): ''' Ensure the CloudFront distribution is present. name (string) Name of the CloudFront distribution config (dict) Configuration for the distribution tags (dict) ...
def present( name, config, tags, region=None, key=None, keyid=None, profile=None, ): ''' Ensure the CloudFront distribution is present. name (string) Name of the CloudFront distribution config (dict) Configuration for the distribution tags (dict) ...
[ "Ensure", "the", "CloudFront", "distribution", "is", "present", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_cloudfront.py#L73-L237
[ "def", "present", "(", "name", ",", "config", ",", "tags", ",", "region", "=", "None", ",", "key", "=", "None", ",", "keyid", "=", "None", ",", "profile", "=", "None", ",", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'comment'", ":", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_fix_quantities
Stupidly simple function to fix any Items/Quantity disparities inside a DistributionConfig block before use. Since AWS only accepts JSON-encodable data types, this implementation is "good enough" for our purposes.
salt/states/boto_cloudfront.py
def _fix_quantities(tree): ''' Stupidly simple function to fix any Items/Quantity disparities inside a DistributionConfig block before use. Since AWS only accepts JSON-encodable data types, this implementation is "good enough" for our purposes. ''' if isinstance(tree, dict): tree = {k: _...
def _fix_quantities(tree): ''' Stupidly simple function to fix any Items/Quantity disparities inside a DistributionConfig block before use. Since AWS only accepts JSON-encodable data types, this implementation is "good enough" for our purposes. ''' if isinstance(tree, dict): tree = {k: _...
[ "Stupidly", "simple", "function", "to", "fix", "any", "Items", "/", "Quantity", "disparities", "inside", "a", "DistributionConfig", "block", "before", "use", ".", "Since", "AWS", "only", "accepts", "JSON", "-", "encodable", "data", "types", "this", "implementati...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_cloudfront.py#L240-L256
[ "def", "_fix_quantities", "(", "tree", ")", ":", "if", "isinstance", "(", "tree", ",", "dict", ")", ":", "tree", "=", "{", "k", ":", "_fix_quantities", "(", "v", ")", "for", "k", ",", "v", "in", "tree", ".", "items", "(", ")", "}", "if", "isinsta...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
distribution_present
Ensure the given CloudFront distribution exists in the described state. The implementation of this function, and all those following, is orthagonal to that of :py:mod:`boto_cloudfront.present <salt.states.boto_cloudfront.present>`. Resources created with :py:mod:`boto_cloudfront.present <salt.states.bo...
salt/states/boto_cloudfront.py
def distribution_present(name, region=None, key=None, keyid=None, profile=None, **kwargs): ''' Ensure the given CloudFront distribution exists in the described state. The implementation of this function, and all those following, is orthagonal to that of :py:mod:`boto_cloudfront.present <salt.states...
def distribution_present(name, region=None, key=None, keyid=None, profile=None, **kwargs): ''' Ensure the given CloudFront distribution exists in the described state. The implementation of this function, and all those following, is orthagonal to that of :py:mod:`boto_cloudfront.present <salt.states...
[ "Ensure", "the", "given", "CloudFront", "distribution", "exists", "in", "the", "described", "state", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_cloudfront.py#L259-L575
[ "def", "distribution_present", "(", "name", ",", "region", "=", "None", ",", "key", "=", "None", ",", "keyid", "=", "None", ",", "profile", "=", "None", ",", "*", "*", "kwargs", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'result'", ":"...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
oai_bucket_policy_present
Ensure the given policy exists on an S3 bucket, granting access for the given origin access identity to do the things specified in the policy. name The name of the state definition Bucket The S3 bucket which CloudFront needs access to. Note that this policy is exclusive - it will b...
salt/states/boto_cloudfront.py
def oai_bucket_policy_present(name, Bucket, OAI, Policy, region=None, key=None, keyid=None, profile=None): ''' Ensure the given policy exists on an S3 bucket, granting access for the given origin access identity to do the things specified in the policy. name The na...
def oai_bucket_policy_present(name, Bucket, OAI, Policy, region=None, key=None, keyid=None, profile=None): ''' Ensure the given policy exists on an S3 bucket, granting access for the given origin access identity to do the things specified in the policy. name The na...
[ "Ensure", "the", "given", "policy", "exists", "on", "an", "S3", "bucket", "granting", "access", "for", "the", "given", "origin", "access", "identity", "to", "do", "the", "things", "specified", "in", "the", "policy", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_cloudfront.py#L578-L695
[ "def", "oai_bucket_policy_present", "(", "name", ",", "Bucket", ",", "OAI", ",", "Policy", ",", "region", "=", "None", ",", "key", "=", "None", ",", "keyid", "=", "None", ",", "profile", "=", "None", ")", ":", "ret", "=", "{", "'name'", ":", "name", ...
e8541fd6e744ab0df786c0f76102e41631f45d46