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/modules/highstate_doc.py
render
def render(jinja_template_text=None, jinja_template_function='highstate_doc.markdown_default_jinja_template', **kwargs): ''' Render highstate to a text format (default Markdown) if `jinja_template_text` is not set, `jinja_template_function` is used. jinja_template_text: jinja text that the render uses...
python
def render(jinja_template_text=None, jinja_template_function='highstate_doc.markdown_default_jinja_template', **kwargs): ''' Render highstate to a text format (default Markdown) if `jinja_template_text` is not set, `jinja_template_function` is used. jinja_template_text: jinja text that the render uses...
[ "def", "render", "(", "jinja_template_text", "=", "None", ",", "jinja_template_function", "=", "'highstate_doc.markdown_default_jinja_template'", ",", "*", "*", "kwargs", ")", ":", "config", "=", "_get_config", "(", "*", "*", "kwargs", ")", "lowstates", "=", "proc...
Render highstate to a text format (default Markdown) if `jinja_template_text` is not set, `jinja_template_function` is used. jinja_template_text: jinja text that the render uses to create the document. jinja_template_function: a salt module call that returns template text. options: hig...
[ "Render", "highstate", "to", "a", "text", "format", "(", "default", "Markdown", ")" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/highstate_doc.py#L424-L461
train
saltstack/salt
salt/modules/highstate_doc.py
proccess_lowstates
def proccess_lowstates(**kwargs): ''' return proccessed lowstate data that was not blacklisted render_module_function is used to provide your own. defaults to from_lowstate ''' states = [] config = _get_config(**kwargs) proccesser = config.get('proccesser') ls = __salt__['state.show...
python
def proccess_lowstates(**kwargs): ''' return proccessed lowstate data that was not blacklisted render_module_function is used to provide your own. defaults to from_lowstate ''' states = [] config = _get_config(**kwargs) proccesser = config.get('proccesser') ls = __salt__['state.show...
[ "def", "proccess_lowstates", "(", "*", "*", "kwargs", ")", ":", "states", "=", "[", "]", "config", "=", "_get_config", "(", "*", "*", "kwargs", ")", "proccesser", "=", "config", ".", "get", "(", "'proccesser'", ")", "ls", "=", "__salt__", "[", "'state....
return proccessed lowstate data that was not blacklisted render_module_function is used to provide your own. defaults to from_lowstate
[ "return", "proccessed", "lowstate", "data", "that", "was", "not", "blacklisted" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/highstate_doc.py#L477-L501
train
saltstack/salt
salt/modules/highstate_doc.py
_state_data_to_yaml_string
def _state_data_to_yaml_string(data, whitelist=None, blacklist=None): ''' return a data dict in yaml string format. ''' y = {} if blacklist is None: # TODO: use salt defined STATE_REQUISITE_IN_KEYWORDS STATE_RUNTIME_KEYWORDS STATE_INTERNAL_KEYWORDS blacklist = ['__env__', '__id__',...
python
def _state_data_to_yaml_string(data, whitelist=None, blacklist=None): ''' return a data dict in yaml string format. ''' y = {} if blacklist is None: # TODO: use salt defined STATE_REQUISITE_IN_KEYWORDS STATE_RUNTIME_KEYWORDS STATE_INTERNAL_KEYWORDS blacklist = ['__env__', '__id__',...
[ "def", "_state_data_to_yaml_string", "(", "data", ",", "whitelist", "=", "None", ",", "blacklist", "=", "None", ")", ":", "y", "=", "{", "}", "if", "blacklist", "is", "None", ":", "# TODO: use salt defined STATE_REQUISITE_IN_KEYWORDS STATE_RUNTIME_KEYWORDS STATE_INTER...
return a data dict in yaml string format.
[ "return", "a", "data", "dict", "in", "yaml", "string", "format", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/highstate_doc.py#L504-L521
train
saltstack/salt
salt/modules/highstate_doc.py
_format_markdown_requisite
def _format_markdown_requisite(state, stateid, makelink=True): ''' format requisite as a link users can click ''' fmt_id = '{0}: {1}'.format(state, stateid) if makelink: return ' * [{0}](#{1})\n'.format(fmt_id, _format_markdown_link(fmt_id)) else: return ' * `{0}`\n'.format(fmt_i...
python
def _format_markdown_requisite(state, stateid, makelink=True): ''' format requisite as a link users can click ''' fmt_id = '{0}: {1}'.format(state, stateid) if makelink: return ' * [{0}](#{1})\n'.format(fmt_id, _format_markdown_link(fmt_id)) else: return ' * `{0}`\n'.format(fmt_i...
[ "def", "_format_markdown_requisite", "(", "state", ",", "stateid", ",", "makelink", "=", "True", ")", ":", "fmt_id", "=", "'{0}: {1}'", ".", "format", "(", "state", ",", "stateid", ")", "if", "makelink", ":", "return", "' * [{0}](#{1})\\n'", ".", "format", "...
format requisite as a link users can click
[ "format", "requisite", "as", "a", "link", "users", "can", "click" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/highstate_doc.py#L569-L577
train
saltstack/salt
salt/modules/highstate_doc.py
proccesser_markdown
def proccesser_markdown(lowstate_item, config, **kwargs): ''' Takes low state data and returns a dict of proccessed data that is by default used in a jinja template when rendering a markdown highstate_doc. This `lowstate_item_markdown` given a lowstate item, returns a dict like: .. code-block:: ya...
python
def proccesser_markdown(lowstate_item, config, **kwargs): ''' Takes low state data and returns a dict of proccessed data that is by default used in a jinja template when rendering a markdown highstate_doc. This `lowstate_item_markdown` given a lowstate item, returns a dict like: .. code-block:: ya...
[ "def", "proccesser_markdown", "(", "lowstate_item", ",", "config", ",", "*", "*", "kwargs", ")", ":", "# TODO: switch or ... ext call.", "s", "=", "lowstate_item", "state_function", "=", "'{0}.{1}'", ".", "format", "(", "s", "[", "'state'", "]", ",", "s", "[",...
Takes low state data and returns a dict of proccessed data that is by default used in a jinja template when rendering a markdown highstate_doc. This `lowstate_item_markdown` given a lowstate item, returns a dict like: .. code-block:: yaml vars: # the raw lowstate_item that was proccessed ...
[ "Takes", "low", "state", "data", "and", "returns", "a", "dict", "of", "proccessed", "data", "that", "is", "by", "default", "used", "in", "a", "jinja", "template", "when", "rendering", "a", "markdown", "highstate_doc", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/highstate_doc.py#L580-L692
train
saltstack/salt
salt/utils/win_osinfo.py
os_version_info_ex
def os_version_info_ex(): ''' Helper function to return the results of the GetVersionExW Windows API call. It is a ctypes Structure that contains Windows OS Version information. Returns: class: An instance of a class containing version info ''' if not HAS_WIN32: return clas...
python
def os_version_info_ex(): ''' Helper function to return the results of the GetVersionExW Windows API call. It is a ctypes Structure that contains Windows OS Version information. Returns: class: An instance of a class containing version info ''' if not HAS_WIN32: return clas...
[ "def", "os_version_info_ex", "(", ")", ":", "if", "not", "HAS_WIN32", ":", "return", "class", "OSVersionInfo", "(", "ctypes", ".", "Structure", ")", ":", "_fields_", "=", "(", "(", "'dwOSVersionInfoSize'", ",", "DWORD", ")", ",", "(", "'dwMajorVersion'", ","...
Helper function to return the results of the GetVersionExW Windows API call. It is a ctypes Structure that contains Windows OS Version information. Returns: class: An instance of a class containing version info
[ "Helper", "function", "to", "return", "the", "results", "of", "the", "GetVersionExW", "Windows", "API", "call", ".", "It", "is", "a", "ctypes", "Structure", "that", "contains", "Windows", "OS", "Version", "information", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_osinfo.py#L35-L66
train
saltstack/salt
salt/utils/win_osinfo.py
get_join_info
def get_join_info(): ''' Gets information about the domain/workgroup. This will tell you if the system is joined to a domain or a workgroup .. version-added:: 2018.3.4 Returns: dict: A dictionary containing the domain/workgroup and it's status ''' info = win32net.NetGetJoinInformat...
python
def get_join_info(): ''' Gets information about the domain/workgroup. This will tell you if the system is joined to a domain or a workgroup .. version-added:: 2018.3.4 Returns: dict: A dictionary containing the domain/workgroup and it's status ''' info = win32net.NetGetJoinInformat...
[ "def", "get_join_info", "(", ")", ":", "info", "=", "win32net", ".", "NetGetJoinInformation", "(", ")", "status", "=", "{", "win32netcon", ".", "NetSetupUnknown", ":", "'Unknown'", ",", "win32netcon", ".", "NetSetupUnjoined", ":", "'Unjoined'", ",", "win32netcon...
Gets information about the domain/workgroup. This will tell you if the system is joined to a domain or a workgroup .. version-added:: 2018.3.4 Returns: dict: A dictionary containing the domain/workgroup and it's status
[ "Gets", "information", "about", "the", "domain", "/", "workgroup", ".", "This", "will", "tell", "you", "if", "the", "system", "is", "joined", "to", "a", "domain", "or", "a", "workgroup" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_osinfo.py#L83-L99
train
saltstack/salt
salt/modules/mac_user.py
_dscl
def _dscl(cmd, ctype='create'): ''' Run a dscl -create command ''' if __grains__['osrelease_info'] < (10, 8): source, noderoot = '.', '' else: source, noderoot = 'localhost', '/Local/Default' if noderoot: cmd[0] = noderoot + cmd[0] return __salt__['cmd.run_all']( ...
python
def _dscl(cmd, ctype='create'): ''' Run a dscl -create command ''' if __grains__['osrelease_info'] < (10, 8): source, noderoot = '.', '' else: source, noderoot = 'localhost', '/Local/Default' if noderoot: cmd[0] = noderoot + cmd[0] return __salt__['cmd.run_all']( ...
[ "def", "_dscl", "(", "cmd", ",", "ctype", "=", "'create'", ")", ":", "if", "__grains__", "[", "'osrelease_info'", "]", "<", "(", "10", ",", "8", ")", ":", "source", ",", "noderoot", "=", "'.'", ",", "''", "else", ":", "source", ",", "noderoot", "="...
Run a dscl -create command
[ "Run", "a", "dscl", "-", "create", "command" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_user.py#L56-L71
train
saltstack/salt
salt/modules/mac_user.py
add
def add(name, uid=None, gid=None, groups=None, home=None, shell=None, fullname=None, createhome=True, **kwargs): ''' Add a user to the minion CLI Example: .. code-block:: bash salt '*' user.add name <uid> <gid> <groups> <home> <s...
python
def add(name, uid=None, gid=None, groups=None, home=None, shell=None, fullname=None, createhome=True, **kwargs): ''' Add a user to the minion CLI Example: .. code-block:: bash salt '*' user.add name <uid> <gid> <groups> <home> <s...
[ "def", "add", "(", "name", ",", "uid", "=", "None", ",", "gid", "=", "None", ",", "groups", "=", "None", ",", "home", "=", "None", ",", "shell", "=", "None", ",", "fullname", "=", "None", ",", "createhome", "=", "True", ",", "*", "*", "kwargs", ...
Add a user to the minion CLI Example: .. code-block:: bash salt '*' user.add name <uid> <gid> <groups> <home> <shell>
[ "Add", "a", "user", "to", "the", "minion" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_user.py#L81-L136
train
saltstack/salt
salt/modules/mac_user.py
delete
def delete(name, remove=False, force=False): ''' Remove a user from the minion CLI Example: .. code-block:: bash salt '*' user.delete name remove=True force=True ''' if salt.utils.stringutils.contains_whitespace(name): raise SaltInvocationError('Username cannot contain whitesp...
python
def delete(name, remove=False, force=False): ''' Remove a user from the minion CLI Example: .. code-block:: bash salt '*' user.delete name remove=True force=True ''' if salt.utils.stringutils.contains_whitespace(name): raise SaltInvocationError('Username cannot contain whitesp...
[ "def", "delete", "(", "name", ",", "remove", "=", "False", ",", "force", "=", "False", ")", ":", "if", "salt", ".", "utils", ".", "stringutils", ".", "contains_whitespace", "(", "name", ")", ":", "raise", "SaltInvocationError", "(", "'Username cannot contain...
Remove a user from the minion CLI Example: .. code-block:: bash salt '*' user.delete name remove=True force=True
[ "Remove", "a", "user", "from", "the", "minion" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_user.py#L139-L166
train
saltstack/salt
salt/modules/mac_user.py
getent
def getent(refresh=False): ''' Return the list of all info for all users CLI Example: .. code-block:: bash salt '*' user.getent ''' if 'user.getent' in __context__ and not refresh: return __context__['user.getent'] ret = [] for data in pwd.getpwall(): ret.appe...
python
def getent(refresh=False): ''' Return the list of all info for all users CLI Example: .. code-block:: bash salt '*' user.getent ''' if 'user.getent' in __context__ and not refresh: return __context__['user.getent'] ret = [] for data in pwd.getpwall(): ret.appe...
[ "def", "getent", "(", "refresh", "=", "False", ")", ":", "if", "'user.getent'", "in", "__context__", "and", "not", "refresh", ":", "return", "__context__", "[", "'user.getent'", "]", "ret", "=", "[", "]", "for", "data", "in", "pwd", ".", "getpwall", "(",...
Return the list of all info for all users CLI Example: .. code-block:: bash salt '*' user.getent
[ "Return", "the", "list", "of", "all", "info", "for", "all", "users" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_user.py#L169-L186
train
saltstack/salt
salt/modules/mac_user.py
chuid
def chuid(name, uid): ''' Change the uid for a named user CLI Example: .. code-block:: bash salt '*' user.chuid foo 4376 ''' if not isinstance(uid, int): raise SaltInvocationError('uid must be an integer') pre_info = info(name) if not pre_info: raise CommandExe...
python
def chuid(name, uid): ''' Change the uid for a named user CLI Example: .. code-block:: bash salt '*' user.chuid foo 4376 ''' if not isinstance(uid, int): raise SaltInvocationError('uid must be an integer') pre_info = info(name) if not pre_info: raise CommandExe...
[ "def", "chuid", "(", "name", ",", "uid", ")", ":", "if", "not", "isinstance", "(", "uid", ",", "int", ")", ":", "raise", "SaltInvocationError", "(", "'uid must be an integer'", ")", "pre_info", "=", "info", "(", "name", ")", "if", "not", "pre_info", ":",...
Change the uid for a named user CLI Example: .. code-block:: bash salt '*' user.chuid foo 4376
[ "Change", "the", "uid", "for", "a", "named", "user" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_user.py#L189-L213
train
saltstack/salt
salt/modules/mac_user.py
chgid
def chgid(name, gid): ''' Change the default group of the user CLI Example: .. code-block:: bash salt '*' user.chgid foo 4376 ''' if not isinstance(gid, int): raise SaltInvocationError('gid must be an integer') pre_info = info(name) if not pre_info: raise Comma...
python
def chgid(name, gid): ''' Change the default group of the user CLI Example: .. code-block:: bash salt '*' user.chgid foo 4376 ''' if not isinstance(gid, int): raise SaltInvocationError('gid must be an integer') pre_info = info(name) if not pre_info: raise Comma...
[ "def", "chgid", "(", "name", ",", "gid", ")", ":", "if", "not", "isinstance", "(", "gid", ",", "int", ")", ":", "raise", "SaltInvocationError", "(", "'gid must be an integer'", ")", "pre_info", "=", "info", "(", "name", ")", "if", "not", "pre_info", ":",...
Change the default group of the user CLI Example: .. code-block:: bash salt '*' user.chgid foo 4376
[ "Change", "the", "default", "group", "of", "the", "user" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_user.py#L216-L240
train
saltstack/salt
salt/modules/mac_user.py
chshell
def chshell(name, shell): ''' Change the default shell of the user CLI Example: .. code-block:: bash salt '*' user.chshell foo /bin/zsh ''' pre_info = info(name) if not pre_info: raise CommandExecutionError('User \'{0}\' does not exist'.format(name)) if shell == pre_in...
python
def chshell(name, shell): ''' Change the default shell of the user CLI Example: .. code-block:: bash salt '*' user.chshell foo /bin/zsh ''' pre_info = info(name) if not pre_info: raise CommandExecutionError('User \'{0}\' does not exist'.format(name)) if shell == pre_in...
[ "def", "chshell", "(", "name", ",", "shell", ")", ":", "pre_info", "=", "info", "(", "name", ")", "if", "not", "pre_info", ":", "raise", "CommandExecutionError", "(", "'User \\'{0}\\' does not exist'", ".", "format", "(", "name", ")", ")", "if", "shell", "...
Change the default shell of the user CLI Example: .. code-block:: bash salt '*' user.chshell foo /bin/zsh
[ "Change", "the", "default", "shell", "of", "the", "user" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_user.py#L243-L265
train
saltstack/salt
salt/modules/mac_user.py
chhome
def chhome(name, home, **kwargs): ''' Change the home directory of the user CLI Example: .. code-block:: bash salt '*' user.chhome foo /Users/foo ''' kwargs = salt.utils.args.clean_kwargs(**kwargs) persist = kwargs.pop('persist', False) if kwargs: salt.utils.args.inval...
python
def chhome(name, home, **kwargs): ''' Change the home directory of the user CLI Example: .. code-block:: bash salt '*' user.chhome foo /Users/foo ''' kwargs = salt.utils.args.clean_kwargs(**kwargs) persist = kwargs.pop('persist', False) if kwargs: salt.utils.args.inval...
[ "def", "chhome", "(", "name", ",", "home", ",", "*", "*", "kwargs", ")", ":", "kwargs", "=", "salt", ".", "utils", ".", "args", ".", "clean_kwargs", "(", "*", "*", "kwargs", ")", "persist", "=", "kwargs", ".", "pop", "(", "'persist'", ",", "False",...
Change the home directory of the user CLI Example: .. code-block:: bash salt '*' user.chhome foo /Users/foo
[ "Change", "the", "home", "directory", "of", "the", "user" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_user.py#L268-L298
train
saltstack/salt
salt/modules/mac_user.py
chfullname
def chfullname(name, fullname): ''' Change the user's Full Name CLI Example: .. code-block:: bash salt '*' user.chfullname foo 'Foo Bar' ''' fullname = salt.utils.data.decode(fullname) pre_info = info(name) if not pre_info: raise CommandExecutionError('User \'{0}\' doe...
python
def chfullname(name, fullname): ''' Change the user's Full Name CLI Example: .. code-block:: bash salt '*' user.chfullname foo 'Foo Bar' ''' fullname = salt.utils.data.decode(fullname) pre_info = info(name) if not pre_info: raise CommandExecutionError('User \'{0}\' doe...
[ "def", "chfullname", "(", "name", ",", "fullname", ")", ":", "fullname", "=", "salt", ".", "utils", ".", "data", ".", "decode", "(", "fullname", ")", "pre_info", "=", "info", "(", "name", ")", "if", "not", "pre_info", ":", "raise", "CommandExecutionError...
Change the user's Full Name CLI Example: .. code-block:: bash salt '*' user.chfullname foo 'Foo Bar'
[ "Change", "the", "user", "s", "Full", "Name" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_user.py#L301-L330
train
saltstack/salt
salt/modules/mac_user.py
chgroups
def chgroups(name, groups, append=False): ''' Change the groups to which the user belongs. Note that the user's primary group does not have to be one of the groups passed, membership in the user's primary group is automatically assumed. groups Groups to which the user should belong, can be ...
python
def chgroups(name, groups, append=False): ''' Change the groups to which the user belongs. Note that the user's primary group does not have to be one of the groups passed, membership in the user's primary group is automatically assumed. groups Groups to which the user should belong, can be ...
[ "def", "chgroups", "(", "name", ",", "groups", ",", "append", "=", "False", ")", ":", "### NOTE: **args isn't used here but needs to be included in this", "### function for compatibility with the user.present state", "uinfo", "=", "info", "(", "name", ")", "if", "not", "u...
Change the groups to which the user belongs. Note that the user's primary group does not have to be one of the groups passed, membership in the user's primary group is automatically assumed. groups Groups to which the user should belong, can be passed either as a python list or a comma-sepa...
[ "Change", "the", "groups", "to", "which", "the", "user", "belongs", ".", "Note", "that", "the", "user", "s", "primary", "group", "does", "not", "have", "to", "be", "one", "of", "the", "groups", "passed", "membership", "in", "the", "user", "s", "primary",...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_user.py#L333-L387
train
saltstack/salt
salt/modules/mac_user.py
_format_info
def _format_info(data): ''' Return user information in a pretty way ''' return {'gid': data.pw_gid, 'groups': list_groups(data.pw_name), 'home': data.pw_dir, 'name': data.pw_name, 'shell': data.pw_shell, 'uid': data.pw_uid, 'fullnam...
python
def _format_info(data): ''' Return user information in a pretty way ''' return {'gid': data.pw_gid, 'groups': list_groups(data.pw_name), 'home': data.pw_dir, 'name': data.pw_name, 'shell': data.pw_shell, 'uid': data.pw_uid, 'fullnam...
[ "def", "_format_info", "(", "data", ")", ":", "return", "{", "'gid'", ":", "data", ".", "pw_gid", ",", "'groups'", ":", "list_groups", "(", "data", ".", "pw_name", ")", ",", "'home'", ":", "data", ".", "pw_dir", ",", "'name'", ":", "data", ".", "pw_n...
Return user information in a pretty way
[ "Return", "user", "information", "in", "a", "pretty", "way" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_user.py#L408-L418
train
saltstack/salt
salt/modules/mac_user.py
list_groups
def list_groups(name): ''' Return a list of groups the named user belongs to. name The name of the user for which to list groups. Starting in Salt 2016.11.0, all groups for the user, including groups beginning with an underscore will be listed. .. versionchanged:: 2016.11....
python
def list_groups(name): ''' Return a list of groups the named user belongs to. name The name of the user for which to list groups. Starting in Salt 2016.11.0, all groups for the user, including groups beginning with an underscore will be listed. .. versionchanged:: 2016.11....
[ "def", "list_groups", "(", "name", ")", ":", "groups", "=", "[", "group", "for", "group", "in", "salt", ".", "utils", ".", "user", ".", "get_group_list", "(", "name", ")", "]", "return", "groups" ]
Return a list of groups the named user belongs to. name The name of the user for which to list groups. Starting in Salt 2016.11.0, all groups for the user, including groups beginning with an underscore will be listed. .. versionchanged:: 2016.11.0 CLI Example: .. code-bl...
[ "Return", "a", "list", "of", "groups", "the", "named", "user", "belongs", "to", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_user.py#L437-L456
train
saltstack/salt
salt/modules/mac_user.py
rename
def rename(name, new_name): ''' Change the username for a named user CLI Example: .. code-block:: bash salt '*' user.rename name new_name ''' current_info = info(name) if not current_info: raise CommandExecutionError('User \'{0}\' does not exist'.format(name)) new_info...
python
def rename(name, new_name): ''' Change the username for a named user CLI Example: .. code-block:: bash salt '*' user.rename name new_name ''' current_info = info(name) if not current_info: raise CommandExecutionError('User \'{0}\' does not exist'.format(name)) new_info...
[ "def", "rename", "(", "name", ",", "new_name", ")", ":", "current_info", "=", "info", "(", "name", ")", "if", "not", "current_info", ":", "raise", "CommandExecutionError", "(", "'User \\'{0}\\' does not exist'", ".", "format", "(", "name", ")", ")", "new_info"...
Change the username for a named user CLI Example: .. code-block:: bash salt '*' user.rename name new_name
[ "Change", "the", "username", "for", "a", "named", "user" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_user.py#L473-L498
train
saltstack/salt
salt/modules/mac_user.py
get_auto_login
def get_auto_login(): ''' .. versionadded:: 2016.3.0 Gets the current setting for Auto Login :return: If enabled, returns the user name, otherwise returns False :rtype: str, bool CLI Example: .. code-block:: bash salt '*' user.get_auto_login ''' cmd = ['defaults', ...
python
def get_auto_login(): ''' .. versionadded:: 2016.3.0 Gets the current setting for Auto Login :return: If enabled, returns the user name, otherwise returns False :rtype: str, bool CLI Example: .. code-block:: bash salt '*' user.get_auto_login ''' cmd = ['defaults', ...
[ "def", "get_auto_login", "(", ")", ":", "cmd", "=", "[", "'defaults'", ",", "'read'", ",", "'/Library/Preferences/com.apple.loginwindow.plist'", ",", "'autoLoginUser'", "]", "ret", "=", "__salt__", "[", "'cmd.run_all'", "]", "(", "cmd", ",", "ignore_retcode", "=",...
.. versionadded:: 2016.3.0 Gets the current setting for Auto Login :return: If enabled, returns the user name, otherwise returns False :rtype: str, bool CLI Example: .. code-block:: bash salt '*' user.get_auto_login
[ "..", "versionadded", "::", "2016", ".", "3", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_user.py#L501-L521
train
saltstack/salt
salt/modules/mac_user.py
_kcpassword
def _kcpassword(password): ''' Internal function for obfuscating the password used for AutoLogin This is later written as the contents of the ``/etc/kcpassword`` file .. versionadded:: 2017.7.3 Adapted from: https://github.com/timsutton/osx-vm-templates/blob/master/scripts/support/set_kcpasswo...
python
def _kcpassword(password): ''' Internal function for obfuscating the password used for AutoLogin This is later written as the contents of the ``/etc/kcpassword`` file .. versionadded:: 2017.7.3 Adapted from: https://github.com/timsutton/osx-vm-templates/blob/master/scripts/support/set_kcpasswo...
[ "def", "_kcpassword", "(", "password", ")", ":", "# The magic 11 bytes - these are just repeated", "# 0x7D 0x89 0x52 0x23 0xD2 0xBC 0xDD 0xEA 0xA3 0xB9 0x1F", "key", "=", "[", "125", ",", "137", ",", "82", ",", "35", ",", "210", ",", "188", ",", "221", ",", "234", ...
Internal function for obfuscating the password used for AutoLogin This is later written as the contents of the ``/etc/kcpassword`` file .. versionadded:: 2017.7.3 Adapted from: https://github.com/timsutton/osx-vm-templates/blob/master/scripts/support/set_kcpassword.py Args: password(str)...
[ "Internal", "function", "for", "obfuscating", "the", "password", "used", "for", "AutoLogin", "This", "is", "later", "written", "as", "the", "contents", "of", "the", "/", "etc", "/", "kcpassword", "file" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_user.py#L524-L571
train
saltstack/salt
salt/modules/mac_user.py
enable_auto_login
def enable_auto_login(name, password): ''' .. versionadded:: 2016.3.0 Configures the machine to auto login with the specified user Args: name (str): The user account use for auto login password (str): The password to user for auto login .. versionadded:: 2017.7.3 Re...
python
def enable_auto_login(name, password): ''' .. versionadded:: 2016.3.0 Configures the machine to auto login with the specified user Args: name (str): The user account use for auto login password (str): The password to user for auto login .. versionadded:: 2017.7.3 Re...
[ "def", "enable_auto_login", "(", "name", ",", "password", ")", ":", "# Make the entry into the defaults file", "cmd", "=", "[", "'defaults'", ",", "'write'", ",", "'/Library/Preferences/com.apple.loginwindow.plist'", ",", "'autoLoginUser'", ",", "name", "]", "__salt__", ...
.. versionadded:: 2016.3.0 Configures the machine to auto login with the specified user Args: name (str): The user account use for auto login password (str): The password to user for auto login .. versionadded:: 2017.7.3 Returns: bool: ``True`` if successful, otherw...
[ "..", "versionadded", "::", "2016", ".", "3", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_user.py#L574-L612
train
saltstack/salt
salt/modules/mac_user.py
disable_auto_login
def disable_auto_login(): ''' .. versionadded:: 2016.3.0 Disables auto login on the machine Returns: bool: ``True`` if successful, otherwise ``False`` CLI Example: .. code-block:: bash salt '*' user.disable_auto_login ''' # Remove the kcpassword file cmd = 'rm -f...
python
def disable_auto_login(): ''' .. versionadded:: 2016.3.0 Disables auto login on the machine Returns: bool: ``True`` if successful, otherwise ``False`` CLI Example: .. code-block:: bash salt '*' user.disable_auto_login ''' # Remove the kcpassword file cmd = 'rm -f...
[ "def", "disable_auto_login", "(", ")", ":", "# Remove the kcpassword file", "cmd", "=", "'rm -f /etc/kcpassword'", "__salt__", "[", "'cmd.run'", "]", "(", "cmd", ")", "# Remove the entry from the defaults file", "cmd", "=", "[", "'defaults'", ",", "'delete'", ",", "'/...
.. versionadded:: 2016.3.0 Disables auto login on the machine Returns: bool: ``True`` if successful, otherwise ``False`` CLI Example: .. code-block:: bash salt '*' user.disable_auto_login
[ "..", "versionadded", "::", "2016", ".", "3", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_user.py#L615-L640
train
saltstack/salt
salt/modules/apf.py
__apf_cmd
def __apf_cmd(cmd): ''' Return the apf location ''' apf_cmd = '{0} {1}'.format(salt.utils.path.which('apf'), cmd) out = __salt__['cmd.run_all'](apf_cmd) if out['retcode'] != 0: if not out['stderr']: msg = out['stdout'] else: msg = out['stderr'] ra...
python
def __apf_cmd(cmd): ''' Return the apf location ''' apf_cmd = '{0} {1}'.format(salt.utils.path.which('apf'), cmd) out = __salt__['cmd.run_all'](apf_cmd) if out['retcode'] != 0: if not out['stderr']: msg = out['stdout'] else: msg = out['stderr'] ra...
[ "def", "__apf_cmd", "(", "cmd", ")", ":", "apf_cmd", "=", "'{0} {1}'", ".", "format", "(", "salt", ".", "utils", ".", "path", ".", "which", "(", "'apf'", ")", ",", "cmd", ")", "out", "=", "__salt__", "[", "'cmd.run_all'", "]", "(", "apf_cmd", ")", ...
Return the apf location
[ "Return", "the", "apf", "location" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/apf.py#L39-L54
train
saltstack/salt
salt/modules/apf.py
_status_apf
def _status_apf(): ''' Return True if apf is running otherwise return False ''' status = 0 table = iptc.Table(iptc.Table.FILTER) for chain in table.chains: if 'sanity' in chain.name.lower(): status = 1 return True if status else False
python
def _status_apf(): ''' Return True if apf is running otherwise return False ''' status = 0 table = iptc.Table(iptc.Table.FILTER) for chain in table.chains: if 'sanity' in chain.name.lower(): status = 1 return True if status else False
[ "def", "_status_apf", "(", ")", ":", "status", "=", "0", "table", "=", "iptc", ".", "Table", "(", "iptc", ".", "Table", ".", "FILTER", ")", "for", "chain", "in", "table", ".", "chains", ":", "if", "'sanity'", "in", "chain", ".", "name", ".", "lower...
Return True if apf is running otherwise return False
[ "Return", "True", "if", "apf", "is", "running", "otherwise", "return", "False" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/apf.py#L57-L66
train
saltstack/salt
salt/modules/composer.py
did_composer_install
def did_composer_install(dir): ''' Test to see if the vendor directory exists in this directory dir Directory location of the composer.json file CLI Example: .. code-block:: bash salt '*' composer.did_composer_install /var/www/application ''' lockFile = "{0}/vendor".forma...
python
def did_composer_install(dir): ''' Test to see if the vendor directory exists in this directory dir Directory location of the composer.json file CLI Example: .. code-block:: bash salt '*' composer.did_composer_install /var/www/application ''' lockFile = "{0}/vendor".forma...
[ "def", "did_composer_install", "(", "dir", ")", ":", "lockFile", "=", "\"{0}/vendor\"", ".", "format", "(", "dir", ")", "if", "os", ".", "path", ".", "exists", "(", "lockFile", ")", ":", "return", "True", "return", "False" ]
Test to see if the vendor directory exists in this directory dir Directory location of the composer.json file CLI Example: .. code-block:: bash salt '*' composer.did_composer_install /var/www/application
[ "Test", "to", "see", "if", "the", "vendor", "directory", "exists", "in", "this", "directory" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/composer.py#L44-L60
train
saltstack/salt
salt/modules/composer.py
_run_composer
def _run_composer(action, directory=None, composer=None, php=None, runas=None, prefer_source=None, prefer_dist=None, no_scripts=None, no_plugins=None, optimiz...
python
def _run_composer(action, directory=None, composer=None, php=None, runas=None, prefer_source=None, prefer_dist=None, no_scripts=None, no_plugins=None, optimiz...
[ "def", "_run_composer", "(", "action", ",", "directory", "=", "None", ",", "composer", "=", "None", ",", "php", "=", "None", ",", "runas", "=", "None", ",", "prefer_source", "=", "None", ",", "prefer_dist", "=", "None", ",", "no_scripts", "=", "None", ...
Run PHP's composer with a specific action. If composer has not been installed globally making it available in the system PATH & making it executable, the ``composer`` and ``php`` parameters will need to be set to the location of the executables. action The action to pass to composer ('install'...
[ "Run", "PHP", "s", "composer", "with", "a", "specific", "action", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/composer.py#L63-L209
train
saltstack/salt
salt/modules/composer.py
install
def install(directory, composer=None, php=None, runas=None, prefer_source=None, prefer_dist=None, no_scripts=None, no_plugins=None, optimize=None, no_dev=None, quiet=False, composer_home='...
python
def install(directory, composer=None, php=None, runas=None, prefer_source=None, prefer_dist=None, no_scripts=None, no_plugins=None, optimize=None, no_dev=None, quiet=False, composer_home='...
[ "def", "install", "(", "directory", ",", "composer", "=", "None", ",", "php", "=", "None", ",", "runas", "=", "None", ",", "prefer_source", "=", "None", ",", "prefer_dist", "=", "None", ",", "no_scripts", "=", "None", ",", "no_plugins", "=", "None", ",...
Install composer dependencies for a directory. If composer has not been installed globally making it available in the system PATH & making it executable, the ``composer`` and ``php`` parameters will need to be set to the location of the executables. directory Directory location of the composer...
[ "Install", "composer", "dependencies", "for", "a", "directory", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/composer.py#L212-L297
train
saltstack/salt
salt/modules/composer.py
selfupdate
def selfupdate(composer=None, php=None, runas=None, quiet=False, composer_home='/root'): ''' Update composer itself. If composer has not been installed globally making it available in the system PATH & making it executable, the ``composer`` and ``php`` pa...
python
def selfupdate(composer=None, php=None, runas=None, quiet=False, composer_home='/root'): ''' Update composer itself. If composer has not been installed globally making it available in the system PATH & making it executable, the ``composer`` and ``php`` pa...
[ "def", "selfupdate", "(", "composer", "=", "None", ",", "php", "=", "None", ",", "runas", "=", "None", ",", "quiet", "=", "False", ",", "composer_home", "=", "'/root'", ")", ":", "result", "=", "_run_composer", "(", "'selfupdate'", ",", "extra_flags", "=...
Update composer itself. If composer has not been installed globally making it available in the system PATH & making it executable, the ``composer`` and ``php`` parameters will need to be set to the location of the executables. composer Location of the composer.phar file. If not set composer wi...
[ "Update", "composer", "itself", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/composer.py#L392-L435
train
saltstack/salt
salt/runners/saltutil.py
sync_all
def sync_all(saltenv='base', extmod_whitelist=None, extmod_blacklist=None): ''' Sync all custom types saltenv : base The fileserver environment from which to sync. To sync from more than one environment, pass a comma-separated list. extmod_whitelist : None dictionary of modules...
python
def sync_all(saltenv='base', extmod_whitelist=None, extmod_blacklist=None): ''' Sync all custom types saltenv : base The fileserver environment from which to sync. To sync from more than one environment, pass a comma-separated list. extmod_whitelist : None dictionary of modules...
[ "def", "sync_all", "(", "saltenv", "=", "'base'", ",", "extmod_whitelist", "=", "None", ",", "extmod_blacklist", "=", "None", ")", ":", "log", ".", "debug", "(", "'Syncing all'", ")", "ret", "=", "{", "}", "ret", "[", "'clouds'", "]", "=", "sync_clouds",...
Sync all custom types saltenv : base The fileserver environment from which to sync. To sync from more than one environment, pass a comma-separated list. extmod_whitelist : None dictionary of modules to sync based on type extmod_blacklist : None dictionary of modules to bla...
[ "Sync", "all", "custom", "types" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/saltutil.py#L20-L68
train
saltstack/salt
salt/runners/saltutil.py
sync_auth
def sync_auth(saltenv='base', extmod_whitelist=None, extmod_blacklist=None): ''' Sync execution modules from ``salt://_auth`` to the master saltenv : base The fileserver environment from which to sync. To sync from more than one environment, pass a comma-separated list. extmod_whitelis...
python
def sync_auth(saltenv='base', extmod_whitelist=None, extmod_blacklist=None): ''' Sync execution modules from ``salt://_auth`` to the master saltenv : base The fileserver environment from which to sync. To sync from more than one environment, pass a comma-separated list. extmod_whitelis...
[ "def", "sync_auth", "(", "saltenv", "=", "'base'", ",", "extmod_whitelist", "=", "None", ",", "extmod_blacklist", "=", "None", ")", ":", "return", "salt", ".", "utils", ".", "extmods", ".", "sync", "(", "__opts__", ",", "'auth'", ",", "saltenv", "=", "sa...
Sync execution modules from ``salt://_auth`` to the master saltenv : base The fileserver environment from which to sync. To sync from more than one environment, pass a comma-separated list. extmod_whitelist : None comma-separated list of modules to sync extmod_blacklist : None ...
[ "Sync", "execution", "modules", "from", "salt", ":", "//", "_auth", "to", "the", "master" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/saltutil.py#L71-L92
train
saltstack/salt
salt/cloud/clouds/packet.py
avail_images
def avail_images(call=None): ''' Return available Packet os images. CLI Example: .. code-block:: bash salt-cloud --list-images packet-provider salt-cloud -f avail_images packet-provider ''' if call == 'action': raise SaltCloudException( 'The avail_images fu...
python
def avail_images(call=None): ''' Return available Packet os images. CLI Example: .. code-block:: bash salt-cloud --list-images packet-provider salt-cloud -f avail_images packet-provider ''' if call == 'action': raise SaltCloudException( 'The avail_images fu...
[ "def", "avail_images", "(", "call", "=", "None", ")", ":", "if", "call", "==", "'action'", ":", "raise", "SaltCloudException", "(", "'The avail_images function must be called with -f or --function.'", ")", "ret", "=", "{", "}", "vm_", "=", "get_configured_provider", ...
Return available Packet os images. CLI Example: .. code-block:: bash salt-cloud --list-images packet-provider salt-cloud -f avail_images packet-provider
[ "Return", "available", "Packet", "os", "images", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/packet.py#L117-L143
train
saltstack/salt
salt/cloud/clouds/packet.py
avail_locations
def avail_locations(call=None): ''' Return available Packet datacenter locations. CLI Example: .. code-block:: bash salt-cloud --list-locations packet-provider salt-cloud -f avail_locations packet-provider ''' if call == 'action': raise SaltCloudException( ...
python
def avail_locations(call=None): ''' Return available Packet datacenter locations. CLI Example: .. code-block:: bash salt-cloud --list-locations packet-provider salt-cloud -f avail_locations packet-provider ''' if call == 'action': raise SaltCloudException( ...
[ "def", "avail_locations", "(", "call", "=", "None", ")", ":", "if", "call", "==", "'action'", ":", "raise", "SaltCloudException", "(", "'The avail_locations function must be called with -f or --function.'", ")", "vm_", "=", "get_configured_provider", "(", ")", "manager"...
Return available Packet datacenter locations. CLI Example: .. code-block:: bash salt-cloud --list-locations packet-provider salt-cloud -f avail_locations packet-provider
[ "Return", "available", "Packet", "datacenter", "locations", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/packet.py#L146-L170
train
saltstack/salt
salt/cloud/clouds/packet.py
avail_sizes
def avail_sizes(call=None): ''' Return available Packet sizes. CLI Example: .. code-block:: bash salt-cloud --list-sizes packet-provider salt-cloud -f avail_sizes packet-provider ''' if call == 'action': raise SaltCloudException( 'The avail_locations functi...
python
def avail_sizes(call=None): ''' Return available Packet sizes. CLI Example: .. code-block:: bash salt-cloud --list-sizes packet-provider salt-cloud -f avail_sizes packet-provider ''' if call == 'action': raise SaltCloudException( 'The avail_locations functi...
[ "def", "avail_sizes", "(", "call", "=", "None", ")", ":", "if", "call", "==", "'action'", ":", "raise", "SaltCloudException", "(", "'The avail_locations function must be called with -f or --function.'", ")", "vm_", "=", "get_configured_provider", "(", ")", "manager", ...
Return available Packet sizes. CLI Example: .. code-block:: bash salt-cloud --list-sizes packet-provider salt-cloud -f avail_sizes packet-provider
[ "Return", "available", "Packet", "sizes", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/packet.py#L173-L198
train
saltstack/salt
salt/cloud/clouds/packet.py
avail_projects
def avail_projects(call=None): ''' Return available Packet projects. CLI Example: .. code-block:: bash salt-cloud -f avail_projects packet-provider ''' if call == 'action': raise SaltCloudException( 'The avail_projects function must be called with -f or --function....
python
def avail_projects(call=None): ''' Return available Packet projects. CLI Example: .. code-block:: bash salt-cloud -f avail_projects packet-provider ''' if call == 'action': raise SaltCloudException( 'The avail_projects function must be called with -f or --function....
[ "def", "avail_projects", "(", "call", "=", "None", ")", ":", "if", "call", "==", "'action'", ":", "raise", "SaltCloudException", "(", "'The avail_projects function must be called with -f or --function.'", ")", "vm_", "=", "get_configured_provider", "(", ")", "manager", ...
Return available Packet projects. CLI Example: .. code-block:: bash salt-cloud -f avail_projects packet-provider
[ "Return", "available", "Packet", "projects", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/packet.py#L201-L224
train
saltstack/salt
salt/cloud/clouds/packet.py
_wait_for_status
def _wait_for_status(status_type, object_id, status=None, timeout=500, quiet=True): ''' Wait for a certain status from Packet. status_type device or volume object_id The ID of the Packet device or volume to wait on. Required. status The status to wait for. timeout ...
python
def _wait_for_status(status_type, object_id, status=None, timeout=500, quiet=True): ''' Wait for a certain status from Packet. status_type device or volume object_id The ID of the Packet device or volume to wait on. Required. status The status to wait for. timeout ...
[ "def", "_wait_for_status", "(", "status_type", ",", "object_id", ",", "status", "=", "None", ",", "timeout", "=", "500", ",", "quiet", "=", "True", ")", ":", "if", "status", "is", "None", ":", "status", "=", "\"ok\"", "interval", "=", "5", "iterations", ...
Wait for a certain status from Packet. status_type device or volume object_id The ID of the Packet device or volume to wait on. Required. status The status to wait for. timeout The amount of time to wait for a status to update. quiet Log status updates to debu...
[ "Wait", "for", "a", "certain", "status", "from", "Packet", ".", "status_type", "device", "or", "volume", "object_id", "The", "ID", "of", "the", "Packet", "device", "or", "volume", "to", "wait", "on", ".", "Required", ".", "status", "The", "status", "to", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/packet.py#L227-L264
train
saltstack/salt
salt/cloud/clouds/packet.py
create
def create(vm_): ''' Create a single Packet VM. ''' name = vm_['name'] if not is_profile_configured(vm_): return False __utils__['cloud.fire_event']( 'event', 'starting create', 'salt/cloud/{0}/creating'.format(name), args=__utils__['cloud.filter_event']...
python
def create(vm_): ''' Create a single Packet VM. ''' name = vm_['name'] if not is_profile_configured(vm_): return False __utils__['cloud.fire_event']( 'event', 'starting create', 'salt/cloud/{0}/creating'.format(name), args=__utils__['cloud.filter_event']...
[ "def", "create", "(", "vm_", ")", ":", "name", "=", "vm_", "[", "'name'", "]", "if", "not", "is_profile_configured", "(", "vm_", ")", ":", "return", "False", "__utils__", "[", "'cloud.fire_event'", "]", "(", "'event'", ",", "'starting create'", ",", "'salt...
Create a single Packet VM.
[ "Create", "a", "single", "Packet", "VM", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/packet.py#L324-L434
train
saltstack/salt
salt/cloud/clouds/packet.py
list_nodes_full
def list_nodes_full(call=None): ''' List devices, with all available information. CLI Example: .. code-block:: bash salt-cloud -F salt-cloud --full-query salt-cloud -f list_nodes_full packet-provider .. ''' if call == 'action': raise SaltCloudException( ...
python
def list_nodes_full(call=None): ''' List devices, with all available information. CLI Example: .. code-block:: bash salt-cloud -F salt-cloud --full-query salt-cloud -f list_nodes_full packet-provider .. ''' if call == 'action': raise SaltCloudException( ...
[ "def", "list_nodes_full", "(", "call", "=", "None", ")", ":", "if", "call", "==", "'action'", ":", "raise", "SaltCloudException", "(", "'The list_nodes_full function must be called with -f or --function.'", ")", "ret", "=", "{", "}", "for", "device", "in", "get_devi...
List devices, with all available information. CLI Example: .. code-block:: bash salt-cloud -F salt-cloud --full-query salt-cloud -f list_nodes_full packet-provider ..
[ "List", "devices", "with", "all", "available", "information", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/packet.py#L437-L461
train
saltstack/salt
salt/cloud/clouds/packet.py
list_nodes_min
def list_nodes_min(call=None): ''' Return a list of the VMs that are on the provider. Only a list of VM names and their state is returned. This is the minimum amount of information needed to check for existing VMs. .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt...
python
def list_nodes_min(call=None): ''' Return a list of the VMs that are on the provider. Only a list of VM names and their state is returned. This is the minimum amount of information needed to check for existing VMs. .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt...
[ "def", "list_nodes_min", "(", "call", "=", "None", ")", ":", "if", "call", "==", "'action'", ":", "raise", "SaltCloudSystemExit", "(", "'The list_nodes_min function must be called with -f or --function.'", ")", "ret", "=", "{", "}", "for", "device", "in", "get_devic...
Return a list of the VMs that are on the provider. Only a list of VM names and their state is returned. This is the minimum amount of information needed to check for existing VMs. .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt-cloud -f list_nodes_min packet-provider ...
[ "Return", "a", "list", "of", "the", "VMs", "that", "are", "on", "the", "provider", ".", "Only", "a", "list", "of", "VM", "names", "and", "their", "state", "is", "returned", ".", "This", "is", "the", "minimum", "amount", "of", "information", "needed", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/packet.py#L464-L489
train
saltstack/salt
salt/cloud/clouds/packet.py
list_nodes
def list_nodes(call=None): ''' Returns a list of devices, keeping only a brief listing. CLI Example: .. code-block:: bash salt-cloud -Q salt-cloud --query salt-cloud -f list_nodes packet-provider .. ''' if call == 'action': raise SaltCloudException( ...
python
def list_nodes(call=None): ''' Returns a list of devices, keeping only a brief listing. CLI Example: .. code-block:: bash salt-cloud -Q salt-cloud --query salt-cloud -f list_nodes packet-provider .. ''' if call == 'action': raise SaltCloudException( ...
[ "def", "list_nodes", "(", "call", "=", "None", ")", ":", "if", "call", "==", "'action'", ":", "raise", "SaltCloudException", "(", "'The list_nodes function must be called with -f or --function.'", ")", "ret", "=", "{", "}", "for", "device", "in", "get_devices_by_tok...
Returns a list of devices, keeping only a brief listing. CLI Example: .. code-block:: bash salt-cloud -Q salt-cloud --query salt-cloud -f list_nodes packet-provider ..
[ "Returns", "a", "list", "of", "devices", "keeping", "only", "a", "brief", "listing", ".", "CLI", "Example", ":", "..", "code", "-", "block", "::", "bash", "salt", "-", "cloud", "-", "Q", "salt", "-", "cloud", "--", "query", "salt", "-", "cloud", "-",...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/packet.py#L515-L536
train
saltstack/salt
salt/cloud/clouds/packet.py
destroy
def destroy(name, call=None): ''' Destroys a Packet device by name. name The hostname of VM to be be destroyed. CLI Example: .. code-block:: bash salt-cloud -d name ''' if call == 'function': raise SaltCloudException( 'The destroy action must be called...
python
def destroy(name, call=None): ''' Destroys a Packet device by name. name The hostname of VM to be be destroyed. CLI Example: .. code-block:: bash salt-cloud -d name ''' if call == 'function': raise SaltCloudException( 'The destroy action must be called...
[ "def", "destroy", "(", "name", ",", "call", "=", "None", ")", ":", "if", "call", "==", "'function'", ":", "raise", "SaltCloudException", "(", "'The destroy action must be called with -d, --destroy, '", "'-a or --action.'", ")", "__utils__", "[", "'cloud.fire_event'", ...
Destroys a Packet device by name. name The hostname of VM to be be destroyed. CLI Example: .. code-block:: bash salt-cloud -d name
[ "Destroys", "a", "Packet", "device", "by", "name", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/packet.py#L539-L593
train
saltstack/salt
salt/beacons/smartos_imgadm.py
beacon
def beacon(config): ''' Poll imgadm and compare available images ''' ret = [] # NOTE: lookup current images current_images = __salt__['imgadm.list'](verbose=True) # NOTE: apply configuration if IMGADM_STATE['first_run']: log.info('Applying configuration for imgadm beacon') ...
python
def beacon(config): ''' Poll imgadm and compare available images ''' ret = [] # NOTE: lookup current images current_images = __salt__['imgadm.list'](verbose=True) # NOTE: apply configuration if IMGADM_STATE['first_run']: log.info('Applying configuration for imgadm beacon') ...
[ "def", "beacon", "(", "config", ")", ":", "ret", "=", "[", "]", "# NOTE: lookup current images", "current_images", "=", "__salt__", "[", "'imgadm.list'", "]", "(", "verbose", "=", "True", ")", "# NOTE: apply configuration", "if", "IMGADM_STATE", "[", "'first_run'"...
Poll imgadm and compare available images
[ "Poll", "imgadm", "and", "compare", "available", "images" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/beacons/smartos_imgadm.py#L69-L117
train
saltstack/salt
doc/conf.py
mock_decorator_with_params
def mock_decorator_with_params(*oargs, **okwargs): # pylint: disable=unused-argument ''' Optionally mock a decorator that takes parameters E.g.: @blah(stuff=True) def things(): pass ''' def inner(fn, *iargs, **ikwargs): # pylint: disable=unused-argument if hasattr(fn, '__...
python
def mock_decorator_with_params(*oargs, **okwargs): # pylint: disable=unused-argument ''' Optionally mock a decorator that takes parameters E.g.: @blah(stuff=True) def things(): pass ''' def inner(fn, *iargs, **ikwargs): # pylint: disable=unused-argument if hasattr(fn, '__...
[ "def", "mock_decorator_with_params", "(", "*", "oargs", ",", "*", "*", "okwargs", ")", ":", "# pylint: disable=unused-argument", "def", "inner", "(", "fn", ",", "*", "iargs", ",", "*", "*", "ikwargs", ")", ":", "# pylint: disable=unused-argument", "if", "hasattr...
Optionally mock a decorator that takes parameters E.g.: @blah(stuff=True) def things(): pass
[ "Optionally", "mock", "a", "decorator", "that", "takes", "parameters" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/doc/conf.py#L63-L77
train
saltstack/salt
salt/states/process.py
absent
def absent(name, user=None, signal=None): ''' Ensures that the named command is not running. name The pattern to match. user The user to which the process belongs signal Signal to send to the process(es). ''' ret = {'name': name, 'changes': {}, ...
python
def absent(name, user=None, signal=None): ''' Ensures that the named command is not running. name The pattern to match. user The user to which the process belongs signal Signal to send to the process(es). ''' ret = {'name': name, 'changes': {}, ...
[ "def", "absent", "(", "name", ",", "user", "=", "None", ",", "signal", "=", "None", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "False", ",", "'comment'", ":", "''", "}", "if", "__opts_...
Ensures that the named command is not running. name The pattern to match. user The user to which the process belongs signal Signal to send to the process(es).
[ "Ensures", "that", "the", "named", "command", "is", "not", "running", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/process.py#L21-L61
train
saltstack/salt
salt/pillar/netbox.py
ext_pillar
def ext_pillar(minion_id, pillar, *args, **kwargs): ''' Query NetBox API for minion data ''' if minion_id == '*': log.info('There\'s no data to collect from NetBox for the Master') return {} # Pull settings from kwargs api_url = kwargs['api_url'].rstrip('/') api_token = kwarg...
python
def ext_pillar(minion_id, pillar, *args, **kwargs): ''' Query NetBox API for minion data ''' if minion_id == '*': log.info('There\'s no data to collect from NetBox for the Master') return {} # Pull settings from kwargs api_url = kwargs['api_url'].rstrip('/') api_token = kwarg...
[ "def", "ext_pillar", "(", "minion_id", ",", "pillar", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "minion_id", "==", "'*'", ":", "log", ".", "info", "(", "'There\\'s no data to collect from NetBox for the Master'", ")", "return", "{", "}", "# ...
Query NetBox API for minion data
[ "Query", "NetBox", "API", "for", "minion", "data" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/netbox.py#L61-L172
train
saltstack/salt
salt/tops/ext_nodes.py
top
def top(**kwargs): ''' Run the command configured ''' if 'id' not in kwargs['opts']: return {} cmd = '{0} {1}'.format( __opts__['master_tops']['ext_nodes'], kwargs['opts']['id'] ) ndata = salt.utils.yaml.safe_load( subprocess.Popen( ...
python
def top(**kwargs): ''' Run the command configured ''' if 'id' not in kwargs['opts']: return {} cmd = '{0} {1}'.format( __opts__['master_tops']['ext_nodes'], kwargs['opts']['id'] ) ndata = salt.utils.yaml.safe_load( subprocess.Popen( ...
[ "def", "top", "(", "*", "*", "kwargs", ")", ":", "if", "'id'", "not", "in", "kwargs", "[", "'opts'", "]", ":", "return", "{", "}", "cmd", "=", "'{0} {1}'", ".", "format", "(", "__opts__", "[", "'master_tops'", "]", "[", "'ext_nodes'", "]", ",", "kw...
Run the command configured
[ "Run", "the", "command", "configured" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/tops/ext_nodes.py#L69-L103
train
saltstack/salt
salt/states/gnomedesktop.py
_check_current_value
def _check_current_value(gnome_kwargs, value): ''' Check the current value with the passed value ''' current_value = __salt__['gnome.get'](**gnome_kwargs) return six.text_type(current_value) == six.text_type(value)
python
def _check_current_value(gnome_kwargs, value): ''' Check the current value with the passed value ''' current_value = __salt__['gnome.get'](**gnome_kwargs) return six.text_type(current_value) == six.text_type(value)
[ "def", "_check_current_value", "(", "gnome_kwargs", ",", "value", ")", ":", "current_value", "=", "__salt__", "[", "'gnome.get'", "]", "(", "*", "*", "gnome_kwargs", ")", "return", "six", ".", "text_type", "(", "current_value", ")", "==", "six", ".", "text_t...
Check the current value with the passed value
[ "Check", "the", "current", "value", "with", "the", "passed", "value" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/gnomedesktop.py#L38-L43
train
saltstack/salt
salt/states/gnomedesktop.py
_do
def _do(name, gnome_kwargs, preferences): ''' worker function for the others to use this handles all the gsetting magic ''' ret = {'name': name, 'result': True, 'changes': {}, 'comment': ''} messages = [] for pref in preferences: key = pref ...
python
def _do(name, gnome_kwargs, preferences): ''' worker function for the others to use this handles all the gsetting magic ''' ret = {'name': name, 'result': True, 'changes': {}, 'comment': ''} messages = [] for pref in preferences: key = pref ...
[ "def", "_do", "(", "name", ",", "gnome_kwargs", ",", "preferences", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'result'", ":", "True", ",", "'changes'", ":", "{", "}", ",", "'comment'", ":", "''", "}", "messages", "=", "[", "]", "for",...
worker function for the others to use this handles all the gsetting magic
[ "worker", "function", "for", "the", "others", "to", "use", "this", "handles", "all", "the", "gsetting", "magic" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/gnomedesktop.py#L46-L92
train
saltstack/salt
salt/states/gnomedesktop.py
wm_preferences
def wm_preferences(name, user=None, action_double_click_titlebar=None, action_middle_click_titlebar=None, action_right_click_titlebar=None, application_based=None, audible_bell=None, auto...
python
def wm_preferences(name, user=None, action_double_click_titlebar=None, action_middle_click_titlebar=None, action_right_click_titlebar=None, application_based=None, audible_bell=None, auto...
[ "def", "wm_preferences", "(", "name", ",", "user", "=", "None", ",", "action_double_click_titlebar", "=", "None", ",", "action_middle_click_titlebar", "=", "None", ",", "action_right_click_titlebar", "=", "None", ",", "application_based", "=", "None", ",", "audible_...
wm_preferences: sets values in the org.gnome.desktop.wm.preferences schema
[ "wm_preferences", ":", "sets", "values", "in", "the", "org", ".", "gnome", ".", "desktop", ".", "wm", ".", "preferences", "schema" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/gnomedesktop.py#L95-L142
train
saltstack/salt
salt/states/gnomedesktop.py
desktop_lockdown
def desktop_lockdown(name, user=None, disable_application_handlers=None, disable_command_line=None, disable_lock_screen=None, disable_log_out=None, disable_print_setup=None, ...
python
def desktop_lockdown(name, user=None, disable_application_handlers=None, disable_command_line=None, disable_lock_screen=None, disable_log_out=None, disable_print_setup=None, ...
[ "def", "desktop_lockdown", "(", "name", ",", "user", "=", "None", ",", "disable_application_handlers", "=", "None", ",", "disable_command_line", "=", "None", ",", "disable_lock_screen", "=", "None", ",", "disable_log_out", "=", "None", ",", "disable_print_setup", ...
desktop_lockdown: sets values in the org.gnome.desktop.lockdown schema
[ "desktop_lockdown", ":", "sets", "values", "in", "the", "org", ".", "gnome", ".", "desktop", ".", "lockdown", "schema" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/gnomedesktop.py#L145-L176
train
saltstack/salt
salt/states/gnomedesktop.py
desktop_interface
def desktop_interface(name, user=None, automatic_mnemonics=None, buttons_have_icons=None, can_change_accels=None, clock_format=None, clock_show_date=None, clock_show_...
python
def desktop_interface(name, user=None, automatic_mnemonics=None, buttons_have_icons=None, can_change_accels=None, clock_format=None, clock_show_date=None, clock_show_...
[ "def", "desktop_interface", "(", "name", ",", "user", "=", "None", ",", "automatic_mnemonics", "=", "None", ",", "buttons_have_icons", "=", "None", ",", "can_change_accels", "=", "None", ",", "clock_format", "=", "None", ",", "clock_show_date", "=", "None", ",...
desktop_interface: sets values in the org.gnome.desktop.interface schema
[ "desktop_interface", ":", "sets", "values", "in", "the", "org", ".", "gnome", ".", "desktop", ".", "interface", "schema" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/gnomedesktop.py#L179-L246
train
saltstack/salt
salt/serializers/toml.py
deserialize
def deserialize(stream_or_string, **options): ''' Deserialize from TOML into Python data structure. :param stream_or_string: toml stream or string to deserialize. :param options: options given to lower pytoml module. ''' try: if not isinstance(stream_or_string, (bytes, six.string_types...
python
def deserialize(stream_or_string, **options): ''' Deserialize from TOML into Python data structure. :param stream_or_string: toml stream or string to deserialize. :param options: options given to lower pytoml module. ''' try: if not isinstance(stream_or_string, (bytes, six.string_types...
[ "def", "deserialize", "(", "stream_or_string", ",", "*", "*", "options", ")", ":", "try", ":", "if", "not", "isinstance", "(", "stream_or_string", ",", "(", "bytes", ",", "six", ".", "string_types", ")", ")", ":", "return", "toml", ".", "load", "(", "s...
Deserialize from TOML into Python data structure. :param stream_or_string: toml stream or string to deserialize. :param options: options given to lower pytoml module.
[ "Deserialize", "from", "TOML", "into", "Python", "data", "structure", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/serializers/toml.py#L29-L46
train
saltstack/salt
salt/serializers/toml.py
serialize
def serialize(obj, **options): ''' Serialize Python data to TOML. :param obj: the data structure to serialize. :param options: options given to lower pytoml module. ''' try: if 'file_out' in options: return toml.dump(obj, options['file_out'], **options) else: ...
python
def serialize(obj, **options): ''' Serialize Python data to TOML. :param obj: the data structure to serialize. :param options: options given to lower pytoml module. ''' try: if 'file_out' in options: return toml.dump(obj, options['file_out'], **options) else: ...
[ "def", "serialize", "(", "obj", ",", "*", "*", "options", ")", ":", "try", ":", "if", "'file_out'", "in", "options", ":", "return", "toml", ".", "dump", "(", "obj", ",", "options", "[", "'file_out'", "]", ",", "*", "*", "options", ")", "else", ":",...
Serialize Python data to TOML. :param obj: the data structure to serialize. :param options: options given to lower pytoml module.
[ "Serialize", "Python", "data", "to", "TOML", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/serializers/toml.py#L49-L63
train
saltstack/salt
salt/renderers/mako.py
render
def render(template_file, saltenv='base', sls='', context=None, tmplpath=None, **kws): ''' Render the template_file, passing the functions and grains into the Mako rendering system. :rtype: string ''' tmp_data = salt.utils.templates.MAKO(template_file, to_str=True, salt=__sa...
python
def render(template_file, saltenv='base', sls='', context=None, tmplpath=None, **kws): ''' Render the template_file, passing the functions and grains into the Mako rendering system. :rtype: string ''' tmp_data = salt.utils.templates.MAKO(template_file, to_str=True, salt=__sa...
[ "def", "render", "(", "template_file", ",", "saltenv", "=", "'base'", ",", "sls", "=", "''", ",", "context", "=", "None", ",", "tmplpath", "=", "None", ",", "*", "*", "kws", ")", ":", "tmp_data", "=", "salt", ".", "utils", ".", "templates", ".", "M...
Render the template_file, passing the functions and grains into the Mako rendering system. :rtype: string
[ "Render", "the", "template_file", "passing", "the", "functions", "and", "grains", "into", "the", "Mako", "rendering", "system", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/renderers/mako.py#L15-L35
train
saltstack/salt
salt/proxy/fx2.py
init
def init(opts): ''' This function gets called when the proxy starts up. We check opts to see if a fallback user and password are supplied. If they are present, and the primary credentials don't work, then we try the backup before failing. Whichever set of credentials works is placed in the pers...
python
def init(opts): ''' This function gets called when the proxy starts up. We check opts to see if a fallback user and password are supplied. If they are present, and the primary credentials don't work, then we try the backup before failing. Whichever set of credentials works is placed in the pers...
[ "def", "init", "(", "opts", ")", ":", "if", "'host'", "not", "in", "opts", "[", "'proxy'", "]", ":", "log", ".", "critical", "(", "'No \"host\" key found in pillar for this proxy'", ")", "return", "False", "DETAILS", "[", "'host'", "]", "=", "opts", "[", "...
This function gets called when the proxy starts up. We check opts to see if a fallback user and password are supplied. If they are present, and the primary credentials don't work, then we try the backup before failing. Whichever set of credentials works is placed in the persistent DETAILS dictionar...
[ "This", "function", "gets", "called", "when", "the", "proxy", "starts", "up", ".", "We", "check", "opts", "to", "see", "if", "a", "fallback", "user", "and", "password", "are", "supplied", ".", "If", "they", "are", "present", "and", "the", "primary", "cre...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/fx2.py#L203-L220
train
saltstack/salt
salt/proxy/fx2.py
_grains
def _grains(host, user, password): ''' Get the grains from the proxied device ''' r = __salt__['dracr.system_info'](host=host, admin_username=user, admin_password=password) if r.get('retcode', 0) == 0: GRAINS_CACHE =...
python
def _grains(host, user, password): ''' Get the grains from the proxied device ''' r = __salt__['dracr.system_info'](host=host, admin_username=user, admin_password=password) if r.get('retcode', 0) == 0: GRAINS_CACHE =...
[ "def", "_grains", "(", "host", ",", "user", ",", "password", ")", ":", "r", "=", "__salt__", "[", "'dracr.system_info'", "]", "(", "host", "=", "host", ",", "admin_username", "=", "user", ",", "admin_password", "=", "password", ")", "if", "r", ".", "ge...
Get the grains from the proxied device
[ "Get", "the", "grains", "from", "the", "proxied", "device" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/fx2.py#L247-L258
train
saltstack/salt
salt/proxy/fx2.py
find_credentials
def find_credentials(): ''' Cycle through all the possible credentials and return the first one that works ''' usernames = [__pillar__['proxy'].get('admin_username', 'root')] if 'fallback_admin_username' in __pillar__.get('proxy'): usernames.append(__pillar__['proxy'].get('fallback_admin...
python
def find_credentials(): ''' Cycle through all the possible credentials and return the first one that works ''' usernames = [__pillar__['proxy'].get('admin_username', 'root')] if 'fallback_admin_username' in __pillar__.get('proxy'): usernames.append(__pillar__['proxy'].get('fallback_admin...
[ "def", "find_credentials", "(", ")", ":", "usernames", "=", "[", "__pillar__", "[", "'proxy'", "]", ".", "get", "(", "'admin_username'", ",", "'root'", ")", "]", "if", "'fallback_admin_username'", "in", "__pillar__", ".", "get", "(", "'proxy'", ")", ":", "...
Cycle through all the possible credentials and return the first one that works
[ "Cycle", "through", "all", "the", "possible", "credentials", "and", "return", "the", "first", "one", "that", "works" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/fx2.py#L281-L313
train
saltstack/salt
salt/proxy/fx2.py
chconfig
def chconfig(cmd, *args, **kwargs): ''' This function is called by the :mod:`salt.modules.chassis.cmd <salt.modules.chassis.cmd>` shim. It then calls whatever is passed in ``cmd`` inside the :mod:`salt.modules.dracr <salt.modules.dracr>` module. :param cmd: The command to call inside salt.modu...
python
def chconfig(cmd, *args, **kwargs): ''' This function is called by the :mod:`salt.modules.chassis.cmd <salt.modules.chassis.cmd>` shim. It then calls whatever is passed in ``cmd`` inside the :mod:`salt.modules.dracr <salt.modules.dracr>` module. :param cmd: The command to call inside salt.modu...
[ "def", "chconfig", "(", "cmd", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# Strip the __pub_ keys...is there a better way to do this?", "for", "k", "in", "list", "(", "kwargs", ")", ":", "if", "k", ".", "startswith", "(", "'__pub_'", ")", ":", "...
This function is called by the :mod:`salt.modules.chassis.cmd <salt.modules.chassis.cmd>` shim. It then calls whatever is passed in ``cmd`` inside the :mod:`salt.modules.dracr <salt.modules.dracr>` module. :param cmd: The command to call inside salt.modules.dracr :param args: Arguments that need t...
[ "This", "function", "is", "called", "by", "the", ":", "mod", ":", "salt", ".", "modules", ".", "chassis", ".", "cmd", "<salt", ".", "modules", ".", "chassis", ".", "cmd", ">", "shim", ".", "It", "then", "calls", "whatever", "is", "passed", "in", "cmd...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/fx2.py#L316-L348
train
saltstack/salt
salt/proxy/fx2.py
ping
def ping(): ''' Is the chassis responding? :return: Returns False if the chassis didn't respond, True otherwise. ''' r = __salt__['dracr.system_info'](host=DETAILS['host'], admin_username=DETAILS['admin_username'], admin_p...
python
def ping(): ''' Is the chassis responding? :return: Returns False if the chassis didn't respond, True otherwise. ''' r = __salt__['dracr.system_info'](host=DETAILS['host'], admin_username=DETAILS['admin_username'], admin_p...
[ "def", "ping", "(", ")", ":", "r", "=", "__salt__", "[", "'dracr.system_info'", "]", "(", "host", "=", "DETAILS", "[", "'host'", "]", ",", "admin_username", "=", "DETAILS", "[", "'admin_username'", "]", ",", "admin_password", "=", "DETAILS", "[", "'admin_p...
Is the chassis responding? :return: Returns False if the chassis didn't respond, True otherwise.
[ "Is", "the", "chassis", "responding?" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/fx2.py#L351-L368
train
saltstack/salt
salt/cache/consul.py
store
def store(bank, key, data): ''' Store a key value. ''' c_key = '{0}/{1}'.format(bank, key) try: c_data = __context__['serial'].dumps(data) api.kv.put(c_key, c_data) except Exception as exc: raise SaltCacheError( 'There was an error writing the key, {0}: {1}'.f...
python
def store(bank, key, data): ''' Store a key value. ''' c_key = '{0}/{1}'.format(bank, key) try: c_data = __context__['serial'].dumps(data) api.kv.put(c_key, c_data) except Exception as exc: raise SaltCacheError( 'There was an error writing the key, {0}: {1}'.f...
[ "def", "store", "(", "bank", ",", "key", ",", "data", ")", ":", "c_key", "=", "'{0}/{1}'", ".", "format", "(", "bank", ",", "key", ")", "try", ":", "c_data", "=", "__context__", "[", "'serial'", "]", ".", "dumps", "(", "data", ")", "api", ".", "k...
Store a key value.
[ "Store", "a", "key", "value", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cache/consul.py#L95-L108
train
saltstack/salt
salt/cache/consul.py
fetch
def fetch(bank, key): ''' Fetch a key value. ''' c_key = '{0}/{1}'.format(bank, key) try: _, value = api.kv.get(c_key) if value is None: return {} return __context__['serial'].loads(value['Value']) except Exception as exc: raise SaltCacheError( ...
python
def fetch(bank, key): ''' Fetch a key value. ''' c_key = '{0}/{1}'.format(bank, key) try: _, value = api.kv.get(c_key) if value is None: return {} return __context__['serial'].loads(value['Value']) except Exception as exc: raise SaltCacheError( ...
[ "def", "fetch", "(", "bank", ",", "key", ")", ":", "c_key", "=", "'{0}/{1}'", ".", "format", "(", "bank", ",", "key", ")", "try", ":", "_", ",", "value", "=", "api", ".", "kv", ".", "get", "(", "c_key", ")", "if", "value", "is", "None", ":", ...
Fetch a key value.
[ "Fetch", "a", "key", "value", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cache/consul.py#L111-L126
train
saltstack/salt
salt/cache/consul.py
flush
def flush(bank, key=None): ''' Remove the key from the cache bank with all the key content. ''' if key is None: c_key = bank else: c_key = '{0}/{1}'.format(bank, key) try: return api.kv.delete(c_key, recurse=key is None) except Exception as exc: raise SaltCach...
python
def flush(bank, key=None): ''' Remove the key from the cache bank with all the key content. ''' if key is None: c_key = bank else: c_key = '{0}/{1}'.format(bank, key) try: return api.kv.delete(c_key, recurse=key is None) except Exception as exc: raise SaltCach...
[ "def", "flush", "(", "bank", ",", "key", "=", "None", ")", ":", "if", "key", "is", "None", ":", "c_key", "=", "bank", "else", ":", "c_key", "=", "'{0}/{1}'", ".", "format", "(", "bank", ",", "key", ")", "try", ":", "return", "api", ".", "kv", "...
Remove the key from the cache bank with all the key content.
[ "Remove", "the", "key", "from", "the", "cache", "bank", "with", "all", "the", "key", "content", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cache/consul.py#L129-L144
train
saltstack/salt
salt/cache/consul.py
list_
def list_(bank): ''' Return an iterable object containing all entries stored in the specified bank. ''' try: _, keys = api.kv.get(bank + '/', keys=True, separator='/') except Exception as exc: raise SaltCacheError( 'There was an error getting the key "{0}": {1}'.format( ...
python
def list_(bank): ''' Return an iterable object containing all entries stored in the specified bank. ''' try: _, keys = api.kv.get(bank + '/', keys=True, separator='/') except Exception as exc: raise SaltCacheError( 'There was an error getting the key "{0}": {1}'.format( ...
[ "def", "list_", "(", "bank", ")", ":", "try", ":", "_", ",", "keys", "=", "api", ".", "kv", ".", "get", "(", "bank", "+", "'/'", ",", "keys", "=", "True", ",", "separator", "=", "'/'", ")", "except", "Exception", "as", "exc", ":", "raise", "Sal...
Return an iterable object containing all entries stored in the specified bank.
[ "Return", "an", "iterable", "object", "containing", "all", "entries", "stored", "in", "the", "specified", "bank", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cache/consul.py#L147-L168
train
saltstack/salt
salt/cache/consul.py
contains
def contains(bank, key): ''' Checks if the specified bank contains the specified key. ''' if key is None: return True # any key could be a branch and a leaf at the same time in Consul else: try: c_key = '{0}/{1}'.format(bank, key) _, value = api.kv.get(c_key)...
python
def contains(bank, key): ''' Checks if the specified bank contains the specified key. ''' if key is None: return True # any key could be a branch and a leaf at the same time in Consul else: try: c_key = '{0}/{1}'.format(bank, key) _, value = api.kv.get(c_key)...
[ "def", "contains", "(", "bank", ",", "key", ")", ":", "if", "key", "is", "None", ":", "return", "True", "# any key could be a branch and a leaf at the same time in Consul", "else", ":", "try", ":", "c_key", "=", "'{0}/{1}'", ".", "format", "(", "bank", ",", "k...
Checks if the specified bank contains the specified key.
[ "Checks", "if", "the", "specified", "bank", "contains", "the", "specified", "key", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cache/consul.py#L171-L187
train
saltstack/salt
salt/modules/sensehat.py
set_pixel
def set_pixel(x, y, color): ''' Sets a single pixel on the LED matrix to a specified color. x The x coordinate of the pixel. Ranges from 0 on the left to 7 on the right. y The y coordinate of the pixel. Ranges from 0 at the top to 7 at the bottom. color The new color of the ...
python
def set_pixel(x, y, color): ''' Sets a single pixel on the LED matrix to a specified color. x The x coordinate of the pixel. Ranges from 0 on the left to 7 on the right. y The y coordinate of the pixel. Ranges from 0 at the top to 7 at the bottom. color The new color of the ...
[ "def", "set_pixel", "(", "x", ",", "y", ",", "color", ")", ":", "_sensehat", ".", "set_pixel", "(", "x", ",", "y", ",", "color", ")", "return", "{", "'color'", ":", "color", "}" ]
Sets a single pixel on the LED matrix to a specified color. x The x coordinate of the pixel. Ranges from 0 on the left to 7 on the right. y The y coordinate of the pixel. Ranges from 0 at the top to 7 at the bottom. color The new color of the pixel as a list of ``[R, G, B]`` values....
[ "Sets", "a", "single", "pixel", "on", "the", "LED", "matrix", "to", "a", "specified", "color", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/sensehat.py#L89-L107
train
saltstack/salt
salt/modules/sensehat.py
show_message
def show_message(message, msg_type=None, text_color=None, back_color=None, scroll_speed=0.1): ''' Displays a message on the LED matrix. message The message to display msg_type The type of the message. Changes the appearance of the message. Available types are:: ...
python
def show_message(message, msg_type=None, text_color=None, back_color=None, scroll_speed=0.1): ''' Displays a message on the LED matrix. message The message to display msg_type The type of the message. Changes the appearance of the message. Available types are:: ...
[ "def", "show_message", "(", "message", ",", "msg_type", "=", "None", ",", "text_color", "=", "None", ",", "back_color", "=", "None", ",", "scroll_speed", "=", "0.1", ")", ":", "text_color", "=", "text_color", "or", "[", "255", ",", "255", ",", "255", "...
Displays a message on the LED matrix. message The message to display msg_type The type of the message. Changes the appearance of the message. Available types are:: error: red text warning: orange text success: green text info:...
[ "Displays", "a", "message", "on", "the", "LED", "matrix", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/sensehat.py#L140-L189
train
saltstack/salt
salt/modules/sensehat.py
show_letter
def show_letter(letter, text_color=None, back_color=None): ''' Displays a single letter on the LED matrix. letter The letter to display text_color The color in which the letter is shown. Defaults to '[255, 255, 255]' (white). back_color The background color of the display. D...
python
def show_letter(letter, text_color=None, back_color=None): ''' Displays a single letter on the LED matrix. letter The letter to display text_color The color in which the letter is shown. Defaults to '[255, 255, 255]' (white). back_color The background color of the display. D...
[ "def", "show_letter", "(", "letter", ",", "text_color", "=", "None", ",", "back_color", "=", "None", ")", ":", "text_color", "=", "text_color", "or", "[", "255", ",", "255", ",", "255", "]", "back_color", "=", "back_color", "or", "[", "0", ",", "0", ...
Displays a single letter on the LED matrix. letter The letter to display text_color The color in which the letter is shown. Defaults to '[255, 255, 255]' (white). back_color The background color of the display. Defaults to '[0, 0, 0]' (black). CLI Example: .. code-block:: ...
[ "Displays", "a", "single", "letter", "on", "the", "LED", "matrix", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/sensehat.py#L192-L215
train
saltstack/salt
salt/modules/netbox.py
_add
def _add(app, endpoint, payload): ''' POST a payload ''' nb = _nb_obj(auth_required=True) try: return getattr(getattr(nb, app), endpoint).create(**payload) except RequestError as e: log.error('%s, %s, %s', e.req.request.headers, e.request_body, e.error) return False
python
def _add(app, endpoint, payload): ''' POST a payload ''' nb = _nb_obj(auth_required=True) try: return getattr(getattr(nb, app), endpoint).create(**payload) except RequestError as e: log.error('%s, %s, %s', e.req.request.headers, e.request_body, e.error) return False
[ "def", "_add", "(", "app", ",", "endpoint", ",", "payload", ")", ":", "nb", "=", "_nb_obj", "(", "auth_required", "=", "True", ")", "try", ":", "return", "getattr", "(", "getattr", "(", "nb", ",", "app", ")", ",", "endpoint", ")", ".", "create", "(...
POST a payload
[ "POST", "a", "payload" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netbox.py#L98-L107
train
saltstack/salt
salt/modules/netbox.py
slugify
def slugify(value): '''' Slugify given value. Credit to Djangoproject https://docs.djangoproject.com/en/2.0/_modules/django/utils/text/#slugify ''' value = re.sub(r'[^\w\s-]', '', value).strip().lower() return re.sub(r'[-\s]+', '-', value)
python
def slugify(value): '''' Slugify given value. Credit to Djangoproject https://docs.djangoproject.com/en/2.0/_modules/django/utils/text/#slugify ''' value = re.sub(r'[^\w\s-]', '', value).strip().lower() return re.sub(r'[-\s]+', '-', value)
[ "def", "slugify", "(", "value", ")", ":", "value", "=", "re", ".", "sub", "(", "r'[^\\w\\s-]'", ",", "''", ",", "value", ")", ".", "strip", "(", ")", ".", "lower", "(", ")", "return", "re", ".", "sub", "(", "r'[-\\s]+'", ",", "'-'", ",", "value",...
Slugify given value. Credit to Djangoproject https://docs.djangoproject.com/en/2.0/_modules/django/utils/text/#slugify
[ "Slugify", "given", "value", ".", "Credit", "to", "Djangoproject", "https", ":", "//", "docs", ".", "djangoproject", ".", "com", "/", "en", "/", "2", ".", "0", "/", "_modules", "/", "django", "/", "utils", "/", "text", "/", "#slugify" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netbox.py#L110-L116
train
saltstack/salt
salt/modules/netbox.py
_get
def _get(app, endpoint, id=None, auth_required=False, **kwargs): ''' Helper function to do a GET request to Netbox. Returns the actual pynetbox object, which allows manipulation from other functions. ''' nb = _nb_obj(auth_required=auth_required) if id: item = getattr(getattr(nb, app), en...
python
def _get(app, endpoint, id=None, auth_required=False, **kwargs): ''' Helper function to do a GET request to Netbox. Returns the actual pynetbox object, which allows manipulation from other functions. ''' nb = _nb_obj(auth_required=auth_required) if id: item = getattr(getattr(nb, app), en...
[ "def", "_get", "(", "app", ",", "endpoint", ",", "id", "=", "None", ",", "auth_required", "=", "False", ",", "*", "*", "kwargs", ")", ":", "nb", "=", "_nb_obj", "(", "auth_required", "=", "auth_required", ")", "if", "id", ":", "item", "=", "getattr",...
Helper function to do a GET request to Netbox. Returns the actual pynetbox object, which allows manipulation from other functions.
[ "Helper", "function", "to", "do", "a", "GET", "request", "to", "Netbox", ".", "Returns", "the", "actual", "pynetbox", "object", "which", "allows", "manipulation", "from", "other", "functions", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netbox.py#L119-L130
train
saltstack/salt
salt/modules/netbox.py
filter_
def filter_(app, endpoint, **kwargs): ''' Get a list of items from NetBox. app String of netbox app, e.g., ``dcim``, ``circuits``, ``ipam`` endpoint String of app endpoint, e.g., ``sites``, ``regions``, ``devices`` kwargs Optional arguments that can be used to filter. ...
python
def filter_(app, endpoint, **kwargs): ''' Get a list of items from NetBox. app String of netbox app, e.g., ``dcim``, ``circuits``, ``ipam`` endpoint String of app endpoint, e.g., ``sites``, ``regions``, ``devices`` kwargs Optional arguments that can be used to filter. ...
[ "def", "filter_", "(", "app", ",", "endpoint", ",", "*", "*", "kwargs", ")", ":", "ret", "=", "[", "]", "nb", "=", "_nb_obj", "(", "auth_required", "=", "True", "if", "app", "in", "AUTH_ENDPOINTS", "else", "False", ")", "nb_query", "=", "getattr", "(...
Get a list of items from NetBox. app String of netbox app, e.g., ``dcim``, ``circuits``, ``ipam`` endpoint String of app endpoint, e.g., ``sites``, ``regions``, ``devices`` kwargs Optional arguments that can be used to filter. All filter keywords are available in Netbox, ...
[ "Get", "a", "list", "of", "items", "from", "NetBox", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netbox.py#L140-L167
train
saltstack/salt
salt/modules/netbox.py
get_
def get_(app, endpoint, id=None, **kwargs): ''' Get a single item from NetBox. app String of netbox app, e.g., ``dcim``, ``circuits``, ``ipam`` endpoint String of app endpoint, e.g., ``sites``, ``regions``, ``devices`` Returns a single dictionary To get an item based on ID. ...
python
def get_(app, endpoint, id=None, **kwargs): ''' Get a single item from NetBox. app String of netbox app, e.g., ``dcim``, ``circuits``, ``ipam`` endpoint String of app endpoint, e.g., ``sites``, ``regions``, ``devices`` Returns a single dictionary To get an item based on ID. ...
[ "def", "get_", "(", "app", ",", "endpoint", ",", "id", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "_dict", "(", "_get", "(", "app", ",", "endpoint", ",", "id", "=", "id", ",", "auth_required", "=", "True", "if", "app", "in", "AUTH_...
Get a single item from NetBox. app String of netbox app, e.g., ``dcim``, ``circuits``, ``ipam`` endpoint String of app endpoint, e.g., ``sites``, ``regions``, ``devices`` Returns a single dictionary To get an item based on ID. .. code-block:: bash salt myminion netbox.ge...
[ "Get", "a", "single", "item", "from", "NetBox", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netbox.py#L170-L194
train
saltstack/salt
salt/modules/netbox.py
create_manufacturer
def create_manufacturer(name): ''' .. versionadded:: 2019.2.0 Create a device manufacturer. name The name of the manufacturer, e.g., ``Juniper`` CLI Example: .. code-block:: bash salt myminion netbox.create_manufacturer Juniper ''' nb_man = get_('dcim', 'manufacturer...
python
def create_manufacturer(name): ''' .. versionadded:: 2019.2.0 Create a device manufacturer. name The name of the manufacturer, e.g., ``Juniper`` CLI Example: .. code-block:: bash salt myminion netbox.create_manufacturer Juniper ''' nb_man = get_('dcim', 'manufacturer...
[ "def", "create_manufacturer", "(", "name", ")", ":", "nb_man", "=", "get_", "(", "'dcim'", ",", "'manufacturers'", ",", "name", "=", "name", ")", "if", "nb_man", ":", "return", "False", "else", ":", "payload", "=", "{", "'name'", ":", "name", ",", "'sl...
.. versionadded:: 2019.2.0 Create a device manufacturer. name The name of the manufacturer, e.g., ``Juniper`` CLI Example: .. code-block:: bash salt myminion netbox.create_manufacturer Juniper
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netbox.py#L197-L221
train
saltstack/salt
salt/modules/netbox.py
create_device_type
def create_device_type(model, manufacturer): ''' .. versionadded:: 2019.2.0 Create a device type. If the manufacturer doesn't exist, create a new manufacturer. model String of device model, e.g., ``MX480`` manufacturer String of device manufacturer, e.g., ``Juniper`` CLI Examp...
python
def create_device_type(model, manufacturer): ''' .. versionadded:: 2019.2.0 Create a device type. If the manufacturer doesn't exist, create a new manufacturer. model String of device model, e.g., ``MX480`` manufacturer String of device manufacturer, e.g., ``Juniper`` CLI Examp...
[ "def", "create_device_type", "(", "model", ",", "manufacturer", ")", ":", "nb_type", "=", "get_", "(", "'dcim'", ",", "'device-types'", ",", "model", "=", "model", ")", "if", "nb_type", ":", "return", "False", "nb_man", "=", "get_", "(", "'dcim'", ",", "...
.. versionadded:: 2019.2.0 Create a device type. If the manufacturer doesn't exist, create a new manufacturer. model String of device model, e.g., ``MX480`` manufacturer String of device manufacturer, e.g., ``Juniper`` CLI Example: .. code-block:: bash salt myminion netb...
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netbox.py#L224-L256
train
saltstack/salt
salt/modules/netbox.py
create_device_role
def create_device_role(role, color): ''' .. versionadded:: 2019.2.0 Create a device role role String of device role, e.g., ``router`` CLI Example: .. code-block:: bash salt myminion netbox.create_device_role router ''' nb_role = get_('dcim', 'device-roles', name=role...
python
def create_device_role(role, color): ''' .. versionadded:: 2019.2.0 Create a device role role String of device role, e.g., ``router`` CLI Example: .. code-block:: bash salt myminion netbox.create_device_role router ''' nb_role = get_('dcim', 'device-roles', name=role...
[ "def", "create_device_role", "(", "role", ",", "color", ")", ":", "nb_role", "=", "get_", "(", "'dcim'", ",", "'device-roles'", ",", "name", "=", "role", ")", "if", "nb_role", ":", "return", "False", "else", ":", "payload", "=", "{", "'name'", ":", "ro...
.. versionadded:: 2019.2.0 Create a device role role String of device role, e.g., ``router`` CLI Example: .. code-block:: bash salt myminion netbox.create_device_role router
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netbox.py#L259-L283
train
saltstack/salt
salt/modules/netbox.py
create_platform
def create_platform(platform): ''' .. versionadded:: 2019.2.0 Create a new device platform platform String of device platform, e.g., ``junos`` CLI Example: .. code-block:: bash salt myminion netbox.create_platform junos ''' nb_platform = get_('dcim', 'platforms', slu...
python
def create_platform(platform): ''' .. versionadded:: 2019.2.0 Create a new device platform platform String of device platform, e.g., ``junos`` CLI Example: .. code-block:: bash salt myminion netbox.create_platform junos ''' nb_platform = get_('dcim', 'platforms', slu...
[ "def", "create_platform", "(", "platform", ")", ":", "nb_platform", "=", "get_", "(", "'dcim'", ",", "'platforms'", ",", "slug", "=", "slugify", "(", "platform", ")", ")", "if", "nb_platform", ":", "return", "False", "else", ":", "payload", "=", "{", "'n...
.. versionadded:: 2019.2.0 Create a new device platform platform String of device platform, e.g., ``junos`` CLI Example: .. code-block:: bash salt myminion netbox.create_platform junos
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netbox.py#L286-L310
train
saltstack/salt
salt/modules/netbox.py
create_site
def create_site(site): ''' .. versionadded:: 2019.2.0 Create a new device site site String of device site, e.g., ``BRU`` CLI Example: .. code-block:: bash salt myminion netbox.create_site BRU ''' nb_site = get_('dcim', 'sites', name=site) if nb_site: retu...
python
def create_site(site): ''' .. versionadded:: 2019.2.0 Create a new device site site String of device site, e.g., ``BRU`` CLI Example: .. code-block:: bash salt myminion netbox.create_site BRU ''' nb_site = get_('dcim', 'sites', name=site) if nb_site: retu...
[ "def", "create_site", "(", "site", ")", ":", "nb_site", "=", "get_", "(", "'dcim'", ",", "'sites'", ",", "name", "=", "site", ")", "if", "nb_site", ":", "return", "False", "else", ":", "payload", "=", "{", "'name'", ":", "site", ",", "'slug'", ":", ...
.. versionadded:: 2019.2.0 Create a new device site site String of device site, e.g., ``BRU`` CLI Example: .. code-block:: bash salt myminion netbox.create_site BRU
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netbox.py#L313-L337
train
saltstack/salt
salt/modules/netbox.py
create_device
def create_device(name, role, model, manufacturer, site): ''' .. versionadded:: 2019.2.0 Create a new device with a name, role, model, manufacturer and site. All these components need to be already in Netbox. name The ...
python
def create_device(name, role, model, manufacturer, site): ''' .. versionadded:: 2019.2.0 Create a new device with a name, role, model, manufacturer and site. All these components need to be already in Netbox. name The ...
[ "def", "create_device", "(", "name", ",", "role", ",", "model", ",", "manufacturer", ",", "site", ")", ":", "try", ":", "nb_role", "=", "get_", "(", "'dcim'", ",", "'device-roles'", ",", "name", "=", "role", ")", "if", "not", "nb_role", ":", "return", ...
.. versionadded:: 2019.2.0 Create a new device with a name, role, model, manufacturer and site. All these components need to be already in Netbox. name The name of the device, e.g., ``edge_router`` role String of device role, e.g., ``router`` model String of device model, e...
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netbox.py#L340-L391
train
saltstack/salt
salt/modules/netbox.py
update_device
def update_device(name, **kwargs): ''' .. versionadded:: 2019.2.0 Add attributes to an existing device, identified by name. name The name of the device, e.g., ``edge_router`` kwargs Arguments to change in device, e.g., ``serial=JN2932930`` CLI Example: .. code-block:: bash...
python
def update_device(name, **kwargs): ''' .. versionadded:: 2019.2.0 Add attributes to an existing device, identified by name. name The name of the device, e.g., ``edge_router`` kwargs Arguments to change in device, e.g., ``serial=JN2932930`` CLI Example: .. code-block:: bash...
[ "def", "update_device", "(", "name", ",", "*", "*", "kwargs", ")", ":", "kwargs", "=", "__utils__", "[", "'args.clean_kwargs'", "]", "(", "*", "*", "kwargs", ")", "nb_device", "=", "_get", "(", "'dcim'", ",", "'devices'", ",", "auth_required", "=", "True...
.. versionadded:: 2019.2.0 Add attributes to an existing device, identified by name. name The name of the device, e.g., ``edge_router`` kwargs Arguments to change in device, e.g., ``serial=JN2932930`` CLI Example: .. code-block:: bash salt myminion netbox.update_device ed...
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netbox.py#L394-L420
train
saltstack/salt
salt/modules/netbox.py
create_inventory_item
def create_inventory_item(device_name, item_name, manufacturer_name=None, serial='', part_id='', description=''): ''' .. versionadded:: 2019.2.0 Add an inventory item to an exis...
python
def create_inventory_item(device_name, item_name, manufacturer_name=None, serial='', part_id='', description=''): ''' .. versionadded:: 2019.2.0 Add an inventory item to an exis...
[ "def", "create_inventory_item", "(", "device_name", ",", "item_name", ",", "manufacturer_name", "=", "None", ",", "serial", "=", "''", ",", "part_id", "=", "''", ",", "description", "=", "''", ")", ":", "nb_device", "=", "get_", "(", "'dcim'", ",", "'devic...
.. versionadded:: 2019.2.0 Add an inventory item to an existing device. device_name The name of the device, e.g., ``edge_router``. item_name String of inventory item name, e.g., ``Transceiver``. manufacturer_name String of inventory item manufacturer, e.g., ``Fiberstore``. ...
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netbox.py#L423-L473
train
saltstack/salt
salt/modules/netbox.py
delete_inventory_item
def delete_inventory_item(item_id): ''' .. versionadded:: 2019.2.0 Remove an item from a devices inventory. Identified by the netbox id item_id Integer of item to be deleted CLI Example: .. code-block:: bash salt myminion netbox.delete_inventory_item 1354 ''' nb_inve...
python
def delete_inventory_item(item_id): ''' .. versionadded:: 2019.2.0 Remove an item from a devices inventory. Identified by the netbox id item_id Integer of item to be deleted CLI Example: .. code-block:: bash salt myminion netbox.delete_inventory_item 1354 ''' nb_inve...
[ "def", "delete_inventory_item", "(", "item_id", ")", ":", "nb_inventory_item", "=", "_get", "(", "'dcim'", ",", "'inventory-items'", ",", "auth_required", "=", "True", ",", "id", "=", "item_id", ")", "nb_inventory_item", ".", "delete", "(", ")", "return", "{",...
.. versionadded:: 2019.2.0 Remove an item from a devices inventory. Identified by the netbox id item_id Integer of item to be deleted CLI Example: .. code-block:: bash salt myminion netbox.delete_inventory_item 1354
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netbox.py#L476-L493
train
saltstack/salt
salt/modules/netbox.py
create_interface_connection
def create_interface_connection(interface_a, interface_b): ''' .. versionadded:: 2019.2.0 Create an interface connection between 2 interfaces interface_a Interface id for Side A interface_b Interface id for Side B CLI Example: .. code-block:: bash salt myminion n...
python
def create_interface_connection(interface_a, interface_b): ''' .. versionadded:: 2019.2.0 Create an interface connection between 2 interfaces interface_a Interface id for Side A interface_b Interface id for Side B CLI Example: .. code-block:: bash salt myminion n...
[ "def", "create_interface_connection", "(", "interface_a", ",", "interface_b", ")", ":", "payload", "=", "{", "'interface_a'", ":", "interface_a", ",", "'interface_b'", ":", "interface_b", "}", "ret", "=", "_add", "(", "'dcim'", ",", "'interface-connections'", ",",...
.. versionadded:: 2019.2.0 Create an interface connection between 2 interfaces interface_a Interface id for Side A interface_b Interface id for Side B CLI Example: .. code-block:: bash salt myminion netbox.create_interface_connection 123 456
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netbox.py#L496-L519
train
saltstack/salt
salt/modules/netbox.py
get_interfaces
def get_interfaces(device_name=None, **kwargs): ''' .. versionadded:: 2019.2.0 Returns interfaces for a specific device using arbitrary netbox filters device_name The name of the device, e.g., ``edge_router`` kwargs Optional arguments to be used for filtering CLI Example: ...
python
def get_interfaces(device_name=None, **kwargs): ''' .. versionadded:: 2019.2.0 Returns interfaces for a specific device using arbitrary netbox filters device_name The name of the device, e.g., ``edge_router`` kwargs Optional arguments to be used for filtering CLI Example: ...
[ "def", "get_interfaces", "(", "device_name", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "not", "device_name", ":", "device_name", "=", "__opts__", "[", "'id'", "]", "netbox_device", "=", "get_", "(", "'dcim'", ",", "'devices'", ",", "name", "=...
.. versionadded:: 2019.2.0 Returns interfaces for a specific device using arbitrary netbox filters device_name The name of the device, e.g., ``edge_router`` kwargs Optional arguments to be used for filtering CLI Example: .. code-block:: bash salt myminion netbox.get_inte...
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netbox.py#L522-L546
train
saltstack/salt
salt/modules/netbox.py
openconfig_interfaces
def openconfig_interfaces(device_name=None): ''' .. versionadded:: 2019.2.0 Return a dictionary structured as standardised in the `openconfig-interfaces <http://ops.openconfig.net/branches/master/openconfig-interfaces.html>`_ YANG model, containing physical and configuration data available in Netbo...
python
def openconfig_interfaces(device_name=None): ''' .. versionadded:: 2019.2.0 Return a dictionary structured as standardised in the `openconfig-interfaces <http://ops.openconfig.net/branches/master/openconfig-interfaces.html>`_ YANG model, containing physical and configuration data available in Netbo...
[ "def", "openconfig_interfaces", "(", "device_name", "=", "None", ")", ":", "oc_if", "=", "{", "}", "interfaces", "=", "get_interfaces", "(", "device_name", "=", "device_name", ")", "ipaddresses", "=", "get_ipaddresses", "(", "device_name", "=", "device_name", ")...
.. versionadded:: 2019.2.0 Return a dictionary structured as standardised in the `openconfig-interfaces <http://ops.openconfig.net/branches/master/openconfig-interfaces.html>`_ YANG model, containing physical and configuration data available in Netbox, e.g., IP addresses, MTU, enabled / disabled, etc. ...
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netbox.py#L549-L641
train
saltstack/salt
salt/modules/netbox.py
openconfig_lacp
def openconfig_lacp(device_name=None): ''' .. versionadded:: 2019.2.0 Return a dictionary structured as standardised in the `openconfig-lacp <http://ops.openconfig.net/branches/master/openconfig-lacp.html>`_ YANG model, with configuration data for Link Aggregation Control Protocol (LACP) for ag...
python
def openconfig_lacp(device_name=None): ''' .. versionadded:: 2019.2.0 Return a dictionary structured as standardised in the `openconfig-lacp <http://ops.openconfig.net/branches/master/openconfig-lacp.html>`_ YANG model, with configuration data for Link Aggregation Control Protocol (LACP) for ag...
[ "def", "openconfig_lacp", "(", "device_name", "=", "None", ")", ":", "oc_lacp", "=", "{", "}", "interfaces", "=", "get_interfaces", "(", "device_name", "=", "device_name", ")", "for", "interface", "in", "interfaces", ":", "if", "not", "interface", "[", "'lag...
.. versionadded:: 2019.2.0 Return a dictionary structured as standardised in the `openconfig-lacp <http://ops.openconfig.net/branches/master/openconfig-lacp.html>`_ YANG model, with configuration data for Link Aggregation Control Protocol (LACP) for aggregate interfaces. .. note:: The ``in...
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netbox.py#L644-L697
train
saltstack/salt
salt/modules/netbox.py
create_interface
def create_interface(device_name, interface_name, mac_address=None, description=None, enabled=None, lag=None, lag_parent=None, form_factor=None): ''' .. versionadded...
python
def create_interface(device_name, interface_name, mac_address=None, description=None, enabled=None, lag=None, lag_parent=None, form_factor=None): ''' .. versionadded...
[ "def", "create_interface", "(", "device_name", ",", "interface_name", ",", "mac_address", "=", "None", ",", "description", "=", "None", ",", "enabled", "=", "None", ",", "lag", "=", "None", ",", "lag_parent", "=", "None", ",", "form_factor", "=", "None", "...
.. versionadded:: 2019.2.0 Attach an interface to a device. If not all arguments are provided, they will default to Netbox defaults. device_name The name of the device, e.g., ``edge_router`` interface_name The name of the interface, e.g., ``TenGigE0/0/0/0`` mac_address Stri...
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netbox.py#L700-L766
train
saltstack/salt
salt/modules/netbox.py
update_interface
def update_interface(device_name, interface_name, **kwargs): ''' .. versionadded:: 2019.2.0 Update an existing interface with new attributes. device_name The name of the device, e.g., ``edge_router`` interface_name The name of the interface, e.g., ``ae13`` kwargs Argume...
python
def update_interface(device_name, interface_name, **kwargs): ''' .. versionadded:: 2019.2.0 Update an existing interface with new attributes. device_name The name of the device, e.g., ``edge_router`` interface_name The name of the interface, e.g., ``ae13`` kwargs Argume...
[ "def", "update_interface", "(", "device_name", ",", "interface_name", ",", "*", "*", "kwargs", ")", ":", "nb_device", "=", "get_", "(", "'dcim'", ",", "'devices'", ",", "name", "=", "device_name", ")", "nb_interface", "=", "_get", "(", "'dcim'", ",", "'int...
.. versionadded:: 2019.2.0 Update an existing interface with new attributes. device_name The name of the device, e.g., ``edge_router`` interface_name The name of the interface, e.g., ``ae13`` kwargs Arguments to change in interface, e.g., ``mac_address=50:87:69:53:32:D0`` ...
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netbox.py#L769-L802
train
saltstack/salt
salt/modules/netbox.py
delete_interface
def delete_interface(device_name, interface_name): ''' .. versionadded:: 2019.2.0 Delete an interface from a device. device_name The name of the device, e.g., ``edge_router``. interface_name The name of the interface, e.g., ``ae13`` CLI Example: .. code-block:: bash ...
python
def delete_interface(device_name, interface_name): ''' .. versionadded:: 2019.2.0 Delete an interface from a device. device_name The name of the device, e.g., ``edge_router``. interface_name The name of the interface, e.g., ``ae13`` CLI Example: .. code-block:: bash ...
[ "def", "delete_interface", "(", "device_name", ",", "interface_name", ")", ":", "nb_device", "=", "get_", "(", "'dcim'", ",", "'devices'", ",", "name", "=", "device_name", ")", "nb_interface", "=", "_get", "(", "'dcim'", ",", "'interfaces'", ",", "auth_require...
.. versionadded:: 2019.2.0 Delete an interface from a device. device_name The name of the device, e.g., ``edge_router``. interface_name The name of the interface, e.g., ``ae13`` CLI Example: .. code-block:: bash salt myminion netbox.delete_interface edge_router ae13
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netbox.py#L805-L828
train
saltstack/salt
salt/modules/netbox.py
make_interface_child
def make_interface_child(device_name, interface_name, parent_name): ''' .. versionadded:: 2019.2.0 Set an interface as part of a LAG. device_name The name of the device, e.g., ``edge_router``. interface_name The name of the interface to be attached to LAG, e.g., ``xe-1/0/2``. ...
python
def make_interface_child(device_name, interface_name, parent_name): ''' .. versionadded:: 2019.2.0 Set an interface as part of a LAG. device_name The name of the device, e.g., ``edge_router``. interface_name The name of the interface to be attached to LAG, e.g., ``xe-1/0/2``. ...
[ "def", "make_interface_child", "(", "device_name", ",", "interface_name", ",", "parent_name", ")", ":", "nb_device", "=", "get_", "(", "'dcim'", ",", "'devices'", ",", "name", "=", "device_name", ")", "nb_parent", "=", "get_", "(", "'dcim'", ",", "'interfaces'...
.. versionadded:: 2019.2.0 Set an interface as part of a LAG. device_name The name of the device, e.g., ``edge_router``. interface_name The name of the interface to be attached to LAG, e.g., ``xe-1/0/2``. parent_name The name of the LAG interface, e.g., ``ae13``. CLI Exa...
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netbox.py#L852-L878
train
saltstack/salt
salt/modules/netbox.py
create_ipaddress
def create_ipaddress(ip_address, family, device=None, interface=None): ''' .. versionadded:: 2019.2.0 Add an IP address, and optionally attach it to an interface. ip_address The IP address and CIDR, e.g., ``192.168.1.1/24`` family Integer of IP family, e.g., ``4`` device ...
python
def create_ipaddress(ip_address, family, device=None, interface=None): ''' .. versionadded:: 2019.2.0 Add an IP address, and optionally attach it to an interface. ip_address The IP address and CIDR, e.g., ``192.168.1.1/24`` family Integer of IP family, e.g., ``4`` device ...
[ "def", "create_ipaddress", "(", "ip_address", ",", "family", ",", "device", "=", "None", ",", "interface", "=", "None", ")", ":", "nb_addr", "=", "None", "payload", "=", "{", "'family'", ":", "family", ",", "'address'", ":", "ip_address", "}", "if", "int...
.. versionadded:: 2019.2.0 Add an IP address, and optionally attach it to an interface. ip_address The IP address and CIDR, e.g., ``192.168.1.1/24`` family Integer of IP family, e.g., ``4`` device The name of the device to attach IP to, e.g., ``edge_router`` interface ...
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netbox.py#L907-L947
train
saltstack/salt
salt/modules/netbox.py
delete_ipaddress
def delete_ipaddress(ipaddr_id): ''' .. versionadded:: 2019.2.0 Delete an IP address. IP addresses in Netbox are a combination of address and the interface it is assigned to. id The Netbox id for the IP address. CLI Example: .. code-block:: bash salt myminion netbox.dele...
python
def delete_ipaddress(ipaddr_id): ''' .. versionadded:: 2019.2.0 Delete an IP address. IP addresses in Netbox are a combination of address and the interface it is assigned to. id The Netbox id for the IP address. CLI Example: .. code-block:: bash salt myminion netbox.dele...
[ "def", "delete_ipaddress", "(", "ipaddr_id", ")", ":", "nb_ipaddr", "=", "_get", "(", "'ipam'", ",", "'ip-addresses'", ",", "auth_required", "=", "True", ",", "id", "=", "ipaddr_id", ")", "if", "nb_ipaddr", ":", "nb_ipaddr", ".", "delete", "(", ")", "retur...
.. versionadded:: 2019.2.0 Delete an IP address. IP addresses in Netbox are a combination of address and the interface it is assigned to. id The Netbox id for the IP address. CLI Example: .. code-block:: bash salt myminion netbox.delete_ipaddress 9002
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netbox.py#L950-L971
train
saltstack/salt
salt/modules/netbox.py
create_circuit_provider
def create_circuit_provider(name, asn=None): ''' .. versionadded:: 2019.2.0 Create a new Netbox circuit provider name The name of the circuit provider asn The ASN of the circuit provider CLI Example: .. code-block:: bash salt myminion netbox.create_circuit_provid...
python
def create_circuit_provider(name, asn=None): ''' .. versionadded:: 2019.2.0 Create a new Netbox circuit provider name The name of the circuit provider asn The ASN of the circuit provider CLI Example: .. code-block:: bash salt myminion netbox.create_circuit_provid...
[ "def", "create_circuit_provider", "(", "name", ",", "asn", "=", "None", ")", ":", "nb_circuit_provider", "=", "get_", "(", "'circuits'", ",", "'providers'", ",", "name", "=", "name", ")", "payload", "=", "{", "}", "if", "nb_circuit_provider", ":", "if", "n...
.. versionadded:: 2019.2.0 Create a new Netbox circuit provider name The name of the circuit provider asn The ASN of the circuit provider CLI Example: .. code-block:: bash salt myminion netbox.create_circuit_provider Telia 1299
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netbox.py#L974-L1013
train
saltstack/salt
salt/modules/netbox.py
get_circuit_provider
def get_circuit_provider(name, asn=None): ''' .. versionadded:: 2019.2.0 Get a circuit provider with a given name and optional ASN. name The name of the circuit provider asn The ASN of the circuit provider CLI Example: .. code-block:: bash salt myminion netbox.ge...
python
def get_circuit_provider(name, asn=None): ''' .. versionadded:: 2019.2.0 Get a circuit provider with a given name and optional ASN. name The name of the circuit provider asn The ASN of the circuit provider CLI Example: .. code-block:: bash salt myminion netbox.ge...
[ "def", "get_circuit_provider", "(", "name", ",", "asn", "=", "None", ")", ":", "if", "asn", ":", "nb_circuit_provider", "=", "get_", "(", "'circuits'", ",", "'providers'", ",", "asn", "=", "asn", ")", "else", ":", "nb_circuit_provider", "=", "get_", "(", ...
.. versionadded:: 2019.2.0 Get a circuit provider with a given name and optional ASN. name The name of the circuit provider asn The ASN of the circuit provider CLI Example: .. code-block:: bash salt myminion netbox.get_circuit_provider Telia 1299
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netbox.py#L1016-L1037
train
saltstack/salt
salt/modules/netbox.py
create_circuit_type
def create_circuit_type(name): ''' .. versionadded:: 2019.2.0 Create a new Netbox circuit type. name The name of the circuit type CLI Example: .. code-block:: bash salt myminion netbox.create_circuit_type Transit ''' nb_circuit_type = get_('circuits', 'circuit-types'...
python
def create_circuit_type(name): ''' .. versionadded:: 2019.2.0 Create a new Netbox circuit type. name The name of the circuit type CLI Example: .. code-block:: bash salt myminion netbox.create_circuit_type Transit ''' nb_circuit_type = get_('circuits', 'circuit-types'...
[ "def", "create_circuit_type", "(", "name", ")", ":", "nb_circuit_type", "=", "get_", "(", "'circuits'", ",", "'circuit-types'", ",", "slug", "=", "slugify", "(", "name", ")", ")", "if", "nb_circuit_type", ":", "return", "False", "else", ":", "payload", "=", ...
.. versionadded:: 2019.2.0 Create a new Netbox circuit type. name The name of the circuit type CLI Example: .. code-block:: bash salt myminion netbox.create_circuit_type Transit
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netbox.py#L1040-L1067
train
saltstack/salt
salt/modules/netbox.py
create_circuit
def create_circuit(name, provider_id, circuit_type, description=None): ''' .. versionadded:: 2019.2.0 Create a new Netbox circuit name Name of the circuit provider_id The netbox id of the circuit provider circuit_type The name of the circuit type asn The ASN...
python
def create_circuit(name, provider_id, circuit_type, description=None): ''' .. versionadded:: 2019.2.0 Create a new Netbox circuit name Name of the circuit provider_id The netbox id of the circuit provider circuit_type The name of the circuit type asn The ASN...
[ "def", "create_circuit", "(", "name", ",", "provider_id", ",", "circuit_type", ",", "description", "=", "None", ")", ":", "nb_circuit_provider", "=", "get_", "(", "'circuits'", ",", "'providers'", ",", "provider_id", ")", "nb_circuit_type", "=", "get_", "(", "...
.. versionadded:: 2019.2.0 Create a new Netbox circuit name Name of the circuit provider_id The netbox id of the circuit provider circuit_type The name of the circuit type asn The ASN of the circuit provider description The description of the circuit ...
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netbox.py#L1070-L1113
train
saltstack/salt
salt/modules/netbox.py
create_circuit_termination
def create_circuit_termination(circuit, interface, device, speed, xconnect_id=None, term_side='A'): ''' .. versionadded:: 2019.2.0 Terminate a circuit on an interface circuit The name of the circuit interface The name of the interface to terminate on device The name of ...
python
def create_circuit_termination(circuit, interface, device, speed, xconnect_id=None, term_side='A'): ''' .. versionadded:: 2019.2.0 Terminate a circuit on an interface circuit The name of the circuit interface The name of the interface to terminate on device The name of ...
[ "def", "create_circuit_termination", "(", "circuit", ",", "interface", ",", "device", ",", "speed", ",", "xconnect_id", "=", "None", ",", "term_side", "=", "'A'", ")", ":", "nb_device", "=", "get_", "(", "'dcim'", ",", "'devices'", ",", "name", "=", "devic...
.. versionadded:: 2019.2.0 Terminate a circuit on an interface circuit The name of the circuit interface The name of the interface to terminate on device The name of the device the interface belongs to speed The speed of the circuit, in Kbps xconnect_id ...
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netbox.py#L1116-L1164
train
saltstack/salt
salt/renderers/aws_kms.py
_cfg
def _cfg(key, default=None): ''' Return the requested value from the aws_kms key in salt configuration. If it's not set, return the default. ''' root_cfg = __salt__.get('config.get', __opts__.get) kms_cfg = root_cfg('aws_kms', {}) return kms_cfg.get(key, default)
python
def _cfg(key, default=None): ''' Return the requested value from the aws_kms key in salt configuration. If it's not set, return the default. ''' root_cfg = __salt__.get('config.get', __opts__.get) kms_cfg = root_cfg('aws_kms', {}) return kms_cfg.get(key, default)
[ "def", "_cfg", "(", "key", ",", "default", "=", "None", ")", ":", "root_cfg", "=", "__salt__", ".", "get", "(", "'config.get'", ",", "__opts__", ".", "get", ")", "kms_cfg", "=", "root_cfg", "(", "'aws_kms'", ",", "{", "}", ")", "return", "kms_cfg", "...
Return the requested value from the aws_kms key in salt configuration. If it's not set, return the default.
[ "Return", "the", "requested", "value", "from", "the", "aws_kms", "key", "in", "salt", "configuration", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/renderers/aws_kms.py#L102-L110
train
saltstack/salt
salt/renderers/aws_kms.py
_session
def _session(): ''' Return the boto3 session to use for the KMS client. If aws_kms:profile_name is set in the salt configuration, use that profile. Otherwise, fall back on the default aws profile. We use the boto3 profile system to avoid having to duplicate individual boto3 configuration setti...
python
def _session(): ''' Return the boto3 session to use for the KMS client. If aws_kms:profile_name is set in the salt configuration, use that profile. Otherwise, fall back on the default aws profile. We use the boto3 profile system to avoid having to duplicate individual boto3 configuration setti...
[ "def", "_session", "(", ")", ":", "profile_name", "=", "_cfg", "(", "'profile_name'", ")", "if", "profile_name", ":", "log", ".", "info", "(", "'Using the \"%s\" aws profile.'", ",", "profile_name", ")", "else", ":", "log", ".", "info", "(", "'aws_kms:profile_...
Return the boto3 session to use for the KMS client. If aws_kms:profile_name is set in the salt configuration, use that profile. Otherwise, fall back on the default aws profile. We use the boto3 profile system to avoid having to duplicate individual boto3 configuration settings in salt configuration.
[ "Return", "the", "boto3", "session", "to", "use", "for", "the", "KMS", "client", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/renderers/aws_kms.py#L125-L151
train
saltstack/salt
salt/renderers/aws_kms.py
_api_decrypt
def _api_decrypt(): ''' Return the response dictionary from the KMS decrypt API call. ''' kms = _kms() data_key = _cfg_data_key() try: return kms.decrypt(CiphertextBlob=data_key) except botocore.exceptions.ClientError as orig_exc: error_code = orig_exc.response.get('Error', {...
python
def _api_decrypt(): ''' Return the response dictionary from the KMS decrypt API call. ''' kms = _kms() data_key = _cfg_data_key() try: return kms.decrypt(CiphertextBlob=data_key) except botocore.exceptions.ClientError as orig_exc: error_code = orig_exc.response.get('Error', {...
[ "def", "_api_decrypt", "(", ")", ":", "kms", "=", "_kms", "(", ")", "data_key", "=", "_cfg_data_key", "(", ")", "try", ":", "return", "kms", ".", "decrypt", "(", "CiphertextBlob", "=", "data_key", ")", "except", "botocore", ".", "exceptions", ".", "Clien...
Return the response dictionary from the KMS decrypt API call.
[ "Return", "the", "response", "dictionary", "from", "the", "KMS", "decrypt", "API", "call", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/renderers/aws_kms.py#L162-L176
train