repo
stringclasses
85 values
path
stringlengths
8
121
func_name
stringlengths
1
82
original_string
stringlengths
112
65.5k
language
stringclasses
1 value
code
stringlengths
112
65.5k
code_tokens
listlengths
20
4.09k
docstring
stringlengths
3
46.3k
docstring_tokens
listlengths
1
564
sha
stringclasses
85 values
url
stringlengths
93
218
partition
stringclasses
1 value
saltstack/salt
salt/states/docker_volume.py
absent
def absent(name, driver=None): ''' Ensure that a volume is absent. .. versionadded:: 2015.8.4 .. versionchanged:: 2017.7.0 This state was renamed from **docker.volume_absent** to **docker_volume.absent** name Name of the volume Usage Examples: .. code-block:: yaml ...
python
def absent(name, driver=None): ''' Ensure that a volume is absent. .. versionadded:: 2015.8.4 .. versionchanged:: 2017.7.0 This state was renamed from **docker.volume_absent** to **docker_volume.absent** name Name of the volume Usage Examples: .. code-block:: yaml ...
[ "def", "absent", "(", "name", ",", "driver", "=", "None", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "False", ",", "'comment'", ":", "''", "}", "volume", "=", "_find_volume", "(", "name"...
Ensure that a volume is absent. .. versionadded:: 2015.8.4 .. versionchanged:: 2017.7.0 This state was renamed from **docker.volume_absent** to **docker_volume.absent** name Name of the volume Usage Examples: .. code-block:: yaml volume_foo: docker_volume.absen...
[ "Ensure", "that", "a", "volume", "is", "absent", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/docker_volume.py#L195-L231
train
saltstack/salt
salt/modules/defaults.py
_load
def _load(formula): ''' Generates a list of salt://<formula>/defaults.(json|yaml) files and fetches them from the Salt master. Returns first defaults file as python dict. ''' # Compute possibilities _mk_client() paths = [] for ext in ('yaml', 'json'): source_url = salt.util...
python
def _load(formula): ''' Generates a list of salt://<formula>/defaults.(json|yaml) files and fetches them from the Salt master. Returns first defaults file as python dict. ''' # Compute possibilities _mk_client() paths = [] for ext in ('yaml', 'json'): source_url = salt.util...
[ "def", "_load", "(", "formula", ")", ":", "# Compute possibilities", "_mk_client", "(", ")", "paths", "=", "[", "]", "for", "ext", "in", "(", "'yaml'", ",", "'json'", ")", ":", "source_url", "=", "salt", ".", "utils", ".", "url", ".", "create", "(", ...
Generates a list of salt://<formula>/defaults.(json|yaml) files and fetches them from the Salt master. Returns first defaults file as python dict.
[ "Generates", "a", "list", "of", "salt", ":", "//", "<formula", ">", "/", "defaults", ".", "(", "json|yaml", ")", "files", "and", "fetches", "them", "from", "the", "Salt", "master", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/defaults.py#L34-L71
train
saltstack/salt
salt/modules/defaults.py
get
def get(key, default=''): ''' defaults.get is used much like pillar.get except that it will read a default value for a pillar from defaults.json or defaults.yaml files that are stored in the root of a salt formula. CLI Example: .. code-block:: bash salt '*' defaults.get core:users:roo...
python
def get(key, default=''): ''' defaults.get is used much like pillar.get except that it will read a default value for a pillar from defaults.json or defaults.yaml files that are stored in the root of a salt formula. CLI Example: .. code-block:: bash salt '*' defaults.get core:users:roo...
[ "def", "get", "(", "key", ",", "default", "=", "''", ")", ":", "# Determine formula namespace from query", "if", "':'", "in", "key", ":", "namespace", ",", "key", "=", "key", ".", "split", "(", "':'", ",", "1", ")", "else", ":", "namespace", ",", "key"...
defaults.get is used much like pillar.get except that it will read a default value for a pillar from defaults.json or defaults.yaml files that are stored in the root of a salt formula. CLI Example: .. code-block:: bash salt '*' defaults.get core:users:root The defaults is computed from p...
[ "defaults", ".", "get", "is", "used", "much", "like", "pillar", ".", "get", "except", "that", "it", "will", "read", "a", "default", "value", "for", "a", "pillar", "from", "defaults", ".", "json", "or", "defaults", ".", "yaml", "files", "that", "are", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/defaults.py#L74-L106
train
saltstack/salt
salt/modules/defaults.py
merge
def merge(dest, src, merge_lists=False, in_place=True): ''' defaults.merge Allows deep merging of dicts in formulas. merge_lists : False If True, it will also merge lists instead of replace their items. in_place : True If True, it will merge into dest dict, if not it wi...
python
def merge(dest, src, merge_lists=False, in_place=True): ''' defaults.merge Allows deep merging of dicts in formulas. merge_lists : False If True, it will also merge lists instead of replace their items. in_place : True If True, it will merge into dest dict, if not it wi...
[ "def", "merge", "(", "dest", ",", "src", ",", "merge_lists", "=", "False", ",", "in_place", "=", "True", ")", ":", "if", "in_place", ":", "merged", "=", "dest", "else", ":", "merged", "=", "copy", ".", "deepcopy", "(", "dest", ")", "return", "dictupd...
defaults.merge Allows deep merging of dicts in formulas. merge_lists : False If True, it will also merge lists instead of replace their items. in_place : True If True, it will merge into dest dict, if not it will make a new copy from that dict and return it. CLI Exampl...
[ "defaults", ".", "merge", "Allows", "deep", "merging", "of", "dicts", "in", "formulas", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/defaults.py#L109-L133
train
saltstack/salt
salt/modules/defaults.py
update
def update(dest, defaults, merge_lists=True, in_place=True): ''' defaults.update Allows to set defaults for group of data set e.g. group for nodes. This function is a combination of defaults.merge and defaults.deepcopy to avoid redundant in jinja. Example: .. code-bloc...
python
def update(dest, defaults, merge_lists=True, in_place=True): ''' defaults.update Allows to set defaults for group of data set e.g. group for nodes. This function is a combination of defaults.merge and defaults.deepcopy to avoid redundant in jinja. Example: .. code-bloc...
[ "def", "update", "(", "dest", ",", "defaults", ",", "merge_lists", "=", "True", ",", "in_place", "=", "True", ")", ":", "if", "in_place", ":", "nodes", "=", "dest", "else", ":", "nodes", "=", "deepcopy", "(", "dest", ")", "for", "node_name", ",", "no...
defaults.update Allows to set defaults for group of data set e.g. group for nodes. This function is a combination of defaults.merge and defaults.deepcopy to avoid redundant in jinja. Example: .. code-block:: yaml group01: defaults: en...
[ "defaults", ".", "update", "Allows", "to", "set", "defaults", "for", "group", "of", "data", "set", "e", ".", "g", ".", "group", "for", "nodes", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/defaults.py#L150-L213
train
saltstack/salt
salt/modules/win_task.py
_get_date_time_format
def _get_date_time_format(dt_string): ''' Copied from win_system.py (_get_date_time_format) Function that detects the date/time format for the string passed. :param str dt_string: A date/time string :return: The format of the passed dt_string :rtype: str ''' valid_formats = [ ...
python
def _get_date_time_format(dt_string): ''' Copied from win_system.py (_get_date_time_format) Function that detects the date/time format for the string passed. :param str dt_string: A date/time string :return: The format of the passed dt_string :rtype: str ''' valid_formats = [ ...
[ "def", "_get_date_time_format", "(", "dt_string", ")", ":", "valid_formats", "=", "[", "'%I:%M:%S %p'", ",", "'%I:%M %p'", ",", "'%H:%M:%S'", ",", "'%H:%M'", ",", "'%Y-%m-%d'", ",", "'%m-%d-%y'", ",", "'%m-%d-%Y'", ",", "'%m/%d/%y'", ",", "'%m/%d/%Y'", ",", "'%Y...
Copied from win_system.py (_get_date_time_format) Function that detects the date/time format for the string passed. :param str dt_string: A date/time string :return: The format of the passed dt_string :rtype: str
[ "Copied", "from", "win_system", ".", "py", "(", "_get_date_time_format", ")" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_task.py#L191-L221
train
saltstack/salt
salt/modules/win_task.py
_reverse_lookup
def _reverse_lookup(dictionary, value): ''' Lookup the key in a dictionary by it's value. Will return the first match. :param dict dictionary: The dictionary to search :param str value: The value to search for. :return: Returns the first key to match the value :rtype: str ''' value_in...
python
def _reverse_lookup(dictionary, value): ''' Lookup the key in a dictionary by it's value. Will return the first match. :param dict dictionary: The dictionary to search :param str value: The value to search for. :return: Returns the first key to match the value :rtype: str ''' value_in...
[ "def", "_reverse_lookup", "(", "dictionary", ",", "value", ")", ":", "value_index", "=", "-", "1", "for", "idx", ",", "dict_value", "in", "enumerate", "(", "dictionary", ".", "values", "(", ")", ")", ":", "if", "type", "(", "dict_value", ")", "==", "li...
Lookup the key in a dictionary by it's value. Will return the first match. :param dict dictionary: The dictionary to search :param str value: The value to search for. :return: Returns the first key to match the value :rtype: str
[ "Lookup", "the", "key", "in", "a", "dictionary", "by", "it", "s", "value", ".", "Will", "return", "the", "first", "match", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_task.py#L241-L262
train
saltstack/salt
salt/modules/win_task.py
_lookup_first
def _lookup_first(dictionary, key): ''' Lookup the first value given a key. Returns the first value if the key refers to a list or the value itself. :param dict dictionary: The dictionary to search :param str key: The key to get :return: Returns the first value available for the key :rtyp...
python
def _lookup_first(dictionary, key): ''' Lookup the first value given a key. Returns the first value if the key refers to a list or the value itself. :param dict dictionary: The dictionary to search :param str key: The key to get :return: Returns the first value available for the key :rtyp...
[ "def", "_lookup_first", "(", "dictionary", ",", "key", ")", ":", "value", "=", "dictionary", "[", "key", "]", "if", "type", "(", "value", ")", "==", "list", ":", "return", "value", "[", "0", "]", "else", ":", "return", "value" ]
Lookup the first value given a key. Returns the first value if the key refers to a list or the value itself. :param dict dictionary: The dictionary to search :param str key: The key to get :return: Returns the first value available for the key :rtype: str
[ "Lookup", "the", "first", "value", "given", "a", "key", ".", "Returns", "the", "first", "value", "if", "the", "key", "refers", "to", "a", "list", "or", "the", "value", "itself", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_task.py#L265-L281
train
saltstack/salt
salt/modules/win_task.py
_save_task_definition
def _save_task_definition(name, task_folder, task_definition, user_name, password, logon_type): ''' Internal function to save the task definition. :param str name: The name of t...
python
def _save_task_definition(name, task_folder, task_definition, user_name, password, logon_type): ''' Internal function to save the task definition. :param str name: The name of t...
[ "def", "_save_task_definition", "(", "name", ",", "task_folder", ",", "task_definition", ",", "user_name", ",", "password", ",", "logon_type", ")", ":", "try", ":", "task_folder", ".", "RegisterTaskDefinition", "(", "name", ",", "task_definition", ",", "TASK_CREAT...
Internal function to save the task definition. :param str name: The name of the task. :param str task_folder: The object representing the folder in which to save the task :param str task_definition: The object representing the task to be saved :param str user_name: The user_account under which t...
[ "Internal", "function", "to", "save", "the", "task", "definition", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_task.py#L284-L333
train
saltstack/salt
salt/modules/win_task.py
list_tasks
def list_tasks(location='\\'): r''' List all tasks located in a specific location in the task scheduler. :param str location: A string value representing the folder from which you want to list tasks. Default is '\\' which is the root for the task scheduler (C:\Windows\System32\tasks). ...
python
def list_tasks(location='\\'): r''' List all tasks located in a specific location in the task scheduler. :param str location: A string value representing the folder from which you want to list tasks. Default is '\\' which is the root for the task scheduler (C:\Windows\System32\tasks). ...
[ "def", "list_tasks", "(", "location", "=", "'\\\\'", ")", ":", "# Create the task service object", "with", "salt", ".", "utils", ".", "winapi", ".", "Com", "(", ")", ":", "task_service", "=", "win32com", ".", "client", ".", "Dispatch", "(", "\"Schedule.Service...
r''' List all tasks located in a specific location in the task scheduler. :param str location: A string value representing the folder from which you want to list tasks. Default is '\\' which is the root for the task scheduler (C:\Windows\System32\tasks). :return: Returns a list of tasks. ...
[ "r", "List", "all", "tasks", "located", "in", "a", "specific", "location", "in", "the", "task", "scheduler", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_task.py#L336-L366
train
saltstack/salt
salt/modules/win_task.py
list_folders
def list_folders(location='\\'): r''' List all folders located in a specific location in the task scheduler. :param str location: A string value representing the folder from which you want to list tasks. Default is '\\' which is the root for the task scheduler (C:\Windows\System32\tasks). ...
python
def list_folders(location='\\'): r''' List all folders located in a specific location in the task scheduler. :param str location: A string value representing the folder from which you want to list tasks. Default is '\\' which is the root for the task scheduler (C:\Windows\System32\tasks). ...
[ "def", "list_folders", "(", "location", "=", "'\\\\'", ")", ":", "# Create the task service object", "with", "salt", ".", "utils", ".", "winapi", ".", "Com", "(", ")", ":", "task_service", "=", "win32com", ".", "client", ".", "Dispatch", "(", "\"Schedule.Servi...
r''' List all folders located in a specific location in the task scheduler. :param str location: A string value representing the folder from which you want to list tasks. Default is '\\' which is the root for the task scheduler (C:\Windows\System32\tasks). :return: Returns a list of folder...
[ "r", "List", "all", "folders", "located", "in", "a", "specific", "location", "in", "the", "task", "scheduler", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_task.py#L369-L399
train
saltstack/salt
salt/modules/win_task.py
list_triggers
def list_triggers(name, location='\\'): r''' List all triggers that pertain to a task in the specified location. :param str name: The name of the task for which list triggers. :param str location: A string value representing the location of the task from which to list triggers. Default is '\\'...
python
def list_triggers(name, location='\\'): r''' List all triggers that pertain to a task in the specified location. :param str name: The name of the task for which list triggers. :param str location: A string value representing the location of the task from which to list triggers. Default is '\\'...
[ "def", "list_triggers", "(", "name", ",", "location", "=", "'\\\\'", ")", ":", "# Create the task service object", "with", "salt", ".", "utils", ".", "winapi", ".", "Com", "(", ")", ":", "task_service", "=", "win32com", ".", "client", ".", "Dispatch", "(", ...
r''' List all triggers that pertain to a task in the specified location. :param str name: The name of the task for which list triggers. :param str location: A string value representing the location of the task from which to list triggers. Default is '\\' which is the root for the task sche...
[ "r", "List", "all", "triggers", "that", "pertain", "to", "a", "task", "in", "the", "specified", "location", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_task.py#L402-L435
train
saltstack/salt
salt/modules/win_task.py
list_actions
def list_actions(name, location='\\'): r''' List all actions that pertain to a task in the specified location. :param str name: The name of the task for which list actions. :param str location: A string value representing the location of the task from which to list actions. Default is '\\' whi...
python
def list_actions(name, location='\\'): r''' List all actions that pertain to a task in the specified location. :param str name: The name of the task for which list actions. :param str location: A string value representing the location of the task from which to list actions. Default is '\\' whi...
[ "def", "list_actions", "(", "name", ",", "location", "=", "'\\\\'", ")", ":", "# Create the task service object", "with", "salt", ".", "utils", ".", "winapi", ".", "Com", "(", ")", ":", "task_service", "=", "win32com", ".", "client", ".", "Dispatch", "(", ...
r''' List all actions that pertain to a task in the specified location. :param str name: The name of the task for which list actions. :param str location: A string value representing the location of the task from which to list actions. Default is '\\' which is the root for the task schedul...
[ "r", "List", "all", "actions", "that", "pertain", "to", "a", "task", "in", "the", "specified", "location", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_task.py#L438-L471
train
saltstack/salt
salt/modules/win_task.py
create_task
def create_task(name, location='\\', user_name='System', password=None, force=False, **kwargs): r''' Create a new task in the designated location. This function has many keyword arguments that are not listed here. For additional...
python
def create_task(name, location='\\', user_name='System', password=None, force=False, **kwargs): r''' Create a new task in the designated location. This function has many keyword arguments that are not listed here. For additional...
[ "def", "create_task", "(", "name", ",", "location", "=", "'\\\\'", ",", "user_name", "=", "'System'", ",", "password", "=", "None", ",", "force", "=", "False", ",", "*", "*", "kwargs", ")", ":", "# Check for existing task", "if", "name", "in", "list_tasks"...
r''' Create a new task in the designated location. This function has many keyword arguments that are not listed here. For additional arguments see: - :py:func:`edit_task` - :py:func:`add_action` - :py:func:`add_trigger` :param str name: The name of the task. This will be displayed in the task ...
[ "r", "Create", "a", "new", "task", "in", "the", "designated", "location", ".", "This", "function", "has", "many", "keyword", "arguments", "that", "are", "not", "listed", "here", ".", "For", "additional", "arguments", "see", ":" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_task.py#L474-L554
train
saltstack/salt
salt/modules/win_task.py
create_task_from_xml
def create_task_from_xml(name, location='\\', xml_text=None, xml_path=None, user_name='System', password=None): r''' Create a task based on XML. Source can be a file or a string of XML. ...
python
def create_task_from_xml(name, location='\\', xml_text=None, xml_path=None, user_name='System', password=None): r''' Create a task based on XML. Source can be a file or a string of XML. ...
[ "def", "create_task_from_xml", "(", "name", ",", "location", "=", "'\\\\'", ",", "xml_text", "=", "None", ",", "xml_path", "=", "None", ",", "user_name", "=", "'System'", ",", "password", "=", "None", ")", ":", "# Check for existing task", "if", "name", "in"...
r''' Create a task based on XML. Source can be a file or a string of XML. :param str name: The name of the task. This will be displayed in the task scheduler. :param str location: A string value representing the location in which to create the task. Default is '\\' which is the root for th...
[ "r", "Create", "a", "task", "based", "on", "XML", ".", "Source", "can", "be", "a", "file", "or", "a", "string", "of", "XML", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_task.py#L557-L675
train
saltstack/salt
salt/modules/win_task.py
create_folder
def create_folder(name, location='\\'): r''' Create a folder in which to create tasks. :param str name: The name of the folder. This will be displayed in the task scheduler. :param str location: A string value representing the location in which to create the folder. Default is '\\' whi...
python
def create_folder(name, location='\\'): r''' Create a folder in which to create tasks. :param str name: The name of the folder. This will be displayed in the task scheduler. :param str location: A string value representing the location in which to create the folder. Default is '\\' whi...
[ "def", "create_folder", "(", "name", ",", "location", "=", "'\\\\'", ")", ":", "# Check for existing folder", "if", "name", "in", "list_folders", "(", "location", ")", ":", "# Connect to an existing task definition", "return", "'{0} already exists'", ".", "format", "(...
r''' Create a folder in which to create tasks. :param str name: The name of the folder. This will be displayed in the task scheduler. :param str location: A string value representing the location in which to create the folder. Default is '\\' which is the root for the task schedule...
[ "r", "Create", "a", "folder", "in", "which", "to", "create", "tasks", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_task.py#L678-L716
train
saltstack/salt
salt/modules/win_task.py
edit_task
def edit_task(name=None, location='\\', # General Tab user_name=None, password=None, description=None, enabled=None, hidden=None, # Conditions Tab run_if_idle=None, idle_duration=N...
python
def edit_task(name=None, location='\\', # General Tab user_name=None, password=None, description=None, enabled=None, hidden=None, # Conditions Tab run_if_idle=None, idle_duration=N...
[ "def", "edit_task", "(", "name", "=", "None", ",", "location", "=", "'\\\\'", ",", "# General Tab", "user_name", "=", "None", ",", "password", "=", "None", ",", "description", "=", "None", ",", "enabled", "=", "None", ",", "hidden", "=", "None", ",", "...
r''' Edit the parameters of a task. Triggers and Actions cannot be edited yet. :param str name: The name of the task. This will be displayed in the task scheduler. :param str location: A string value representing the location in which to create the task. Default is '\\' which is the root f...
[ "r", "Edit", "the", "parameters", "of", "a", "task", ".", "Triggers", "and", "Actions", "cannot", "be", "edited", "yet", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_task.py#L719-L1058
train
saltstack/salt
salt/modules/win_task.py
delete_task
def delete_task(name, location='\\'): r''' Delete a task from the task scheduler. :param str name: The name of the task to delete. :param str location: A string value representing the location of the task. Default is '\\' which is the root for the task scheduler (C:\Windows\System32\ta...
python
def delete_task(name, location='\\'): r''' Delete a task from the task scheduler. :param str name: The name of the task to delete. :param str location: A string value representing the location of the task. Default is '\\' which is the root for the task scheduler (C:\Windows\System32\ta...
[ "def", "delete_task", "(", "name", ",", "location", "=", "'\\\\'", ")", ":", "# Check for existing task", "if", "name", "not", "in", "list_tasks", "(", "location", ")", ":", "return", "'{0} not found in {1}'", ".", "format", "(", "name", ",", "location", ")", ...
r''' Delete a task from the task scheduler. :param str name: The name of the task to delete. :param str location: A string value representing the location of the task. Default is '\\' which is the root for the task scheduler (C:\Windows\System32\tasks). :return: True if successful, Fa...
[ "r", "Delete", "a", "task", "from", "the", "task", "scheduler", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_task.py#L1061-L1098
train
saltstack/salt
salt/modules/win_task.py
run
def run(name, location='\\'): r''' Run a scheduled task manually. :param str name: The name of the task to run. :param str location: A string value representing the location of the task. Default is '\\' which is the root for the task scheduler (C:\Windows\System32\tasks). :return:...
python
def run(name, location='\\'): r''' Run a scheduled task manually. :param str name: The name of the task to run. :param str location: A string value representing the location of the task. Default is '\\' which is the root for the task scheduler (C:\Windows\System32\tasks). :return:...
[ "def", "run", "(", "name", ",", "location", "=", "'\\\\'", ")", ":", "# Check for existing folder", "if", "name", "not", "in", "list_tasks", "(", "location", ")", ":", "return", "'{0} not found in {1}'", ".", "format", "(", "name", ",", "location", ")", "# c...
r''' Run a scheduled task manually. :param str name: The name of the task to run. :param str location: A string value representing the location of the task. Default is '\\' which is the root for the task scheduler (C:\Windows\System32\tasks). :return: True if successful, False if unsu...
[ "r", "Run", "a", "scheduled", "task", "manually", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_task.py#L1142-L1178
train
saltstack/salt
salt/modules/win_task.py
run_wait
def run_wait(name, location='\\'): r''' Run a scheduled task and return when the task finishes :param str name: The name of the task to run. :param str location: A string value representing the location of the task. Default is '\\' which is the root for the task scheduler (C:\Windows\S...
python
def run_wait(name, location='\\'): r''' Run a scheduled task and return when the task finishes :param str name: The name of the task to run. :param str location: A string value representing the location of the task. Default is '\\' which is the root for the task scheduler (C:\Windows\S...
[ "def", "run_wait", "(", "name", ",", "location", "=", "'\\\\'", ")", ":", "# Check for existing folder", "if", "name", "not", "in", "list_tasks", "(", "location", ")", ":", "return", "'{0} not found in {1}'", ".", "format", "(", "name", ",", "location", ")", ...
r''' Run a scheduled task and return when the task finishes :param str name: The name of the task to run. :param str location: A string value representing the location of the task. Default is '\\' which is the root for the task scheduler (C:\Windows\System32\tasks). :return: True if s...
[ "r", "Run", "a", "scheduled", "task", "and", "return", "when", "the", "task", "finishes" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_task.py#L1181-L1235
train
saltstack/salt
salt/modules/win_task.py
status
def status(name, location='\\'): r''' Determine the status of a task. Is it Running, Queued, Ready, etc. :param str name: The name of the task for which to return the status :param str location: A string value representing the location of the task. Default is '\\' which is the root for the tas...
python
def status(name, location='\\'): r''' Determine the status of a task. Is it Running, Queued, Ready, etc. :param str name: The name of the task for which to return the status :param str location: A string value representing the location of the task. Default is '\\' which is the root for the tas...
[ "def", "status", "(", "name", ",", "location", "=", "'\\\\'", ")", ":", "# Check for existing folder", "if", "name", "not", "in", "list_tasks", "(", "location", ")", ":", "return", "'{0} not found in {1}'", ".", "format", "(", "name", ",", "location", ")", "...
r''' Determine the status of a task. Is it Running, Queued, Ready, etc. :param str name: The name of the task for which to return the status :param str location: A string value representing the location of the task. Default is '\\' which is the root for the task scheduler (C:\Windows\Syste...
[ "r", "Determine", "the", "status", "of", "a", "task", ".", "Is", "it", "Running", "Queued", "Ready", "etc", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_task.py#L1277-L1316
train
saltstack/salt
salt/modules/win_task.py
info
def info(name, location='\\'): r''' Get the details about a task in the task scheduler. :param str name: The name of the task for which to return the status :param str location: A string value representing the location of the task. Default is '\\' which is the root for the task scheduler ...
python
def info(name, location='\\'): r''' Get the details about a task in the task scheduler. :param str name: The name of the task for which to return the status :param str location: A string value representing the location of the task. Default is '\\' which is the root for the task scheduler ...
[ "def", "info", "(", "name", ",", "location", "=", "'\\\\'", ")", ":", "# Check for existing folder", "if", "name", "not", "in", "list_tasks", "(", "location", ")", ":", "return", "'{0} not found in {1}'", ".", "format", "(", "name", ",", "location", ")", "# ...
r''' Get the details about a task in the task scheduler. :param str name: The name of the task for which to return the status :param str location: A string value representing the location of the task. Default is '\\' which is the root for the task scheduler (C:\Windows\System32\tasks). ...
[ "r", "Get", "the", "details", "about", "a", "task", "in", "the", "task", "scheduler", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_task.py#L1319-L1451
train
saltstack/salt
salt/modules/win_task.py
add_action
def add_action(name=None, location='\\', action_type='Execute', **kwargs): r''' Add an action to a task. :param str name: The name of the task to which to add the action. :param str location: A string value representing the location of the task. Def...
python
def add_action(name=None, location='\\', action_type='Execute', **kwargs): r''' Add an action to a task. :param str name: The name of the task to which to add the action. :param str location: A string value representing the location of the task. Def...
[ "def", "add_action", "(", "name", "=", "None", ",", "location", "=", "'\\\\'", ",", "action_type", "=", "'Execute'", ",", "*", "*", "kwargs", ")", ":", "save_definition", "=", "False", "if", "kwargs", ".", "get", "(", "'task_definition'", ",", "False", "...
r''' Add an action to a task. :param str name: The name of the task to which to add the action. :param str location: A string value representing the location of the task. Default is '\\' which is the root for the task scheduler (C:\Windows\System32\tasks). :param str action_type: The ...
[ "r", "Add", "an", "action", "to", "a", "task", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_task.py#L1454-L1619
train
saltstack/salt
salt/modules/win_task.py
add_trigger
def add_trigger(name=None, location='\\', trigger_type=None, trigger_enabled=True, start_date=None, start_time=None, end_date=None, end_time=None, random_delay=None, repeat_int...
python
def add_trigger(name=None, location='\\', trigger_type=None, trigger_enabled=True, start_date=None, start_time=None, end_date=None, end_time=None, random_delay=None, repeat_int...
[ "def", "add_trigger", "(", "name", "=", "None", ",", "location", "=", "'\\\\'", ",", "trigger_type", "=", "None", ",", "trigger_enabled", "=", "True", ",", "start_date", "=", "None", ",", "start_time", "=", "None", ",", "end_date", "=", "None", ",", "end...
r''' :param str name: The name of the task to which to add the trigger. :param str location: A string value representing the location of the task. Default is '\\' which is the root for the task scheduler (C:\Windows\System32\tasks). :param str trigger_type: The type of trigger to create. T...
[ "r", ":", "param", "str", "name", ":", "The", "name", "of", "the", "task", "to", "which", "to", "add", "the", "trigger", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_task.py#L1666-L2202
train
saltstack/salt
salt/modules/win_task.py
clear_triggers
def clear_triggers(name, location='\\'): r''' Remove all triggers from the task. :param str name: The name of the task from which to clear all triggers. :param str location: A string value representing the location of the task. Default is '\\' which is the root for the task scheduler (...
python
def clear_triggers(name, location='\\'): r''' Remove all triggers from the task. :param str name: The name of the task from which to clear all triggers. :param str location: A string value representing the location of the task. Default is '\\' which is the root for the task scheduler (...
[ "def", "clear_triggers", "(", "name", ",", "location", "=", "'\\\\'", ")", ":", "# Check for existing task", "if", "name", "not", "in", "list_tasks", "(", "location", ")", ":", "return", "'{0} not found in {1}'", ".", "format", "(", "name", ",", "location", ")...
r''' Remove all triggers from the task. :param str name: The name of the task from which to clear all triggers. :param str location: A string value representing the location of the task. Default is '\\' which is the root for the task scheduler (C:\Windows\System32\tasks). :return: Tru...
[ "r", "Remove", "all", "triggers", "from", "the", "task", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_task.py#L2205-L2246
train
saltstack/salt
salt/sdb/couchdb.py
_get_conn
def _get_conn(profile): ''' Get a connection to CouchDB ''' DEFAULT_BASE_URL = _construct_uri(profile) or 'http://localhost:5984' server = couchdb.Server() if profile['database'] not in server: server.create(profile['database']) return server
python
def _get_conn(profile): ''' Get a connection to CouchDB ''' DEFAULT_BASE_URL = _construct_uri(profile) or 'http://localhost:5984' server = couchdb.Server() if profile['database'] not in server: server.create(profile['database']) return server
[ "def", "_get_conn", "(", "profile", ")", ":", "DEFAULT_BASE_URL", "=", "_construct_uri", "(", "profile", ")", "or", "'http://localhost:5984'", "server", "=", "couchdb", ".", "Server", "(", ")", "if", "profile", "[", "'database'", "]", "not", "in", "server", ...
Get a connection to CouchDB
[ "Get", "a", "connection", "to", "CouchDB" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/sdb/couchdb.py#L79-L88
train
saltstack/salt
salt/sdb/couchdb.py
set_
def set_(key, value, profile=None): ''' Set a key/value pair in couchdb ''' db = _get_db(profile) return db.save({'_id': uuid4().hex, key: value})
python
def set_(key, value, profile=None): ''' Set a key/value pair in couchdb ''' db = _get_db(profile) return db.save({'_id': uuid4().hex, key: value})
[ "def", "set_", "(", "key", ",", "value", ",", "profile", "=", "None", ")", ":", "db", "=", "_get_db", "(", "profile", ")", "return", "db", ".", "save", "(", "{", "'_id'", ":", "uuid4", "(", ")", ".", "hex", ",", "key", ":", "value", "}", ")" ]
Set a key/value pair in couchdb
[ "Set", "a", "key", "/", "value", "pair", "in", "couchdb" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/sdb/couchdb.py#L91-L96
train
saltstack/salt
salt/client/ssh/shell.py
gen_key
def gen_key(path): ''' Generate a key for use with salt-ssh ''' cmd = 'ssh-keygen -P "" -f {0} -t rsa -q'.format(path) if not os.path.isdir(os.path.dirname(path)): os.makedirs(os.path.dirname(path)) subprocess.call(cmd, shell=True)
python
def gen_key(path): ''' Generate a key for use with salt-ssh ''' cmd = 'ssh-keygen -P "" -f {0} -t rsa -q'.format(path) if not os.path.isdir(os.path.dirname(path)): os.makedirs(os.path.dirname(path)) subprocess.call(cmd, shell=True)
[ "def", "gen_key", "(", "path", ")", ":", "cmd", "=", "'ssh-keygen -P \"\" -f {0} -t rsa -q'", ".", "format", "(", "path", ")", "if", "not", "os", ".", "path", ".", "isdir", "(", "os", ".", "path", ".", "dirname", "(", "path", ")", ")", ":", "os", "."...
Generate a key for use with salt-ssh
[ "Generate", "a", "key", "for", "use", "with", "salt", "-", "ssh" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/shell.py#L42-L49
train
saltstack/salt
salt/client/ssh/shell.py
gen_shell
def gen_shell(opts, **kwargs): ''' Return the correct shell interface for the target system ''' if kwargs['winrm']: try: import saltwinshell shell = saltwinshell.Shell(opts, **kwargs) except ImportError: log.error('The saltwinshell library is not avail...
python
def gen_shell(opts, **kwargs): ''' Return the correct shell interface for the target system ''' if kwargs['winrm']: try: import saltwinshell shell = saltwinshell.Shell(opts, **kwargs) except ImportError: log.error('The saltwinshell library is not avail...
[ "def", "gen_shell", "(", "opts", ",", "*", "*", "kwargs", ")", ":", "if", "kwargs", "[", "'winrm'", "]", ":", "try", ":", "import", "saltwinshell", "shell", "=", "saltwinshell", ".", "Shell", "(", "opts", ",", "*", "*", "kwargs", ")", "except", "Impo...
Return the correct shell interface for the target system
[ "Return", "the", "correct", "shell", "interface", "for", "the", "target", "system" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/shell.py#L52-L65
train
saltstack/salt
salt/client/ssh/shell.py
Shell.get_error
def get_error(self, errstr): ''' Parse out an error and return a targeted error string ''' for line in errstr.split('\n'): if line.startswith('ssh:'): return line if line.startswith('Pseudo-terminal'): continue if 'to th...
python
def get_error(self, errstr): ''' Parse out an error and return a targeted error string ''' for line in errstr.split('\n'): if line.startswith('ssh:'): return line if line.startswith('Pseudo-terminal'): continue if 'to th...
[ "def", "get_error", "(", "self", ",", "errstr", ")", ":", "for", "line", "in", "errstr", ".", "split", "(", "'\\n'", ")", ":", "if", "line", ".", "startswith", "(", "'ssh:'", ")", ":", "return", "line", "if", "line", ".", "startswith", "(", "'Pseudo-...
Parse out an error and return a targeted error string
[ "Parse", "out", "an", "error", "and", "return", "a", "targeted", "error", "string" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/shell.py#L106-L118
train
saltstack/salt
salt/client/ssh/shell.py
Shell._key_opts
def _key_opts(self): ''' Return options for the ssh command base for Salt to call ''' options = [ 'KbdInteractiveAuthentication=no', ] if self.passwd: options.append('PasswordAuthentication=yes') else: options....
python
def _key_opts(self): ''' Return options for the ssh command base for Salt to call ''' options = [ 'KbdInteractiveAuthentication=no', ] if self.passwd: options.append('PasswordAuthentication=yes') else: options....
[ "def", "_key_opts", "(", "self", ")", ":", "options", "=", "[", "'KbdInteractiveAuthentication=no'", ",", "]", "if", "self", ".", "passwd", ":", "options", ".", "append", "(", "'PasswordAuthentication=yes'", ")", "else", ":", "options", ".", "append", "(", "...
Return options for the ssh command base for Salt to call
[ "Return", "options", "for", "the", "ssh", "command", "base", "for", "Salt", "to", "call" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/shell.py#L120-L154
train
saltstack/salt
salt/client/ssh/shell.py
Shell._passwd_opts
def _passwd_opts(self): ''' Return options to pass to ssh ''' # TODO ControlMaster does not work without ControlPath # user could take advantage of it if they set ControlPath in their # ssh config. Also, ControlPersist not widely available. options = ['ControlMas...
python
def _passwd_opts(self): ''' Return options to pass to ssh ''' # TODO ControlMaster does not work without ControlPath # user could take advantage of it if they set ControlPath in their # ssh config. Also, ControlPersist not widely available. options = ['ControlMas...
[ "def", "_passwd_opts", "(", "self", ")", ":", "# TODO ControlMaster does not work without ControlPath", "# user could take advantage of it if they set ControlPath in their", "# ssh config. Also, ControlPersist not widely available.", "options", "=", "[", "'ControlMaster=auto'", ",", "'S...
Return options to pass to ssh
[ "Return", "options", "to", "pass", "to", "ssh" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/shell.py#L156-L194
train
saltstack/salt
salt/client/ssh/shell.py
Shell._copy_id_str_old
def _copy_id_str_old(self): ''' Return the string to execute ssh-copy-id ''' if self.passwd: # Using single quotes prevents shell expansion and # passwords containing '$' return "{0} {1} '{2} -p {3} {4} {5}@{6}'".format( 'ssh-copy-i...
python
def _copy_id_str_old(self): ''' Return the string to execute ssh-copy-id ''' if self.passwd: # Using single quotes prevents shell expansion and # passwords containing '$' return "{0} {1} '{2} -p {3} {4} {5}@{6}'".format( 'ssh-copy-i...
[ "def", "_copy_id_str_old", "(", "self", ")", ":", "if", "self", ".", "passwd", ":", "# Using single quotes prevents shell expansion and", "# passwords containing '$'", "return", "\"{0} {1} '{2} -p {3} {4} {5}@{6}'\"", ".", "format", "(", "'ssh-copy-id'", ",", "'-i {0}.pub'", ...
Return the string to execute ssh-copy-id
[ "Return", "the", "string", "to", "execute", "ssh", "-", "copy", "-", "id" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/shell.py#L200-L215
train
saltstack/salt
salt/client/ssh/shell.py
Shell.copy_id
def copy_id(self): ''' Execute ssh-copy-id to plant the id file on the target ''' stdout, stderr, retcode = self._run_cmd(self._copy_id_str_old()) if salt.defaults.exitcodes.EX_OK != retcode and 'Usage' in stderr: stdout, stderr, retcode = self._run_cmd(self._copy_id_...
python
def copy_id(self): ''' Execute ssh-copy-id to plant the id file on the target ''' stdout, stderr, retcode = self._run_cmd(self._copy_id_str_old()) if salt.defaults.exitcodes.EX_OK != retcode and 'Usage' in stderr: stdout, stderr, retcode = self._run_cmd(self._copy_id_...
[ "def", "copy_id", "(", "self", ")", ":", "stdout", ",", "stderr", ",", "retcode", "=", "self", ".", "_run_cmd", "(", "self", ".", "_copy_id_str_old", "(", ")", ")", "if", "salt", ".", "defaults", ".", "exitcodes", ".", "EX_OK", "!=", "retcode", "and", ...
Execute ssh-copy-id to plant the id file on the target
[ "Execute", "ssh", "-", "copy", "-", "id", "to", "plant", "the", "id", "file", "on", "the", "target" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/shell.py#L235-L242
train
saltstack/salt
salt/client/ssh/shell.py
Shell._cmd_str
def _cmd_str(self, cmd, ssh='ssh'): ''' Return the cmd string to execute ''' # TODO: if tty, then our SSH_SHIM cannot be supplied from STDIN Will # need to deliver the SHIM to the remote host and execute it there command = [ssh] if ssh != 'scp': comm...
python
def _cmd_str(self, cmd, ssh='ssh'): ''' Return the cmd string to execute ''' # TODO: if tty, then our SSH_SHIM cannot be supplied from STDIN Will # need to deliver the SHIM to the remote host and execute it there command = [ssh] if ssh != 'scp': comm...
[ "def", "_cmd_str", "(", "self", ",", "cmd", ",", "ssh", "=", "'ssh'", ")", ":", "# TODO: if tty, then our SSH_SHIM cannot be supplied from STDIN Will", "# need to deliver the SHIM to the remote host and execute it there", "command", "=", "[", "ssh", "]", "if", "ssh", "!=", ...
Return the cmd string to execute
[ "Return", "the", "cmd", "string", "to", "execute" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/shell.py#L244-L267
train
saltstack/salt
salt/client/ssh/shell.py
Shell._old_run_cmd
def _old_run_cmd(self, cmd): ''' Cleanly execute the command string ''' try: proc = subprocess.Popen( cmd, shell=True, stderr=subprocess.PIPE, stdout=subprocess.PIPE, ) data = proc.commun...
python
def _old_run_cmd(self, cmd): ''' Cleanly execute the command string ''' try: proc = subprocess.Popen( cmd, shell=True, stderr=subprocess.PIPE, stdout=subprocess.PIPE, ) data = proc.commun...
[ "def", "_old_run_cmd", "(", "self", ",", "cmd", ")", ":", "try", ":", "proc", "=", "subprocess", ".", "Popen", "(", "cmd", ",", "shell", "=", "True", ",", "stderr", "=", "subprocess", ".", "PIPE", ",", "stdout", "=", "subprocess", ".", "PIPE", ",", ...
Cleanly execute the command string
[ "Cleanly", "execute", "the", "command", "string" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/shell.py#L269-L284
train
saltstack/salt
salt/client/ssh/shell.py
Shell._run_nb_cmd
def _run_nb_cmd(self, cmd): ''' cmd iterator ''' try: proc = salt.utils.nb_popen.NonBlockingPopen( cmd, shell=True, stderr=subprocess.PIPE, stdout=subprocess.PIPE, ) while True: ...
python
def _run_nb_cmd(self, cmd): ''' cmd iterator ''' try: proc = salt.utils.nb_popen.NonBlockingPopen( cmd, shell=True, stderr=subprocess.PIPE, stdout=subprocess.PIPE, ) while True: ...
[ "def", "_run_nb_cmd", "(", "self", ",", "cmd", ")", ":", "try", ":", "proc", "=", "salt", ".", "utils", ".", "nb_popen", ".", "NonBlockingPopen", "(", "cmd", ",", "shell", "=", "True", ",", "stderr", "=", "subprocess", ".", "PIPE", ",", "stdout", "="...
cmd iterator
[ "cmd", "iterator" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/shell.py#L286-L308
train
saltstack/salt
salt/client/ssh/shell.py
Shell.exec_nb_cmd
def exec_nb_cmd(self, cmd): ''' Yield None until cmd finished ''' r_out = [] r_err = [] rcode = None cmd = self._cmd_str(cmd) logmsg = 'Executing non-blocking command: {0}'.format(cmd) if self.passwd: logmsg = logmsg.replace(self.passw...
python
def exec_nb_cmd(self, cmd): ''' Yield None until cmd finished ''' r_out = [] r_err = [] rcode = None cmd = self._cmd_str(cmd) logmsg = 'Executing non-blocking command: {0}'.format(cmd) if self.passwd: logmsg = logmsg.replace(self.passw...
[ "def", "exec_nb_cmd", "(", "self", ",", "cmd", ")", ":", "r_out", "=", "[", "]", "r_err", "=", "[", "]", "rcode", "=", "None", "cmd", "=", "self", ".", "_cmd_str", "(", "cmd", ")", "logmsg", "=", "'Executing non-blocking command: {0}'", ".", "format", ...
Yield None until cmd finished
[ "Yield", "None", "until", "cmd", "finished" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/shell.py#L310-L330
train
saltstack/salt
salt/client/ssh/shell.py
Shell.exec_cmd
def exec_cmd(self, cmd): ''' Execute a remote command ''' cmd = self._cmd_str(cmd) logmsg = 'Executing command: {0}'.format(cmd) if self.passwd: logmsg = logmsg.replace(self.passwd, ('*' * 6)) if 'decode("base64")' in logmsg or 'base64.b64decode(' in ...
python
def exec_cmd(self, cmd): ''' Execute a remote command ''' cmd = self._cmd_str(cmd) logmsg = 'Executing command: {0}'.format(cmd) if self.passwd: logmsg = logmsg.replace(self.passwd, ('*' * 6)) if 'decode("base64")' in logmsg or 'base64.b64decode(' in ...
[ "def", "exec_cmd", "(", "self", ",", "cmd", ")", ":", "cmd", "=", "self", ".", "_cmd_str", "(", "cmd", ")", "logmsg", "=", "'Executing command: {0}'", ".", "format", "(", "cmd", ")", "if", "self", ".", "passwd", ":", "logmsg", "=", "logmsg", ".", "re...
Execute a remote command
[ "Execute", "a", "remote", "command" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/shell.py#L332-L348
train
saltstack/salt
salt/client/ssh/shell.py
Shell.send
def send(self, local, remote, makedirs=False): ''' scp a file or files to a remote system ''' if makedirs: self.exec_cmd('mkdir -p {0}'.format(os.path.dirname(remote))) # scp needs [<ipv6} host = self.host if ':' in host: host = '[{0}]'.fo...
python
def send(self, local, remote, makedirs=False): ''' scp a file or files to a remote system ''' if makedirs: self.exec_cmd('mkdir -p {0}'.format(os.path.dirname(remote))) # scp needs [<ipv6} host = self.host if ':' in host: host = '[{0}]'.fo...
[ "def", "send", "(", "self", ",", "local", ",", "remote", ",", "makedirs", "=", "False", ")", ":", "if", "makedirs", ":", "self", ".", "exec_cmd", "(", "'mkdir -p {0}'", ".", "format", "(", "os", ".", "path", ".", "dirname", "(", "remote", ")", ")", ...
scp a file or files to a remote system
[ "scp", "a", "file", "or", "files", "to", "a", "remote", "system" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/shell.py#L350-L370
train
saltstack/salt
salt/client/ssh/shell.py
Shell._run_cmd
def _run_cmd(self, cmd, key_accept=False, passwd_retries=3): ''' Execute a shell command via VT. This is blocking and assumes that ssh is being run ''' if not cmd: return '', 'No command or passphrase', 245 term = salt.utils.vt.Terminal( cmd, ...
python
def _run_cmd(self, cmd, key_accept=False, passwd_retries=3): ''' Execute a shell command via VT. This is blocking and assumes that ssh is being run ''' if not cmd: return '', 'No command or passphrase', 245 term = salt.utils.vt.Terminal( cmd, ...
[ "def", "_run_cmd", "(", "self", ",", "cmd", ",", "key_accept", "=", "False", ",", "passwd_retries", "=", "3", ")", ":", "if", "not", "cmd", ":", "return", "''", ",", "'No command or passphrase'", ",", "245", "term", "=", "salt", ".", "utils", ".", "vt"...
Execute a shell command via VT. This is blocking and assumes that ssh is being run
[ "Execute", "a", "shell", "command", "via", "VT", ".", "This", "is", "blocking", "and", "assumes", "that", "ssh", "is", "being", "run" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/shell.py#L372-L441
train
saltstack/salt
salt/log/handlers/sentry_mod.py
setup_handlers
def setup_handlers(): ''' sets up the sentry handler ''' __grains__ = salt.loader.grains(__opts__) __salt__ = salt.loader.minion_mods(__opts__) if 'sentry_handler' not in __opts__: log.debug('No \'sentry_handler\' key was found in the configuration') return False options = {}...
python
def setup_handlers(): ''' sets up the sentry handler ''' __grains__ = salt.loader.grains(__opts__) __salt__ = salt.loader.minion_mods(__opts__) if 'sentry_handler' not in __opts__: log.debug('No \'sentry_handler\' key was found in the configuration') return False options = {}...
[ "def", "setup_handlers", "(", ")", ":", "__grains__", "=", "salt", ".", "loader", ".", "grains", "(", "__opts__", ")", "__salt__", "=", "salt", ".", "loader", ".", "minion_mods", "(", "__opts__", ")", "if", "'sentry_handler'", "not", "in", "__opts__", ":",...
sets up the sentry handler
[ "sets", "up", "the", "sentry", "handler" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/log/handlers/sentry_mod.py#L120-L235
train
saltstack/salt
salt/auth/ldap.py
_config
def _config(key, mandatory=True, opts=None): ''' Return a value for 'name' from master config file options or defaults. ''' try: if opts: value = opts['auth.ldap.{0}'.format(key)] else: value = __opts__['auth.ldap.{0}'.format(key)] except KeyError: try...
python
def _config(key, mandatory=True, opts=None): ''' Return a value for 'name' from master config file options or defaults. ''' try: if opts: value = opts['auth.ldap.{0}'.format(key)] else: value = __opts__['auth.ldap.{0}'.format(key)] except KeyError: try...
[ "def", "_config", "(", "key", ",", "mandatory", "=", "True", ",", "opts", "=", "None", ")", ":", "try", ":", "if", "opts", ":", "value", "=", "opts", "[", "'auth.ldap.{0}'", ".", "format", "(", "key", ")", "]", "else", ":", "value", "=", "__opts__"...
Return a value for 'name' from master config file options or defaults.
[ "Return", "a", "value", "for", "name", "from", "master", "config", "file", "options", "or", "defaults", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/auth/ldap.py#L51-L68
train
saltstack/salt
salt/auth/ldap.py
_render_template
def _render_template(param, username): ''' Render config template, substituting username where found. ''' env = Environment() template = env.from_string(param) variables = {'username': username} return template.render(variables)
python
def _render_template(param, username): ''' Render config template, substituting username where found. ''' env = Environment() template = env.from_string(param) variables = {'username': username} return template.render(variables)
[ "def", "_render_template", "(", "param", ",", "username", ")", ":", "env", "=", "Environment", "(", ")", "template", "=", "env", ".", "from_string", "(", "param", ")", "variables", "=", "{", "'username'", ":", "username", "}", "return", "template", ".", ...
Render config template, substituting username where found.
[ "Render", "config", "template", "substituting", "username", "where", "found", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/auth/ldap.py#L71-L78
train
saltstack/salt
salt/auth/ldap.py
_bind_for_search
def _bind_for_search(anonymous=False, opts=None): ''' Bind with binddn and bindpw only for searching LDAP :param anonymous: Try binding anonymously :param opts: Pass in when __opts__ is not available :return: LDAPConnection object ''' # Get config params; create connection dictionary con...
python
def _bind_for_search(anonymous=False, opts=None): ''' Bind with binddn and bindpw only for searching LDAP :param anonymous: Try binding anonymously :param opts: Pass in when __opts__ is not available :return: LDAPConnection object ''' # Get config params; create connection dictionary con...
[ "def", "_bind_for_search", "(", "anonymous", "=", "False", ",", "opts", "=", "None", ")", ":", "# Get config params; create connection dictionary", "connargs", "=", "{", "}", "# config params (auth.ldap.*)", "params", "=", "{", "'mandatory'", ":", "[", "'uri'", ",",...
Bind with binddn and bindpw only for searching LDAP :param anonymous: Try binding anonymously :param opts: Pass in when __opts__ is not available :return: LDAPConnection object
[ "Bind", "with", "binddn", "and", "bindpw", "only", "for", "searching", "LDAP", ":", "param", "anonymous", ":", "Try", "binding", "anonymously", ":", "param", "opts", ":", "Pass", "in", "when", "__opts__", "is", "not", "available", ":", "return", ":", "LDAP...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/auth/ldap.py#L140-L183
train
saltstack/salt
salt/auth/ldap.py
_bind
def _bind(username, password, anonymous=False, opts=None): ''' Authenticate via an LDAP bind ''' # Get config params; create connection dictionary basedn = _config('basedn', opts=opts) scope = _config('scope', opts=opts) connargs = {} # config params (auth.ldap.*) params = { ...
python
def _bind(username, password, anonymous=False, opts=None): ''' Authenticate via an LDAP bind ''' # Get config params; create connection dictionary basedn = _config('basedn', opts=opts) scope = _config('scope', opts=opts) connargs = {} # config params (auth.ldap.*) params = { ...
[ "def", "_bind", "(", "username", ",", "password", ",", "anonymous", "=", "False", ",", "opts", "=", "None", ")", ":", "# Get config params; create connection dictionary", "basedn", "=", "_config", "(", "'basedn'", ",", "opts", "=", "opts", ")", "scope", "=", ...
Authenticate via an LDAP bind
[ "Authenticate", "via", "an", "LDAP", "bind" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/auth/ldap.py#L186-L290
train
saltstack/salt
salt/auth/ldap.py
auth
def auth(username, password): ''' Simple LDAP auth ''' if not HAS_LDAP: log.error('LDAP authentication requires python-ldap module') return False bind = None # If bind credentials are configured, verify that we receive a valid bind if _config('binddn', mandatory=False) and ...
python
def auth(username, password): ''' Simple LDAP auth ''' if not HAS_LDAP: log.error('LDAP authentication requires python-ldap module') return False bind = None # If bind credentials are configured, verify that we receive a valid bind if _config('binddn', mandatory=False) and ...
[ "def", "auth", "(", "username", ",", "password", ")", ":", "if", "not", "HAS_LDAP", ":", "log", ".", "error", "(", "'LDAP authentication requires python-ldap module'", ")", "return", "False", "bind", "=", "None", "# If bind credentials are configured, verify that we rec...
Simple LDAP auth
[ "Simple", "LDAP", "auth" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/auth/ldap.py#L293-L322
train
saltstack/salt
salt/auth/ldap.py
groups
def groups(username, **kwargs): ''' Authenticate against an LDAP group Behavior is highly dependent on if Active Directory is in use. AD handles group membership very differently than OpenLDAP. See the :ref:`External Authentication <acl-eauth>` documentation for a thorough discussion of availa...
python
def groups(username, **kwargs): ''' Authenticate against an LDAP group Behavior is highly dependent on if Active Directory is in use. AD handles group membership very differently than OpenLDAP. See the :ref:`External Authentication <acl-eauth>` documentation for a thorough discussion of availa...
[ "def", "groups", "(", "username", ",", "*", "*", "kwargs", ")", ":", "group_list", "=", "[", "]", "# If bind credentials are configured, use them instead of user's", "if", "_config", "(", "'binddn'", ",", "mandatory", "=", "False", ")", "and", "_config", "(", "'...
Authenticate against an LDAP group Behavior is highly dependent on if Active Directory is in use. AD handles group membership very differently than OpenLDAP. See the :ref:`External Authentication <acl-eauth>` documentation for a thorough discussion of available parameters for customizing the search. ...
[ "Authenticate", "against", "an", "LDAP", "group" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/auth/ldap.py#L325-L436
train
saltstack/salt
salt/auth/ldap.py
process_acl
def process_acl(auth_list, opts=None): ''' Query LDAP, retrieve list of minion_ids from an OU or other search. For each minion_id returned from the LDAP search, copy the perms matchers into the auth dictionary :param auth_list: :param opts: __opts__ for when __opts__ is not injected :return:...
python
def process_acl(auth_list, opts=None): ''' Query LDAP, retrieve list of minion_ids from an OU or other search. For each minion_id returned from the LDAP search, copy the perms matchers into the auth dictionary :param auth_list: :param opts: __opts__ for when __opts__ is not injected :return:...
[ "def", "process_acl", "(", "auth_list", ",", "opts", "=", "None", ")", ":", "ou_names", "=", "[", "]", "for", "item", "in", "auth_list", ":", "if", "isinstance", "(", "item", ",", "six", ".", "string_types", ")", ":", "continue", "ou_names", ".", "exte...
Query LDAP, retrieve list of minion_ids from an OU or other search. For each minion_id returned from the LDAP search, copy the perms matchers into the auth dictionary :param auth_list: :param opts: __opts__ for when __opts__ is not injected :return: Modified auth list.
[ "Query", "LDAP", "retrieve", "list", "of", "minion_ids", "from", "an", "OU", "or", "other", "search", ".", "For", "each", "minion_id", "returned", "from", "the", "LDAP", "search", "copy", "the", "perms", "matchers", "into", "the", "auth", "dictionary", ":", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/auth/ldap.py#L509-L525
train
saltstack/salt
salt/modules/napalm_mod.py
_get_netmiko_args
def _get_netmiko_args(optional_args): ''' Check for Netmiko arguments that were passed in as NAPALM optional arguments. Return a dictionary of these optional args that will be passed into the Netmiko ConnectHandler call. .. note:: This is a port of the NAPALM helper for backwards compatib...
python
def _get_netmiko_args(optional_args): ''' Check for Netmiko arguments that were passed in as NAPALM optional arguments. Return a dictionary of these optional args that will be passed into the Netmiko ConnectHandler call. .. note:: This is a port of the NAPALM helper for backwards compatib...
[ "def", "_get_netmiko_args", "(", "optional_args", ")", ":", "if", "HAS_NETMIKO_HELPERS", ":", "return", "napalm", ".", "base", ".", "netmiko_helpers", ".", "netmiko_args", "(", "optional_args", ")", "# Older version don't have the netmiko_helpers module, the following code is...
Check for Netmiko arguments that were passed in as NAPALM optional arguments. Return a dictionary of these optional args that will be passed into the Netmiko ConnectHandler call. .. note:: This is a port of the NAPALM helper for backwards compatibility with older versions of NAPALM, and s...
[ "Check", "for", "Netmiko", "arguments", "that", "were", "passed", "in", "as", "NAPALM", "optional", "arguments", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/napalm_mod.py#L81-L118
train
saltstack/salt
salt/modules/napalm_mod.py
reconnect
def reconnect(force=False, **kwargs): # pylint: disable=unused-argument ''' Reconnect the NAPALM proxy when the connection is dropped by the network device. The connection can be forced to be restarted using the ``force`` argument. .. note:: This function can be used only when running...
python
def reconnect(force=False, **kwargs): # pylint: disable=unused-argument ''' Reconnect the NAPALM proxy when the connection is dropped by the network device. The connection can be forced to be restarted using the ``force`` argument. .. note:: This function can be used only when running...
[ "def", "reconnect", "(", "force", "=", "False", ",", "*", "*", "kwargs", ")", ":", "# pylint: disable=unused-argument", "default_ret", "=", "{", "'out'", ":", "None", ",", "'result'", ":", "True", ",", "'comment'", ":", "'Already alive.'", "}", "if", "not", ...
Reconnect the NAPALM proxy when the connection is dropped by the network device. The connection can be forced to be restarted using the ``force`` argument. .. note:: This function can be used only when running proxy minions. CLI Example: .. code-block:: bash salt '*' napalm....
[ "Reconnect", "the", "NAPALM", "proxy", "when", "the", "connection", "is", "dropped", "by", "the", "network", "device", ".", "The", "connection", "can", "be", "forced", "to", "be", "restarted", "using", "the", "force", "argument", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/napalm_mod.py#L195-L249
train
saltstack/salt
salt/modules/napalm_mod.py
call
def call(method, *args, **kwargs): ''' Execute arbitrary methods from the NAPALM library. To see the expected output, please consult the NAPALM documentation. .. note:: This feature is not recommended to be used in production. It should be used for testing only! CLI Example: ...
python
def call(method, *args, **kwargs): ''' Execute arbitrary methods from the NAPALM library. To see the expected output, please consult the NAPALM documentation. .. note:: This feature is not recommended to be used in production. It should be used for testing only! CLI Example: ...
[ "def", "call", "(", "method", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "clean_kwargs", "=", "{", "}", "for", "karg", ",", "warg", "in", "six", ".", "iteritems", "(", "kwargs", ")", ":", "# remove the __pub args", "if", "not", "karg", ".",...
Execute arbitrary methods from the NAPALM library. To see the expected output, please consult the NAPALM documentation. .. note:: This feature is not recommended to be used in production. It should be used for testing only! CLI Example: .. code-block:: bash salt '*' napalm.c...
[ "Execute", "arbitrary", "methods", "from", "the", "NAPALM", "library", ".", "To", "see", "the", "expected", "output", "please", "consult", "the", "NAPALM", "documentation", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/napalm_mod.py#L253-L281
train
saltstack/salt
salt/modules/napalm_mod.py
compliance_report
def compliance_report(filepath=None, string=None, renderer='jinja|yaml', **kwargs): ''' Return the compliance report. filepath The absolute path to the validation file. .. versionchanged:: 2019.2.0 Beginning with re...
python
def compliance_report(filepath=None, string=None, renderer='jinja|yaml', **kwargs): ''' Return the compliance report. filepath The absolute path to the validation file. .. versionchanged:: 2019.2.0 Beginning with re...
[ "def", "compliance_report", "(", "filepath", "=", "None", ",", "string", "=", "None", ",", "renderer", "=", "'jinja|yaml'", ",", "*", "*", "kwargs", ")", ":", "validation_string", "=", "__salt__", "[", "'slsutil.renderer'", "]", "(", "path", "=", "filepath",...
Return the compliance report. filepath The absolute path to the validation file. .. versionchanged:: 2019.2.0 Beginning with release codename ``2019.2.0``, this function has been enhanced, to be able to leverage the multi-engine template rendering of Salt, besides the poss...
[ "Return", "the", "compliance", "report", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/napalm_mod.py#L285-L417
train
saltstack/salt
salt/modules/napalm_mod.py
netmiko_args
def netmiko_args(**kwargs): ''' .. versionadded:: 2019.2.0 Return the key-value arguments used for the authentication arguments for the netmiko module. When running in a non-native NAPALM driver (e.g., ``panos``, `f5``, ``mos`` - either from https://github.com/napalm-automation-community or de...
python
def netmiko_args(**kwargs): ''' .. versionadded:: 2019.2.0 Return the key-value arguments used for the authentication arguments for the netmiko module. When running in a non-native NAPALM driver (e.g., ``panos``, `f5``, ``mos`` - either from https://github.com/napalm-automation-community or de...
[ "def", "netmiko_args", "(", "*", "*", "kwargs", ")", ":", "if", "not", "HAS_NETMIKO", ":", "raise", "CommandExecutionError", "(", "'Please install netmiko to be able to use this feature.'", ")", "kwargs", "=", "{", "}", "napalm_opts", "=", "salt", ".", "utils", "....
.. versionadded:: 2019.2.0 Return the key-value arguments used for the authentication arguments for the netmiko module. When running in a non-native NAPALM driver (e.g., ``panos``, `f5``, ``mos`` - either from https://github.com/napalm-automation-community or defined in user's own environment, one...
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/napalm_mod.py#L421-L488
train
saltstack/salt
salt/modules/napalm_mod.py
netmiko_fun
def netmiko_fun(fun, *args, **kwargs): ''' .. versionadded:: 2019.2.0 Call an arbitrary function from the :mod:`Netmiko<salt.modules.netmiko_mod>` module, passing the authentication details from the existing NAPALM connection. fun The name of the function from the :mod:`Netmiko<salt.mo...
python
def netmiko_fun(fun, *args, **kwargs): ''' .. versionadded:: 2019.2.0 Call an arbitrary function from the :mod:`Netmiko<salt.modules.netmiko_mod>` module, passing the authentication details from the existing NAPALM connection. fun The name of the function from the :mod:`Netmiko<salt.mo...
[ "def", "netmiko_fun", "(", "fun", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "'netmiko.'", "not", "in", "fun", ":", "fun", "=", "'netmiko.{fun}'", ".", "format", "(", "fun", "=", "fun", ")", "netmiko_kwargs", "=", "netmiko_args", "(", ...
.. versionadded:: 2019.2.0 Call an arbitrary function from the :mod:`Netmiko<salt.modules.netmiko_mod>` module, passing the authentication details from the existing NAPALM connection. fun The name of the function from the :mod:`Netmiko<salt.modules.netmiko_mod>` to invoke. args ...
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/napalm_mod.py#L492-L522
train
saltstack/salt
salt/modules/napalm_mod.py
netmiko_call
def netmiko_call(method, *args, **kwargs): ''' .. versionadded:: 2019.2.0 Execute an arbitrary Netmiko method, passing the authentication details from the existing NAPALM connection. method The name of the Netmiko method to execute. args List of arguments to send to the Netmik...
python
def netmiko_call(method, *args, **kwargs): ''' .. versionadded:: 2019.2.0 Execute an arbitrary Netmiko method, passing the authentication details from the existing NAPALM connection. method The name of the Netmiko method to execute. args List of arguments to send to the Netmik...
[ "def", "netmiko_call", "(", "method", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "netmiko_kwargs", "=", "netmiko_args", "(", ")", "kwargs", ".", "update", "(", "netmiko_kwargs", ")", "return", "__salt__", "[", "'netmiko.call'", "]", "(", "method"...
.. versionadded:: 2019.2.0 Execute an arbitrary Netmiko method, passing the authentication details from the existing NAPALM connection. method The name of the Netmiko method to execute. args List of arguments to send to the Netmiko method specified in ``method``. kwargs K...
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/napalm_mod.py#L526-L551
train
saltstack/salt
salt/modules/napalm_mod.py
netmiko_multi_call
def netmiko_multi_call(*methods, **kwargs): ''' .. versionadded:: 2019.2.0 Execute a list of arbitrary Netmiko methods, passing the authentication details from the existing NAPALM connection. methods List of dictionaries with the following keys: - ``name``: the name of the Netmiko...
python
def netmiko_multi_call(*methods, **kwargs): ''' .. versionadded:: 2019.2.0 Execute a list of arbitrary Netmiko methods, passing the authentication details from the existing NAPALM connection. methods List of dictionaries with the following keys: - ``name``: the name of the Netmiko...
[ "def", "netmiko_multi_call", "(", "*", "methods", ",", "*", "*", "kwargs", ")", ":", "netmiko_kwargs", "=", "netmiko_args", "(", ")", "kwargs", ".", "update", "(", "netmiko_kwargs", ")", "return", "__salt__", "[", "'netmiko.multi_call'", "]", "(", "*", "meth...
.. versionadded:: 2019.2.0 Execute a list of arbitrary Netmiko methods, passing the authentication details from the existing NAPALM connection. methods List of dictionaries with the following keys: - ``name``: the name of the Netmiko function to invoke. - ``args``: list of argumen...
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/napalm_mod.py#L555-L578
train
saltstack/salt
salt/modules/napalm_mod.py
netmiko_commands
def netmiko_commands(*commands, **kwargs): ''' .. versionadded:: 2019.2.0 Invoke one or more commands to be executed on the remote device, via Netmiko. Returns a list of strings, with the output from each command. commands A list of commands to be executed. expect_string Regul...
python
def netmiko_commands(*commands, **kwargs): ''' .. versionadded:: 2019.2.0 Invoke one or more commands to be executed on the remote device, via Netmiko. Returns a list of strings, with the output from each command. commands A list of commands to be executed. expect_string Regul...
[ "def", "netmiko_commands", "(", "*", "commands", ",", "*", "*", "kwargs", ")", ":", "conn", "=", "netmiko_conn", "(", "*", "*", "kwargs", ")", "ret", "=", "[", "]", "for", "cmd", "in", "commands", ":", "ret", ".", "append", "(", "conn", ".", "send_...
.. versionadded:: 2019.2.0 Invoke one or more commands to be executed on the remote device, via Netmiko. Returns a list of strings, with the output from each command. commands A list of commands to be executed. expect_string Regular expression pattern to use for determining end of out...
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/napalm_mod.py#L582-L628
train
saltstack/salt
salt/modules/napalm_mod.py
netmiko_config
def netmiko_config(*config_commands, **kwargs): ''' .. versionadded:: 2019.2.0 Load a list of configuration commands on the remote device, via Netmiko. .. warning:: Please remember that ``netmiko`` does not have any rollback safeguards and any configuration change will be directly loa...
python
def netmiko_config(*config_commands, **kwargs): ''' .. versionadded:: 2019.2.0 Load a list of configuration commands on the remote device, via Netmiko. .. warning:: Please remember that ``netmiko`` does not have any rollback safeguards and any configuration change will be directly loa...
[ "def", "netmiko_config", "(", "*", "config_commands", ",", "*", "*", "kwargs", ")", ":", "netmiko_kwargs", "=", "netmiko_args", "(", ")", "kwargs", ".", "update", "(", "netmiko_kwargs", ")", "return", "__salt__", "[", "'netmiko.send_config'", "]", "(", "config...
.. versionadded:: 2019.2.0 Load a list of configuration commands on the remote device, via Netmiko. .. warning:: Please remember that ``netmiko`` does not have any rollback safeguards and any configuration change will be directly loaded into the running config if the platform doesn't ...
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/napalm_mod.py#L632-L699
train
saltstack/salt
salt/modules/napalm_mod.py
junos_rpc
def junos_rpc(cmd=None, dest=None, format=None, **kwargs): ''' .. versionadded:: 2019.2.0 Execute an RPC request on the remote Junos device. cmd The RPC request to the executed. To determine the RPC request, you can check the from the command line of the device, by executing the usual ...
python
def junos_rpc(cmd=None, dest=None, format=None, **kwargs): ''' .. versionadded:: 2019.2.0 Execute an RPC request on the remote Junos device. cmd The RPC request to the executed. To determine the RPC request, you can check the from the command line of the device, by executing the usual ...
[ "def", "junos_rpc", "(", "cmd", "=", "None", ",", "dest", "=", "None", ",", "format", "=", "None", ",", "*", "*", "kwargs", ")", ":", "prep", "=", "_junos_prep_fun", "(", "napalm_device", ")", "# pylint: disable=undefined-variable", "if", "not", "prep", "[...
.. versionadded:: 2019.2.0 Execute an RPC request on the remote Junos device. cmd The RPC request to the executed. To determine the RPC request, you can check the from the command line of the device, by executing the usual command followed by ``| display xml rpc``, e.g., ``show...
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/napalm_mod.py#L729-L785
train
saltstack/salt
salt/modules/napalm_mod.py
junos_install_os
def junos_install_os(path=None, **kwargs): ''' .. versionadded:: 2019.2.0 Installs the given image on the device. path The image file source. This argument supports the following URIs: - Absolute path on the Minion. - ``salt://`` to fetch from the Salt fileserver. - ``...
python
def junos_install_os(path=None, **kwargs): ''' .. versionadded:: 2019.2.0 Installs the given image on the device. path The image file source. This argument supports the following URIs: - Absolute path on the Minion. - ``salt://`` to fetch from the Salt fileserver. - ``...
[ "def", "junos_install_os", "(", "path", "=", "None", ",", "*", "*", "kwargs", ")", ":", "prep", "=", "_junos_prep_fun", "(", "napalm_device", ")", "# pylint: disable=undefined-variable", "if", "not", "prep", "[", "'result'", "]", ":", "return", "prep", "return...
.. versionadded:: 2019.2.0 Installs the given image on the device. path The image file source. This argument supports the following URIs: - Absolute path on the Minion. - ``salt://`` to fetch from the Salt fileserver. - ``http://`` and ``https://`` - ``ftp://`` ...
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/napalm_mod.py#L838-L873
train
saltstack/salt
salt/modules/napalm_mod.py
junos_facts
def junos_facts(**kwargs): ''' .. versionadded:: 2019.2.0 The complete list of Junos facts collected by ``junos-eznc``. CLI Example: .. code-block:: bash salt '*' napalm.junos_facts ''' prep = _junos_prep_fun(napalm_device) # pylint: disable=undefined-variable if not prep['r...
python
def junos_facts(**kwargs): ''' .. versionadded:: 2019.2.0 The complete list of Junos facts collected by ``junos-eznc``. CLI Example: .. code-block:: bash salt '*' napalm.junos_facts ''' prep = _junos_prep_fun(napalm_device) # pylint: disable=undefined-variable if not prep['r...
[ "def", "junos_facts", "(", "*", "*", "kwargs", ")", ":", "prep", "=", "_junos_prep_fun", "(", "napalm_device", ")", "# pylint: disable=undefined-variable", "if", "not", "prep", "[", "'result'", "]", ":", "return", "prep", "facts", "=", "dict", "(", "napalm_dev...
.. versionadded:: 2019.2.0 The complete list of Junos facts collected by ``junos-eznc``. CLI Example: .. code-block:: bash salt '*' napalm.junos_facts
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/napalm_mod.py#L877-L902
train
saltstack/salt
salt/modules/napalm_mod.py
junos_cli
def junos_cli(command, format=None, dev_timeout=None, dest=None, **kwargs): ''' .. versionadded:: 2019.2.0 Execute a CLI command and return the output in the specified format. command The command to execute on the Junos CLI. format: ``text`` Format in which to get the CLI output (...
python
def junos_cli(command, format=None, dev_timeout=None, dest=None, **kwargs): ''' .. versionadded:: 2019.2.0 Execute a CLI command and return the output in the specified format. command The command to execute on the Junos CLI. format: ``text`` Format in which to get the CLI output (...
[ "def", "junos_cli", "(", "command", ",", "format", "=", "None", ",", "dev_timeout", "=", "None", ",", "dest", "=", "None", ",", "*", "*", "kwargs", ")", ":", "prep", "=", "_junos_prep_fun", "(", "napalm_device", ")", "# pylint: disable=undefined-variable", "...
.. versionadded:: 2019.2.0 Execute a CLI command and return the output in the specified format. command The command to execute on the Junos CLI. format: ``text`` Format in which to get the CLI output (either ``text`` or ``xml``). dev_timeout: ``30`` The NETCONF RPC timeout (i...
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/napalm_mod.py#L906-L939
train
saltstack/salt
salt/modules/napalm_mod.py
junos_copy_file
def junos_copy_file(src, dst, **kwargs): ''' .. versionadded:: 2019.2.0 Copies the file on the remote Junos device. src The source file path. This argument accepts the usual Salt URIs (e.g., ``salt://``, ``http://``, ``https://``, ``s3://``, ``ftp://``, etc.). dst The dest...
python
def junos_copy_file(src, dst, **kwargs): ''' .. versionadded:: 2019.2.0 Copies the file on the remote Junos device. src The source file path. This argument accepts the usual Salt URIs (e.g., ``salt://``, ``http://``, ``https://``, ``s3://``, ``ftp://``, etc.). dst The dest...
[ "def", "junos_copy_file", "(", "src", ",", "dst", ",", "*", "*", "kwargs", ")", ":", "prep", "=", "_junos_prep_fun", "(", "napalm_device", ")", "# pylint: disable=undefined-variable", "if", "not", "prep", "[", "'result'", "]", ":", "return", "prep", "cached_sr...
.. versionadded:: 2019.2.0 Copies the file on the remote Junos device. src The source file path. This argument accepts the usual Salt URIs (e.g., ``salt://``, ``http://``, ``https://``, ``s3://``, ``ftp://``, etc.). dst The destination path on the device where to copy the file. ...
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/napalm_mod.py#L943-L966
train
saltstack/salt
salt/modules/napalm_mod.py
junos_call
def junos_call(fun, *args, **kwargs): ''' .. versionadded:: 2019.2.0 Execute an arbitrary function from the :mod:`junos execution module <salt.module.junos>`. To check what ``args`` and ``kwargs`` you must send to the function, please consult the appropriate documentation. fun The ...
python
def junos_call(fun, *args, **kwargs): ''' .. versionadded:: 2019.2.0 Execute an arbitrary function from the :mod:`junos execution module <salt.module.junos>`. To check what ``args`` and ``kwargs`` you must send to the function, please consult the appropriate documentation. fun The ...
[ "def", "junos_call", "(", "fun", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "prep", "=", "_junos_prep_fun", "(", "napalm_device", ")", "# pylint: disable=undefined-variable", "if", "not", "prep", "[", "'result'", "]", ":", "return", "prep", "if", ...
.. versionadded:: 2019.2.0 Execute an arbitrary function from the :mod:`junos execution module <salt.module.junos>`. To check what ``args`` and ``kwargs`` you must send to the function, please consult the appropriate documentation. fun The name of the function. E.g., ``set_hostname``. ...
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/napalm_mod.py#L970-L1008
train
saltstack/salt
salt/modules/napalm_mod.py
pyeapi_nxos_api_args
def pyeapi_nxos_api_args(**prev_kwargs): ''' .. versionadded:: 2019.2.0 Return the key-value arguments used for the authentication arguments for the :mod:`pyeapi execution module <salt.module.arista_pyeapi>`. CLI Example: .. code-block:: bash salt '*' napalm.pyeapi_nxos_api_args ...
python
def pyeapi_nxos_api_args(**prev_kwargs): ''' .. versionadded:: 2019.2.0 Return the key-value arguments used for the authentication arguments for the :mod:`pyeapi execution module <salt.module.arista_pyeapi>`. CLI Example: .. code-block:: bash salt '*' napalm.pyeapi_nxos_api_args ...
[ "def", "pyeapi_nxos_api_args", "(", "*", "*", "prev_kwargs", ")", ":", "kwargs", "=", "{", "}", "napalm_opts", "=", "salt", ".", "utils", ".", "napalm", ".", "get_device_opts", "(", "__opts__", ",", "salt_obj", "=", "__salt__", ")", "optional_args", "=", "...
.. versionadded:: 2019.2.0 Return the key-value arguments used for the authentication arguments for the :mod:`pyeapi execution module <salt.module.arista_pyeapi>`. CLI Example: .. code-block:: bash salt '*' napalm.pyeapi_nxos_api_args
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/napalm_mod.py#L1011-L1035
train
saltstack/salt
salt/modules/napalm_mod.py
pyeapi_call
def pyeapi_call(method, *args, **kwargs): ''' .. versionadded:: 2019.2.0 Invoke an arbitrary method from the ``pyeapi`` library. This function forwards the existing connection details to the :mod:`pyeapi.run_commands <salt.module.arista_pyeapi.run_commands>` execution function. method ...
python
def pyeapi_call(method, *args, **kwargs): ''' .. versionadded:: 2019.2.0 Invoke an arbitrary method from the ``pyeapi`` library. This function forwards the existing connection details to the :mod:`pyeapi.run_commands <salt.module.arista_pyeapi.run_commands>` execution function. method ...
[ "def", "pyeapi_call", "(", "method", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "pyeapi_kwargs", "=", "pyeapi_nxos_api_args", "(", "*", "*", "kwargs", ")", "return", "__salt__", "[", "'pyeapi.call'", "]", "(", "method", ",", "*", "args", ",", ...
.. versionadded:: 2019.2.0 Invoke an arbitrary method from the ``pyeapi`` library. This function forwards the existing connection details to the :mod:`pyeapi.run_commands <salt.module.arista_pyeapi.run_commands>` execution function. method The name of the ``pyeapi`` method to invoke. ...
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/napalm_mod.py#L1065-L1088
train
saltstack/salt
salt/modules/napalm_mod.py
pyeapi_config
def pyeapi_config(commands=None, config_file=None, template_engine='jinja', context=None, defaults=None, saltenv='base', **kwargs): ''' .. versionadded:: 2019.2.0 Configures the Arista switch with th...
python
def pyeapi_config(commands=None, config_file=None, template_engine='jinja', context=None, defaults=None, saltenv='base', **kwargs): ''' .. versionadded:: 2019.2.0 Configures the Arista switch with th...
[ "def", "pyeapi_config", "(", "commands", "=", "None", ",", "config_file", "=", "None", ",", "template_engine", "=", "'jinja'", ",", "context", "=", "None", ",", "defaults", "=", "None", ",", "saltenv", "=", "'base'", ",", "*", "*", "kwargs", ")", ":", ...
.. versionadded:: 2019.2.0 Configures the Arista switch with the specified commands, via the ``pyeapi`` library. This function forwards the existing connection details to the :mod:`pyeapi.run_commands <salt.module.arista_pyeapi.run_commands>` execution function. commands The list of config...
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/napalm_mod.py#L1117-L1179
train
saltstack/salt
salt/modules/napalm_mod.py
nxos_api_rpc
def nxos_api_rpc(commands, method='cli', **kwargs): ''' .. versionadded:: 2019.2.0 Execute an arbitrary RPC request via the Nexus API. commands The RPC commands to be executed. method: ``cli`` The type of the response, i.e., raw text (``cli_ascii`...
python
def nxos_api_rpc(commands, method='cli', **kwargs): ''' .. versionadded:: 2019.2.0 Execute an arbitrary RPC request via the Nexus API. commands The RPC commands to be executed. method: ``cli`` The type of the response, i.e., raw text (``cli_ascii`...
[ "def", "nxos_api_rpc", "(", "commands", ",", "method", "=", "'cli'", ",", "*", "*", "kwargs", ")", ":", "nxos_api_kwargs", "=", "pyeapi_nxos_api_args", "(", "*", "*", "kwargs", ")", "return", "__salt__", "[", "'nxos_api.rpc'", "]", "(", "commands", ",", "m...
.. versionadded:: 2019.2.0 Execute an arbitrary RPC request via the Nexus API. commands The RPC commands to be executed. method: ``cli`` The type of the response, i.e., raw text (``cli_ascii``) or structured document (``cli``). Defaults to ``cli`` (structured data). CLI Examp...
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/napalm_mod.py#L1183-L1205
train
saltstack/salt
salt/modules/napalm_mod.py
nxos_api_config
def nxos_api_config(commands=None, config_file=None, template_engine='jinja', context=None, defaults=None, saltenv='base', **kwargs): ''' .. versionadded:: 2019.2.0 Configures the Nexus ...
python
def nxos_api_config(commands=None, config_file=None, template_engine='jinja', context=None, defaults=None, saltenv='base', **kwargs): ''' .. versionadded:: 2019.2.0 Configures the Nexus ...
[ "def", "nxos_api_config", "(", "commands", "=", "None", ",", "config_file", "=", "None", ",", "template_engine", "=", "'jinja'", ",", "context", "=", "None", ",", "defaults", "=", "None", ",", "saltenv", "=", "'base'", ",", "*", "*", "kwargs", ")", ":", ...
.. versionadded:: 2019.2.0 Configures the Nexus switch with the specified commands, via the NX-API. commands The list of configuration commands to load on the Nexus switch. .. note:: This argument is ignored when ``config_file`` is specified. config_file The source fi...
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/napalm_mod.py#L1209-L1269
train
saltstack/salt
salt/modules/napalm_mod.py
nxos_api_show
def nxos_api_show(commands, raw_text=True, **kwargs): ''' .. versionadded:: 2019.2.0 Execute one or more show (non-configuration) commands. commands The commands to be executed. raw_text: ``True`` Whether to return raw text or structured data. CLI Example: .. code-block:...
python
def nxos_api_show(commands, raw_text=True, **kwargs): ''' .. versionadded:: 2019.2.0 Execute one or more show (non-configuration) commands. commands The commands to be executed. raw_text: ``True`` Whether to return raw text or structured data. CLI Example: .. code-block:...
[ "def", "nxos_api_show", "(", "commands", ",", "raw_text", "=", "True", ",", "*", "*", "kwargs", ")", ":", "nxos_api_kwargs", "=", "pyeapi_nxos_api_args", "(", "*", "*", "kwargs", ")", "return", "__salt__", "[", "'nxos_api.show'", "]", "(", "commands", ",", ...
.. versionadded:: 2019.2.0 Execute one or more show (non-configuration) commands. commands The commands to be executed. raw_text: ``True`` Whether to return raw text or structured data. CLI Example: .. code-block:: bash salt '*' napalm.nxos_api_show 'show version' ...
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/napalm_mod.py#L1273-L1295
train
saltstack/salt
salt/modules/napalm_mod.py
rpc
def rpc(command, **kwargs): ''' .. versionadded:: 2019.2.0 This is a wrapper to execute RPC requests on various network operating systems supported by NAPALM, invoking the following functions for the NAPALM native drivers: - :py:func:`napalm.junos_rpc <salt.modules.napalm_mod.junos_rpc>` for `...
python
def rpc(command, **kwargs): ''' .. versionadded:: 2019.2.0 This is a wrapper to execute RPC requests on various network operating systems supported by NAPALM, invoking the following functions for the NAPALM native drivers: - :py:func:`napalm.junos_rpc <salt.modules.napalm_mod.junos_rpc>` for `...
[ "def", "rpc", "(", "command", ",", "*", "*", "kwargs", ")", ":", "default_map", "=", "{", "'junos'", ":", "'napalm.junos_rpc'", ",", "'eos'", ":", "'napalm.pyeapi_run_commands'", ",", "'nxos'", ":", "'napalm.nxos_api_rpc'", "}", "napalm_map", "=", "__salt__", ...
.. versionadded:: 2019.2.0 This is a wrapper to execute RPC requests on various network operating systems supported by NAPALM, invoking the following functions for the NAPALM native drivers: - :py:func:`napalm.junos_rpc <salt.modules.napalm_mod.junos_rpc>` for ``junos`` - :py:func:`napalm.pyeapi_r...
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/napalm_mod.py#L1299-L1352
train
saltstack/salt
salt/modules/napalm_mod.py
config_find_lines
def config_find_lines(regex, source='running'): r''' .. versionadded:: 2019.2.0 Return the configuration lines that match the regular expressions from the ``regex`` argument. The configuration is read from the network device interrogated. regex The regular expression to match the confi...
python
def config_find_lines(regex, source='running'): r''' .. versionadded:: 2019.2.0 Return the configuration lines that match the regular expressions from the ``regex`` argument. The configuration is read from the network device interrogated. regex The regular expression to match the confi...
[ "def", "config_find_lines", "(", "regex", ",", "source", "=", "'running'", ")", ":", "config_txt", "=", "__salt__", "[", "'net.config'", "]", "(", "source", "=", "source", ")", "[", "'out'", "]", "[", "source", "]", "return", "__salt__", "[", "'ciscoconfpa...
r''' .. versionadded:: 2019.2.0 Return the configuration lines that match the regular expressions from the ``regex`` argument. The configuration is read from the network device interrogated. regex The regular expression to match the configuration lines against. source: ``running`` ...
[ "r", "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/napalm_mod.py#L1356-L1379
train
saltstack/salt
salt/modules/napalm_mod.py
config_lines_w_child
def config_lines_w_child(parent_regex, child_regex, source='running'): r''' .. versionadded:: 2019.2.0 Return the configuration lines that match the regular expressions from the ``parent_regex`` argument, having child lines matching ``child_regex``. The configuration is read from the network devic...
python
def config_lines_w_child(parent_regex, child_regex, source='running'): r''' .. versionadded:: 2019.2.0 Return the configuration lines that match the regular expressions from the ``parent_regex`` argument, having child lines matching ``child_regex``. The configuration is read from the network devic...
[ "def", "config_lines_w_child", "(", "parent_regex", ",", "child_regex", ",", "source", "=", "'running'", ")", ":", "config_txt", "=", "__salt__", "[", "'net.config'", "]", "(", "source", "=", "source", ")", "[", "'out'", "]", "[", "source", "]", "return", ...
r''' .. versionadded:: 2019.2.0 Return the configuration lines that match the regular expressions from the ``parent_regex`` argument, having child lines matching ``child_regex``. The configuration is read from the network device interrogated. .. note:: This function is only available only...
[ "r", "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/napalm_mod.py#L1383-L1418
train
saltstack/salt
salt/modules/napalm_mod.py
config_lines_wo_child
def config_lines_wo_child(parent_regex, child_regex, source='running'): ''' .. versionadded:: 2019.2.0 Return the configuration lines that match the regular expressions from the ``parent_regex`` argument, having the child lines *not* matching ``child_regex``. The configuration is read from th...
python
def config_lines_wo_child(parent_regex, child_regex, source='running'): ''' .. versionadded:: 2019.2.0 Return the configuration lines that match the regular expressions from the ``parent_regex`` argument, having the child lines *not* matching ``child_regex``. The configuration is read from th...
[ "def", "config_lines_wo_child", "(", "parent_regex", ",", "child_regex", ",", "source", "=", "'running'", ")", ":", "config_txt", "=", "__salt__", "[", "'net.config'", "]", "(", "source", "=", "source", ")", "[", "'out'", "]", "[", "source", "]", "return", ...
.. versionadded:: 2019.2.0 Return the configuration lines that match the regular expressions from the ``parent_regex`` argument, having the child lines *not* matching ``child_regex``. The configuration is read from the network device interrogated. .. note:: This function is only available ...
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/napalm_mod.py#L1422-L1458
train
saltstack/salt
salt/modules/napalm_mod.py
config_filter_lines
def config_filter_lines(parent_regex, child_regex, source='running'): r''' .. versionadded:: 2019.2.0 Return a list of detailed matches, for the configuration blocks (parent-child relationship) whose parent respects the regular expressions configured via the ``parent_regex`` argument, and the child...
python
def config_filter_lines(parent_regex, child_regex, source='running'): r''' .. versionadded:: 2019.2.0 Return a list of detailed matches, for the configuration blocks (parent-child relationship) whose parent respects the regular expressions configured via the ``parent_regex`` argument, and the child...
[ "def", "config_filter_lines", "(", "parent_regex", ",", "child_regex", ",", "source", "=", "'running'", ")", ":", "config_txt", "=", "__salt__", "[", "'net.config'", "]", "(", "source", "=", "source", ")", "[", "'out'", "]", "[", "source", "]", "return", "...
r''' .. versionadded:: 2019.2.0 Return a list of detailed matches, for the configuration blocks (parent-child relationship) whose parent respects the regular expressions configured via the ``parent_regex`` argument, and the child matches the ``child_regex`` regular expression. The result is a list ...
[ "r", "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/napalm_mod.py#L1462-L1505
train
saltstack/salt
salt/modules/napalm_mod.py
config_tree
def config_tree(source='running', with_tags=False): ''' .. versionadded:: 2019.2.0 Transform Cisco IOS style configuration to structured Python dictionary. Depending on the value of the ``with_tags`` argument, this function may provide different views, valuable in different situations. source:...
python
def config_tree(source='running', with_tags=False): ''' .. versionadded:: 2019.2.0 Transform Cisco IOS style configuration to structured Python dictionary. Depending on the value of the ``with_tags`` argument, this function may provide different views, valuable in different situations. source:...
[ "def", "config_tree", "(", "source", "=", "'running'", ",", "with_tags", "=", "False", ")", ":", "config_txt", "=", "__salt__", "[", "'net.config'", "]", "(", "source", "=", "source", ")", "[", "'out'", "]", "[", "source", "]", "return", "__salt__", "[",...
.. versionadded:: 2019.2.0 Transform Cisco IOS style configuration to structured Python dictionary. Depending on the value of the ``with_tags`` argument, this function may provide different views, valuable in different situations. source: ``running`` The configuration type to retrieve from the...
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/napalm_mod.py#L1508-L1530
train
saltstack/salt
salt/modules/napalm_mod.py
config_merge_tree
def config_merge_tree(source='running', merge_config=None, merge_path=None, saltenv='base'): ''' .. versionadded:: 2019.2.0 Return the merge tree of the ``initial_config`` with the ``merge_config``, as a Python dictionary. source: `...
python
def config_merge_tree(source='running', merge_config=None, merge_path=None, saltenv='base'): ''' .. versionadded:: 2019.2.0 Return the merge tree of the ``initial_config`` with the ``merge_config``, as a Python dictionary. source: `...
[ "def", "config_merge_tree", "(", "source", "=", "'running'", ",", "merge_config", "=", "None", ",", "merge_path", "=", "None", ",", "saltenv", "=", "'base'", ")", ":", "config_txt", "=", "__salt__", "[", "'net.config'", "]", "(", "source", "=", "source", "...
.. versionadded:: 2019.2.0 Return the merge tree of the ``initial_config`` with the ``merge_config``, as a Python dictionary. source: ``running`` The configuration type to retrieve from the network device. Default: ``running``. Available options: ``running``, ``startup``, ``candidate``. ...
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/napalm_mod.py#L1533-L1571
train
saltstack/salt
salt/modules/napalm_mod.py
config_merge_text
def config_merge_text(source='running', merge_config=None, merge_path=None, saltenv='base'): ''' .. versionadded:: 2019.2.0 Return the merge result of the configuration from ``source`` with the merge configuration, as plain text (without...
python
def config_merge_text(source='running', merge_config=None, merge_path=None, saltenv='base'): ''' .. versionadded:: 2019.2.0 Return the merge result of the configuration from ``source`` with the merge configuration, as plain text (without...
[ "def", "config_merge_text", "(", "source", "=", "'running'", ",", "merge_config", "=", "None", ",", "merge_path", "=", "None", ",", "saltenv", "=", "'base'", ")", ":", "config_txt", "=", "__salt__", "[", "'net.config'", "]", "(", "source", "=", "source", "...
.. versionadded:: 2019.2.0 Return the merge result of the configuration from ``source`` with the merge configuration, as plain text (without loading the config on the device). source: ``running`` The configuration type to retrieve from the network device. Default: ``running``. Availabl...
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/napalm_mod.py#L1574-L1613
train
saltstack/salt
salt/modules/napalm_mod.py
config_merge_diff
def config_merge_diff(source='running', merge_config=None, merge_path=None, saltenv='base'): ''' .. versionadded:: 2019.2.0 Return the merge diff, as text, after merging the merge config into the configuration source requested (without l...
python
def config_merge_diff(source='running', merge_config=None, merge_path=None, saltenv='base'): ''' .. versionadded:: 2019.2.0 Return the merge diff, as text, after merging the merge config into the configuration source requested (without l...
[ "def", "config_merge_diff", "(", "source", "=", "'running'", ",", "merge_config", "=", "None", ",", "merge_path", "=", "None", ",", "saltenv", "=", "'base'", ")", ":", "config_txt", "=", "__salt__", "[", "'net.config'", "]", "(", "source", "=", "source", "...
.. versionadded:: 2019.2.0 Return the merge diff, as text, after merging the merge config into the configuration source requested (without loading the config on the device). source: ``running`` The configuration type to retrieve from the network device. Default: ``running``. Available opti...
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/napalm_mod.py#L1616-L1654
train
saltstack/salt
salt/modules/napalm_mod.py
config_diff_tree
def config_diff_tree(source1='candidate', candidate_path=None, source2='running', running_path=None): ''' .. versionadded:: 2019.2.0 Return the diff, as Python dictionary, between two different sources. The sources can be either specified u...
python
def config_diff_tree(source1='candidate', candidate_path=None, source2='running', running_path=None): ''' .. versionadded:: 2019.2.0 Return the diff, as Python dictionary, between two different sources. The sources can be either specified u...
[ "def", "config_diff_tree", "(", "source1", "=", "'candidate'", ",", "candidate_path", "=", "None", ",", "source2", "=", "'running'", ",", "running_path", "=", "None", ")", ":", "get_config", "=", "__salt__", "[", "'net.config'", "]", "(", ")", "[", "'out'", ...
.. versionadded:: 2019.2.0 Return the diff, as Python dictionary, between two different sources. The sources can be either specified using the ``source1`` and ``source2`` arguments when retrieving from the managed network device. source1: ``candidate`` The source from where to retrieve the con...
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/napalm_mod.py#L1657-L1717
train
saltstack/salt
salt/modules/napalm_mod.py
scp_get
def scp_get(remote_path, local_path='', recursive=False, preserve_times=False, **kwargs): ''' .. versionadded:: 2019.2.0 Transfer files and directories from remote network device to the localhost of the Minion. .. note:: This function is only...
python
def scp_get(remote_path, local_path='', recursive=False, preserve_times=False, **kwargs): ''' .. versionadded:: 2019.2.0 Transfer files and directories from remote network device to the localhost of the Minion. .. note:: This function is only...
[ "def", "scp_get", "(", "remote_path", ",", "local_path", "=", "''", ",", "recursive", "=", "False", ",", "preserve_times", "=", "False", ",", "*", "*", "kwargs", ")", ":", "conn_args", "=", "netmiko_args", "(", "*", "*", "kwargs", ")", "conn_args", "[", ...
.. versionadded:: 2019.2.0 Transfer files and directories from remote network device to the localhost of the Minion. .. note:: This function is only available only when the underlying library `scp <https://github.com/jbardin/scp.py>`_ is installed. See :mod:`scp module <sal...
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/napalm_mod.py#L1777-L1855
train
saltstack/salt
salt/modules/napalm_mod.py
scp_put
def scp_put(files, remote_path=None, recursive=False, preserve_times=False, saltenv='base', **kwargs): ''' .. versionadded:: 2019.2.0 Transfer files and directories to remote network device. .. note:: This function is only available o...
python
def scp_put(files, remote_path=None, recursive=False, preserve_times=False, saltenv='base', **kwargs): ''' .. versionadded:: 2019.2.0 Transfer files and directories to remote network device. .. note:: This function is only available o...
[ "def", "scp_put", "(", "files", ",", "remote_path", "=", "None", ",", "recursive", "=", "False", ",", "preserve_times", "=", "False", ",", "saltenv", "=", "'base'", ",", "*", "*", "kwargs", ")", ":", "conn_args", "=", "netmiko_args", "(", "*", "*", "kw...
.. versionadded:: 2019.2.0 Transfer files and directories to remote network device. .. note:: This function is only available only when the underlying library `scp <https://github.com/jbardin/scp.py>`_ is installed. See :mod:`scp module <salt.modules.scp_mod>` for more ...
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/napalm_mod.py#L1859-L1957
train
saltstack/salt
salt/utils/nacl.py
_get_config
def _get_config(**kwargs): ''' Return configuration ''' config = { 'box_type': 'sealedbox', 'sk': None, 'sk_file': os.path.join(kwargs['opts'].get('pki_dir'), 'master/nacl'), 'pk': None, 'pk_file': os.path.join(kwargs['opts'].get('pki_dir'), 'master/nacl.pub'), ...
python
def _get_config(**kwargs): ''' Return configuration ''' config = { 'box_type': 'sealedbox', 'sk': None, 'sk_file': os.path.join(kwargs['opts'].get('pki_dir'), 'master/nacl'), 'pk': None, 'pk_file': os.path.join(kwargs['opts'].get('pki_dir'), 'master/nacl.pub'), ...
[ "def", "_get_config", "(", "*", "*", "kwargs", ")", ":", "config", "=", "{", "'box_type'", ":", "'sealedbox'", ",", "'sk'", ":", "None", ",", "'sk_file'", ":", "os", ".", "path", ".", "join", "(", "kwargs", "[", "'opts'", "]", ".", "get", "(", "'pk...
Return configuration
[ "Return", "configuration" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/nacl.py#L43-L64
train
saltstack/salt
salt/utils/nacl.py
_get_sk
def _get_sk(**kwargs): ''' Return sk ''' config = _get_config(**kwargs) key = salt.utils.stringutils.to_str(config['sk']) sk_file = config['sk_file'] if not key and sk_file: with salt.utils.files.fopen(sk_file, 'rb') as keyf: key = salt.utils.stringutils.to_unicode(keyf.r...
python
def _get_sk(**kwargs): ''' Return sk ''' config = _get_config(**kwargs) key = salt.utils.stringutils.to_str(config['sk']) sk_file = config['sk_file'] if not key and sk_file: with salt.utils.files.fopen(sk_file, 'rb') as keyf: key = salt.utils.stringutils.to_unicode(keyf.r...
[ "def", "_get_sk", "(", "*", "*", "kwargs", ")", ":", "config", "=", "_get_config", "(", "*", "*", "kwargs", ")", "key", "=", "salt", ".", "utils", ".", "stringutils", ".", "to_str", "(", "config", "[", "'sk'", "]", ")", "sk_file", "=", "config", "[...
Return sk
[ "Return", "sk" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/nacl.py#L67-L79
train
saltstack/salt
salt/utils/nacl.py
_get_pk
def _get_pk(**kwargs): ''' Return pk ''' config = _get_config(**kwargs) pubkey = salt.utils.stringutils.to_str(config['pk']) pk_file = config['pk_file'] if not pubkey and pk_file: with salt.utils.files.fopen(pk_file, 'rb') as keyf: pubkey = salt.utils.stringutils.to_unico...
python
def _get_pk(**kwargs): ''' Return pk ''' config = _get_config(**kwargs) pubkey = salt.utils.stringutils.to_str(config['pk']) pk_file = config['pk_file'] if not pubkey and pk_file: with salt.utils.files.fopen(pk_file, 'rb') as keyf: pubkey = salt.utils.stringutils.to_unico...
[ "def", "_get_pk", "(", "*", "*", "kwargs", ")", ":", "config", "=", "_get_config", "(", "*", "*", "kwargs", ")", "pubkey", "=", "salt", ".", "utils", ".", "stringutils", ".", "to_str", "(", "config", "[", "'pk'", "]", ")", "pk_file", "=", "config", ...
Return pk
[ "Return", "pk" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/nacl.py#L82-L95
train
saltstack/salt
salt/utils/nacl.py
keygen
def keygen(sk_file=None, pk_file=None, **kwargs): ''' Use libnacl to generate a keypair. If no `sk_file` is defined return a keypair. If only the `sk_file` is defined `pk_file` will use the same name with a postfix `.pub`. When the `sk_file` is already existing, but `pk_file` is not. The `pk_file...
python
def keygen(sk_file=None, pk_file=None, **kwargs): ''' Use libnacl to generate a keypair. If no `sk_file` is defined return a keypair. If only the `sk_file` is defined `pk_file` will use the same name with a postfix `.pub`. When the `sk_file` is already existing, but `pk_file` is not. The `pk_file...
[ "def", "keygen", "(", "sk_file", "=", "None", ",", "pk_file", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "'keyfile'", "in", "kwargs", ":", "salt", ".", "utils", ".", "versions", ".", "warn_until", "(", "'Neon'", ",", "'The \\'keyfile\\' argume...
Use libnacl to generate a keypair. If no `sk_file` is defined return a keypair. If only the `sk_file` is defined `pk_file` will use the same name with a postfix `.pub`. When the `sk_file` is already existing, but `pk_file` is not. The `pk_file` will be generated using the `sk_file`. CLI Examples...
[ "Use", "libnacl", "to", "generate", "a", "keypair", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/nacl.py#L98-L177
train
saltstack/salt
salt/utils/nacl.py
enc
def enc(data, **kwargs): ''' Alias to `{box_type}_encrypt` box_type: secretbox, sealedbox(default) ''' if 'keyfile' in kwargs: salt.utils.versions.warn_until( 'Neon', 'The \'keyfile\' argument has been deprecated and will be removed in Salt ' '{version}. ...
python
def enc(data, **kwargs): ''' Alias to `{box_type}_encrypt` box_type: secretbox, sealedbox(default) ''' if 'keyfile' in kwargs: salt.utils.versions.warn_until( 'Neon', 'The \'keyfile\' argument has been deprecated and will be removed in Salt ' '{version}. ...
[ "def", "enc", "(", "data", ",", "*", "*", "kwargs", ")", ":", "if", "'keyfile'", "in", "kwargs", ":", "salt", ".", "utils", ".", "versions", ".", "warn_until", "(", "'Neon'", ",", "'The \\'keyfile\\' argument has been deprecated and will be removed in Salt '", "'{...
Alias to `{box_type}_encrypt` box_type: secretbox, sealedbox(default)
[ "Alias", "to", "{", "box_type", "}", "_encrypt" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/nacl.py#L180-L205
train
saltstack/salt
salt/utils/nacl.py
enc_file
def enc_file(name, out=None, **kwargs): ''' This is a helper function to encrypt a file and return its contents. You can provide an optional output file using `out` `name` can be a local file or when not using `salt-run` can be a url like `salt://`, `https://` etc. CLI Examples: .. code-bloc...
python
def enc_file(name, out=None, **kwargs): ''' This is a helper function to encrypt a file and return its contents. You can provide an optional output file using `out` `name` can be a local file or when not using `salt-run` can be a url like `salt://`, `https://` etc. CLI Examples: .. code-bloc...
[ "def", "enc_file", "(", "name", ",", "out", "=", "None", ",", "*", "*", "kwargs", ")", ":", "try", ":", "data", "=", "__salt__", "[", "'cp.get_file_str'", "]", "(", "name", ")", "except", "Exception", "as", "e", ":", "# likly using salt-run so fallback to ...
This is a helper function to encrypt a file and return its contents. You can provide an optional output file using `out` `name` can be a local file or when not using `salt-run` can be a url like `salt://`, `https://` etc. CLI Examples: .. code-block:: bash salt-run nacl.enc_file name=/tmp/i...
[ "This", "is", "a", "helper", "function", "to", "encrypt", "a", "file", "and", "return", "its", "contents", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/nacl.py#L208-L238
train
saltstack/salt
salt/utils/nacl.py
dec
def dec(data, **kwargs): ''' Alias to `{box_type}_decrypt` box_type: secretbox, sealedbox(default) ''' if 'keyfile' in kwargs: salt.utils.versions.warn_until( 'Neon', 'The \'keyfile\' argument has been deprecated and will be removed in Salt ' '{version}. ...
python
def dec(data, **kwargs): ''' Alias to `{box_type}_decrypt` box_type: secretbox, sealedbox(default) ''' if 'keyfile' in kwargs: salt.utils.versions.warn_until( 'Neon', 'The \'keyfile\' argument has been deprecated and will be removed in Salt ' '{version}. ...
[ "def", "dec", "(", "data", ",", "*", "*", "kwargs", ")", ":", "if", "'keyfile'", "in", "kwargs", ":", "salt", ".", "utils", ".", "versions", ".", "warn_until", "(", "'Neon'", ",", "'The \\'keyfile\\' argument has been deprecated and will be removed in Salt '", "'{...
Alias to `{box_type}_decrypt` box_type: secretbox, sealedbox(default)
[ "Alias", "to", "{", "box_type", "}", "_decrypt" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/nacl.py#L241-L272
train
saltstack/salt
salt/utils/nacl.py
sealedbox_encrypt
def sealedbox_encrypt(data, **kwargs): ''' Encrypt data using a public key generated from `nacl.keygen`. The encryptd data can be decrypted using `nacl.sealedbox_decrypt` only with the secret key. CLI Examples: .. code-block:: bash salt-run nacl.sealedbox_encrypt datatoenc salt-ca...
python
def sealedbox_encrypt(data, **kwargs): ''' Encrypt data using a public key generated from `nacl.keygen`. The encryptd data can be decrypted using `nacl.sealedbox_decrypt` only with the secret key. CLI Examples: .. code-block:: bash salt-run nacl.sealedbox_encrypt datatoenc salt-ca...
[ "def", "sealedbox_encrypt", "(", "data", ",", "*", "*", "kwargs", ")", ":", "# ensure data is in bytes", "data", "=", "salt", ".", "utils", ".", "stringutils", ".", "to_bytes", "(", "data", ")", "pk", "=", "_get_pk", "(", "*", "*", "kwargs", ")", "b", ...
Encrypt data using a public key generated from `nacl.keygen`. The encryptd data can be decrypted using `nacl.sealedbox_decrypt` only with the secret key. CLI Examples: .. code-block:: bash salt-run nacl.sealedbox_encrypt datatoenc salt-call --local nacl.sealedbox_encrypt datatoenc pk_file...
[ "Encrypt", "data", "using", "a", "public", "key", "generated", "from", "nacl", ".", "keygen", ".", "The", "encryptd", "data", "can", "be", "decrypted", "using", "nacl", ".", "sealedbox_decrypt", "only", "with", "the", "secret", "key", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/nacl.py#L308-L326
train
saltstack/salt
salt/utils/nacl.py
sealedbox_decrypt
def sealedbox_decrypt(data, **kwargs): ''' Decrypt data using a secret key that was encrypted using a public key with `nacl.sealedbox_encrypt`. CLI Examples: .. code-block:: bash salt-call nacl.sealedbox_decrypt pEXHQM6cuaF7A= salt-call --local nacl.sealedbox_decrypt data='pEXHQM6cuaF...
python
def sealedbox_decrypt(data, **kwargs): ''' Decrypt data using a secret key that was encrypted using a public key with `nacl.sealedbox_encrypt`. CLI Examples: .. code-block:: bash salt-call nacl.sealedbox_decrypt pEXHQM6cuaF7A= salt-call --local nacl.sealedbox_decrypt data='pEXHQM6cuaF...
[ "def", "sealedbox_decrypt", "(", "data", ",", "*", "*", "kwargs", ")", ":", "if", "data", "is", "None", ":", "return", "None", "# ensure data is in bytes", "data", "=", "salt", ".", "utils", ".", "stringutils", ".", "to_bytes", "(", "data", ")", "sk", "=...
Decrypt data using a secret key that was encrypted using a public key with `nacl.sealedbox_encrypt`. CLI Examples: .. code-block:: bash salt-call nacl.sealedbox_decrypt pEXHQM6cuaF7A= salt-call --local nacl.sealedbox_decrypt data='pEXHQM6cuaF7A=' sk_file=/etc/salt/pki/master/nacl salt...
[ "Decrypt", "data", "using", "a", "secret", "key", "that", "was", "encrypted", "using", "a", "public", "key", "with", "nacl", ".", "sealedbox_encrypt", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/nacl.py#L329-L350
train
saltstack/salt
salt/utils/nacl.py
secretbox_encrypt
def secretbox_encrypt(data, **kwargs): ''' Encrypt data using a secret key generated from `nacl.keygen`. The same secret key can be used to decrypt the data using `nacl.secretbox_decrypt`. CLI Examples: .. code-block:: bash salt-run nacl.secretbox_encrypt datatoenc salt-call --loc...
python
def secretbox_encrypt(data, **kwargs): ''' Encrypt data using a secret key generated from `nacl.keygen`. The same secret key can be used to decrypt the data using `nacl.secretbox_decrypt`. CLI Examples: .. code-block:: bash salt-run nacl.secretbox_encrypt datatoenc salt-call --loc...
[ "def", "secretbox_encrypt", "(", "data", ",", "*", "*", "kwargs", ")", ":", "# ensure data is in bytes", "data", "=", "salt", ".", "utils", ".", "stringutils", ".", "to_bytes", "(", "data", ")", "sk", "=", "_get_sk", "(", "*", "*", "kwargs", ")", "b", ...
Encrypt data using a secret key generated from `nacl.keygen`. The same secret key can be used to decrypt the data using `nacl.secretbox_decrypt`. CLI Examples: .. code-block:: bash salt-run nacl.secretbox_encrypt datatoenc salt-call --local nacl.secretbox_encrypt datatoenc sk_file=/etc/sa...
[ "Encrypt", "data", "using", "a", "secret", "key", "generated", "from", "nacl", ".", "keygen", ".", "The", "same", "secret", "key", "can", "be", "used", "to", "decrypt", "the", "data", "using", "nacl", ".", "secretbox_decrypt", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/nacl.py#L353-L371
train
saltstack/salt
salt/utils/nacl.py
secretbox_decrypt
def secretbox_decrypt(data, **kwargs): ''' Decrypt data that was encrypted using `nacl.secretbox_encrypt` using the secret key that was generated from `nacl.keygen`. CLI Examples: .. code-block:: bash salt-call nacl.secretbox_decrypt pEXHQM6cuaF7A= salt-call --local nacl.secretbox...
python
def secretbox_decrypt(data, **kwargs): ''' Decrypt data that was encrypted using `nacl.secretbox_encrypt` using the secret key that was generated from `nacl.keygen`. CLI Examples: .. code-block:: bash salt-call nacl.secretbox_decrypt pEXHQM6cuaF7A= salt-call --local nacl.secretbox...
[ "def", "secretbox_decrypt", "(", "data", ",", "*", "*", "kwargs", ")", ":", "if", "data", "is", "None", ":", "return", "None", "# ensure data is in bytes", "data", "=", "salt", ".", "utils", ".", "stringutils", ".", "to_bytes", "(", "data", ")", "key", "...
Decrypt data that was encrypted using `nacl.secretbox_encrypt` using the secret key that was generated from `nacl.keygen`. CLI Examples: .. code-block:: bash salt-call nacl.secretbox_decrypt pEXHQM6cuaF7A= salt-call --local nacl.secretbox_decrypt data='pEXHQM6cuaF7A=' sk_file=/etc/salt/pk...
[ "Decrypt", "data", "that", "was", "encrypted", "using", "nacl", ".", "secretbox_encrypt", "using", "the", "secret", "key", "that", "was", "generated", "from", "nacl", ".", "keygen", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/nacl.py#L374-L396
train
saltstack/salt
salt/states/grafana_dashboard.py
present
def present(name, base_dashboards_from_pillar=None, base_panels_from_pillar=None, base_rows_from_pillar=None, dashboard=None, profile='grafana'): ''' Ensure the grafana dashboard exists and is managed. name Name of the grafana dashboard. ...
python
def present(name, base_dashboards_from_pillar=None, base_panels_from_pillar=None, base_rows_from_pillar=None, dashboard=None, profile='grafana'): ''' Ensure the grafana dashboard exists and is managed. name Name of the grafana dashboard. ...
[ "def", "present", "(", "name", ",", "base_dashboards_from_pillar", "=", "None", ",", "base_panels_from_pillar", "=", "None", ",", "base_rows_from_pillar", "=", "None", ",", "dashboard", "=", "None", ",", "profile", "=", "'grafana'", ")", ":", "ret", "=", "{", ...
Ensure the grafana dashboard exists and is managed. name Name of the grafana dashboard. base_dashboards_from_pillar A pillar key that contains a list of dashboards to inherit from base_panels_from_pillar A pillar key that contains a list of panels to inherit from base_rows_fr...
[ "Ensure", "the", "grafana", "dashboard", "exists", "and", "is", "managed", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/grafana_dashboard.py#L63-L190
train
saltstack/salt
salt/states/grafana_dashboard.py
absent
def absent(name, profile='grafana'): ''' Ensure the named grafana dashboard is absent. name Name of the grafana dashboard. profile A pillar key or dict that contains grafana information ''' ret = {'name': name, 'result': True, 'comment': '', 'changes': {}} if isinstance(pr...
python
def absent(name, profile='grafana'): ''' Ensure the named grafana dashboard is absent. name Name of the grafana dashboard. profile A pillar key or dict that contains grafana information ''' ret = {'name': name, 'result': True, 'comment': '', 'changes': {}} if isinstance(pr...
[ "def", "absent", "(", "name", ",", "profile", "=", "'grafana'", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'result'", ":", "True", ",", "'comment'", ":", "''", ",", "'changes'", ":", "{", "}", "}", "if", "isinstance", "(", "profile", "...
Ensure the named grafana dashboard is absent. name Name of the grafana dashboard. profile A pillar key or dict that contains grafana information
[ "Ensure", "the", "named", "grafana", "dashboard", "is", "absent", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/grafana_dashboard.py#L193-L222
train
saltstack/salt
salt/states/grafana_dashboard.py
_cleaned
def _cleaned(_dashboard): '''Return a copy without fields that can differ.''' dashboard = copy.deepcopy(_dashboard) for ignored_dashboard_field in _IGNORED_DASHBOARD_FIELDS: dashboard.pop(ignored_dashboard_field, None) for row in dashboard.get('rows', []): for ignored_row_field in _IGNO...
python
def _cleaned(_dashboard): '''Return a copy without fields that can differ.''' dashboard = copy.deepcopy(_dashboard) for ignored_dashboard_field in _IGNORED_DASHBOARD_FIELDS: dashboard.pop(ignored_dashboard_field, None) for row in dashboard.get('rows', []): for ignored_row_field in _IGNO...
[ "def", "_cleaned", "(", "_dashboard", ")", ":", "dashboard", "=", "copy", ".", "deepcopy", "(", "_dashboard", ")", "for", "ignored_dashboard_field", "in", "_IGNORED_DASHBOARD_FIELDS", ":", "dashboard", ".", "pop", "(", "ignored_dashboard_field", ",", "None", ")", ...
Return a copy without fields that can differ.
[ "Return", "a", "copy", "without", "fields", "that", "can", "differ", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/grafana_dashboard.py#L241-L258
train
saltstack/salt
salt/states/grafana_dashboard.py
_inherited_dashboard
def _inherited_dashboard(dashboard, base_dashboards_from_pillar, ret): '''Return a dashboard with properties from parents.''' base_dashboards = [] for base_dashboard_from_pillar in base_dashboards_from_pillar: base_dashboard = __salt__['pillar.get'](base_dashboard_from_pillar) if base_dashbo...
python
def _inherited_dashboard(dashboard, base_dashboards_from_pillar, ret): '''Return a dashboard with properties from parents.''' base_dashboards = [] for base_dashboard_from_pillar in base_dashboards_from_pillar: base_dashboard = __salt__['pillar.get'](base_dashboard_from_pillar) if base_dashbo...
[ "def", "_inherited_dashboard", "(", "dashboard", ",", "base_dashboards_from_pillar", ",", "ret", ")", ":", "base_dashboards", "=", "[", "]", "for", "base_dashboard_from_pillar", "in", "base_dashboards_from_pillar", ":", "base_dashboard", "=", "__salt__", "[", "'pillar.g...
Return a dashboard with properties from parents.
[ "Return", "a", "dashboard", "with", "properties", "from", "parents", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/grafana_dashboard.py#L261-L282
train
saltstack/salt
salt/states/grafana_dashboard.py
_inherited_row
def _inherited_row(row, base_rows_from_pillar, ret): '''Return a row with properties from parents.''' base_rows = [] for base_row_from_pillar in base_rows_from_pillar: base_row = __salt__['pillar.get'](base_row_from_pillar) if base_row: base_rows.append(base_row) elif bas...
python
def _inherited_row(row, base_rows_from_pillar, ret): '''Return a row with properties from parents.''' base_rows = [] for base_row_from_pillar in base_rows_from_pillar: base_row = __salt__['pillar.get'](base_row_from_pillar) if base_row: base_rows.append(base_row) elif bas...
[ "def", "_inherited_row", "(", "row", ",", "base_rows_from_pillar", ",", "ret", ")", ":", "base_rows", "=", "[", "]", "for", "base_row_from_pillar", "in", "base_rows_from_pillar", ":", "base_row", "=", "__salt__", "[", "'pillar.get'", "]", "(", "base_row_from_pilla...
Return a row with properties from parents.
[ "Return", "a", "row", "with", "properties", "from", "parents", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/grafana_dashboard.py#L285-L303
train
saltstack/salt
salt/states/grafana_dashboard.py
_inherited_panel
def _inherited_panel(panel, base_panels_from_pillar, ret): '''Return a panel with properties from parents.''' base_panels = [] for base_panel_from_pillar in base_panels_from_pillar: base_panel = __salt__['pillar.get'](base_panel_from_pillar) if base_panel: base_panels.append(base...
python
def _inherited_panel(panel, base_panels_from_pillar, ret): '''Return a panel with properties from parents.''' base_panels = [] for base_panel_from_pillar in base_panels_from_pillar: base_panel = __salt__['pillar.get'](base_panel_from_pillar) if base_panel: base_panels.append(base...
[ "def", "_inherited_panel", "(", "panel", ",", "base_panels_from_pillar", ",", "ret", ")", ":", "base_panels", "=", "[", "]", "for", "base_panel_from_pillar", "in", "base_panels_from_pillar", ":", "base_panel", "=", "__salt__", "[", "'pillar.get'", "]", "(", "base_...
Return a panel with properties from parents.
[ "Return", "a", "panel", "with", "properties", "from", "parents", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/grafana_dashboard.py#L306-L324
train