partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
absent
Ensures that the named DNS record is absent. name The host portion of the DNS record, e.g., 'webserver'. Name and zone are concatenated when the entry is created unless name includes a trailing dot, so make sure that information is not duplicated in these two arguments. zone ...
salt/states/ddns.py
def absent(name, zone, data=None, rdtype=None, **kwargs): ''' Ensures that the named DNS record is absent. name The host portion of the DNS record, e.g., 'webserver'. Name and zone are concatenated when the entry is created unless name includes a trailing dot, so make sure that info...
def absent(name, zone, data=None, rdtype=None, **kwargs): ''' Ensures that the named DNS record is absent. name The host portion of the DNS record, e.g., 'webserver'. Name and zone are concatenated when the entry is created unless name includes a trailing dot, so make sure that info...
[ "Ensures", "that", "the", "named", "DNS", "record", "is", "absent", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/ddns.py#L94-L145
[ "def", "absent", "(", "name", ",", "zone", ",", "data", "=", "None", ",", "rdtype", "=", "None", ",", "*", "*", "kwargs", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "False", ",", "'c...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
render
Accepts JSON as a string or as a file object and runs it through the JSON parser. :rtype: A Python data structure
salt/renderers/json.py
def render(json_data, saltenv='base', sls='', **kws): ''' Accepts JSON as a string or as a file object and runs it through the JSON parser. :rtype: A Python data structure ''' if not isinstance(json_data, six.string_types): json_data = json_data.read() if json_data.startswith('#!')...
def render(json_data, saltenv='base', sls='', **kws): ''' Accepts JSON as a string or as a file object and runs it through the JSON parser. :rtype: A Python data structure ''' if not isinstance(json_data, six.string_types): json_data = json_data.read() if json_data.startswith('#!')...
[ "Accepts", "JSON", "as", "a", "string", "or", "as", "a", "file", "object", "and", "runs", "it", "through", "the", "JSON", "parser", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/renderers/json.py#L16-L30
[ "def", "render", "(", "json_data", ",", "saltenv", "=", "'base'", ",", "sls", "=", "''", ",", "*", "*", "kws", ")", ":", "if", "not", "isinstance", "(", "json_data", ",", "six", ".", "string_types", ")", ":", "json_data", "=", "json_data", ".", "read...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_cmd
Wrapper to run at(1) or return None.
salt/modules/at.py
def _cmd(binary, *args): ''' Wrapper to run at(1) or return None. ''' binary = salt.utils.path.which(binary) if not binary: raise CommandNotFoundError('{0}: command not found'.format(binary)) cmd = [binary] + list(args) return __salt__['cmd.run_stdout']([binary] + list(args), ...
def _cmd(binary, *args): ''' Wrapper to run at(1) or return None. ''' binary = salt.utils.path.which(binary) if not binary: raise CommandNotFoundError('{0}: command not found'.format(binary)) cmd = [binary] + list(args) return __salt__['cmd.run_stdout']([binary] + list(args), ...
[ "Wrapper", "to", "run", "at", "(", "1", ")", "or", "return", "None", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/at.py#L51-L60
[ "def", "_cmd", "(", "binary", ",", "*", "args", ")", ":", "binary", "=", "salt", ".", "utils", ".", "path", ".", "which", "(", "binary", ")", "if", "not", "binary", ":", "raise", "CommandNotFoundError", "(", "'{0}: command not found'", ".", "format", "("...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
atq
List all queued and running jobs or only those with an optional 'tag'. CLI Example: .. code-block:: bash salt '*' at.atq salt '*' at.atq [tag] salt '*' at.atq [job number]
salt/modules/at.py
def atq(tag=None): ''' List all queued and running jobs or only those with an optional 'tag'. CLI Example: .. code-block:: bash salt '*' at.atq salt '*' at.atq [tag] salt '*' at.atq [job number] ''' jobs = [] # Shim to produce output similar to what __virtual_...
def atq(tag=None): ''' List all queued and running jobs or only those with an optional 'tag'. CLI Example: .. code-block:: bash salt '*' at.atq salt '*' at.atq [tag] salt '*' at.atq [job number] ''' jobs = [] # Shim to produce output similar to what __virtual_...
[ "List", "all", "queued", "and", "running", "jobs", "or", "only", "those", "with", "an", "optional", "tag", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/at.py#L63-L163
[ "def", "atq", "(", "tag", "=", "None", ")", ":", "jobs", "=", "[", "]", "# Shim to produce output similar to what __virtual__() should do", "# but __salt__ isn't available in __virtual__()", "# Tested on CentOS 5.8", "if", "__grains__", "[", "'os_family'", "]", "==", "'RedH...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
atrm
Remove jobs from the queue. CLI Example: .. code-block:: bash salt '*' at.atrm <jobid> <jobid> .. <jobid> salt '*' at.atrm all salt '*' at.atrm all [tag]
salt/modules/at.py
def atrm(*args): ''' Remove jobs from the queue. CLI Example: .. code-block:: bash salt '*' at.atrm <jobid> <jobid> .. <jobid> salt '*' at.atrm all salt '*' at.atrm all [tag] ''' # Need to do this here also since we use atq() if not salt.utils.path.which('at'): ...
def atrm(*args): ''' Remove jobs from the queue. CLI Example: .. code-block:: bash salt '*' at.atrm <jobid> <jobid> .. <jobid> salt '*' at.atrm all salt '*' at.atrm all [tag] ''' # Need to do this here also since we use atq() if not salt.utils.path.which('at'): ...
[ "Remove", "jobs", "from", "the", "queue", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/at.py#L166-L207
[ "def", "atrm", "(", "*", "args", ")", ":", "# Need to do this here also since we use atq()", "if", "not", "salt", ".", "utils", ".", "path", ".", "which", "(", "'at'", ")", ":", "return", "'\\'at.atrm\\' is not available.'", "if", "not", "args", ":", "return", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
at
Add a job to the queue. The 'timespec' follows the format documented in the at(1) manpage. CLI Example: .. code-block:: bash salt '*' at.at <timespec> <cmd> [tag=<tag>] [runas=<user>] salt '*' at.at 12:05am '/sbin/reboot' tag=reboot salt '*' at.at '3:05am +3 days' 'bin/myscri...
salt/modules/at.py
def at(*args, **kwargs): # pylint: disable=C0103 ''' Add a job to the queue. The 'timespec' follows the format documented in the at(1) manpage. CLI Example: .. code-block:: bash salt '*' at.at <timespec> <cmd> [tag=<tag>] [runas=<user>] salt '*' at.at 12:05am '/sbin/reboot' ...
def at(*args, **kwargs): # pylint: disable=C0103 ''' Add a job to the queue. The 'timespec' follows the format documented in the at(1) manpage. CLI Example: .. code-block:: bash salt '*' at.at <timespec> <cmd> [tag=<tag>] [runas=<user>] salt '*' at.at 12:05am '/sbin/reboot' ...
[ "Add", "a", "job", "to", "the", "queue", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/at.py#L210-L263
[ "def", "at", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# pylint: disable=C0103", "if", "len", "(", "args", ")", "<", "2", ":", "return", "{", "'jobs'", ":", "[", "]", "}", "# Shim to produce output similar to what __virtual__() should do", "# but _...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
atc
Print the at(1) script that will run for the passed job id. This is mostly for debugging so the output will just be text. CLI Example: .. code-block:: bash salt '*' at.atc <jobid>
salt/modules/at.py
def atc(jobid): ''' Print the at(1) script that will run for the passed job id. This is mostly for debugging so the output will just be text. CLI Example: .. code-block:: bash salt '*' at.atc <jobid> ''' # Shim to produce output similar to what __virtual__() should do # bu...
def atc(jobid): ''' Print the at(1) script that will run for the passed job id. This is mostly for debugging so the output will just be text. CLI Example: .. code-block:: bash salt '*' at.atc <jobid> ''' # Shim to produce output similar to what __virtual__() should do # bu...
[ "Print", "the", "at", "(", "1", ")", "script", "that", "will", "run", "for", "the", "passed", "job", "id", ".", "This", "is", "mostly", "for", "debugging", "so", "the", "output", "will", "just", "be", "text", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/at.py#L266-L287
[ "def", "atc", "(", "jobid", ")", ":", "# Shim to produce output similar to what __virtual__() should do", "# but __salt__ isn't available in __virtual__()", "output", "=", "_cmd", "(", "'at'", ",", "'-c'", ",", "six", ".", "text_type", "(", "jobid", ")", ")", "if", "o...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_atq
Return match jobs list
salt/modules/at.py
def _atq(**kwargs): ''' Return match jobs list ''' jobs = [] runas = kwargs.get('runas', None) tag = kwargs.get('tag', None) hour = kwargs.get('hour', None) minute = kwargs.get('minute', None) day = kwargs.get('day', None) month = kwargs.get('month', None) year = kwargs.get...
def _atq(**kwargs): ''' Return match jobs list ''' jobs = [] runas = kwargs.get('runas', None) tag = kwargs.get('tag', None) hour = kwargs.get('hour', None) minute = kwargs.get('minute', None) day = kwargs.get('day', None) month = kwargs.get('month', None) year = kwargs.get...
[ "Return", "match", "jobs", "list" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/at.py#L290-L368
[ "def", "_atq", "(", "*", "*", "kwargs", ")", ":", "jobs", "=", "[", "]", "runas", "=", "kwargs", ".", "get", "(", "'runas'", ",", "None", ")", "tag", "=", "kwargs", ".", "get", "(", "'tag'", ",", "None", ")", "hour", "=", "kwargs", ".", "get", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_render_profile
Render profile as Jinja2. :param path: :return:
salt/cli/support/__init__.py
def _render_profile(path, caller, runner): ''' Render profile as Jinja2. :param path: :return: ''' env = jinja2.Environment(loader=jinja2.FileSystemLoader(os.path.dirname(path)), trim_blocks=False) return env.get_template(os.path.basename(path)).render(salt=caller, runners=runner).strip()
def _render_profile(path, caller, runner): ''' Render profile as Jinja2. :param path: :return: ''' env = jinja2.Environment(loader=jinja2.FileSystemLoader(os.path.dirname(path)), trim_blocks=False) return env.get_template(os.path.basename(path)).render(salt=caller, runners=runner).strip()
[ "Render", "profile", "as", "Jinja2", ".", ":", "param", "path", ":", ":", "return", ":" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/support/__init__.py#L15-L22
[ "def", "_render_profile", "(", "path", ",", "caller", ",", "runner", ")", ":", "env", "=", "jinja2", ".", "Environment", "(", "loader", "=", "jinja2", ".", "FileSystemLoader", "(", "os", ".", "path", ".", "dirname", "(", "path", ")", ")", ",", "trim_bl...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
get_profile
Get profile. :param profile: :return:
salt/cli/support/__init__.py
def get_profile(profile, caller, runner): ''' Get profile. :param profile: :return: ''' profiles = profile.split(',') data = {} for profile in profiles: if os.path.basename(profile) == profile: profile = profile.split('.')[0] # Trim extension if someone added it ...
def get_profile(profile, caller, runner): ''' Get profile. :param profile: :return: ''' profiles = profile.split(',') data = {} for profile in profiles: if os.path.basename(profile) == profile: profile = profile.split('.')[0] # Trim extension if someone added it ...
[ "Get", "profile", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/support/__init__.py#L25-L52
[ "def", "get_profile", "(", "profile", ",", "caller", ",", "runner", ")", ":", "profiles", "=", "profile", ".", "split", "(", "','", ")", "data", "=", "{", "}", "for", "profile", "in", "profiles", ":", "if", "os", ".", "path", ".", "basename", "(", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
get_profiles
Get available profiles. :return:
salt/cli/support/__init__.py
def get_profiles(config): ''' Get available profiles. :return: ''' profiles = [] for profile_name in os.listdir(os.path.join(os.path.dirname(__file__), 'profiles')): if profile_name.endswith('.yml'): profiles.append(profile_name.split('.')[0]) return sorted(profiles)
def get_profiles(config): ''' Get available profiles. :return: ''' profiles = [] for profile_name in os.listdir(os.path.join(os.path.dirname(__file__), 'profiles')): if profile_name.endswith('.yml'): profiles.append(profile_name.split('.')[0]) return sorted(profiles)
[ "Get", "available", "profiles", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/support/__init__.py#L55-L66
[ "def", "get_profiles", "(", "config", ")", ":", "profiles", "=", "[", "]", "for", "profile_name", "in", "os", ".", "listdir", "(", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "dirname", "(", "__file__", ")", ",", "'profiles'", ")", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
get_user
Get the current user
salt/utils/user.py
def get_user(): ''' Get the current user ''' if HAS_PWD: ret = pwd.getpwuid(os.geteuid()).pw_name elif HAS_WIN_FUNCTIONS and salt.utils.win_functions.HAS_WIN32: ret = salt.utils.win_functions.get_current_user() else: raise CommandExecutionError( 'Required exte...
def get_user(): ''' Get the current user ''' if HAS_PWD: ret = pwd.getpwuid(os.geteuid()).pw_name elif HAS_WIN_FUNCTIONS and salt.utils.win_functions.HAS_WIN32: ret = salt.utils.win_functions.get_current_user() else: raise CommandExecutionError( 'Required exte...
[ "Get", "the", "current", "user" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/user.py#L54-L65
[ "def", "get_user", "(", ")", ":", "if", "HAS_PWD", ":", "ret", "=", "pwd", ".", "getpwuid", "(", "os", ".", "geteuid", "(", ")", ")", ".", "pw_name", "elif", "HAS_WIN_FUNCTIONS", "and", "salt", ".", "utils", ".", "win_functions", ".", "HAS_WIN32", ":",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
get_uid
Get the uid for a given user name. If no user given, the current euid will be returned. If the user does not exist, None will be returned. On systems which do not support pwd or os.geteuid, None will be returned.
salt/utils/user.py
def get_uid(user=None): ''' Get the uid for a given user name. If no user given, the current euid will be returned. If the user does not exist, None will be returned. On systems which do not support pwd or os.geteuid, None will be returned. ''' if not HAS_PWD: return None elif user i...
def get_uid(user=None): ''' Get the uid for a given user name. If no user given, the current euid will be returned. If the user does not exist, None will be returned. On systems which do not support pwd or os.geteuid, None will be returned. ''' if not HAS_PWD: return None elif user i...
[ "Get", "the", "uid", "for", "a", "given", "user", "name", ".", "If", "no", "user", "given", "the", "current", "euid", "will", "be", "returned", ".", "If", "the", "user", "does", "not", "exist", "None", "will", "be", "returned", ".", "On", "systems", ...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/user.py#L69-L86
[ "def", "get_uid", "(", "user", "=", "None", ")", ":", "if", "not", "HAS_PWD", ":", "return", "None", "elif", "user", "is", "None", ":", "try", ":", "return", "os", ".", "geteuid", "(", ")", "except", "AttributeError", ":", "return", "None", "else", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_win_user_token_is_admin
Using the win32 api, determine if the user with token 'user_token' has administrator rights. See MSDN entry here: http://msdn.microsoft.com/en-us/library/aa376389(VS.85).aspx
salt/utils/user.py
def _win_user_token_is_admin(user_token): ''' Using the win32 api, determine if the user with token 'user_token' has administrator rights. See MSDN entry here: http://msdn.microsoft.com/en-us/library/aa376389(VS.85).aspx ''' class SID_IDENTIFIER_AUTHORITY(ctypes.Structure): _fie...
def _win_user_token_is_admin(user_token): ''' Using the win32 api, determine if the user with token 'user_token' has administrator rights. See MSDN entry here: http://msdn.microsoft.com/en-us/library/aa376389(VS.85).aspx ''' class SID_IDENTIFIER_AUTHORITY(ctypes.Structure): _fie...
[ "Using", "the", "win32", "api", "determine", "if", "the", "user", "with", "token", "user_token", "has", "administrator", "rights", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/user.py#L89-L131
[ "def", "_win_user_token_is_admin", "(", "user_token", ")", ":", "class", "SID_IDENTIFIER_AUTHORITY", "(", "ctypes", ".", "Structure", ")", ":", "_fields_", "=", "[", "(", "\"byte0\"", ",", "ctypes", ".", "c_byte", ")", ",", "(", "\"byte1\"", ",", "ctypes", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
get_specific_user
Get a user name for publishing. If you find the user is "root" attempt to be more specific
salt/utils/user.py
def get_specific_user(): ''' Get a user name for publishing. If you find the user is "root" attempt to be more specific ''' user = get_user() if salt.utils.platform.is_windows(): if _win_current_user_is_admin(): return 'sudo_{0}'.format(user) else: env_vars = ('SU...
def get_specific_user(): ''' Get a user name for publishing. If you find the user is "root" attempt to be more specific ''' user = get_user() if salt.utils.platform.is_windows(): if _win_current_user_is_admin(): return 'sudo_{0}'.format(user) else: env_vars = ('SU...
[ "Get", "a", "user", "name", "for", "publishing", ".", "If", "you", "find", "the", "user", "is", "root", "attempt", "to", "be", "more", "specific" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/user.py#L142-L157
[ "def", "get_specific_user", "(", ")", ":", "user", "=", "get_user", "(", ")", "if", "salt", ".", "utils", ".", "platform", ".", "is_windows", "(", ")", ":", "if", "_win_current_user_is_admin", "(", ")", ":", "return", "'sudo_{0}'", ".", "format", "(", "u...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
chugid
Change the current process to belong to the specified user (and the groups to which it belongs)
salt/utils/user.py
def chugid(runas, group=None): ''' Change the current process to belong to the specified user (and the groups to which it belongs) ''' uinfo = pwd.getpwnam(runas) supgroups = [] supgroups_seen = set() if group: try: target_pw_gid = grp.getgrnam(group).gr_gid ...
def chugid(runas, group=None): ''' Change the current process to belong to the specified user (and the groups to which it belongs) ''' uinfo = pwd.getpwnam(runas) supgroups = [] supgroups_seen = set() if group: try: target_pw_gid = grp.getgrnam(group).gr_gid ...
[ "Change", "the", "current", "process", "to", "belong", "to", "the", "specified", "user", "(", "and", "the", "groups", "to", "which", "it", "belongs", ")" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/user.py#L160-L229
[ "def", "chugid", "(", "runas", ",", "group", "=", "None", ")", ":", "uinfo", "=", "pwd", ".", "getpwnam", "(", "runas", ")", "supgroups", "=", "[", "]", "supgroups_seen", "=", "set", "(", ")", "if", "group", ":", "try", ":", "target_pw_gid", "=", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
chugid_and_umask
Helper method for for subprocess.Popen to initialise uid/gid and umask for the new process.
salt/utils/user.py
def chugid_and_umask(runas, umask, group=None): ''' Helper method for for subprocess.Popen to initialise uid/gid and umask for the new process. ''' set_runas = False set_grp = False current_user = getpass.getuser() if runas and runas != current_user: set_runas = True run...
def chugid_and_umask(runas, umask, group=None): ''' Helper method for for subprocess.Popen to initialise uid/gid and umask for the new process. ''' set_runas = False set_grp = False current_user = getpass.getuser() if runas and runas != current_user: set_runas = True run...
[ "Helper", "method", "for", "for", "subprocess", ".", "Popen", "to", "initialise", "uid", "/", "gid", "and", "umask", "for", "the", "new", "process", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/user.py#L232-L257
[ "def", "chugid_and_umask", "(", "runas", ",", "umask", ",", "group", "=", "None", ")", ":", "set_runas", "=", "False", "set_grp", "=", "False", "current_user", "=", "getpass", ".", "getuser", "(", ")", "if", "runas", "and", "runas", "!=", "current_user", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
get_default_group
Returns the specified user's default group. If the user doesn't exist, a KeyError will be raised.
salt/utils/user.py
def get_default_group(user): ''' Returns the specified user's default group. If the user doesn't exist, a KeyError will be raised. ''' return grp.getgrgid(pwd.getpwnam(user).pw_gid).gr_name \ if HAS_GRP and HAS_PWD \ else None
def get_default_group(user): ''' Returns the specified user's default group. If the user doesn't exist, a KeyError will be raised. ''' return grp.getgrgid(pwd.getpwnam(user).pw_gid).gr_name \ if HAS_GRP and HAS_PWD \ else None
[ "Returns", "the", "specified", "user", "s", "default", "group", ".", "If", "the", "user", "doesn", "t", "exist", "a", "KeyError", "will", "be", "raised", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/user.py#L260-L267
[ "def", "get_default_group", "(", "user", ")", ":", "return", "grp", ".", "getgrgid", "(", "pwd", ".", "getpwnam", "(", "user", ")", ".", "pw_gid", ")", ".", "gr_name", "if", "HAS_GRP", "and", "HAS_PWD", "else", "None" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
train
get_group_list
Returns a list of all of the system group names of which the user is a member.
salt/utils/user.py
def get_group_list(user, include_default=True): ''' Returns a list of all of the system group names of which the user is a member. ''' if HAS_GRP is False or HAS_PWD is False: return [] group_names = None ugroups = set() if hasattr(os, 'getgrouplist'): # Try os.getgroupli...
def get_group_list(user, include_default=True): ''' Returns a list of all of the system group names of which the user is a member. ''' if HAS_GRP is False or HAS_PWD is False: return [] group_names = None ugroups = set() if hasattr(os, 'getgrouplist'): # Try os.getgroupli...
[ "Returns", "a", "list", "of", "all", "of", "the", "system", "group", "names", "of", "which", "the", "user", "is", "a", "member", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/user.py#L270-L326
[ "def", "get_group_list", "(", "user", ",", "include_default", "=", "True", ")", ":", "if", "HAS_GRP", "is", "False", "or", "HAS_PWD", "is", "False", ":", "return", "[", "]", "group_names", "=", "None", "ugroups", "=", "set", "(", ")", "if", "hasattr", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
get_group_dict
Returns a dict of all of the system groups as keys, and group ids as values, of which the user is a member. E.g.: {'staff': 501, 'sudo': 27}
salt/utils/user.py
def get_group_dict(user=None, include_default=True): ''' Returns a dict of all of the system groups as keys, and group ids as values, of which the user is a member. E.g.: {'staff': 501, 'sudo': 27} ''' if HAS_GRP is False or HAS_PWD is False: return {} group_dict = {} group_names...
def get_group_dict(user=None, include_default=True): ''' Returns a dict of all of the system groups as keys, and group ids as values, of which the user is a member. E.g.: {'staff': 501, 'sudo': 27} ''' if HAS_GRP is False or HAS_PWD is False: return {} group_dict = {} group_names...
[ "Returns", "a", "dict", "of", "all", "of", "the", "system", "groups", "as", "keys", "and", "group", "ids", "as", "values", "of", "which", "the", "user", "is", "a", "member", ".", "E", ".", "g", ".", ":", "{", "staff", ":", "501", "sudo", ":", "27...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/user.py#L329-L341
[ "def", "get_group_dict", "(", "user", "=", "None", ",", "include_default", "=", "True", ")", ":", "if", "HAS_GRP", "is", "False", "or", "HAS_PWD", "is", "False", ":", "return", "{", "}", "group_dict", "=", "{", "}", "group_names", "=", "get_group_list", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
get_gid_list
Returns a list of all of the system group IDs of which the user is a member.
salt/utils/user.py
def get_gid_list(user, include_default=True): ''' Returns a list of all of the system group IDs of which the user is a member. ''' if HAS_GRP is False or HAS_PWD is False: return [] gid_list = list( six.itervalues( get_group_dict(user, include_default=include_default)...
def get_gid_list(user, include_default=True): ''' Returns a list of all of the system group IDs of which the user is a member. ''' if HAS_GRP is False or HAS_PWD is False: return [] gid_list = list( six.itervalues( get_group_dict(user, include_default=include_default)...
[ "Returns", "a", "list", "of", "all", "of", "the", "system", "group", "IDs", "of", "which", "the", "user", "is", "a", "member", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/user.py#L344-L356
[ "def", "get_gid_list", "(", "user", ",", "include_default", "=", "True", ")", ":", "if", "HAS_GRP", "is", "False", "or", "HAS_PWD", "is", "False", ":", "return", "[", "]", "gid_list", "=", "list", "(", "six", ".", "itervalues", "(", "get_group_dict", "("...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
get_gid
Get the gid for a given group name. If no group given, the current egid will be returned. If the group does not exist, None will be returned. On systems which do not support grp or os.getegid it will return None.
salt/utils/user.py
def get_gid(group=None): ''' Get the gid for a given group name. If no group given, the current egid will be returned. If the group does not exist, None will be returned. On systems which do not support grp or os.getegid it will return None. ''' if not HAS_GRP: return None if group i...
def get_gid(group=None): ''' Get the gid for a given group name. If no group given, the current egid will be returned. If the group does not exist, None will be returned. On systems which do not support grp or os.getegid it will return None. ''' if not HAS_GRP: return None if group i...
[ "Get", "the", "gid", "for", "a", "given", "group", "name", ".", "If", "no", "group", "given", "the", "current", "egid", "will", "be", "returned", ".", "If", "the", "group", "does", "not", "exist", "None", "will", "be", "returned", ".", "On", "systems",...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/user.py#L359-L376
[ "def", "get_gid", "(", "group", "=", "None", ")", ":", "if", "not", "HAS_GRP", ":", "return", "None", "if", "group", "is", "None", ":", "try", ":", "return", "os", ".", "getegid", "(", ")", "except", "AttributeError", ":", "return", "None", "else", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
html_override_tool
Bypass the normal handler and serve HTML for all URLs The ``app_path`` setting must be non-empty and the request must ask for ``text/html`` in the ``Accept`` header.
salt/netapi/rest_cherrypy/app.py
def html_override_tool(): ''' Bypass the normal handler and serve HTML for all URLs The ``app_path`` setting must be non-empty and the request must ask for ``text/html`` in the ``Accept`` header. ''' apiopts = cherrypy.config['apiopts'] request = cherrypy.request url_blacklist = ( ...
def html_override_tool(): ''' Bypass the normal handler and serve HTML for all URLs The ``app_path`` setting must be non-empty and the request must ask for ``text/html`` in the ``Accept`` header. ''' apiopts = cherrypy.config['apiopts'] request = cherrypy.request url_blacklist = ( ...
[ "Bypass", "the", "normal", "handler", "and", "serve", "HTML", "for", "all", "URLs" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_cherrypy/app.py#L649-L681
[ "def", "html_override_tool", "(", ")", ":", "apiopts", "=", "cherrypy", ".", "config", "[", "'apiopts'", "]", "request", "=", "cherrypy", ".", "request", "url_blacklist", "=", "(", "apiopts", ".", "get", "(", "'app_path'", ",", "'/app'", ")", ",", "apiopts...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
salt_token_tool
If the custom authentication header is supplied, put it in the cookie dict so the rest of the session-based auth works as intended
salt/netapi/rest_cherrypy/app.py
def salt_token_tool(): ''' If the custom authentication header is supplied, put it in the cookie dict so the rest of the session-based auth works as intended ''' x_auth = cherrypy.request.headers.get('X-Auth-Token', None) # X-Auth-Token header trumps session cookie if x_auth: cherry...
def salt_token_tool(): ''' If the custom authentication header is supplied, put it in the cookie dict so the rest of the session-based auth works as intended ''' x_auth = cherrypy.request.headers.get('X-Auth-Token', None) # X-Auth-Token header trumps session cookie if x_auth: cherry...
[ "If", "the", "custom", "authentication", "header", "is", "supplied", "put", "it", "in", "the", "cookie", "dict", "so", "the", "rest", "of", "the", "session", "-", "based", "auth", "works", "as", "intended" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_cherrypy/app.py#L684-L693
[ "def", "salt_token_tool", "(", ")", ":", "x_auth", "=", "cherrypy", ".", "request", ".", "headers", ".", "get", "(", "'X-Auth-Token'", ",", "None", ")", "# X-Auth-Token header trumps session cookie", "if", "x_auth", ":", "cherrypy", ".", "request", ".", "cookie"...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
salt_api_acl_tool
..versionadded:: 2016.3.0 Verifies user requests against the API whitelist. (User/IP pair) in order to provide whitelisting for the API similar to the master, but over the API. ..code-block:: yaml rest_cherrypy: api_acl: users: '*': ...
salt/netapi/rest_cherrypy/app.py
def salt_api_acl_tool(username, request): ''' ..versionadded:: 2016.3.0 Verifies user requests against the API whitelist. (User/IP pair) in order to provide whitelisting for the API similar to the master, but over the API. ..code-block:: yaml rest_cherrypy: api_acl: ...
def salt_api_acl_tool(username, request): ''' ..versionadded:: 2016.3.0 Verifies user requests against the API whitelist. (User/IP pair) in order to provide whitelisting for the API similar to the master, but over the API. ..code-block:: yaml rest_cherrypy: api_acl: ...
[ "..", "versionadded", "::", "2016", ".", "3", ".", "0" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_cherrypy/app.py#L696-L762
[ "def", "salt_api_acl_tool", "(", "username", ",", "request", ")", ":", "failure_str", "=", "(", "\"[api_acl] Authentication failed for \"", "\"user %s from IP %s\"", ")", "success_str", "=", "(", "\"[api_acl] Authentication sucessful for \"", "\"user %s from IP %s\"", ")", "p...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
salt_ip_verify_tool
If there is a list of restricted IPs, verify current client is coming from one of those IPs.
salt/netapi/rest_cherrypy/app.py
def salt_ip_verify_tool(): ''' If there is a list of restricted IPs, verify current client is coming from one of those IPs. ''' # This is overly cumbersome and crude, # But, it's also safe... ish... salt_config = cherrypy.config.get('saltopts', None) if salt_config: cherrypy_conf...
def salt_ip_verify_tool(): ''' If there is a list of restricted IPs, verify current client is coming from one of those IPs. ''' # This is overly cumbersome and crude, # But, it's also safe... ish... salt_config = cherrypy.config.get('saltopts', None) if salt_config: cherrypy_conf...
[ "If", "there", "is", "a", "list", "of", "restricted", "IPs", "verify", "current", "client", "is", "coming", "from", "one", "of", "those", "IPs", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_cherrypy/app.py#L765-L783
[ "def", "salt_ip_verify_tool", "(", ")", ":", "# This is overly cumbersome and crude,", "# But, it's also safe... ish...", "salt_config", "=", "cherrypy", ".", "config", ".", "get", "(", "'saltopts'", ",", "None", ")", "if", "salt_config", ":", "cherrypy_conf", "=", "s...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
cors_tool
Handle both simple and complex CORS requests Add CORS headers to each response. If the request is a CORS preflight request swap out the default handler with a simple, single-purpose handler that verifies the request and provides a valid CORS response.
salt/netapi/rest_cherrypy/app.py
def cors_tool(): ''' Handle both simple and complex CORS requests Add CORS headers to each response. If the request is a CORS preflight request swap out the default handler with a simple, single-purpose handler that verifies the request and provides a valid CORS response. ''' req_head = che...
def cors_tool(): ''' Handle both simple and complex CORS requests Add CORS headers to each response. If the request is a CORS preflight request swap out the default handler with a simple, single-purpose handler that verifies the request and provides a valid CORS response. ''' req_head = che...
[ "Handle", "both", "simple", "and", "complex", "CORS", "requests" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_cherrypy/app.py#L798-L840
[ "def", "cors_tool", "(", ")", ":", "req_head", "=", "cherrypy", ".", "request", ".", "headers", "resp_head", "=", "cherrypy", ".", "response", ".", "headers", "# Always set response headers necessary for 'simple' CORS.", "resp_head", "[", "'Access-Control-Allow-Origin'", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
hypermedia_handler
Determine the best output format based on the Accept header, execute the regular handler, and transform the output to the request content type (even if it's an error). :param args: Pass args through to the main handler :param kwargs: Pass kwargs through to the main handler
salt/netapi/rest_cherrypy/app.py
def hypermedia_handler(*args, **kwargs): ''' Determine the best output format based on the Accept header, execute the regular handler, and transform the output to the request content type (even if it's an error). :param args: Pass args through to the main handler :param kwargs: Pass kwargs thro...
def hypermedia_handler(*args, **kwargs): ''' Determine the best output format based on the Accept header, execute the regular handler, and transform the output to the request content type (even if it's an error). :param args: Pass args through to the main handler :param kwargs: Pass kwargs thro...
[ "Determine", "the", "best", "output", "format", "based", "on", "the", "Accept", "header", "execute", "the", "regular", "handler", "and", "transform", "the", "output", "to", "the", "request", "content", "type", "(", "even", "if", "it", "s", "an", "error", "...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_cherrypy/app.py#L853-L918
[ "def", "hypermedia_handler", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# Execute the real handler. Handle or pass-through any errors we know how", "# to handle (auth & HTTP errors). Reformat any errors we don't know how to", "# handle as a data structure.", "try", ":", "c...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
hypermedia_out
Determine the best handler for the requested content type Wrap the normal handler and transform the output from that handler into the requested content type
salt/netapi/rest_cherrypy/app.py
def hypermedia_out(): ''' Determine the best handler for the requested content type Wrap the normal handler and transform the output from that handler into the requested content type ''' request = cherrypy.serving.request request._hypermedia_inner_handler = request.handler # If handler...
def hypermedia_out(): ''' Determine the best handler for the requested content type Wrap the normal handler and transform the output from that handler into the requested content type ''' request = cherrypy.serving.request request._hypermedia_inner_handler = request.handler # If handler...
[ "Determine", "the", "best", "handler", "for", "the", "requested", "content", "type" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_cherrypy/app.py#L921-L933
[ "def", "hypermedia_out", "(", ")", ":", "request", "=", "cherrypy", ".", "serving", ".", "request", "request", ".", "_hypermedia_inner_handler", "=", "request", ".", "handler", "# If handler has been explicitly set to None, don't override.", "if", "request", ".", "handl...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
process_request_body
A decorator to skip a processor function if process_request_body is False
salt/netapi/rest_cherrypy/app.py
def process_request_body(fn): ''' A decorator to skip a processor function if process_request_body is False ''' @functools.wraps(fn) def wrapped(*args, **kwargs): # pylint: disable=C0111 if cherrypy.request.process_request_body is not False: fn(*args, **kwargs) return wrappe...
def process_request_body(fn): ''' A decorator to skip a processor function if process_request_body is False ''' @functools.wraps(fn) def wrapped(*args, **kwargs): # pylint: disable=C0111 if cherrypy.request.process_request_body is not False: fn(*args, **kwargs) return wrappe...
[ "A", "decorator", "to", "skip", "a", "processor", "function", "if", "process_request_body", "is", "False" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_cherrypy/app.py#L936-L944
[ "def", "process_request_body", "(", "fn", ")", ":", "@", "functools", ".", "wraps", "(", "fn", ")", "def", "wrapped", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# pylint: disable=C0111", "if", "cherrypy", ".", "request", ".", "process_request_bo...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
urlencoded_processor
Accept x-www-form-urlencoded data (run through CherryPy's formatter) and reformat it into a Low State data structure. Since we can't easily represent complicated data structures with key-value pairs, any more complicated requirements (e.g. compound commands) must instead be delivered via JSON or YAML. ...
salt/netapi/rest_cherrypy/app.py
def urlencoded_processor(entity): ''' Accept x-www-form-urlencoded data (run through CherryPy's formatter) and reformat it into a Low State data structure. Since we can't easily represent complicated data structures with key-value pairs, any more complicated requirements (e.g. compound commands...
def urlencoded_processor(entity): ''' Accept x-www-form-urlencoded data (run through CherryPy's formatter) and reformat it into a Low State data structure. Since we can't easily represent complicated data structures with key-value pairs, any more complicated requirements (e.g. compound commands...
[ "Accept", "x", "-", "www", "-", "form", "-", "urlencoded", "data", "(", "run", "through", "CherryPy", "s", "formatter", ")", "and", "reformat", "it", "into", "a", "Low", "State", "data", "structure", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_cherrypy/app.py#L947-L969
[ "def", "urlencoded_processor", "(", "entity", ")", ":", "# First call out to CherryPy's default processor", "cherrypy", ".", "_cpreqbody", ".", "process_urlencoded", "(", "entity", ")", "cherrypy", ".", "_cpreqbody", ".", "process_urlencoded", "(", "entity", ")", "cherr...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
json_processor
Unserialize raw POST data in JSON format to a Python data structure. :param entity: raw POST data
salt/netapi/rest_cherrypy/app.py
def json_processor(entity): ''' Unserialize raw POST data in JSON format to a Python data structure. :param entity: raw POST data ''' if six.PY2: body = entity.fp.read() else: # https://github.com/cherrypy/cherrypy/pull/1572 contents = BytesIO() body = entity.fp....
def json_processor(entity): ''' Unserialize raw POST data in JSON format to a Python data structure. :param entity: raw POST data ''' if six.PY2: body = entity.fp.read() else: # https://github.com/cherrypy/cherrypy/pull/1572 contents = BytesIO() body = entity.fp....
[ "Unserialize", "raw", "POST", "data", "in", "JSON", "format", "to", "a", "Python", "data", "structure", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_cherrypy/app.py#L973-L993
[ "def", "json_processor", "(", "entity", ")", ":", "if", "six", ".", "PY2", ":", "body", "=", "entity", ".", "fp", ".", "read", "(", ")", "else", ":", "# https://github.com/cherrypy/cherrypy/pull/1572", "contents", "=", "BytesIO", "(", ")", "body", "=", "en...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
yaml_processor
Unserialize raw POST data in YAML format to a Python data structure. :param entity: raw POST data
salt/netapi/rest_cherrypy/app.py
def yaml_processor(entity): ''' Unserialize raw POST data in YAML format to a Python data structure. :param entity: raw POST data ''' if six.PY2: body = entity.fp.read() else: # https://github.com/cherrypy/cherrypy/pull/1572 contents = BytesIO() body = entity.fp....
def yaml_processor(entity): ''' Unserialize raw POST data in YAML format to a Python data structure. :param entity: raw POST data ''' if six.PY2: body = entity.fp.read() else: # https://github.com/cherrypy/cherrypy/pull/1572 contents = BytesIO() body = entity.fp....
[ "Unserialize", "raw", "POST", "data", "in", "YAML", "format", "to", "a", "Python", "data", "structure", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_cherrypy/app.py#L997-L1016
[ "def", "yaml_processor", "(", "entity", ")", ":", "if", "six", ".", "PY2", ":", "body", "=", "entity", ".", "fp", ".", "read", "(", ")", "else", ":", "# https://github.com/cherrypy/cherrypy/pull/1572", "contents", "=", "BytesIO", "(", ")", "body", "=", "en...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
hypermedia_in
Unserialize POST/PUT data of a specified Content-Type. The following custom processors all are intended to format Low State data and will place that data structure into the request object. :raises HTTPError: if the request contains a Content-Type that we do not have a processor for
salt/netapi/rest_cherrypy/app.py
def hypermedia_in(): ''' Unserialize POST/PUT data of a specified Content-Type. The following custom processors all are intended to format Low State data and will place that data structure into the request object. :raises HTTPError: if the request contains a Content-Type that we do not hav...
def hypermedia_in(): ''' Unserialize POST/PUT data of a specified Content-Type. The following custom processors all are intended to format Low State data and will place that data structure into the request object. :raises HTTPError: if the request contains a Content-Type that we do not hav...
[ "Unserialize", "POST", "/", "PUT", "data", "of", "a", "specified", "Content", "-", "Type", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_cherrypy/app.py#L1045-L1074
[ "def", "hypermedia_in", "(", ")", ":", "# Be liberal in what you accept", "ct_in_map", "=", "{", "'application/x-www-form-urlencoded'", ":", "urlencoded_processor", ",", "'application/json'", ":", "json_processor", ",", "'application/x-yaml'", ":", "yaml_processor", ",", "'...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
lowdata_fmt
Validate and format lowdata from incoming unserialized request data This tool requires that the hypermedia_in tool has already been run.
salt/netapi/rest_cherrypy/app.py
def lowdata_fmt(): ''' Validate and format lowdata from incoming unserialized request data This tool requires that the hypermedia_in tool has already been run. ''' if cherrypy.request.method.upper() != 'POST': return data = cherrypy.request.unserialized_data # if the data was sen...
def lowdata_fmt(): ''' Validate and format lowdata from incoming unserialized request data This tool requires that the hypermedia_in tool has already been run. ''' if cherrypy.request.method.upper() != 'POST': return data = cherrypy.request.unserialized_data # if the data was sen...
[ "Validate", "and", "format", "lowdata", "from", "incoming", "unserialized", "request", "data" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_cherrypy/app.py#L1077-L1100
[ "def", "lowdata_fmt", "(", ")", ":", "if", "cherrypy", ".", "request", ".", "method", ".", "upper", "(", ")", "!=", "'POST'", ":", "return", "data", "=", "cherrypy", ".", "request", ".", "unserialized_data", "# if the data was sent as urlencoded, we need to make i...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
get_app
Returns a WSGI app and a configuration dictionary
salt/netapi/rest_cherrypy/app.py
def get_app(opts): ''' Returns a WSGI app and a configuration dictionary ''' apiopts = opts.get(__name__.rsplit('.', 2)[-2], {}) # rest_cherrypy opts # Add Salt and salt-api config options to the main CherryPy config dict cherrypy.config['saltopts'] = opts cherrypy.config['apiopts'] = apio...
def get_app(opts): ''' Returns a WSGI app and a configuration dictionary ''' apiopts = opts.get(__name__.rsplit('.', 2)[-2], {}) # rest_cherrypy opts # Add Salt and salt-api config options to the main CherryPy config dict cherrypy.config['saltopts'] = opts cherrypy.config['apiopts'] = apio...
[ "Returns", "a", "WSGI", "app", "and", "a", "configuration", "dictionary" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_cherrypy/app.py#L2927-L2940
[ "def", "get_app", "(", "opts", ")", ":", "apiopts", "=", "opts", ".", "get", "(", "__name__", ".", "rsplit", "(", "'.'", ",", "2", ")", "[", "-", "2", "]", ",", "{", "}", ")", "# rest_cherrypy opts", "# Add Salt and salt-api config options to the main Cherry...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
LowDataAdapter.exec_lowstate
Pull a Low State data structure from request and execute the low-data chunks through Salt. The low-data chunks will be updated to include the authorization token for the current session.
salt/netapi/rest_cherrypy/app.py
def exec_lowstate(self, client=None, token=None): ''' Pull a Low State data structure from request and execute the low-data chunks through Salt. The low-data chunks will be updated to include the authorization token for the current session. ''' lowstate = cherrypy.request...
def exec_lowstate(self, client=None, token=None): ''' Pull a Low State data structure from request and execute the low-data chunks through Salt. The low-data chunks will be updated to include the authorization token for the current session. ''' lowstate = cherrypy.request...
[ "Pull", "a", "Low", "State", "data", "structure", "from", "request", "and", "execute", "the", "low", "-", "data", "chunks", "through", "Salt", ".", "The", "low", "-", "data", "chunks", "will", "be", "updated", "to", "include", "the", "authorization", "toke...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_cherrypy/app.py#L1155-L1208
[ "def", "exec_lowstate", "(", "self", ",", "client", "=", "None", ",", "token", "=", "None", ")", ":", "lowstate", "=", "cherrypy", ".", "request", ".", "lowstate", "# Release the session lock before executing any potentially", "# long-running Salt commands. This allows di...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
LowDataAdapter.POST
Send one or more Salt commands in the request body .. http:post:: / :reqheader X-Auth-Token: |req_token| :reqheader Accept: |req_accept| :reqheader Content-Type: |req_ct| :resheader Content-Type: |res_ct| :status 200: |200| :status 400:...
salt/netapi/rest_cherrypy/app.py
def POST(self, **kwargs): ''' Send one or more Salt commands in the request body .. http:post:: / :reqheader X-Auth-Token: |req_token| :reqheader Accept: |req_accept| :reqheader Content-Type: |req_ct| :resheader Content-Type: |res_ct| ...
def POST(self, **kwargs): ''' Send one or more Salt commands in the request body .. http:post:: / :reqheader X-Auth-Token: |req_token| :reqheader Accept: |req_accept| :reqheader Content-Type: |req_ct| :resheader Content-Type: |res_ct| ...
[ "Send", "one", "or", "more", "Salt", "commands", "in", "the", "request", "body" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_cherrypy/app.py#L1251-L1310
[ "def", "POST", "(", "self", ",", "*", "*", "kwargs", ")", ":", "return", "{", "'return'", ":", "list", "(", "self", ".", "exec_lowstate", "(", "token", "=", "cherrypy", ".", "session", ".", "get", "(", "'token'", ")", ")", ")", "}" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
train
Minions.GET
A convenience URL for getting lists of minions or getting minion details .. http:get:: /minions/(mid) :reqheader X-Auth-Token: |req_token| :reqheader Accept: |req_accept| :status 200: |200| :status 401: |401| :status 406: |406| **Ex...
salt/netapi/rest_cherrypy/app.py
def GET(self, mid=None): ''' A convenience URL for getting lists of minions or getting minion details .. http:get:: /minions/(mid) :reqheader X-Auth-Token: |req_token| :reqheader Accept: |req_accept| :status 200: |200| :status 401: |401|...
def GET(self, mid=None): ''' A convenience URL for getting lists of minions or getting minion details .. http:get:: /minions/(mid) :reqheader X-Auth-Token: |req_token| :reqheader Accept: |req_accept| :status 200: |200| :status 401: |401|...
[ "A", "convenience", "URL", "for", "getting", "lists", "of", "minions", "or", "getting", "minion", "details" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_cherrypy/app.py#L1321-L1366
[ "def", "GET", "(", "self", ",", "mid", "=", "None", ")", ":", "cherrypy", ".", "request", ".", "lowstate", "=", "[", "{", "'client'", ":", "'local'", ",", "'tgt'", ":", "mid", "or", "'*'", ",", "'fun'", ":", "'grains.items'", ",", "}", "]", "return...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
Minions.POST
Start an execution command and immediately return the job id .. http:post:: /minions :reqheader X-Auth-Token: |req_token| :reqheader Accept: |req_accept| :reqheader Content-Type: |req_ct| :resheader Content-Type: |res_ct| :status 200: |200| ...
salt/netapi/rest_cherrypy/app.py
def POST(self, **kwargs): ''' Start an execution command and immediately return the job id .. http:post:: /minions :reqheader X-Auth-Token: |req_token| :reqheader Accept: |req_accept| :reqheader Content-Type: |req_ct| :resheader Content-Type: |r...
def POST(self, **kwargs): ''' Start an execution command and immediately return the job id .. http:post:: /minions :reqheader X-Auth-Token: |req_token| :reqheader Accept: |req_accept| :reqheader Content-Type: |req_ct| :resheader Content-Type: |r...
[ "Start", "an", "execution", "command", "and", "immediately", "return", "the", "job", "id" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_cherrypy/app.py#L1368-L1432
[ "def", "POST", "(", "self", ",", "*", "*", "kwargs", ")", ":", "job_data", "=", "list", "(", "self", ".", "exec_lowstate", "(", "client", "=", "'local_async'", ",", "token", "=", "cherrypy", ".", "session", ".", "get", "(", "'token'", ")", ")", ")", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
Jobs.GET
A convenience URL for getting lists of previously run jobs or getting the return from a single job .. http:get:: /jobs/(jid) List jobs or show a single job from the job cache. :reqheader X-Auth-Token: |req_token| :reqheader Accept: |req_accept| :status...
salt/netapi/rest_cherrypy/app.py
def GET(self, jid=None, timeout=''): ''' A convenience URL for getting lists of previously run jobs or getting the return from a single job .. http:get:: /jobs/(jid) List jobs or show a single job from the job cache. :reqheader X-Auth-Token: |req_token| ...
def GET(self, jid=None, timeout=''): ''' A convenience URL for getting lists of previously run jobs or getting the return from a single job .. http:get:: /jobs/(jid) List jobs or show a single job from the job cache. :reqheader X-Auth-Token: |req_token| ...
[ "A", "convenience", "URL", "for", "getting", "lists", "of", "previously", "run", "jobs", "or", "getting", "the", "return", "from", "a", "single", "job" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_cherrypy/app.py#L1440-L1548
[ "def", "GET", "(", "self", ",", "jid", "=", "None", ",", "timeout", "=", "''", ")", ":", "lowstate", "=", "{", "'client'", ":", "'runner'", "}", "if", "jid", ":", "lowstate", ".", "update", "(", "{", "'fun'", ":", "'jobs.list_job'", ",", "'jid'", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
Keys.GET
Show the list of minion keys or detail on a specific key .. versionadded:: 2014.7.0 .. http:get:: /keys/(mid) List all keys or show a specific key :reqheader X-Auth-Token: |req_token| :reqheader Accept: |req_accept| :status 200: |200| :sta...
salt/netapi/rest_cherrypy/app.py
def GET(self, mid=None): ''' Show the list of minion keys or detail on a specific key .. versionadded:: 2014.7.0 .. http:get:: /keys/(mid) List all keys or show a specific key :reqheader X-Auth-Token: |req_token| :reqheader Accept: |req_accept| ...
def GET(self, mid=None): ''' Show the list of minion keys or detail on a specific key .. versionadded:: 2014.7.0 .. http:get:: /keys/(mid) List all keys or show a specific key :reqheader X-Auth-Token: |req_token| :reqheader Accept: |req_accept| ...
[ "Show", "the", "list", "of", "minion", "keys", "or", "detail", "on", "a", "specific", "key" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_cherrypy/app.py#L1561-L1646
[ "def", "GET", "(", "self", ",", "mid", "=", "None", ")", ":", "if", "mid", ":", "lowstate", "=", "[", "{", "'client'", ":", "'wheel'", ",", "'fun'", ":", "'key.finger'", ",", "'match'", ":", "mid", ",", "}", "]", "else", ":", "lowstate", "=", "["...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
Keys.POST
r''' Easily generate keys for a minion and auto-accept the new key Accepts all the same parameters as the :py:func:`key.gen_accept <salt.wheel.key.gen_accept>`. .. note:: A note about ``curl`` Avoid using the ``-i`` flag or HTTP headers will be written and produce...
salt/netapi/rest_cherrypy/app.py
def POST(self, **kwargs): r''' Easily generate keys for a minion and auto-accept the new key Accepts all the same parameters as the :py:func:`key.gen_accept <salt.wheel.key.gen_accept>`. .. note:: A note about ``curl`` Avoid using the ``-i`` flag or HTTP headers will...
def POST(self, **kwargs): r''' Easily generate keys for a minion and auto-accept the new key Accepts all the same parameters as the :py:func:`key.gen_accept <salt.wheel.key.gen_accept>`. .. note:: A note about ``curl`` Avoid using the ``-i`` flag or HTTP headers will...
[ "r", "Easily", "generate", "keys", "for", "a", "minion", "and", "auto", "-", "accept", "the", "new", "key" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_cherrypy/app.py#L1649-L1752
[ "def", "POST", "(", "self", ",", "*", "*", "kwargs", ")", ":", "lowstate", "=", "cherrypy", ".", "request", ".", "lowstate", "lowstate", "[", "0", "]", ".", "update", "(", "{", "'client'", ":", "'wheel'", ",", "'fun'", ":", "'key.gen_accept'", ",", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
Login.POST
:ref:`Authenticate <rest_cherrypy-auth>` against Salt's eauth system .. http:post:: /login :reqheader X-Auth-Token: |req_token| :reqheader Accept: |req_accept| :reqheader Content-Type: |req_ct| :form eauth: the eauth backend configured for the user ...
salt/netapi/rest_cherrypy/app.py
def POST(self, **kwargs): ''' :ref:`Authenticate <rest_cherrypy-auth>` against Salt's eauth system .. http:post:: /login :reqheader X-Auth-Token: |req_token| :reqheader Accept: |req_accept| :reqheader Content-Type: |req_ct| :form eauth: the eau...
def POST(self, **kwargs): ''' :ref:`Authenticate <rest_cherrypy-auth>` against Salt's eauth system .. http:post:: /login :reqheader X-Auth-Token: |req_token| :reqheader Accept: |req_accept| :reqheader Content-Type: |req_ct| :form eauth: the eau...
[ ":", "ref", ":", "Authenticate", "<rest_cherrypy", "-", "auth", ">", "against", "Salt", "s", "eauth", "system" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_cherrypy/app.py#L1805-L1932
[ "def", "POST", "(", "self", ",", "*", "*", "kwargs", ")", ":", "if", "not", "self", ".", "api", ".", "_is_master_running", "(", ")", ":", "raise", "salt", ".", "exceptions", ".", "SaltDaemonNotRunning", "(", "'Salt Master is not available.'", ")", "# the url...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
Token.POST
r''' .. http:post:: /token Generate a Salt eauth token :status 200: |200| :status 400: |400| :status 401: |401| **Example request:** .. code-block:: bash curl -sSk https://localhost:8000/token \ -H 'Content-type: ap...
salt/netapi/rest_cherrypy/app.py
def POST(self, **kwargs): r''' .. http:post:: /token Generate a Salt eauth token :status 200: |200| :status 400: |400| :status 401: |401| **Example request:** .. code-block:: bash curl -sSk https://localhost:8000/token \ ...
def POST(self, **kwargs): r''' .. http:post:: /token Generate a Salt eauth token :status 200: |200| :status 400: |400| :status 401: |401| **Example request:** .. code-block:: bash curl -sSk https://localhost:8000/token \ ...
[ "r", "..", "http", ":", "post", "::", "/", "token" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_cherrypy/app.py#L1964-L2016
[ "def", "POST", "(", "self", ",", "*", "*", "kwargs", ")", ":", "for", "creds", "in", "cherrypy", ".", "request", ".", "lowstate", ":", "try", ":", "creds", ".", "update", "(", "{", "'client'", ":", "'runner'", ",", "'fun'", ":", "'auth.mk_token'", ",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
Events._is_valid_token
Check if this is a valid salt-api token or valid Salt token salt-api tokens are regular session tokens that tie back to a real Salt token. Salt tokens are tokens generated by Salt's eauth system. :return bool: True if valid, False if not valid.
salt/netapi/rest_cherrypy/app.py
def _is_valid_token(self, auth_token): ''' Check if this is a valid salt-api token or valid Salt token salt-api tokens are regular session tokens that tie back to a real Salt token. Salt tokens are tokens generated by Salt's eauth system. :return bool: True if valid, False if n...
def _is_valid_token(self, auth_token): ''' Check if this is a valid salt-api token or valid Salt token salt-api tokens are regular session tokens that tie back to a real Salt token. Salt tokens are tokens generated by Salt's eauth system. :return bool: True if valid, False if n...
[ "Check", "if", "this", "is", "a", "valid", "salt", "-", "api", "token", "or", "valid", "Salt", "token" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_cherrypy/app.py#L2191-L2219
[ "def", "_is_valid_token", "(", "self", ",", "auth_token", ")", ":", "# Make sure that auth token is hex. If it's None, or something other", "# than hex, this will raise a ValueError.", "try", ":", "int", "(", "auth_token", ",", "16", ")", "except", "(", "TypeError", ",", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
Events.GET
r''' An HTTP stream of the Salt master event bus This stream is formatted per the Server Sent Events (SSE) spec. Each event is formatted as JSON. .. http:get:: /events :status 200: |200| :status 401: |401| :status 406: |406| :query token...
salt/netapi/rest_cherrypy/app.py
def GET(self, token=None, salt_token=None): r''' An HTTP stream of the Salt master event bus This stream is formatted per the Server Sent Events (SSE) spec. Each event is formatted as JSON. .. http:get:: /events :status 200: |200| :status 401: |401| ...
def GET(self, token=None, salt_token=None): r''' An HTTP stream of the Salt master event bus This stream is formatted per the Server Sent Events (SSE) spec. Each event is formatted as JSON. .. http:get:: /events :status 200: |200| :status 401: |401| ...
[ "r", "An", "HTTP", "stream", "of", "the", "Salt", "master", "event", "bus" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_cherrypy/app.py#L2221-L2380
[ "def", "GET", "(", "self", ",", "token", "=", "None", ",", "salt_token", "=", "None", ")", ":", "cookies", "=", "cherrypy", ".", "request", ".", "cookie", "auth_token", "=", "token", "or", "salt_token", "or", "(", "cookies", "[", "'session_id'", "]", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
WebsocketEndpoint.GET
Return a websocket connection of Salt's event stream .. http:get:: /ws/(token) :query format_events: The event stream will undergo server-side formatting if the ``format_events`` URL parameter is included in the request. This can be useful to avoid formatting on the ...
salt/netapi/rest_cherrypy/app.py
def GET(self, token=None, **kwargs): ''' Return a websocket connection of Salt's event stream .. http:get:: /ws/(token) :query format_events: The event stream will undergo server-side formatting if the ``format_events`` URL parameter is included in the request. ...
def GET(self, token=None, **kwargs): ''' Return a websocket connection of Salt's event stream .. http:get:: /ws/(token) :query format_events: The event stream will undergo server-side formatting if the ``format_events`` URL parameter is included in the request. ...
[ "Return", "a", "websocket", "connection", "of", "Salt", "s", "event", "stream" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_cherrypy/app.py#L2413-L2573
[ "def", "GET", "(", "self", ",", "token", "=", "None", ",", "*", "*", "kwargs", ")", ":", "# Pulling the session token from an URL param is a workaround for", "# browsers not supporting CORS in the EventSource API.", "if", "token", ":", "orig_session", ",", "_", "=", "ch...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
Webhook.POST
Fire an event in Salt with a custom event tag and data .. http:post:: /hook :status 200: |200| :status 401: |401| :status 406: |406| :status 413: request body is too large **Example request:** .. code-block:: bash curl -sS localhos...
salt/netapi/rest_cherrypy/app.py
def POST(self, *args, **kwargs): ''' Fire an event in Salt with a custom event tag and data .. http:post:: /hook :status 200: |200| :status 401: |401| :status 406: |406| :status 413: request body is too large **Example request:** ...
def POST(self, *args, **kwargs): ''' Fire an event in Salt with a custom event tag and data .. http:post:: /hook :status 200: |200| :status 401: |401| :status 406: |406| :status 413: request body is too large **Example request:** ...
[ "Fire", "an", "event", "in", "Salt", "with", "a", "custom", "event", "tag", "and", "data" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_cherrypy/app.py#L2643-L2739
[ "def", "POST", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "tag", "=", "'/'", ".", "join", "(", "itertools", ".", "chain", "(", "self", ".", "tag_base", ",", "args", ")", ")", "data", "=", "cherrypy", ".", "serving", ".", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
App.GET
Serve a single static file ignoring the remaining path This is useful in combination with a browser-based app using the HTML5 history API. .. http::get:: /app :reqheader X-Auth-Token: |req_token| :status 200: |200| :status 401: |401|
salt/netapi/rest_cherrypy/app.py
def GET(self, *args): ''' Serve a single static file ignoring the remaining path This is useful in combination with a browser-based app using the HTML5 history API. .. http::get:: /app :reqheader X-Auth-Token: |req_token| :status 200: |200| ...
def GET(self, *args): ''' Serve a single static file ignoring the remaining path This is useful in combination with a browser-based app using the HTML5 history API. .. http::get:: /app :reqheader X-Auth-Token: |req_token| :status 200: |200| ...
[ "Serve", "a", "single", "static", "file", "ignoring", "the", "remaining", "path" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_cherrypy/app.py#L2783-L2803
[ "def", "GET", "(", "self", ",", "*", "args", ")", ":", "apiopts", "=", "cherrypy", ".", "config", "[", "'apiopts'", "]", "default_index", "=", "os", ".", "path", ".", "abspath", "(", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "d...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
API._setattr_url_map
Set an attribute on the local instance for each key/val in url_map CherryPy uses class attributes to resolve URLs.
salt/netapi/rest_cherrypy/app.py
def _setattr_url_map(self): ''' Set an attribute on the local instance for each key/val in url_map CherryPy uses class attributes to resolve URLs. ''' if self.apiopts.get('enable_sessions', True) is False: url_blacklist = ['login', 'logout', 'minions', 'jobs'] ...
def _setattr_url_map(self): ''' Set an attribute on the local instance for each key/val in url_map CherryPy uses class attributes to resolve URLs. ''' if self.apiopts.get('enable_sessions', True) is False: url_blacklist = ['login', 'logout', 'minions', 'jobs'] ...
[ "Set", "an", "attribute", "on", "the", "local", "instance", "for", "each", "key", "/", "val", "in", "url_map" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_cherrypy/app.py#L2823-L2838
[ "def", "_setattr_url_map", "(", "self", ")", ":", "if", "self", ".", "apiopts", ".", "get", "(", "'enable_sessions'", ",", "True", ")", "is", "False", ":", "url_blacklist", "=", "[", "'login'", ",", "'logout'", ",", "'minions'", ",", "'jobs'", "]", "else...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
API._update_url_map
Assemble any dynamic or configurable URLs
salt/netapi/rest_cherrypy/app.py
def _update_url_map(self): ''' Assemble any dynamic or configurable URLs ''' if HAS_WEBSOCKETS: self.url_map.update({ 'ws': WebsocketEndpoint, }) # Allow the Webhook URL to be overridden from the conf. self.url_map.update({ ...
def _update_url_map(self): ''' Assemble any dynamic or configurable URLs ''' if HAS_WEBSOCKETS: self.url_map.update({ 'ws': WebsocketEndpoint, }) # Allow the Webhook URL to be overridden from the conf. self.url_map.update({ ...
[ "Assemble", "any", "dynamic", "or", "configurable", "URLs" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_cherrypy/app.py#L2840-L2857
[ "def", "_update_url_map", "(", "self", ")", ":", "if", "HAS_WEBSOCKETS", ":", "self", ".", "url_map", ".", "update", "(", "{", "'ws'", ":", "WebsocketEndpoint", ",", "}", ")", "# Allow the Webhook URL to be overridden from the conf.", "self", ".", "url_map", ".", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
API.get_conf
Combine the CherryPy configuration with the rest_cherrypy config values pulled from the master config and return the CherryPy configuration
salt/netapi/rest_cherrypy/app.py
def get_conf(self): ''' Combine the CherryPy configuration with the rest_cherrypy config values pulled from the master config and return the CherryPy configuration ''' conf = { 'global': { 'server.socket_host': self.apiopts.get('host', '0.0.0.0'), ...
def get_conf(self): ''' Combine the CherryPy configuration with the rest_cherrypy config values pulled from the master config and return the CherryPy configuration ''' conf = { 'global': { 'server.socket_host': self.apiopts.get('host', '0.0.0.0'), ...
[ "Combine", "the", "CherryPy", "configuration", "with", "the", "rest_cherrypy", "config", "values", "pulled", "from", "the", "master", "config", "and", "return", "the", "CherryPy", "configuration" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_cherrypy/app.py#L2866-L2924
[ "def", "get_conf", "(", "self", ")", ":", "conf", "=", "{", "'global'", ":", "{", "'server.socket_host'", ":", "self", ".", "apiopts", ".", "get", "(", "'host'", ",", "'0.0.0.0'", ")", ",", "'server.socket_port'", ":", "self", ".", "apiopts", ".", "get",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
get_disabled
Return a set of services that are installed but disabled CLI Example: .. code-block:: bash salt '*' service.get_disabled
salt/modules/gentoo_service.py
def get_disabled(): ''' Return a set of services that are installed but disabled CLI Example: .. code-block:: bash salt '*' service.get_disabled ''' (enabled_services, disabled_services) = _get_service_list(include_enabled=False, ...
def get_disabled(): ''' Return a set of services that are installed but disabled CLI Example: .. code-block:: bash salt '*' service.get_disabled ''' (enabled_services, disabled_services) = _get_service_list(include_enabled=False, ...
[ "Return", "a", "set", "of", "services", "that", "are", "installed", "but", "disabled" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/gentoo_service.py#L107-L119
[ "def", "get_disabled", "(", ")", ":", "(", "enabled_services", ",", "disabled_services", ")", "=", "_get_service_list", "(", "include_enabled", "=", "False", ",", "include_disabled", "=", "True", ")", "return", "sorted", "(", "disabled_services", ")" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
train
available
Returns ``True`` if the specified service is available, otherwise returns ``False``. CLI Example: .. code-block:: bash salt '*' service.available sshd
salt/modules/gentoo_service.py
def available(name): ''' Returns ``True`` if the specified service is available, otherwise returns ``False``. CLI Example: .. code-block:: bash salt '*' service.available sshd ''' (enabled_services, disabled_services) = _get_service_list(include_enabled=True, ...
def available(name): ''' Returns ``True`` if the specified service is available, otherwise returns ``False``. CLI Example: .. code-block:: bash salt '*' service.available sshd ''' (enabled_services, disabled_services) = _get_service_list(include_enabled=True, ...
[ "Returns", "True", "if", "the", "specified", "service", "is", "available", "otherwise", "returns", "False", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/gentoo_service.py#L122-L135
[ "def", "available", "(", "name", ")", ":", "(", "enabled_services", ",", "disabled_services", ")", "=", "_get_service_list", "(", "include_enabled", "=", "True", ",", "include_disabled", "=", "True", ")", "return", "name", "in", "enabled_services", "or", "name",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
get_all
Return all available boot services CLI Example: .. code-block:: bash salt '*' service.get_all
salt/modules/gentoo_service.py
def get_all(): ''' Return all available boot services CLI Example: .. code-block:: bash salt '*' service.get_all ''' (enabled_services, disabled_services) = _get_service_list(include_enabled=True, include_disabled=True) ...
def get_all(): ''' Return all available boot services CLI Example: .. code-block:: bash salt '*' service.get_all ''' (enabled_services, disabled_services) = _get_service_list(include_enabled=True, include_disabled=True) ...
[ "Return", "all", "available", "boot", "services" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/gentoo_service.py#L153-L166
[ "def", "get_all", "(", ")", ":", "(", "enabled_services", ",", "disabled_services", ")", "=", "_get_service_list", "(", "include_enabled", "=", "True", ",", "include_disabled", "=", "True", ")", "enabled_services", ".", "update", "(", "dict", "(", "[", "(", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
status
Return the status for a service. If the name contains globbing, a dict mapping service name to True/False values is returned. .. versionchanged:: 2018.3.0 The service name can now be a glob (e.g. ``salt*``) Args: name (str): The name of the service to check sig (str): Signature...
salt/modules/gentoo_service.py
def status(name, sig=None): ''' Return the status for a service. If the name contains globbing, a dict mapping service name to True/False values is returned. .. versionchanged:: 2018.3.0 The service name can now be a glob (e.g. ``salt*``) Args: name (str): The name of the servi...
def status(name, sig=None): ''' Return the status for a service. If the name contains globbing, a dict mapping service name to True/False values is returned. .. versionchanged:: 2018.3.0 The service name can now be a glob (e.g. ``salt*``) Args: name (str): The name of the servi...
[ "Return", "the", "status", "for", "a", "service", ".", "If", "the", "name", "contains", "globbing", "a", "dict", "mapping", "service", "name", "to", "True", "/", "False", "values", "is", "returned", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/gentoo_service.py#L239-L276
[ "def", "status", "(", "name", ",", "sig", "=", "None", ")", ":", "if", "sig", ":", "return", "bool", "(", "__salt__", "[", "'status.pid'", "]", "(", "sig", ")", ")", "contains_globbing", "=", "bool", "(", "re", ".", "search", "(", "r'\\*|\\?|\\[.+\\]'"...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
enable
Enable the named service to start at boot CLI Example: .. code-block:: bash salt '*' service.enable <service name> <runlevels=single-runlevel> salt '*' service.enable <service name> <runlevels=[runlevel1,runlevel2]>
salt/modules/gentoo_service.py
def enable(name, **kwargs): ''' Enable the named service to start at boot CLI Example: .. code-block:: bash salt '*' service.enable <service name> <runlevels=single-runlevel> salt '*' service.enable <service name> <runlevels=[runlevel1,runlevel2]> ''' if 'runlevels' in kwargs:...
def enable(name, **kwargs): ''' Enable the named service to start at boot CLI Example: .. code-block:: bash salt '*' service.enable <service name> <runlevels=single-runlevel> salt '*' service.enable <service name> <runlevels=[runlevel1,runlevel2]> ''' if 'runlevels' in kwargs:...
[ "Enable", "the", "named", "service", "to", "start", "at", "boot" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/gentoo_service.py#L279-L306
[ "def", "enable", "(", "name", ",", "*", "*", "kwargs", ")", ":", "if", "'runlevels'", "in", "kwargs", ":", "requested_levels", "=", "set", "(", "kwargs", "[", "'runlevels'", "]", "if", "isinstance", "(", "kwargs", "[", "'runlevels'", "]", ",", "list", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
disable
Disable the named service to start at boot CLI Example: .. code-block:: bash salt '*' service.disable <service name> <runlevels=single-runlevel> salt '*' service.disable <service name> <runlevels=[runlevel1,runlevel2]>
salt/modules/gentoo_service.py
def disable(name, **kwargs): ''' Disable the named service to start at boot CLI Example: .. code-block:: bash salt '*' service.disable <service name> <runlevels=single-runlevel> salt '*' service.disable <service name> <runlevels=[runlevel1,runlevel2]> ''' levels = [] if 'r...
def disable(name, **kwargs): ''' Disable the named service to start at boot CLI Example: .. code-block:: bash salt '*' service.disable <service name> <runlevels=single-runlevel> salt '*' service.disable <service name> <runlevels=[runlevel1,runlevel2]> ''' levels = [] if 'r...
[ "Disable", "the", "named", "service", "to", "start", "at", "boot" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/gentoo_service.py#L309-L328
[ "def", "disable", "(", "name", ",", "*", "*", "kwargs", ")", ":", "levels", "=", "[", "]", "if", "'runlevels'", "in", "kwargs", ":", "requested_levels", "=", "set", "(", "kwargs", "[", "'runlevels'", "]", "if", "isinstance", "(", "kwargs", "[", "'runle...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
enabled
Return True if the named service is enabled, false otherwise CLI Example: .. code-block:: bash salt '*' service.enabled <service name> <runlevels=single-runlevel> salt '*' service.enabled <service name> <runlevels=[runlevel1,runlevel2]>
salt/modules/gentoo_service.py
def enabled(name, **kwargs): ''' Return True if the named service is enabled, false otherwise CLI Example: .. code-block:: bash salt '*' service.enabled <service name> <runlevels=single-runlevel> salt '*' service.enabled <service name> <runlevels=[runlevel1,runlevel2]> ''' ena...
def enabled(name, **kwargs): ''' Return True if the named service is enabled, false otherwise CLI Example: .. code-block:: bash salt '*' service.enabled <service name> <runlevels=single-runlevel> salt '*' service.enabled <service name> <runlevels=[runlevel1,runlevel2]> ''' ena...
[ "Return", "True", "if", "the", "named", "service", "is", "enabled", "false", "otherwise" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/gentoo_service.py#L331-L349
[ "def", "enabled", "(", "name", ",", "*", "*", "kwargs", ")", ":", "enabled_services", "=", "get_enabled", "(", ")", "if", "name", "not", "in", "enabled_services", ":", "return", "False", "if", "'runlevels'", "not", "in", "kwargs", ":", "return", "True", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
managed
Create a virtualenv and optionally manage it with pip name Path to the virtualenv. venv_bin: virtualenv The name (and optionally path) of the virtualenv command. This can also be set globally in the minion config file as ``virtualenv.venv_bin``. requirements: None Path to ...
salt/states/virtualenv_mod.py
def managed(name, venv_bin=None, requirements=None, system_site_packages=False, distribute=False, use_wheel=False, clear=False, python=None, extra_search_dir=None, never_download=None, prompt=None, ...
def managed(name, venv_bin=None, requirements=None, system_site_packages=False, distribute=False, use_wheel=False, clear=False, python=None, extra_search_dir=None, never_download=None, prompt=None, ...
[ "Create", "a", "virtualenv", "and", "optionally", "manage", "it", "with", "pip" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/virtualenv_mod.py#L33-L337
[ "def", "managed", "(", "name", ",", "venv_bin", "=", "None", ",", "requirements", "=", "None", ",", "system_site_packages", "=", "False", ",", "distribute", "=", "False", ",", "use_wheel", "=", "False", ",", "clear", "=", "False", ",", "python", "=", "No...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_parse_settings_bond_1
Filters given options and outputs valid settings for bond1. If an option has a value that is not expected, this function will log what the Interface, Setting and what it was expecting.
salt/modules/rh_ip.py
def _parse_settings_bond_1(opts, iface, bond_def): ''' Filters given options and outputs valid settings for bond1. If an option has a value that is not expected, this function will log what the Interface, Setting and what it was expecting. ''' bond = {'mode': '1'} for binding in ['miim...
def _parse_settings_bond_1(opts, iface, bond_def): ''' Filters given options and outputs valid settings for bond1. If an option has a value that is not expected, this function will log what the Interface, Setting and what it was expecting. ''' bond = {'mode': '1'} for binding in ['miim...
[ "Filters", "given", "options", "and", "outputs", "valid", "settings", "for", "bond1", ".", "If", "an", "option", "has", "a", "value", "that", "is", "not", "expected", "this", "function", "will", "log", "what", "the", "Interface", "Setting", "and", "what", ...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rh_ip.py#L320-L356
[ "def", "_parse_settings_bond_1", "(", "opts", ",", "iface", ",", "bond_def", ")", ":", "bond", "=", "{", "'mode'", ":", "'1'", "}", "for", "binding", "in", "[", "'miimon'", ",", "'downdelay'", ",", "'updelay'", "]", ":", "if", "binding", "in", "opts", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_parse_settings_vlan
Filters given options and outputs valid settings for a vlan
salt/modules/rh_ip.py
def _parse_settings_vlan(opts, iface): ''' Filters given options and outputs valid settings for a vlan ''' vlan = {} if 'reorder_hdr' in opts: if opts['reorder_hdr'] in _CONFIG_TRUE + _CONFIG_FALSE: vlan.update({'reorder_hdr': opts['reorder_hdr']}) else: vali...
def _parse_settings_vlan(opts, iface): ''' Filters given options and outputs valid settings for a vlan ''' vlan = {} if 'reorder_hdr' in opts: if opts['reorder_hdr'] in _CONFIG_TRUE + _CONFIG_FALSE: vlan.update({'reorder_hdr': opts['reorder_hdr']}) else: vali...
[ "Filters", "given", "options", "and", "outputs", "valid", "settings", "for", "a", "vlan" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rh_ip.py#L571-L596
[ "def", "_parse_settings_vlan", "(", "opts", ",", "iface", ")", ":", "vlan", "=", "{", "}", "if", "'reorder_hdr'", "in", "opts", ":", "if", "opts", "[", "'reorder_hdr'", "]", "in", "_CONFIG_TRUE", "+", "_CONFIG_FALSE", ":", "vlan", ".", "update", "(", "{"...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_parse_settings_eth
Filters given options and outputs valid settings for a network interface.
salt/modules/rh_ip.py
def _parse_settings_eth(opts, iface_type, enabled, iface): ''' Filters given options and outputs valid settings for a network interface. ''' result = {'name': iface} if 'proto' in opts: valid = ['none', 'bootp', 'dhcp'] if opts['proto'] in valid: result['proto'] = opt...
def _parse_settings_eth(opts, iface_type, enabled, iface): ''' Filters given options and outputs valid settings for a network interface. ''' result = {'name': iface} if 'proto' in opts: valid = ['none', 'bootp', 'dhcp'] if opts['proto'] in valid: result['proto'] = opt...
[ "Filters", "given", "options", "and", "outputs", "valid", "settings", "for", "a", "network", "interface", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rh_ip.py#L599-L816
[ "def", "_parse_settings_eth", "(", "opts", ",", "iface_type", ",", "enabled", ",", "iface", ")", ":", "result", "=", "{", "'name'", ":", "iface", "}", "if", "'proto'", "in", "opts", ":", "valid", "=", "[", "'none'", ",", "'bootp'", ",", "'dhcp'", "]", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_parse_network_settings
Filters given options and outputs valid settings for the global network settings file.
salt/modules/rh_ip.py
def _parse_network_settings(opts, current): ''' Filters given options and outputs valid settings for the global network settings file. ''' # Normalize keys opts = dict((k.lower(), v) for (k, v) in six.iteritems(opts)) current = dict((k.lower(), v) for (k, v) in six.iteritems(current)) #...
def _parse_network_settings(opts, current): ''' Filters given options and outputs valid settings for the global network settings file. ''' # Normalize keys opts = dict((k.lower(), v) for (k, v) in six.iteritems(opts)) current = dict((k.lower(), v) for (k, v) in six.iteritems(current)) #...
[ "Filters", "given", "options", "and", "outputs", "valid", "settings", "for", "the", "global", "network", "settings", "file", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rh_ip.py#L836-L903
[ "def", "_parse_network_settings", "(", "opts", ",", "current", ")", ":", "# Normalize keys", "opts", "=", "dict", "(", "(", "k", ".", "lower", "(", ")", ",", "v", ")", "for", "(", "k", ",", "v", ")", "in", "six", ".", "iteritems", "(", "opts", ")",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_read_file
Reads and returns the contents of a file
salt/modules/rh_ip.py
def _read_file(path): ''' Reads and returns the contents of a file ''' try: with salt.utils.files.fopen(path, 'rb') as rfh: lines = salt.utils.stringutils.to_unicode(rfh.read()).splitlines() try: lines.remove('') except ValueError: ...
def _read_file(path): ''' Reads and returns the contents of a file ''' try: with salt.utils.files.fopen(path, 'rb') as rfh: lines = salt.utils.stringutils.to_unicode(rfh.read()).splitlines() try: lines.remove('') except ValueError: ...
[ "Reads", "and", "returns", "the", "contents", "of", "a", "file" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rh_ip.py#L933-L946
[ "def", "_read_file", "(", "path", ")", ":", "try", ":", "with", "salt", ".", "utils", ".", "files", ".", "fopen", "(", "path", ",", "'rb'", ")", "as", "rfh", ":", "lines", "=", "salt", ".", "utils", ".", "stringutils", ".", "to_unicode", "(", "rfh"...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_write_file_iface
Writes a file to disk
salt/modules/rh_ip.py
def _write_file_iface(iface, data, folder, pattern): ''' Writes a file to disk ''' filename = os.path.join(folder, pattern.format(iface)) if not os.path.exists(folder): msg = '{0} cannot be written. {1} does not exist' msg = msg.format(filename, folder) log.error(msg) ...
def _write_file_iface(iface, data, folder, pattern): ''' Writes a file to disk ''' filename = os.path.join(folder, pattern.format(iface)) if not os.path.exists(folder): msg = '{0} cannot be written. {1} does not exist' msg = msg.format(filename, folder) log.error(msg) ...
[ "Writes", "a", "file", "to", "disk" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rh_ip.py#L949-L960
[ "def", "_write_file_iface", "(", "iface", ",", "data", ",", "folder", ",", "pattern", ")", ":", "filename", "=", "os", ".", "path", ".", "join", "(", "folder", ",", "pattern", ".", "format", "(", "iface", ")", ")", "if", "not", "os", ".", "path", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_write_file_network
Writes a file to disk
salt/modules/rh_ip.py
def _write_file_network(data, filename): ''' Writes a file to disk ''' with salt.utils.files.fopen(filename, 'w') as fp_: fp_.write(salt.utils.stringutils.to_str(data))
def _write_file_network(data, filename): ''' Writes a file to disk ''' with salt.utils.files.fopen(filename, 'w') as fp_: fp_.write(salt.utils.stringutils.to_str(data))
[ "Writes", "a", "file", "to", "disk" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rh_ip.py#L963-L968
[ "def", "_write_file_network", "(", "data", ",", "filename", ")", ":", "with", "salt", ".", "utils", ".", "files", ".", "fopen", "(", "filename", ",", "'w'", ")", "as", "fp_", ":", "fp_", ".", "write", "(", "salt", ".", "utils", ".", "stringutils", "....
e8541fd6e744ab0df786c0f76102e41631f45d46
train
build_bond
Create a bond script in /etc/modprobe.d with the passed settings and load the bonding kernel module. CLI Example: .. code-block:: bash salt '*' ip.build_bond bond0 mode=balance-alb
salt/modules/rh_ip.py
def build_bond(iface, **settings): ''' Create a bond script in /etc/modprobe.d with the passed settings and load the bonding kernel module. CLI Example: .. code-block:: bash salt '*' ip.build_bond bond0 mode=balance-alb ''' rh_major = __grains__['osrelease'][:1] opts = _parse...
def build_bond(iface, **settings): ''' Create a bond script in /etc/modprobe.d with the passed settings and load the bonding kernel module. CLI Example: .. code-block:: bash salt '*' ip.build_bond bond0 mode=balance-alb ''' rh_major = __grains__['osrelease'][:1] opts = _parse...
[ "Create", "a", "bond", "script", "in", "/", "etc", "/", "modprobe", ".", "d", "with", "the", "passed", "settings", "and", "load", "the", "bonding", "kernel", "module", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rh_ip.py#L980-L1017
[ "def", "build_bond", "(", "iface", ",", "*", "*", "settings", ")", ":", "rh_major", "=", "__grains__", "[", "'osrelease'", "]", "[", ":", "1", "]", "opts", "=", "_parse_settings_bond", "(", "settings", ",", "iface", ")", "try", ":", "template", "=", "J...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
build_interface
Build an interface script for a network interface. CLI Example: .. code-block:: bash salt '*' ip.build_interface eth0 eth <settings>
salt/modules/rh_ip.py
def build_interface(iface, iface_type, enabled, **settings): ''' Build an interface script for a network interface. CLI Example: .. code-block:: bash salt '*' ip.build_interface eth0 eth <settings> ''' if __grains__['os'] == 'Fedora': if __grains__['osmajorrelease'] >= 18: ...
def build_interface(iface, iface_type, enabled, **settings): ''' Build an interface script for a network interface. CLI Example: .. code-block:: bash salt '*' ip.build_interface eth0 eth <settings> ''' if __grains__['os'] == 'Fedora': if __grains__['osmajorrelease'] >= 18: ...
[ "Build", "an", "interface", "script", "for", "a", "network", "interface", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rh_ip.py#L1020-L1074
[ "def", "build_interface", "(", "iface", ",", "iface_type", ",", "enabled", ",", "*", "*", "settings", ")", ":", "if", "__grains__", "[", "'os'", "]", "==", "'Fedora'", ":", "if", "__grains__", "[", "'osmajorrelease'", "]", ">=", "18", ":", "rh_major", "=...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
build_routes
Build a route script for a network interface. CLI Example: .. code-block:: bash salt '*' ip.build_routes eth0 <settings>
salt/modules/rh_ip.py
def build_routes(iface, **settings): ''' Build a route script for a network interface. CLI Example: .. code-block:: bash salt '*' ip.build_routes eth0 <settings> ''' template = 'rh6_route_eth.jinja' try: if int(__grains__['osrelease'][0]) < 6: template = 'rout...
def build_routes(iface, **settings): ''' Build a route script for a network interface. CLI Example: .. code-block:: bash salt '*' ip.build_routes eth0 <settings> ''' template = 'rh6_route_eth.jinja' try: if int(__grains__['osrelease'][0]) < 6: template = 'rout...
[ "Build", "a", "route", "script", "for", "a", "network", "interface", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rh_ip.py#L1077-L1130
[ "def", "build_routes", "(", "iface", ",", "*", "*", "settings", ")", ":", "template", "=", "'rh6_route_eth.jinja'", "try", ":", "if", "int", "(", "__grains__", "[", "'osrelease'", "]", "[", "0", "]", ")", "<", "6", ":", "template", "=", "'route_eth.jinja...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
get_bond
Return the content of a bond script CLI Example: .. code-block:: bash salt '*' ip.get_bond bond0
salt/modules/rh_ip.py
def get_bond(iface): ''' Return the content of a bond script CLI Example: .. code-block:: bash salt '*' ip.get_bond bond0 ''' path = os.path.join(_RH_NETWORK_CONF_FILES, '{0}.conf'.format(iface)) return _read_file(path)
def get_bond(iface): ''' Return the content of a bond script CLI Example: .. code-block:: bash salt '*' ip.get_bond bond0 ''' path = os.path.join(_RH_NETWORK_CONF_FILES, '{0}.conf'.format(iface)) return _read_file(path)
[ "Return", "the", "content", "of", "a", "bond", "script" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rh_ip.py#L1149-L1160
[ "def", "get_bond", "(", "iface", ")", ":", "path", "=", "os", ".", "path", ".", "join", "(", "_RH_NETWORK_CONF_FILES", ",", "'{0}.conf'", ".", "format", "(", "iface", ")", ")", "return", "_read_file", "(", "path", ")" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
train
get_interface
Return the contents of an interface script CLI Example: .. code-block:: bash salt '*' ip.get_interface eth0
salt/modules/rh_ip.py
def get_interface(iface): ''' Return the contents of an interface script CLI Example: .. code-block:: bash salt '*' ip.get_interface eth0 ''' path = os.path.join(_RH_NETWORK_SCRIPT_DIR, 'ifcfg-{0}'.format(iface)) return _read_file(path)
def get_interface(iface): ''' Return the contents of an interface script CLI Example: .. code-block:: bash salt '*' ip.get_interface eth0 ''' path = os.path.join(_RH_NETWORK_SCRIPT_DIR, 'ifcfg-{0}'.format(iface)) return _read_file(path)
[ "Return", "the", "contents", "of", "an", "interface", "script" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rh_ip.py#L1163-L1174
[ "def", "get_interface", "(", "iface", ")", ":", "path", "=", "os", ".", "path", ".", "join", "(", "_RH_NETWORK_SCRIPT_DIR", ",", "'ifcfg-{0}'", ".", "format", "(", "iface", ")", ")", "return", "_read_file", "(", "path", ")" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
train
get_routes
Return the contents of the interface routes script. CLI Example: .. code-block:: bash salt '*' ip.get_routes eth0
salt/modules/rh_ip.py
def get_routes(iface): ''' Return the contents of the interface routes script. CLI Example: .. code-block:: bash salt '*' ip.get_routes eth0 ''' path = os.path.join(_RH_NETWORK_SCRIPT_DIR, 'route-{0}'.format(iface)) path6 = os.path.join(_RH_NETWORK_SCRIPT_DIR, 'route6-{0}'.format(...
def get_routes(iface): ''' Return the contents of the interface routes script. CLI Example: .. code-block:: bash salt '*' ip.get_routes eth0 ''' path = os.path.join(_RH_NETWORK_SCRIPT_DIR, 'route-{0}'.format(iface)) path6 = os.path.join(_RH_NETWORK_SCRIPT_DIR, 'route6-{0}'.format(...
[ "Return", "the", "contents", "of", "the", "interface", "routes", "script", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rh_ip.py#L1193-L1207
[ "def", "get_routes", "(", "iface", ")", ":", "path", "=", "os", ".", "path", ".", "join", "(", "_RH_NETWORK_SCRIPT_DIR", ",", "'route-{0}'", ".", "format", "(", "iface", ")", ")", "path6", "=", "os", ".", "path", ".", "join", "(", "_RH_NETWORK_SCRIPT_DIR...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
apply_network_settings
Apply global network configuration. CLI Example: .. code-block:: bash salt '*' ip.apply_network_settings
salt/modules/rh_ip.py
def apply_network_settings(**settings): ''' Apply global network configuration. CLI Example: .. code-block:: bash salt '*' ip.apply_network_settings ''' if 'require_reboot' not in settings: settings['require_reboot'] = False if 'apply_hostname' not in settings: se...
def apply_network_settings(**settings): ''' Apply global network configuration. CLI Example: .. code-block:: bash salt '*' ip.apply_network_settings ''' if 'require_reboot' not in settings: settings['require_reboot'] = False if 'apply_hostname' not in settings: se...
[ "Apply", "global", "network", "configuration", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rh_ip.py#L1223-L1260
[ "def", "apply_network_settings", "(", "*", "*", "settings", ")", ":", "if", "'require_reboot'", "not", "in", "settings", ":", "settings", "[", "'require_reboot'", "]", "=", "False", "if", "'apply_hostname'", "not", "in", "settings", ":", "settings", "[", "'app...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
build_network_settings
Build the global network script. CLI Example: .. code-block:: bash salt '*' ip.build_network_settings <settings>
salt/modules/rh_ip.py
def build_network_settings(**settings): ''' Build the global network script. CLI Example: .. code-block:: bash salt '*' ip.build_network_settings <settings> ''' # Read current configuration and store default values current_network_settings = _parse_rh_config(_RH_NETWORK_FILE) ...
def build_network_settings(**settings): ''' Build the global network script. CLI Example: .. code-block:: bash salt '*' ip.build_network_settings <settings> ''' # Read current configuration and store default values current_network_settings = _parse_rh_config(_RH_NETWORK_FILE) ...
[ "Build", "the", "global", "network", "script", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rh_ip.py#L1263-L1291
[ "def", "build_network_settings", "(", "*", "*", "settings", ")", ":", "# Read current configuration and store default values", "current_network_settings", "=", "_parse_rh_config", "(", "_RH_NETWORK_FILE", ")", "# Build settings", "opts", "=", "_parse_network_settings", "(", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
setIdleDelay
Set the current idle delay setting in seconds CLI Example: .. code-block:: bash salt '*' gnome.setIdleDelay <seconds> user=<username>
salt/modules/gnomedesktop.py
def setIdleDelay(delaySeconds, **kwargs): ''' Set the current idle delay setting in seconds CLI Example: .. code-block:: bash salt '*' gnome.setIdleDelay <seconds> user=<username> ''' _gsession = _GSettings(user=kwargs.get('user'), schema='org.gnome.desktop...
def setIdleDelay(delaySeconds, **kwargs): ''' Set the current idle delay setting in seconds CLI Example: .. code-block:: bash salt '*' gnome.setIdleDelay <seconds> user=<username> ''' _gsession = _GSettings(user=kwargs.get('user'), schema='org.gnome.desktop...
[ "Set", "the", "current", "idle", "delay", "setting", "in", "seconds" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/gnomedesktop.py#L144-L158
[ "def", "setIdleDelay", "(", "delaySeconds", ",", "*", "*", "kwargs", ")", ":", "_gsession", "=", "_GSettings", "(", "user", "=", "kwargs", ".", "get", "(", "'user'", ")", ",", "schema", "=", "'org.gnome.desktop.session'", ",", "key", "=", "'idle-delay'", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
setClockFormat
Set the clock format, either 12h or 24h format. CLI Example: .. code-block:: bash salt '*' gnome.setClockFormat <12h|24h> user=<username>
salt/modules/gnomedesktop.py
def setClockFormat(clockFormat, **kwargs): ''' Set the clock format, either 12h or 24h format. CLI Example: .. code-block:: bash salt '*' gnome.setClockFormat <12h|24h> user=<username> ''' if clockFormat != '12h' and clockFormat != '24h': return False _gsession = _GSettin...
def setClockFormat(clockFormat, **kwargs): ''' Set the clock format, either 12h or 24h format. CLI Example: .. code-block:: bash salt '*' gnome.setClockFormat <12h|24h> user=<username> ''' if clockFormat != '12h' and clockFormat != '24h': return False _gsession = _GSettin...
[ "Set", "the", "clock", "format", "either", "12h", "or", "24h", "format", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/gnomedesktop.py#L178-L194
[ "def", "setClockFormat", "(", "clockFormat", ",", "*", "*", "kwargs", ")", ":", "if", "clockFormat", "!=", "'12h'", "and", "clockFormat", "!=", "'24h'", ":", "return", "False", "_gsession", "=", "_GSettings", "(", "user", "=", "kwargs", ".", "get", "(", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
setClockShowDate
Set whether the date is visible in the clock CLI Example: .. code-block:: bash salt '*' gnome.setClockShowDate <True|False> user=<username>
salt/modules/gnomedesktop.py
def setClockShowDate(kvalue, **kwargs): ''' Set whether the date is visible in the clock CLI Example: .. code-block:: bash salt '*' gnome.setClockShowDate <True|False> user=<username> ''' if kvalue is not True and kvalue is not False: return False _gsession = _GSettings(u...
def setClockShowDate(kvalue, **kwargs): ''' Set whether the date is visible in the clock CLI Example: .. code-block:: bash salt '*' gnome.setClockShowDate <True|False> user=<username> ''' if kvalue is not True and kvalue is not False: return False _gsession = _GSettings(u...
[ "Set", "whether", "the", "date", "is", "visible", "in", "the", "clock" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/gnomedesktop.py#L214-L230
[ "def", "setClockShowDate", "(", "kvalue", ",", "*", "*", "kwargs", ")", ":", "if", "kvalue", "is", "not", "True", "and", "kvalue", "is", "not", "False", ":", "return", "False", "_gsession", "=", "_GSettings", "(", "user", "=", "kwargs", ".", "get", "("...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
getIdleActivation
Get whether the idle activation is enabled CLI Example: .. code-block:: bash salt '*' gnome.getIdleActivation user=<username>
salt/modules/gnomedesktop.py
def getIdleActivation(**kwargs): ''' Get whether the idle activation is enabled CLI Example: .. code-block:: bash salt '*' gnome.getIdleActivation user=<username> ''' _gsession = _GSettings(user=kwargs.get('user'), schema='org.gnome.desktop.screensaver', ...
def getIdleActivation(**kwargs): ''' Get whether the idle activation is enabled CLI Example: .. code-block:: bash salt '*' gnome.getIdleActivation user=<username> ''' _gsession = _GSettings(user=kwargs.get('user'), schema='org.gnome.desktop.screensaver', ...
[ "Get", "whether", "the", "idle", "activation", "is", "enabled" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/gnomedesktop.py#L233-L247
[ "def", "getIdleActivation", "(", "*", "*", "kwargs", ")", ":", "_gsession", "=", "_GSettings", "(", "user", "=", "kwargs", ".", "get", "(", "'user'", ")", ",", "schema", "=", "'org.gnome.desktop.screensaver'", ",", "key", "=", "'idle-activation-enabled'", ")",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
get
Get key in a particular GNOME schema CLI Example: .. code-block:: bash salt '*' gnome.get user=<username> schema=org.gnome.desktop.screensaver key=idle-activation-enabled
salt/modules/gnomedesktop.py
def get(schema=None, key=None, user=None, **kwargs): ''' Get key in a particular GNOME schema CLI Example: .. code-block:: bash salt '*' gnome.get user=<username> schema=org.gnome.desktop.screensaver key=idle-activation-enabled ''' _gsession = _GSettings(user=user, schema=schema, key...
def get(schema=None, key=None, user=None, **kwargs): ''' Get key in a particular GNOME schema CLI Example: .. code-block:: bash salt '*' gnome.get user=<username> schema=org.gnome.desktop.screensaver key=idle-activation-enabled ''' _gsession = _GSettings(user=user, schema=schema, key...
[ "Get", "key", "in", "a", "particular", "GNOME", "schema" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/gnomedesktop.py#L269-L281
[ "def", "get", "(", "schema", "=", "None", ",", "key", "=", "None", ",", "user", "=", "None", ",", "*", "*", "kwargs", ")", ":", "_gsession", "=", "_GSettings", "(", "user", "=", "user", ",", "schema", "=", "schema", ",", "key", "=", "key", ")", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
set_
Set key in a particular GNOME schema CLI Example: .. code-block:: bash salt '*' gnome.set user=<username> schema=org.gnome.desktop.screensaver key=idle-activation-enabled value=False
salt/modules/gnomedesktop.py
def set_(schema=None, key=None, user=None, value=None, **kwargs): ''' Set key in a particular GNOME schema CLI Example: .. code-block:: bash salt '*' gnome.set user=<username> schema=org.gnome.desktop.screensaver key=idle-activation-enabled value=False ''' _gsession = _GSettings(user...
def set_(schema=None, key=None, user=None, value=None, **kwargs): ''' Set key in a particular GNOME schema CLI Example: .. code-block:: bash salt '*' gnome.set user=<username> schema=org.gnome.desktop.screensaver key=idle-activation-enabled value=False ''' _gsession = _GSettings(user...
[ "Set", "key", "in", "a", "particular", "GNOME", "schema" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/gnomedesktop.py#L284-L296
[ "def", "set_", "(", "schema", "=", "None", ",", "key", "=", "None", ",", "user", "=", "None", ",", "value", "=", "None", ",", "*", "*", "kwargs", ")", ":", "_gsession", "=", "_GSettings", "(", "user", "=", "user", ",", "schema", "=", "schema", ",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_GSettings._get
get the value for user in gsettings
salt/modules/gnomedesktop.py
def _get(self): ''' get the value for user in gsettings ''' user = self.USER try: uid = pwd.getpwnam(user).pw_uid except KeyError: log.info('User does not exist') return False cmd = self.gsetting_command + ['get', str(self.SCH...
def _get(self): ''' get the value for user in gsettings ''' user = self.USER try: uid = pwd.getpwnam(user).pw_uid except KeyError: log.info('User does not exist') return False cmd = self.gsetting_command + ['get', str(self.SCH...
[ "get", "the", "value", "for", "user", "in", "gsettings" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/gnomedesktop.py#L66-L89
[ "def", "_get", "(", "self", ")", ":", "user", "=", "self", ".", "USER", "try", ":", "uid", "=", "pwd", ".", "getpwnam", "(", "user", ")", ".", "pw_uid", "except", "KeyError", ":", "log", ".", "info", "(", "'User does not exist'", ")", "return", "Fals...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_GSettings._set
set the value for user in gsettings
salt/modules/gnomedesktop.py
def _set(self, value): ''' set the value for user in gsettings ''' user = self.USER try: uid = pwd.getpwnam(user).pw_uid except KeyError: log.info('User does not exist') result = {} result['retcode'] = 1 result[...
def _set(self, value): ''' set the value for user in gsettings ''' user = self.USER try: uid = pwd.getpwnam(user).pw_uid except KeyError: log.info('User does not exist') result = {} result['retcode'] = 1 result[...
[ "set", "the", "value", "for", "user", "in", "gsettings" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/gnomedesktop.py#L91-L110
[ "def", "_set", "(", "self", ",", "value", ")", ":", "user", "=", "self", ".", "USER", "try", ":", "uid", "=", "pwd", ".", "getpwnam", "(", "user", ")", ".", "pw_uid", "except", "KeyError", ":", "log", ".", "info", "(", "'User does not exist'", ")", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
bin_pkg_info
.. versionadded:: 2015.8.0 Parses RPM metadata and returns a dictionary of information about the package (name, version, etc.). path Path to the file. Can either be an absolute path to a file on the minion, or a salt fileserver URL (e.g. ``salt://path/to/file.rpm``). If a salt file...
salt/modules/rpm_lowpkg.py
def bin_pkg_info(path, saltenv='base'): ''' .. versionadded:: 2015.8.0 Parses RPM metadata and returns a dictionary of information about the package (name, version, etc.). path Path to the file. Can either be an absolute path to a file on the minion, or a salt fileserver URL (e.g. ...
def bin_pkg_info(path, saltenv='base'): ''' .. versionadded:: 2015.8.0 Parses RPM metadata and returns a dictionary of information about the package (name, version, etc.). path Path to the file. Can either be an absolute path to a file on the minion, or a salt fileserver URL (e.g. ...
[ "..", "versionadded", "::", "2015", ".", "8", ".", "0" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rpm_lowpkg.py#L65-L128
[ "def", "bin_pkg_info", "(", "path", ",", "saltenv", "=", "'base'", ")", ":", "# If the path is a valid protocol, pull it down using cp.cache_file", "if", "__salt__", "[", "'config.valid_fileproto'", "]", "(", "path", ")", ":", "newpath", "=", "__salt__", "[", "'cp.cac...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
list_pkgs
List the packages currently installed in a dict:: {'<package_name>': '<version>'} root use root as top level directory (default: "/") CLI Example: .. code-block:: bash salt '*' lowpkg.list_pkgs
salt/modules/rpm_lowpkg.py
def list_pkgs(*packages, **kwargs): ''' List the packages currently installed in a dict:: {'<package_name>': '<version>'} root use root as top level directory (default: "/") CLI Example: .. code-block:: bash salt '*' lowpkg.list_pkgs ''' pkgs = {} cmd = ['rpm...
def list_pkgs(*packages, **kwargs): ''' List the packages currently installed in a dict:: {'<package_name>': '<version>'} root use root as top level directory (default: "/") CLI Example: .. code-block:: bash salt '*' lowpkg.list_pkgs ''' pkgs = {} cmd = ['rpm...
[ "List", "the", "packages", "currently", "installed", "in", "a", "dict", "::" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rpm_lowpkg.py#L131-L160
[ "def", "list_pkgs", "(", "*", "packages", ",", "*", "*", "kwargs", ")", ":", "pkgs", "=", "{", "}", "cmd", "=", "[", "'rpm'", "]", "if", "kwargs", ".", "get", "(", "'root'", ")", ":", "cmd", ".", "extend", "(", "[", "'--root'", ",", "kwargs", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
verify
Runs an rpm -Va on a system, and returns the results in a dict root use root as top level directory (default: "/") Files with an attribute of config, doc, ghost, license or readme in the package header can be ignored using the ``ignore_types`` keyword argument CLI Example: .. code-block:...
salt/modules/rpm_lowpkg.py
def verify(*packages, **kwargs): ''' Runs an rpm -Va on a system, and returns the results in a dict root use root as top level directory (default: "/") Files with an attribute of config, doc, ghost, license or readme in the package header can be ignored using the ``ignore_types`` keyword a...
def verify(*packages, **kwargs): ''' Runs an rpm -Va on a system, and returns the results in a dict root use root as top level directory (default: "/") Files with an attribute of config, doc, ghost, license or readme in the package header can be ignored using the ``ignore_types`` keyword a...
[ "Runs", "an", "rpm", "-", "Va", "on", "a", "system", "and", "returns", "the", "results", "in", "a", "dict" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rpm_lowpkg.py#L163-L262
[ "def", "verify", "(", "*", "packages", ",", "*", "*", "kwargs", ")", ":", "ftypes", "=", "{", "'c'", ":", "'config'", ",", "'d'", ":", "'doc'", ",", "'g'", ":", "'ghost'", ",", "'l'", ":", "'license'", ",", "'r'", ":", "'readme'", "}", "ret", "="...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
modified
List the modified files that belong to a package. Not specifying any packages will return a list of _all_ modified files on the system's RPM database. .. versionadded:: 2015.5.0 root use root as top level directory (default: "/") CLI examples: .. code-block:: bash salt '*' lowpk...
salt/modules/rpm_lowpkg.py
def modified(*packages, **flags): ''' List the modified files that belong to a package. Not specifying any packages will return a list of _all_ modified files on the system's RPM database. .. versionadded:: 2015.5.0 root use root as top level directory (default: "/") CLI examples: ...
def modified(*packages, **flags): ''' List the modified files that belong to a package. Not specifying any packages will return a list of _all_ modified files on the system's RPM database. .. versionadded:: 2015.5.0 root use root as top level directory (default: "/") CLI examples: ...
[ "List", "the", "modified", "files", "that", "belong", "to", "a", "package", ".", "Not", "specifying", "any", "packages", "will", "return", "a", "list", "of", "_all_", "modified", "files", "on", "the", "system", "s", "RPM", "database", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rpm_lowpkg.py#L265-L340
[ "def", "modified", "(", "*", "packages", ",", "*", "*", "flags", ")", ":", "cmd", "=", "[", "'rpm'", "]", "if", "flags", ".", "get", "(", "'root'", ")", ":", "cmd", ".", "extend", "(", "[", "'--root'", ",", "flags", ".", "pop", "(", "'root'", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
file_list
List the files that belong to a package. Not specifying any packages will return a list of _every_ file on the system's rpm database (not generally recommended). root use root as top level directory (default: "/") CLI Examples: .. code-block:: bash salt '*' lowpkg.file_list httpd...
salt/modules/rpm_lowpkg.py
def file_list(*packages, **kwargs): ''' List the files that belong to a package. Not specifying any packages will return a list of _every_ file on the system's rpm database (not generally recommended). root use root as top level directory (default: "/") CLI Examples: .. code-block...
def file_list(*packages, **kwargs): ''' List the files that belong to a package. Not specifying any packages will return a list of _every_ file on the system's rpm database (not generally recommended). root use root as top level directory (default: "/") CLI Examples: .. code-block...
[ "List", "the", "files", "that", "belong", "to", "a", "package", ".", "Not", "specifying", "any", "packages", "will", "return", "a", "list", "of", "_every_", "file", "on", "the", "system", "s", "rpm", "database", "(", "not", "generally", "recommended", ")",...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rpm_lowpkg.py#L343-L373
[ "def", "file_list", "(", "*", "packages", ",", "*", "*", "kwargs", ")", ":", "cmd", "=", "[", "'rpm'", "]", "if", "kwargs", ".", "get", "(", "'root'", ")", ":", "cmd", ".", "extend", "(", "[", "'--root'", ",", "kwargs", "[", "'root'", "]", "]", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
file_dict
List the files that belong to a package, sorted by group. Not specifying any packages will return a list of _every_ file on the system's rpm database (not generally recommended). root use root as top level directory (default: "/") CLI Examples: .. code-block:: bash salt '*' lowpk...
salt/modules/rpm_lowpkg.py
def file_dict(*packages, **kwargs): ''' List the files that belong to a package, sorted by group. Not specifying any packages will return a list of _every_ file on the system's rpm database (not generally recommended). root use root as top level directory (default: "/") CLI Examples: ...
def file_dict(*packages, **kwargs): ''' List the files that belong to a package, sorted by group. Not specifying any packages will return a list of _every_ file on the system's rpm database (not generally recommended). root use root as top level directory (default: "/") CLI Examples: ...
[ "List", "the", "files", "that", "belong", "to", "a", "package", "sorted", "by", "group", ".", "Not", "specifying", "any", "packages", "will", "return", "a", "list", "of", "_every_", "file", "on", "the", "system", "s", "rpm", "database", "(", "not", "gene...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rpm_lowpkg.py#L376-L420
[ "def", "file_dict", "(", "*", "packages", ",", "*", "*", "kwargs", ")", ":", "errors", "=", "[", "]", "ret", "=", "{", "}", "pkgs", "=", "{", "}", "cmd", "=", "[", "'rpm'", "]", "if", "kwargs", ".", "get", "(", "'root'", ")", ":", "cmd", ".",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
owner
Return the name of the package that owns the file. Multiple file paths can be passed. If a single path is passed, a string will be returned, and if multiple paths are passed, a dictionary of file/package name pairs will be returned. If the file is not owned by a package, or is not present on the minion...
salt/modules/rpm_lowpkg.py
def owner(*paths, **kwargs): ''' Return the name of the package that owns the file. Multiple file paths can be passed. If a single path is passed, a string will be returned, and if multiple paths are passed, a dictionary of file/package name pairs will be returned. If the file is not owned by a...
def owner(*paths, **kwargs): ''' Return the name of the package that owns the file. Multiple file paths can be passed. If a single path is passed, a string will be returned, and if multiple paths are passed, a dictionary of file/package name pairs will be returned. If the file is not owned by a...
[ "Return", "the", "name", "of", "the", "package", "that", "owns", "the", "file", ".", "Multiple", "file", "paths", "can", "be", "passed", ".", "If", "a", "single", "path", "is", "passed", "a", "string", "will", "be", "returned", "and", "if", "multiple", ...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rpm_lowpkg.py#L423-L458
[ "def", "owner", "(", "*", "paths", ",", "*", "*", "kwargs", ")", ":", "if", "not", "paths", ":", "return", "''", "ret", "=", "{", "}", "for", "path", "in", "paths", ":", "cmd", "=", "[", "'rpm'", "]", "if", "kwargs", ".", "get", "(", "'root'", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
diff
Return a formatted diff between current file and original in a package. NOTE: this function includes all files (configuration and not), but does not work on binary content. :param package: Full pack of the RPM file :param path: Full path to the installed file :return: Difference or empty string. Fo...
salt/modules/rpm_lowpkg.py
def diff(package_path, path): ''' Return a formatted diff between current file and original in a package. NOTE: this function includes all files (configuration and not), but does not work on binary content. :param package: Full pack of the RPM file :param path: Full path to the installed file ...
def diff(package_path, path): ''' Return a formatted diff between current file and original in a package. NOTE: this function includes all files (configuration and not), but does not work on binary content. :param package: Full pack of the RPM file :param path: Full path to the installed file ...
[ "Return", "a", "formatted", "diff", "between", "current", "file", "and", "original", "in", "a", "package", ".", "NOTE", ":", "this", "function", "includes", "all", "files", "(", "configuration", "and", "not", ")", "but", "does", "not", "work", "on", "binar...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rpm_lowpkg.py#L464-L490
[ "def", "diff", "(", "package_path", ",", "path", ")", ":", "cmd", "=", "\"rpm2cpio {0} \"", "\"| cpio -i --quiet --to-stdout .{1} \"", "\"| diff -u --label 'A {1}' --from-file=- --label 'B {1}' {1}\"", "res", "=", "__salt__", "[", "'cmd.shell'", "]", "(", "cmd", ".", "for...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
info
Return a detailed package(s) summary information. If no packages specified, all packages will be returned. :param packages: :param attr: Comma-separated package attributes. If no 'attr' is specified, all available attributes returned. Valid attributes are: version, vendor, rel...
salt/modules/rpm_lowpkg.py
def info(*packages, **kwargs): ''' Return a detailed package(s) summary information. If no packages specified, all packages will be returned. :param packages: :param attr: Comma-separated package attributes. If no 'attr' is specified, all available attributes returned. Valid attri...
def info(*packages, **kwargs): ''' Return a detailed package(s) summary information. If no packages specified, all packages will be returned. :param packages: :param attr: Comma-separated package attributes. If no 'attr' is specified, all available attributes returned. Valid attri...
[ "Return", "a", "detailed", "package", "(", "s", ")", "summary", "information", ".", "If", "no", "packages", "specified", "all", "packages", "will", "be", "returned", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rpm_lowpkg.py#L493-L674
[ "def", "info", "(", "*", "packages", ",", "*", "*", "kwargs", ")", ":", "all_versions", "=", "kwargs", ".", "get", "(", "'all_versions'", ",", "False", ")", "# LONGSIZE is not a valid tag for all versions of rpm. If LONGSIZE isn't", "# available, then we can just use SIZE...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
version_cmp
.. versionadded:: 2015.8.9 Do a cmp-style comparison on two packages. Return -1 if ver1 < ver2, 0 if ver1 == ver2, and 1 if ver1 > ver2. Return None if there was a problem making the comparison. ignore_epoch : False Set to ``True`` to ignore the epoch when comparing versions .. versio...
salt/modules/rpm_lowpkg.py
def version_cmp(ver1, ver2, ignore_epoch=False): ''' .. versionadded:: 2015.8.9 Do a cmp-style comparison on two packages. Return -1 if ver1 < ver2, 0 if ver1 == ver2, and 1 if ver1 > ver2. Return None if there was a problem making the comparison. ignore_epoch : False Set to ``True`` t...
def version_cmp(ver1, ver2, ignore_epoch=False): ''' .. versionadded:: 2015.8.9 Do a cmp-style comparison on two packages. Return -1 if ver1 < ver2, 0 if ver1 == ver2, and 1 if ver1 > ver2. Return None if there was a problem making the comparison. ignore_epoch : False Set to ``True`` t...
[ "..", "versionadded", "::", "2015", ".", "8", ".", "9" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rpm_lowpkg.py#L677-L791
[ "def", "version_cmp", "(", "ver1", ",", "ver2", ",", "ignore_epoch", "=", "False", ")", ":", "normalize", "=", "lambda", "x", ":", "six", ".", "text_type", "(", "x", ")", ".", "split", "(", "':'", ",", "1", ")", "[", "-", "1", "]", "if", "ignore_...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
checksum
Return if the signature of a RPM file is valid. root use root as top level directory (default: "/") CLI Example: .. code-block:: bash salt '*' lowpkg.checksum /path/to/package1.rpm salt '*' lowpkg.checksum /path/to/package1.rpm /path/to/package2.rpm
salt/modules/rpm_lowpkg.py
def checksum(*paths, **kwargs): ''' Return if the signature of a RPM file is valid. root use root as top level directory (default: "/") CLI Example: .. code-block:: bash salt '*' lowpkg.checksum /path/to/package1.rpm salt '*' lowpkg.checksum /path/to/package1.rpm /path/to...
def checksum(*paths, **kwargs): ''' Return if the signature of a RPM file is valid. root use root as top level directory (default: "/") CLI Example: .. code-block:: bash salt '*' lowpkg.checksum /path/to/package1.rpm salt '*' lowpkg.checksum /path/to/package1.rpm /path/to...
[ "Return", "if", "the", "signature", "of", "a", "RPM", "file", "is", "valid", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rpm_lowpkg.py#L794-L825
[ "def", "checksum", "(", "*", "paths", ",", "*", "*", "kwargs", ")", ":", "ret", "=", "dict", "(", ")", "if", "not", "paths", ":", "raise", "CommandExecutionError", "(", "\"No package files has been specified.\"", ")", "cmd", "=", "[", "'rpm'", "]", "if", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_get_conn
Get connection to haproxy socket.
salt/modules/haproxyconn.py
def _get_conn(socket=DEFAULT_SOCKET_URL): ''' Get connection to haproxy socket. ''' assert os.path.exists(socket), '{0} does not exist.'.format(socket) issock = os.stat(socket).st_mode assert stat.S_ISSOCK(issock), '{0} is not a socket.'.format(socket) ha_conn = haproxy.conn.HaPConn(socket) ...
def _get_conn(socket=DEFAULT_SOCKET_URL): ''' Get connection to haproxy socket. ''' assert os.path.exists(socket), '{0} does not exist.'.format(socket) issock = os.stat(socket).st_mode assert stat.S_ISSOCK(issock), '{0} is not a socket.'.format(socket) ha_conn = haproxy.conn.HaPConn(socket) ...
[ "Get", "connection", "to", "haproxy", "socket", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/haproxyconn.py#L44-L52
[ "def", "_get_conn", "(", "socket", "=", "DEFAULT_SOCKET_URL", ")", ":", "assert", "os", ".", "path", ".", "exists", "(", "socket", ")", ",", "'{0} does not exist.'", ".", "format", "(", "socket", ")", "issock", "=", "os", ".", "stat", "(", "socket", ")",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
list_servers
List servers in haproxy backend. backend haproxy backend socket haproxy stats socket, default ``/var/run/haproxy.sock`` CLI Example: .. code-block:: bash salt '*' haproxy.list_servers mysql
salt/modules/haproxyconn.py
def list_servers(backend, socket=DEFAULT_SOCKET_URL, objectify=False): ''' List servers in haproxy backend. backend haproxy backend socket haproxy stats socket, default ``/var/run/haproxy.sock`` CLI Example: .. code-block:: bash salt '*' haproxy.list_servers mysql ...
def list_servers(backend, socket=DEFAULT_SOCKET_URL, objectify=False): ''' List servers in haproxy backend. backend haproxy backend socket haproxy stats socket, default ``/var/run/haproxy.sock`` CLI Example: .. code-block:: bash salt '*' haproxy.list_servers mysql ...
[ "List", "servers", "in", "haproxy", "backend", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/haproxyconn.py#L55-L73
[ "def", "list_servers", "(", "backend", ",", "socket", "=", "DEFAULT_SOCKET_URL", ",", "objectify", "=", "False", ")", ":", "ha_conn", "=", "_get_conn", "(", "socket", ")", "ha_cmd", "=", "haproxy", ".", "cmds", ".", "listServers", "(", "backend", "=", "bac...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
enable_server
Enable Server in haproxy name Server to enable backend haproxy backend, or all backends if "*" is supplied socket haproxy stats socket, default ``/var/run/haproxy.sock`` CLI Example: .. code-block:: bash salt '*' haproxy.enable_server web1.example.com www
salt/modules/haproxyconn.py
def enable_server(name, backend, socket=DEFAULT_SOCKET_URL): ''' Enable Server in haproxy name Server to enable backend haproxy backend, or all backends if "*" is supplied socket haproxy stats socket, default ``/var/run/haproxy.sock`` CLI Example: .. code-block::...
def enable_server(name, backend, socket=DEFAULT_SOCKET_URL): ''' Enable Server in haproxy name Server to enable backend haproxy backend, or all backends if "*" is supplied socket haproxy stats socket, default ``/var/run/haproxy.sock`` CLI Example: .. code-block::...
[ "Enable", "Server", "in", "haproxy" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/haproxyconn.py#L158-L190
[ "def", "enable_server", "(", "name", ",", "backend", ",", "socket", "=", "DEFAULT_SOCKET_URL", ")", ":", "if", "backend", "==", "'*'", ":", "backends", "=", "show_backends", "(", "socket", "=", "socket", ")", ".", "split", "(", "'\\n'", ")", "else", ":",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
get_weight
Get server weight name Server name backend haproxy backend socket haproxy stats socket, default ``/var/run/haproxy.sock`` CLI Example: .. code-block:: bash salt '*' haproxy.get_weight web1.example.com www
salt/modules/haproxyconn.py
def get_weight(name, backend, socket=DEFAULT_SOCKET_URL): ''' Get server weight name Server name backend haproxy backend socket haproxy stats socket, default ``/var/run/haproxy.sock`` CLI Example: .. code-block:: bash salt '*' haproxy.get_weight web1.exa...
def get_weight(name, backend, socket=DEFAULT_SOCKET_URL): ''' Get server weight name Server name backend haproxy backend socket haproxy stats socket, default ``/var/run/haproxy.sock`` CLI Example: .. code-block:: bash salt '*' haproxy.get_weight web1.exa...
[ "Get", "server", "weight" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/haproxyconn.py#L228-L249
[ "def", "get_weight", "(", "name", ",", "backend", ",", "socket", "=", "DEFAULT_SOCKET_URL", ")", ":", "ha_conn", "=", "_get_conn", "(", "socket", ")", "ha_cmd", "=", "haproxy", ".", "cmds", ".", "getWeight", "(", "server", "=", "name", ",", "backend", "=...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
set_state
Force a server's administrative state to a new state. This can be useful to disable load balancing and/or any traffic to a server. Setting the state to "ready" puts the server in normal mode, and the command is the equivalent of the "enable server" command. Setting the state to "maint" disables any traffic ...
salt/modules/haproxyconn.py
def set_state(name, backend, state, socket=DEFAULT_SOCKET_URL): ''' Force a server's administrative state to a new state. This can be useful to disable load balancing and/or any traffic to a server. Setting the state to "ready" puts the server in normal mode, and the command is the equivalent of the...
def set_state(name, backend, state, socket=DEFAULT_SOCKET_URL): ''' Force a server's administrative state to a new state. This can be useful to disable load balancing and/or any traffic to a server. Setting the state to "ready" puts the server in normal mode, and the command is the equivalent of the...
[ "Force", "a", "server", "s", "administrative", "state", "to", "a", "new", "state", ".", "This", "can", "be", "useful", "to", "disable", "load", "balancing", "and", "/", "or", "any", "traffic", "to", "a", "server", ".", "Setting", "the", "state", "to", ...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/haproxyconn.py#L280-L320
[ "def", "set_state", "(", "name", ",", "backend", ",", "state", ",", "socket", "=", "DEFAULT_SOCKET_URL", ")", ":", "# Pulling this in from the latest 0.5 release which is not yet in PyPi.", "# https://github.com/neurogeek/haproxyctl", "class", "setServerState", "(", "haproxy", ...
e8541fd6e744ab0df786c0f76102e41631f45d46