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
import_key
List the keys available CLI Example: .. code-block:: bash salt-cloud -f import_key joyent keyname=mykey keyfile=/tmp/mykey.pub
salt/cloud/clouds/joyent.py
def import_key(kwargs=None, call=None): ''' List the keys available CLI Example: .. code-block:: bash salt-cloud -f import_key joyent keyname=mykey keyfile=/tmp/mykey.pub ''' if call != 'function': log.error( 'The import_key function must be called with -f or --fun...
def import_key(kwargs=None, call=None): ''' List the keys available CLI Example: .. code-block:: bash salt-cloud -f import_key joyent keyname=mykey keyfile=/tmp/mykey.pub ''' if call != 'function': log.error( 'The import_key function must be called with -f or --fun...
[ "List", "the", "keys", "available" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/joyent.py#L917-L960
[ "def", "import_key", "(", "kwargs", "=", "None", ",", "call", "=", "None", ")", ":", "if", "call", "!=", "'function'", ":", "log", ".", "error", "(", "'The import_key function must be called with -f or --function.'", ")", "return", "False", "if", "not", "kwargs"...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
query
Make a web call to Joyent
salt/cloud/clouds/joyent.py
def query(action=None, command=None, args=None, method='GET', location=None, data=None): ''' Make a web call to Joyent ''' user = config.get_cloud_config_value( 'user', get_configured_provider(), __opts__, search_global=False ) if not us...
def query(action=None, command=None, args=None, method='GET', location=None, data=None): ''' Make a web call to Joyent ''' user = config.get_cloud_config_value( 'user', get_configured_provider(), __opts__, search_global=False ) if not us...
[ "Make", "a", "web", "call", "to", "Joyent" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/joyent.py#L1002-L1127
[ "def", "query", "(", "action", "=", "None", ",", "command", "=", "None", ",", "args", "=", "None", ",", "method", "=", "'GET'", ",", "location", "=", "None", ",", "data", "=", "None", ")", ":", "user", "=", "config", ".", "get_cloud_config_value", "(...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_find_utmp
Figure out which utmp file to use when determining runlevel. Sometimes /var/run/utmp doesn't exist, /run/utmp is the new hotness.
salt/modules/upstart_service.py
def _find_utmp(): ''' Figure out which utmp file to use when determining runlevel. Sometimes /var/run/utmp doesn't exist, /run/utmp is the new hotness. ''' result = {} # These are the likely locations for the file on Ubuntu for utmp in '/var/run/utmp', '/run/utmp': try: r...
def _find_utmp(): ''' Figure out which utmp file to use when determining runlevel. Sometimes /var/run/utmp doesn't exist, /run/utmp is the new hotness. ''' result = {} # These are the likely locations for the file on Ubuntu for utmp in '/var/run/utmp', '/run/utmp': try: r...
[ "Figure", "out", "which", "utmp", "file", "to", "use", "when", "determining", "runlevel", ".", "Sometimes", "/", "var", "/", "run", "/", "utmp", "doesn", "t", "exist", "/", "run", "/", "utmp", "is", "the", "new", "hotness", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/upstart_service.py#L89-L104
[ "def", "_find_utmp", "(", ")", ":", "result", "=", "{", "}", "# These are the likely locations for the file on Ubuntu", "for", "utmp", "in", "'/var/run/utmp'", ",", "'/run/utmp'", ":", "try", ":", "result", "[", "os", ".", "stat", "(", "utmp", ")", ".", "st_mt...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_runlevel
Return the current runlevel
salt/modules/upstart_service.py
def _runlevel(): ''' Return the current runlevel ''' if 'upstart._runlevel' in __context__: return __context__['upstart._runlevel'] ret = _default_runlevel() utmp = _find_utmp() if utmp: out = __salt__['cmd.run'](['runlevel', '{0}'.format(utmp)], python_shell=False) t...
def _runlevel(): ''' Return the current runlevel ''' if 'upstart._runlevel' in __context__: return __context__['upstart._runlevel'] ret = _default_runlevel() utmp = _find_utmp() if utmp: out = __salt__['cmd.run'](['runlevel', '{0}'.format(utmp)], python_shell=False) t...
[ "Return", "the", "current", "runlevel" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/upstart_service.py#L152-L167
[ "def", "_runlevel", "(", ")", ":", "if", "'upstart._runlevel'", "in", "__context__", ":", "return", "__context__", "[", "'upstart._runlevel'", "]", "ret", "=", "_default_runlevel", "(", ")", "utmp", "=", "_find_utmp", "(", ")", "if", "utmp", ":", "out", "=",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_upstart_is_disabled
An Upstart service is assumed disabled if a manual stanza is placed in /etc/init/[name].override. NOTE: An Upstart service can also be disabled by placing "manual" in /etc/init/[name].conf.
salt/modules/upstart_service.py
def _upstart_is_disabled(name): ''' An Upstart service is assumed disabled if a manual stanza is placed in /etc/init/[name].override. NOTE: An Upstart service can also be disabled by placing "manual" in /etc/init/[name].conf. ''' files = ['/etc/init/{0}.conf'.format(name), '/etc/init/{0}.ove...
def _upstart_is_disabled(name): ''' An Upstart service is assumed disabled if a manual stanza is placed in /etc/init/[name].override. NOTE: An Upstart service can also be disabled by placing "manual" in /etc/init/[name].conf. ''' files = ['/etc/init/{0}.conf'.format(name), '/etc/init/{0}.ove...
[ "An", "Upstart", "service", "is", "assumed", "disabled", "if", "a", "manual", "stanza", "is", "placed", "in", "/", "etc", "/", "init", "/", "[", "name", "]", ".", "override", ".", "NOTE", ":", "An", "Upstart", "service", "can", "also", "be", "disabled"...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/upstart_service.py#L185-L199
[ "def", "_upstart_is_disabled", "(", "name", ")", ":", "files", "=", "[", "'/etc/init/{0}.conf'", ".", "format", "(", "name", ")", ",", "'/etc/init/{0}.override'", ".", "format", "(", "name", ")", "]", "for", "file_name", "in", "filter", "(", "os", ".", "pa...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_service_is_sysv
A System-V style service will have a control script in /etc/init.d. We make sure to skip over symbolic links that point to Upstart's /lib/init/upstart-job, and anything that isn't an executable, like README or skeleton.
salt/modules/upstart_service.py
def _service_is_sysv(name): ''' A System-V style service will have a control script in /etc/init.d. We make sure to skip over symbolic links that point to Upstart's /lib/init/upstart-job, and anything that isn't an executable, like README or skeleton. ''' script = '/etc/init.d/{0}'.format(na...
def _service_is_sysv(name): ''' A System-V style service will have a control script in /etc/init.d. We make sure to skip over symbolic links that point to Upstart's /lib/init/upstart-job, and anything that isn't an executable, like README or skeleton. ''' script = '/etc/init.d/{0}'.format(na...
[ "A", "System", "-", "V", "style", "service", "will", "have", "a", "control", "script", "in", "/", "etc", "/", "init", ".", "d", ".", "We", "make", "sure", "to", "skip", "over", "symbolic", "links", "that", "point", "to", "Upstart", "s", "/", "lib", ...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/upstart_service.py#L210-L218
[ "def", "_service_is_sysv", "(", "name", ")", ":", "script", "=", "'/etc/init.d/{0}'", ".", "format", "(", "name", ")", "return", "not", "_service_is_upstart", "(", "name", ")", "and", "os", ".", "access", "(", "script", ",", "os", ".", "X_OK", ")" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_iter_service_names
Detect all of the service names available to upstart via init configuration files and via classic sysv init scripts
salt/modules/upstart_service.py
def _iter_service_names(): ''' Detect all of the service names available to upstart via init configuration files and via classic sysv init scripts ''' found = set() for line in glob.glob('/etc/init.d/*'): name = os.path.basename(line) found.add(name) yield name # Thi...
def _iter_service_names(): ''' Detect all of the service names available to upstart via init configuration files and via classic sysv init scripts ''' found = set() for line in glob.glob('/etc/init.d/*'): name = os.path.basename(line) found.add(name) yield name # Thi...
[ "Detect", "all", "of", "the", "service", "names", "available", "to", "upstart", "via", "init", "configuration", "files", "and", "via", "classic", "sysv", "init", "scripts" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/upstart_service.py#L238-L265
[ "def", "_iter_service_names", "(", ")", ":", "found", "=", "set", "(", ")", "for", "line", "in", "glob", ".", "glob", "(", "'/etc/init.d/*'", ")", ":", "name", "=", "os", ".", "path", ".", "basename", "(", "line", ")", "found", ".", "add", "(", "na...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
get_enabled
Return the enabled services CLI Example: .. code-block:: bash salt '*' service.get_enabled
salt/modules/upstart_service.py
def get_enabled(): ''' Return the enabled services CLI Example: .. code-block:: bash salt '*' service.get_enabled ''' ret = set() for name in _iter_service_names(): if _service_is_upstart(name): if _upstart_is_enabled(name): ret.add(name) ...
def get_enabled(): ''' Return the enabled services CLI Example: .. code-block:: bash salt '*' service.get_enabled ''' ret = set() for name in _iter_service_names(): if _service_is_upstart(name): if _upstart_is_enabled(name): ret.add(name) ...
[ "Return", "the", "enabled", "services" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/upstart_service.py#L268-L287
[ "def", "get_enabled", "(", ")", ":", "ret", "=", "set", "(", ")", "for", "name", "in", "_iter_service_names", "(", ")", ":", "if", "_service_is_upstart", "(", "name", ")", ":", "if", "_upstart_is_enabled", "(", "name", ")", ":", "ret", ".", "add", "(",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
get_disabled
Return the disabled services CLI Example: .. code-block:: bash salt '*' service.get_disabled
salt/modules/upstart_service.py
def get_disabled(): ''' Return the disabled services CLI Example: .. code-block:: bash salt '*' service.get_disabled ''' ret = set() for name in _iter_service_names(): if _service_is_upstart(name): if _upstart_is_disabled(name): ret.add(name) ...
def get_disabled(): ''' Return the disabled services CLI Example: .. code-block:: bash salt '*' service.get_disabled ''' ret = set() for name in _iter_service_names(): if _service_is_upstart(name): if _upstart_is_disabled(name): ret.add(name) ...
[ "Return", "the", "disabled", "services" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/upstart_service.py#L290-L309
[ "def", "get_disabled", "(", ")", ":", "ret", "=", "set", "(", ")", "for", "name", "in", "_iter_service_names", "(", ")", ":", "if", "_service_is_upstart", "(", "name", ")", ":", "if", "_upstart_is_disabled", "(", "name", ")", ":", "ret", ".", "add", "(...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_upstart_disable
Disable an Upstart service.
salt/modules/upstart_service.py
def _upstart_disable(name): ''' Disable an Upstart service. ''' if _upstart_is_disabled(name): return _upstart_is_disabled(name) override = '/etc/init/{0}.override'.format(name) with salt.utils.files.fopen(override, 'a') as ofile: ofile.write(salt.utils.stringutils.to_str('manual...
def _upstart_disable(name): ''' Disable an Upstart service. ''' if _upstart_is_disabled(name): return _upstart_is_disabled(name) override = '/etc/init/{0}.override'.format(name) with salt.utils.files.fopen(override, 'a') as ofile: ofile.write(salt.utils.stringutils.to_str('manual...
[ "Disable", "an", "Upstart", "service", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/upstart_service.py#L499-L508
[ "def", "_upstart_disable", "(", "name", ")", ":", "if", "_upstart_is_disabled", "(", "name", ")", ":", "return", "_upstart_is_disabled", "(", "name", ")", "override", "=", "'/etc/init/{0}.override'", ".", "format", "(", "name", ")", "with", "salt", ".", "utils...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_upstart_enable
Enable an Upstart service.
salt/modules/upstart_service.py
def _upstart_enable(name): ''' Enable an Upstart service. ''' if _upstart_is_enabled(name): return _upstart_is_enabled(name) override = '/etc/init/{0}.override'.format(name) files = ['/etc/init/{0}.conf'.format(name), override] for file_name in filter(os.path.isfile, files): ...
def _upstart_enable(name): ''' Enable an Upstart service. ''' if _upstart_is_enabled(name): return _upstart_is_enabled(name) override = '/etc/init/{0}.override'.format(name) files = ['/etc/init/{0}.conf'.format(name), override] for file_name in filter(os.path.isfile, files): ...
[ "Enable", "an", "Upstart", "service", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/upstart_service.py#L511-L535
[ "def", "_upstart_enable", "(", "name", ")", ":", "if", "_upstart_is_enabled", "(", "name", ")", ":", "return", "_upstart_is_enabled", "(", "name", ")", "override", "=", "'/etc/init/{0}.override'", ".", "format", "(", "name", ")", "files", "=", "[", "'/etc/init...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
enable
Enable the named service to start at boot CLI Example: .. code-block:: bash salt '*' service.enable <service name>
salt/modules/upstart_service.py
def enable(name, **kwargs): ''' Enable the named service to start at boot CLI Example: .. code-block:: bash salt '*' service.enable <service name> ''' if _service_is_upstart(name): return _upstart_enable(name) executable = _get_service_exec() cmd = '{0} -f {1} defaults...
def enable(name, **kwargs): ''' Enable the named service to start at boot CLI Example: .. code-block:: bash salt '*' service.enable <service name> ''' if _service_is_upstart(name): return _upstart_enable(name) executable = _get_service_exec() cmd = '{0} -f {1} defaults...
[ "Enable", "the", "named", "service", "to", "start", "at", "boot" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/upstart_service.py#L538-L552
[ "def", "enable", "(", "name", ",", "*", "*", "kwargs", ")", ":", "if", "_service_is_upstart", "(", "name", ")", ":", "return", "_upstart_enable", "(", "name", ")", "executable", "=", "_get_service_exec", "(", ")", "cmd", "=", "'{0} -f {1} defaults'", ".", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
disable
Disable the named service from starting on boot CLI Example: .. code-block:: bash salt '*' service.disable <service name>
salt/modules/upstart_service.py
def disable(name, **kwargs): ''' Disable the named service from starting on boot CLI Example: .. code-block:: bash salt '*' service.disable <service name> ''' if _service_is_upstart(name): return _upstart_disable(name) executable = _get_service_exec() cmd = [executable...
def disable(name, **kwargs): ''' Disable the named service from starting on boot CLI Example: .. code-block:: bash salt '*' service.disable <service name> ''' if _service_is_upstart(name): return _upstart_disable(name) executable = _get_service_exec() cmd = [executable...
[ "Disable", "the", "named", "service", "from", "starting", "on", "boot" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/upstart_service.py#L555-L569
[ "def", "disable", "(", "name", ",", "*", "*", "kwargs", ")", ":", "if", "_service_is_upstart", "(", "name", ")", ":", "return", "_upstart_disable", "(", "name", ")", "executable", "=", "_get_service_exec", "(", ")", "cmd", "=", "[", "executable", ",", "'...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
enabled
Check to see if the named service is enabled to start on boot CLI Example: .. code-block:: bash salt '*' service.enabled <service name>
salt/modules/upstart_service.py
def enabled(name, **kwargs): ''' Check to see if the named service is enabled to start on boot CLI Example: .. code-block:: bash salt '*' service.enabled <service name> ''' if _service_is_upstart(name): return _upstart_is_enabled(name) else: if _service_is_sysv(nam...
def enabled(name, **kwargs): ''' Check to see if the named service is enabled to start on boot CLI Example: .. code-block:: bash salt '*' service.enabled <service name> ''' if _service_is_upstart(name): return _upstart_is_enabled(name) else: if _service_is_sysv(nam...
[ "Check", "to", "see", "if", "the", "named", "service", "is", "enabled", "to", "start", "on", "boot" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/upstart_service.py#L572-L587
[ "def", "enabled", "(", "name", ",", "*", "*", "kwargs", ")", ":", "if", "_service_is_upstart", "(", "name", ")", ":", "return", "_upstart_is_enabled", "(", "name", ")", "else", ":", "if", "_service_is_sysv", "(", "name", ")", ":", "return", "_sysv_is_enabl...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
disabled
Check to see if the named service is disabled to start on boot CLI Example: .. code-block:: bash salt '*' service.disabled <service name>
salt/modules/upstart_service.py
def disabled(name): ''' Check to see if the named service is disabled to start on boot CLI Example: .. code-block:: bash salt '*' service.disabled <service name> ''' if _service_is_upstart(name): return _upstart_is_disabled(name) else: if _service_is_sysv(name): ...
def disabled(name): ''' Check to see if the named service is disabled to start on boot CLI Example: .. code-block:: bash salt '*' service.disabled <service name> ''' if _service_is_upstart(name): return _upstart_is_disabled(name) else: if _service_is_sysv(name): ...
[ "Check", "to", "see", "if", "the", "named", "service", "is", "disabled", "to", "start", "on", "boot" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/upstart_service.py#L590-L605
[ "def", "disabled", "(", "name", ")", ":", "if", "_service_is_upstart", "(", "name", ")", ":", "return", "_upstart_is_disabled", "(", "name", ")", "else", ":", "if", "_service_is_sysv", "(", "name", ")", ":", "return", "_sysv_is_disabled", "(", "name", ")", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
__get_yubico_users
Grab the YubiKey Client ID & Secret Key
salt/auth/yubico.py
def __get_yubico_users(username): ''' Grab the YubiKey Client ID & Secret Key ''' user = {} try: if __opts__['yubico_users'].get(username, None): (user['id'], user['key']) = list(__opts__['yubico_users'][username].values()) else: return None except KeyErr...
def __get_yubico_users(username): ''' Grab the YubiKey Client ID & Secret Key ''' user = {} try: if __opts__['yubico_users'].get(username, None): (user['id'], user['key']) = list(__opts__['yubico_users'][username].values()) else: return None except KeyErr...
[ "Grab", "the", "YubiKey", "Client", "ID", "&", "Secret", "Key" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/auth/yubico.py#L55-L69
[ "def", "__get_yubico_users", "(", "username", ")", ":", "user", "=", "{", "}", "try", ":", "if", "__opts__", "[", "'yubico_users'", "]", ".", "get", "(", "username", ",", "None", ")", ":", "(", "user", "[", "'id'", "]", ",", "user", "[", "'key'", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
auth
Authenticate against yubico server
salt/auth/yubico.py
def auth(username, password): ''' Authenticate against yubico server ''' _cred = __get_yubico_users(username) client = Yubico(_cred['id'], _cred['key']) try: return client.verify(password) except yubico_exceptions.StatusCodeError as e: log.info('Unable to verify YubiKey `%s...
def auth(username, password): ''' Authenticate against yubico server ''' _cred = __get_yubico_users(username) client = Yubico(_cred['id'], _cred['key']) try: return client.verify(password) except yubico_exceptions.StatusCodeError as e: log.info('Unable to verify YubiKey `%s...
[ "Authenticate", "against", "yubico", "server" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/auth/yubico.py#L72-L84
[ "def", "auth", "(", "username", ",", "password", ")", ":", "_cred", "=", "__get_yubico_users", "(", "username", ")", "client", "=", "Yubico", "(", "_cred", "[", "'id'", "]", ",", "_cred", "[", "'key'", "]", ")", "try", ":", "return", "client", ".", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
ExcInfoOnLogLevelFormatMixIn.format
Format the log record to include exc_info if the handler is enabled for a specific log level
salt/log/mixins.py
def format(self, record): ''' Format the log record to include exc_info if the handler is enabled for a specific log level ''' formatted_record = super(ExcInfoOnLogLevelFormatMixIn, self).format(record) exc_info_on_loglevel = getattr(record, 'exc_info_on_loglevel', None) ...
def format(self, record): ''' Format the log record to include exc_info if the handler is enabled for a specific log level ''' formatted_record = super(ExcInfoOnLogLevelFormatMixIn, self).format(record) exc_info_on_loglevel = getattr(record, 'exc_info_on_loglevel', None) ...
[ "Format", "the", "log", "record", "to", "include", "exc_info", "if", "the", "handler", "is", "enabled", "for", "a", "specific", "log", "level" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/log/mixins.py#L90-L141
[ "def", "format", "(", "self", ",", "record", ")", ":", "formatted_record", "=", "super", "(", "ExcInfoOnLogLevelFormatMixIn", ",", "self", ")", ".", "format", "(", "record", ")", "exc_info_on_loglevel", "=", "getattr", "(", "record", ",", "'exc_info_on_loglevel'...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
delete
Delete a bucket, or delete an object from a bucket. CLI Example to delete a bucket:: salt myminion s3.delete mybucket CLI Example to delete an object from a bucket:: salt myminion s3.delete mybucket remoteobject
salt/modules/s3.py
def delete(bucket, path=None, action=None, key=None, keyid=None, service_url=None, verify_ssl=None, kms_keyid=None, location=None, role_arn=None, path_style=None, https_enable=None): ''' Delete a bucket, or delete an object from a bucket. CLI Example to delete a bucket:: salt...
def delete(bucket, path=None, action=None, key=None, keyid=None, service_url=None, verify_ssl=None, kms_keyid=None, location=None, role_arn=None, path_style=None, https_enable=None): ''' Delete a bucket, or delete an object from a bucket. CLI Example to delete a bucket:: salt...
[ "Delete", "a", "bucket", "or", "delete", "an", "object", "from", "a", "bucket", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/s3.py#L82-L120
[ "def", "delete", "(", "bucket", ",", "path", "=", "None", ",", "action", "=", "None", ",", "key", "=", "None", ",", "keyid", "=", "None", ",", "service_url", "=", "None", ",", "verify_ssl", "=", "None", ",", "kms_keyid", "=", "None", ",", "location",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
get
List the contents of a bucket, or return an object from a bucket. Set return_bin to True in order to retrieve an object wholesale. Otherwise, Salt will attempt to parse an XML response. CLI Example to list buckets: .. code-block:: bash salt myminion s3.get CLI Example to list the content...
salt/modules/s3.py
def get(bucket='', path='', return_bin=False, action=None, local_file=None, key=None, keyid=None, service_url=None, verify_ssl=None, kms_keyid=None, location=None, role_arn=None, path_style=None, https_enable=None): ''' List the contents of a bucket, or return an object from a bucket. Se...
def get(bucket='', path='', return_bin=False, action=None, local_file=None, key=None, keyid=None, service_url=None, verify_ssl=None, kms_keyid=None, location=None, role_arn=None, path_style=None, https_enable=None): ''' List the contents of a bucket, or return an object from a bucket. Se...
[ "List", "the", "contents", "of", "a", "bucket", "or", "return", "an", "object", "from", "a", "bucket", ".", "Set", "return_bin", "to", "True", "in", "order", "to", "retrieve", "an", "object", "wholesale", ".", "Otherwise", "Salt", "will", "attempt", "to", ...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/s3.py#L123-L204
[ "def", "get", "(", "bucket", "=", "''", ",", "path", "=", "''", ",", "return_bin", "=", "False", ",", "action", "=", "None", ",", "local_file", "=", "None", ",", "key", "=", "None", ",", "keyid", "=", "None", ",", "service_url", "=", "None", ",", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
head
Return the metadata for a bucket, or an object in a bucket. CLI Examples: .. code-block:: bash salt myminion s3.head mybucket salt myminion s3.head mybucket myfile.png
salt/modules/s3.py
def head(bucket, path='', key=None, keyid=None, service_url=None, verify_ssl=None, kms_keyid=None, location=None, role_arn=None, path_style=None, https_enable=None): ''' Return the metadata for a bucket, or an object in a bucket. CLI Examples: .. code-block:: bash salt mymin...
def head(bucket, path='', key=None, keyid=None, service_url=None, verify_ssl=None, kms_keyid=None, location=None, role_arn=None, path_style=None, https_enable=None): ''' Return the metadata for a bucket, or an object in a bucket. CLI Examples: .. code-block:: bash salt mymin...
[ "Return", "the", "metadata", "for", "a", "bucket", "or", "an", "object", "in", "a", "bucket", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/s3.py#L207-L244
[ "def", "head", "(", "bucket", ",", "path", "=", "''", ",", "key", "=", "None", ",", "keyid", "=", "None", ",", "service_url", "=", "None", ",", "verify_ssl", "=", "None", ",", "kms_keyid", "=", "None", ",", "location", "=", "None", ",", "role_arn", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
put
Create a new bucket, or upload an object to a bucket. CLI Example to create a bucket: .. code-block:: bash salt myminion s3.put mybucket CLI Example to upload an object to a bucket: .. code-block:: bash salt myminion s3.put mybucket remotepath local_file=/path/to/file
salt/modules/s3.py
def put(bucket, path=None, return_bin=False, action=None, local_file=None, key=None, keyid=None, service_url=None, verify_ssl=None, kms_keyid=None, location=None, role_arn=None, path_style=None, https_enable=None, headers=None, full_headers=False): ''' Create a new bucket, or upload an o...
def put(bucket, path=None, return_bin=False, action=None, local_file=None, key=None, keyid=None, service_url=None, verify_ssl=None, kms_keyid=None, location=None, role_arn=None, path_style=None, https_enable=None, headers=None, full_headers=False): ''' Create a new bucket, or upload an o...
[ "Create", "a", "new", "bucket", "or", "upload", "an", "object", "to", "a", "bucket", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/s3.py#L247-L300
[ "def", "put", "(", "bucket", ",", "path", "=", "None", ",", "return_bin", "=", "False", ",", "action", "=", "None", ",", "local_file", "=", "None", ",", "key", "=", "None", ",", "keyid", "=", "None", ",", "service_url", "=", "None", ",", "verify_ssl"...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_get_key
Examine the keys, and populate as necessary
salt/modules/s3.py
def _get_key(key, keyid, service_url, verify_ssl, kms_keyid, location, role_arn, path_style, https_enable): ''' Examine the keys, and populate as necessary ''' if not key and __salt__['config.option']('s3.key'): key = __salt__['config.option']('s3.key') if not keyid and __salt__['config.opt...
def _get_key(key, keyid, service_url, verify_ssl, kms_keyid, location, role_arn, path_style, https_enable): ''' Examine the keys, and populate as necessary ''' if not key and __salt__['config.option']('s3.key'): key = __salt__['config.option']('s3.key') if not keyid and __salt__['config.opt...
[ "Examine", "the", "keys", "and", "populate", "as", "necessary" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/s3.py#L303-L346
[ "def", "_get_key", "(", "key", ",", "keyid", ",", "service_url", ",", "verify_ssl", ",", "kms_keyid", ",", "location", ",", "role_arn", ",", "path_style", ",", "https_enable", ")", ":", "if", "not", "key", "and", "__salt__", "[", "'config.option'", "]", "(...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
generate_nt_hash
Generate a NT HASH CLI Example: .. code-block:: bash salt '*' pdbedit.generate_nt_hash my_passwd
salt/modules/pdbedit.py
def generate_nt_hash(password): ''' Generate a NT HASH CLI Example: .. code-block:: bash salt '*' pdbedit.generate_nt_hash my_passwd ''' return binascii.hexlify( hashlib.new( 'md4', password.encode('utf-16le') ).digest() ).upper()
def generate_nt_hash(password): ''' Generate a NT HASH CLI Example: .. code-block:: bash salt '*' pdbedit.generate_nt_hash my_passwd ''' return binascii.hexlify( hashlib.new( 'md4', password.encode('utf-16le') ).digest() ).upper()
[ "Generate", "a", "NT", "HASH" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pdbedit.py#L52-L67
[ "def", "generate_nt_hash", "(", "password", ")", ":", "return", "binascii", ".", "hexlify", "(", "hashlib", ".", "new", "(", "'md4'", ",", "password", ".", "encode", "(", "'utf-16le'", ")", ")", ".", "digest", "(", ")", ")", ".", "upper", "(", ")" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
train
list_users
List user accounts verbose : boolean return all information hashes : boolean include NT HASH and LM HASH in verbose output CLI Example: .. code-block:: bash salt '*' pdbedit.list
salt/modules/pdbedit.py
def list_users(verbose=True, hashes=False): ''' List user accounts verbose : boolean return all information hashes : boolean include NT HASH and LM HASH in verbose output CLI Example: .. code-block:: bash salt '*' pdbedit.list ''' users = {} if verbose else []...
def list_users(verbose=True, hashes=False): ''' List user accounts verbose : boolean return all information hashes : boolean include NT HASH and LM HASH in verbose output CLI Example: .. code-block:: bash salt '*' pdbedit.list ''' users = {} if verbose else []...
[ "List", "user", "accounts" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pdbedit.py#L70-L124
[ "def", "list_users", "(", "verbose", "=", "True", ",", "hashes", "=", "False", ")", ":", "users", "=", "{", "}", "if", "verbose", "else", "[", "]", "if", "verbose", ":", "# parse detailed user data", "res", "=", "__salt__", "[", "'cmd.run_all'", "]", "("...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
get_user
Get user account details login : string login name hashes : boolean include NTHASH and LMHASH in verbose output CLI Example: .. code-block:: bash salt '*' pdbedit.get kaylee
salt/modules/pdbedit.py
def get_user(login, hashes=False): ''' Get user account details login : string login name hashes : boolean include NTHASH and LMHASH in verbose output CLI Example: .. code-block:: bash salt '*' pdbedit.get kaylee ''' users = list_users(verbose=True, hashes=has...
def get_user(login, hashes=False): ''' Get user account details login : string login name hashes : boolean include NTHASH and LMHASH in verbose output CLI Example: .. code-block:: bash salt '*' pdbedit.get kaylee ''' users = list_users(verbose=True, hashes=has...
[ "Get", "user", "account", "details" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pdbedit.py#L127-L143
[ "def", "get_user", "(", "login", ",", "hashes", "=", "False", ")", ":", "users", "=", "list_users", "(", "verbose", "=", "True", ",", "hashes", "=", "hashes", ")", "return", "users", "[", "login", "]", "if", "login", "in", "users", "else", "{", "}" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
train
delete
Delete user account login : string login name CLI Example: .. code-block:: bash salt '*' pdbedit.delete wash
salt/modules/pdbedit.py
def delete(login): ''' Delete user account login : string login name CLI Example: .. code-block:: bash salt '*' pdbedit.delete wash ''' if login in list_users(False): res = __salt__['cmd.run_all']( 'pdbedit --delete {login}'.format(login=_quote_args(lo...
def delete(login): ''' Delete user account login : string login name CLI Example: .. code-block:: bash salt '*' pdbedit.delete wash ''' if login in list_users(False): res = __salt__['cmd.run_all']( 'pdbedit --delete {login}'.format(login=_quote_args(lo...
[ "Delete", "user", "account" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pdbedit.py#L146-L169
[ "def", "delete", "(", "login", ")", ":", "if", "login", "in", "list_users", "(", "False", ")", ":", "res", "=", "__salt__", "[", "'cmd.run_all'", "]", "(", "'pdbedit --delete {login}'", ".", "format", "(", "login", "=", "_quote_args", "(", "login", ")", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
create
Create user account login : string login name password : string password password_hashed : boolean set if password is a nt hash instead of plain text machine_account : boolean set to create a machine trust account instead CLI Example: .. code-block:: bash ...
salt/modules/pdbedit.py
def create(login, password, password_hashed=False, machine_account=False): ''' Create user account login : string login name password : string password password_hashed : boolean set if password is a nt hash instead of plain text machine_account : boolean set to c...
def create(login, password, password_hashed=False, machine_account=False): ''' Create user account login : string login name password : string password password_hashed : boolean set if password is a nt hash instead of plain text machine_account : boolean set to c...
[ "Create", "user", "account" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pdbedit.py#L172-L233
[ "def", "create", "(", "login", ",", "password", ",", "password_hashed", "=", "False", ",", "machine_account", "=", "False", ")", ":", "ret", "=", "'unchanged'", "# generate nt hash if needed", "if", "password_hashed", ":", "password_hash", "=", "password", ".", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
modify
Modify user account login : string login name password : string password password_hashed : boolean set if password is a nt hash instead of plain text domain : string users domain profile : string profile path script : string logon script drive...
salt/modules/pdbedit.py
def modify( login, password=None, password_hashed=False, domain=None, profile=None, script=None, drive=None, homedir=None, fullname=None, account_desc=None, account_control=None, machine_sid=None, user_sid=None, reset_login_hours=False, reset_bad_password_count=False, ): ''' Modify user ...
def modify( login, password=None, password_hashed=False, domain=None, profile=None, script=None, drive=None, homedir=None, fullname=None, account_desc=None, account_control=None, machine_sid=None, user_sid=None, reset_login_hours=False, reset_bad_password_count=False, ): ''' Modify user ...
[ "Modify", "user", "account" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pdbedit.py#L236-L385
[ "def", "modify", "(", "login", ",", "password", "=", "None", ",", "password_hashed", "=", "False", ",", "domain", "=", "None", ",", "profile", "=", "None", ",", "script", "=", "None", ",", "drive", "=", "None", ",", "homedir", "=", "None", ",", "full...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_validate_time_range
Check time range
salt/beacons/wtmp.py
def _validate_time_range(trange, status, msg): ''' Check time range ''' # If trange is empty, just return the current status & msg if not trange: return status, msg if not isinstance(trange, dict): status = False msg = ('The time_range parameter for ' 'wtm...
def _validate_time_range(trange, status, msg): ''' Check time range ''' # If trange is empty, just return the current status & msg if not trange: return status, msg if not isinstance(trange, dict): status = False msg = ('The time_range parameter for ' 'wtm...
[ "Check", "time", "range" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/beacons/wtmp.py#L174-L194
[ "def", "_validate_time_range", "(", "trange", ",", "status", ",", "msg", ")", ":", "# If trange is empty, just return the current status & msg", "if", "not", "trange", ":", "return", "status", ",", "msg", "if", "not", "isinstance", "(", "trange", ",", "dict", ")",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
validate
Validate the beacon configuration
salt/beacons/wtmp.py
def validate(config): ''' Validate the beacon configuration ''' vstatus = True vmsg = 'Valid beacon configuration' # Configuration for wtmp beacon should be a list of dicts if not isinstance(config, list): vstatus = False vmsg = ('Configuration for wtmp beacon must be a list...
def validate(config): ''' Validate the beacon configuration ''' vstatus = True vmsg = 'Valid beacon configuration' # Configuration for wtmp beacon should be a list of dicts if not isinstance(config, list): vstatus = False vmsg = ('Configuration for wtmp beacon must be a list...
[ "Validate", "the", "beacon", "configuration" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/beacons/wtmp.py#L234-L291
[ "def", "validate", "(", "config", ")", ":", "vstatus", "=", "True", "vmsg", "=", "'Valid beacon configuration'", "# Configuration for wtmp beacon should be a list of dicts", "if", "not", "isinstance", "(", "config", ",", "list", ")", ":", "vstatus", "=", "False", "v...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
running
Ensure the named service is running. name Service name as defined in the supervisor configuration file restart Whether to force a restart update Whether to update the supervisor configuration. user Name of the user to run the supervisorctl command .. versiona...
salt/states/supervisord.py
def running(name, restart=False, update=False, user=None, conf_file=None, bin_env=None, **kwargs): ''' Ensure the named service is running. name Service name as defined in the supervisor configuration file restart ...
def running(name, restart=False, update=False, user=None, conf_file=None, bin_env=None, **kwargs): ''' Ensure the named service is running. name Service name as defined in the supervisor configuration file restart ...
[ "Ensure", "the", "named", "service", "is", "running", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/supervisord.py#L52-L272
[ "def", "running", "(", "name", ",", "restart", "=", "False", ",", "update", "=", "False", ",", "user", "=", "None", ",", "conf_file", "=", "None", ",", "bin_env", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "name", ".", "endswith", "(", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
dead
Ensure the named service is dead (not running). name Service name as defined in the supervisor configuration file user Name of the user to run the supervisorctl command .. versionadded:: 0.17.0 conf_file path to supervisorctl config file bin_env path to super...
salt/states/supervisord.py
def dead(name, user=None, conf_file=None, bin_env=None, **kwargs): ''' Ensure the named service is dead (not running). name Service name as defined in the supervisor configuration file user Name of the user to run the supervisorctl command ....
def dead(name, user=None, conf_file=None, bin_env=None, **kwargs): ''' Ensure the named service is dead (not running). name Service name as defined in the supervisor configuration file user Name of the user to run the supervisorctl command ....
[ "Ensure", "the", "named", "service", "is", "dead", "(", "not", "running", ")", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/supervisord.py#L275-L355
[ "def", "dead", "(", "name", ",", "user", "=", "None", ",", "conf_file", "=", "None", ",", "bin_env", "=", "None", ",", "*", "*", "kwargs", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'result'", ":", "True", ",", "'comment'", ":", "''"...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
mod_watch
The supervisord watcher, called to invoke the watch command. Always restart on watch .. note:: This state exists to support special handling of the ``watch`` :ref:`requisite <requisites>`. It should not be called directly. Parameters for this function should be set by the state being t...
salt/states/supervisord.py
def mod_watch(name, restart=True, update=False, user=None, conf_file=None, bin_env=None, **kwargs): ''' The supervisord watcher, called to invoke the watch command. Always restart on watch .. note:: This state e...
def mod_watch(name, restart=True, update=False, user=None, conf_file=None, bin_env=None, **kwargs): ''' The supervisord watcher, called to invoke the watch command. Always restart on watch .. note:: This state e...
[ "The", "supervisord", "watcher", "called", "to", "invoke", "the", "watch", "command", ".", "Always", "restart", "on", "watch" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/supervisord.py#L358-L382
[ "def", "mod_watch", "(", "name", ",", "restart", "=", "True", ",", "update", "=", "False", ",", "user", "=", "None", ",", "conf_file", "=", "None", ",", "bin_env", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "running", "(", "name", ",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
render
Render a Cheetah template. :rtype: A Python data structure
salt/renderers/cheetah.py
def render(cheetah_data, saltenv='base', sls='', method='xml', **kws): ''' Render a Cheetah template. :rtype: A Python data structure ''' if not HAS_LIBS: return {} if not isinstance(cheetah_data, six.string_types): cheetah_data = cheetah_data.read() if cheetah_data.starts...
def render(cheetah_data, saltenv='base', sls='', method='xml', **kws): ''' Render a Cheetah template. :rtype: A Python data structure ''' if not HAS_LIBS: return {} if not isinstance(cheetah_data, six.string_types): cheetah_data = cheetah_data.read() if cheetah_data.starts...
[ "Render", "a", "Cheetah", "template", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/renderers/cheetah.py#L19-L36
[ "def", "render", "(", "cheetah_data", ",", "saltenv", "=", "'base'", ",", "sls", "=", "''", ",", "method", "=", "'xml'", ",", "*", "*", "kws", ")", ":", "if", "not", "HAS_LIBS", ":", "return", "{", "}", "if", "not", "isinstance", "(", "cheetah_data",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_config
Get configuration items for URL, Username and Password
salt/modules/nagios_rpc.py
def _config(): ''' Get configuration items for URL, Username and Password ''' status_url = __salt__['config.get']('nagios.status_url') or \ __salt__['config.get']('nagios:status_url') if not status_url: raise CommandExecutionError('Missing Nagios URL in the configuration.') user...
def _config(): ''' Get configuration items for URL, Username and Password ''' status_url = __salt__['config.get']('nagios.status_url') or \ __salt__['config.get']('nagios:status_url') if not status_url: raise CommandExecutionError('Missing Nagios URL in the configuration.') user...
[ "Get", "configuration", "items", "for", "URL", "Username", "and", "Password" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nagios_rpc.py#L32-L49
[ "def", "_config", "(", ")", ":", "status_url", "=", "__salt__", "[", "'config.get'", "]", "(", "'nagios.status_url'", ")", "or", "__salt__", "[", "'config.get'", "]", "(", "'nagios:status_url'", ")", "if", "not", "status_url", ":", "raise", "CommandExecutionErro...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_status_query
Send query along to Nagios.
salt/modules/nagios_rpc.py
def _status_query(query, hostname, enumerate=None, service=None): ''' Send query along to Nagios. ''' config = _config() data = None params = { 'hostname': hostname, 'query': query, } ret = { 'result': False } if enumerate: params['formatoptions...
def _status_query(query, hostname, enumerate=None, service=None): ''' Send query along to Nagios. ''' config = _config() data = None params = { 'hostname': hostname, 'query': query, } ret = { 'result': False } if enumerate: params['formatoptions...
[ "Send", "query", "along", "to", "Nagios", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nagios_rpc.py#L52-L110
[ "def", "_status_query", "(", "query", ",", "hostname", ",", "enumerate", "=", "None", ",", "service", "=", "None", ")", ":", "config", "=", "_config", "(", ")", "data", "=", "None", "params", "=", "{", "'hostname'", ":", "hostname", ",", "'query'", ":"...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
host_status
Check status of a particular host By default statuses are returned in a numeric format. Parameters: hostname The hostname to check the status of the service in Nagios. numeric Turn to false in order to return status in text format ('OK' instead of 0, 'Warning' instead of 1 etc...
salt/modules/nagios_rpc.py
def host_status(hostname=None, **kwargs): ''' Check status of a particular host By default statuses are returned in a numeric format. Parameters: hostname The hostname to check the status of the service in Nagios. numeric Turn to false in order to return status in text format ...
def host_status(hostname=None, **kwargs): ''' Check status of a particular host By default statuses are returned in a numeric format. Parameters: hostname The hostname to check the status of the service in Nagios. numeric Turn to false in order to return status in text format ...
[ "Check", "status", "of", "a", "particular", "host", "By", "default", "statuses", "are", "returned", "in", "a", "numeric", "format", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nagios_rpc.py#L113-L150
[ "def", "host_status", "(", "hostname", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "not", "hostname", ":", "raise", "CommandExecutionError", "(", "'Missing hostname parameter'", ")", "target", "=", "'host'", "numeric", "=", "kwargs", ".", "get", "(...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
service_status
Check status of a particular service on a host on it in Nagios. By default statuses are returned in a numeric format. Parameters: hostname The hostname to check the status of the service in Nagios. service The service to check the status of in Nagios. numeric Turn to fals...
salt/modules/nagios_rpc.py
def service_status(hostname=None, service=None, **kwargs): ''' Check status of a particular service on a host on it in Nagios. By default statuses are returned in a numeric format. Parameters: hostname The hostname to check the status of the service in Nagios. service The serv...
def service_status(hostname=None, service=None, **kwargs): ''' Check status of a particular service on a host on it in Nagios. By default statuses are returned in a numeric format. Parameters: hostname The hostname to check the status of the service in Nagios. service The serv...
[ "Check", "status", "of", "a", "particular", "service", "on", "a", "host", "on", "it", "in", "Nagios", ".", "By", "default", "statuses", "are", "returned", "in", "a", "numeric", "format", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nagios_rpc.py#L153-L196
[ "def", "service_status", "(", "hostname", "=", "None", ",", "service", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "not", "hostname", ":", "raise", "CommandExecutionError", "(", "'Missing hostname parameter'", ")", "if", "not", "service", ":", "rai...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
set_
Set a key/value pair in a keyring service
salt/sdb/keyring_db.py
def set_(key, value, service=None, profile=None): ''' Set a key/value pair in a keyring service ''' service = _get_service(service, profile) keyring.set_password(service, key, value)
def set_(key, value, service=None, profile=None): ''' Set a key/value pair in a keyring service ''' service = _get_service(service, profile) keyring.set_password(service, key, value)
[ "Set", "a", "key", "/", "value", "pair", "in", "a", "keyring", "service" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/sdb/keyring_db.py#L76-L81
[ "def", "set_", "(", "key", ",", "value", ",", "service", "=", "None", ",", "profile", "=", "None", ")", ":", "service", "=", "_get_service", "(", "service", ",", "profile", ")", "keyring", ".", "set_password", "(", "service", ",", "key", ",", "value", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
get
Get a value from a keyring service
salt/sdb/keyring_db.py
def get(key, service=None, profile=None): ''' Get a value from a keyring service ''' service = _get_service(service, profile) return keyring.get_password(service, key)
def get(key, service=None, profile=None): ''' Get a value from a keyring service ''' service = _get_service(service, profile) return keyring.get_password(service, key)
[ "Get", "a", "value", "from", "a", "keyring", "service" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/sdb/keyring_db.py#L84-L89
[ "def", "get", "(", "key", ",", "service", "=", "None", ",", "profile", "=", "None", ")", ":", "service", "=", "_get_service", "(", "service", ",", "profile", ")", "return", "keyring", ".", "get_password", "(", "service", ",", "key", ")" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
train
returner
Log outcome to sentry. The returner tries to identify errors and report them as such. All other messages will be reported at info level. Failed states will be appended as separate list for convenience.
salt/returners/sentry_return.py
def returner(ret): ''' Log outcome to sentry. The returner tries to identify errors and report them as such. All other messages will be reported at info level. Failed states will be appended as separate list for convenience. ''' try: _connect_sentry(_get_message(ret), ret) except Ex...
def returner(ret): ''' Log outcome to sentry. The returner tries to identify errors and report them as such. All other messages will be reported at info level. Failed states will be appended as separate list for convenience. ''' try: _connect_sentry(_get_message(ret), ret) except Ex...
[ "Log", "outcome", "to", "sentry", ".", "The", "returner", "tries", "to", "identify", "errors", "and", "report", "them", "as", "such", ".", "All", "other", "messages", "will", "be", "reported", "at", "info", "level", ".", "Failed", "states", "will", "be", ...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/sentry_return.py#L74-L84
[ "def", "returner", "(", "ret", ")", ":", "try", ":", "_connect_sentry", "(", "_get_message", "(", "ret", ")", ",", "ret", ")", "except", "Exception", "as", "err", ":", "log", ".", "error", "(", "'Can\\'t run connect_sentry: %s'", ",", "err", ",", "exc_info...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_connect_sentry
Connect to the Sentry server
salt/returners/sentry_return.py
def _connect_sentry(message, result): ''' Connect to the Sentry server ''' pillar_data = __salt__['pillar.raw']() grains = __salt__['grains.items']() raven_config = pillar_data['raven'] hide_pillar = raven_config.get('hide_pillar') sentry_data = { 'result': result, 'pilla...
def _connect_sentry(message, result): ''' Connect to the Sentry server ''' pillar_data = __salt__['pillar.raw']() grains = __salt__['grains.items']() raven_config = pillar_data['raven'] hide_pillar = raven_config.get('hide_pillar') sentry_data = { 'result': result, 'pilla...
[ "Connect", "to", "the", "Sentry", "server" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/sentry_return.py#L120-L180
[ "def", "_connect_sentry", "(", "message", ",", "result", ")", ":", "pillar_data", "=", "__salt__", "[", "'pillar.raw'", "]", "(", ")", "grains", "=", "__salt__", "[", "'grains.items'", "]", "(", ")", "raven_config", "=", "pillar_data", "[", "'raven'", "]", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
list_nodes_min
Return a list of registered VMs, with minimal information CLI Example: .. code-block:: bash salt '*' vboxmanage.list_nodes_min
salt/modules/vboxmanage.py
def list_nodes_min(): ''' Return a list of registered VMs, with minimal information CLI Example: .. code-block:: bash salt '*' vboxmanage.list_nodes_min ''' ret = {} cmd = '{0} list vms'.format(vboxcmd()) for line in salt.modules.cmdmod.run(cmd).splitlines(): if not li...
def list_nodes_min(): ''' Return a list of registered VMs, with minimal information CLI Example: .. code-block:: bash salt '*' vboxmanage.list_nodes_min ''' ret = {} cmd = '{0} list vms'.format(vboxcmd()) for line in salt.modules.cmdmod.run(cmd).splitlines(): if not li...
[ "Return", "a", "list", "of", "registered", "VMs", "with", "minimal", "information" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/vboxmanage.py#L77-L95
[ "def", "list_nodes_min", "(", ")", ":", "ret", "=", "{", "}", "cmd", "=", "'{0} list vms'", ".", "format", "(", "vboxcmd", "(", ")", ")", "for", "line", "in", "salt", ".", "modules", ".", "cmdmod", ".", "run", "(", "cmd", ")", ".", "splitlines", "(...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
list_nodes
Return a list of registered VMs CLI Example: .. code-block:: bash salt '*' vboxmanage.list_nodes
salt/modules/vboxmanage.py
def list_nodes(): ''' Return a list of registered VMs CLI Example: .. code-block:: bash salt '*' vboxmanage.list_nodes ''' ret = {} nodes = list_nodes_full() for node in nodes: ret[node] = { 'id': nodes[node]['UUID'], 'image': nodes[node]['Guest...
def list_nodes(): ''' Return a list of registered VMs CLI Example: .. code-block:: bash salt '*' vboxmanage.list_nodes ''' ret = {} nodes = list_nodes_full() for node in nodes: ret[node] = { 'id': nodes[node]['UUID'], 'image': nodes[node]['Guest...
[ "Return", "a", "list", "of", "registered", "VMs" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/vboxmanage.py#L111-L136
[ "def", "list_nodes", "(", ")", ":", "ret", "=", "{", "}", "nodes", "=", "list_nodes_full", "(", ")", "for", "node", "in", "nodes", ":", "ret", "[", "node", "]", "=", "{", "'id'", ":", "nodes", "[", "node", "]", "[", "'UUID'", "]", ",", "'image'",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
start
Start a VM CLI Example: .. code-block:: bash salt '*' vboxmanage.start my_vm
salt/modules/vboxmanage.py
def start(name): ''' Start a VM CLI Example: .. code-block:: bash salt '*' vboxmanage.start my_vm ''' ret = {} cmd = '{0} startvm {1}'.format(vboxcmd(), name) ret = salt.modules.cmdmod.run(cmd).splitlines() return ret
def start(name): ''' Start a VM CLI Example: .. code-block:: bash salt '*' vboxmanage.start my_vm ''' ret = {} cmd = '{0} startvm {1}'.format(vboxcmd(), name) ret = salt.modules.cmdmod.run(cmd).splitlines() return ret
[ "Start", "a", "VM" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/vboxmanage.py#L139-L152
[ "def", "start", "(", "name", ")", ":", "ret", "=", "{", "}", "cmd", "=", "'{0} startvm {1}'", ".", "format", "(", "vboxcmd", "(", ")", ",", "name", ")", "ret", "=", "salt", ".", "modules", ".", "cmdmod", ".", "run", "(", "cmd", ")", ".", "splitli...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
register
Register a VM CLI Example: .. code-block:: bash salt '*' vboxmanage.register my_vm_filename
salt/modules/vboxmanage.py
def register(filename): ''' Register a VM CLI Example: .. code-block:: bash salt '*' vboxmanage.register my_vm_filename ''' if not os.path.isfile(filename): raise CommandExecutionError( 'The specified filename ({0}) does not exist.'.format(filename) ) ...
def register(filename): ''' Register a VM CLI Example: .. code-block:: bash salt '*' vboxmanage.register my_vm_filename ''' if not os.path.isfile(filename): raise CommandExecutionError( 'The specified filename ({0}) does not exist.'.format(filename) ) ...
[ "Register", "a", "VM" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/vboxmanage.py#L170-L189
[ "def", "register", "(", "filename", ")", ":", "if", "not", "os", ".", "path", ".", "isfile", "(", "filename", ")", ":", "raise", "CommandExecutionError", "(", "'The specified filename ({0}) does not exist.'", ".", "format", "(", "filename", ")", ")", "cmd", "=...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
unregister
Unregister a VM CLI Example: .. code-block:: bash salt '*' vboxmanage.unregister my_vm_filename
salt/modules/vboxmanage.py
def unregister(name, delete=False): ''' Unregister a VM CLI Example: .. code-block:: bash salt '*' vboxmanage.unregister my_vm_filename ''' nodes = list_nodes_min() if name not in nodes: raise CommandExecutionError( 'The specified VM ({0}) is not registered.'.f...
def unregister(name, delete=False): ''' Unregister a VM CLI Example: .. code-block:: bash salt '*' vboxmanage.unregister my_vm_filename ''' nodes = list_nodes_min() if name not in nodes: raise CommandExecutionError( 'The specified VM ({0}) is not registered.'.f...
[ "Unregister", "a", "VM" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/vboxmanage.py#L192-L214
[ "def", "unregister", "(", "name", ",", "delete", "=", "False", ")", ":", "nodes", "=", "list_nodes_min", "(", ")", "if", "name", "not", "in", "nodes", ":", "raise", "CommandExecutionError", "(", "'The specified VM ({0}) is not registered.'", ".", "format", "(", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
create
Create a new VM CLI Example: .. code-block:: bash salt 'hypervisor' vboxmanage.create <name>
salt/modules/vboxmanage.py
def create(name, groups=None, ostype=None, register=True, basefolder=None, new_uuid=None, **kwargs): ''' Create a new VM CLI Example: .. code-block:: bash salt 'hypervisor' vboxmanage.create <name> ''' nodes = list_node...
def create(name, groups=None, ostype=None, register=True, basefolder=None, new_uuid=None, **kwargs): ''' Create a new VM CLI Example: .. code-block:: bash salt 'hypervisor' vboxmanage.create <name> ''' nodes = list_node...
[ "Create", "a", "new", "VM" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/vboxmanage.py#L230-L294
[ "def", "create", "(", "name", ",", "groups", "=", "None", ",", "ostype", "=", "None", ",", "register", "=", "True", ",", "basefolder", "=", "None", ",", "new_uuid", "=", "None", ",", "*", "*", "kwargs", ")", ":", "nodes", "=", "list_nodes_min", "(", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
clonevm
Clone a new VM from an existing VM CLI Example: .. code-block:: bash salt 'hypervisor' vboxmanage.clonevm <name> <new_name>
salt/modules/vboxmanage.py
def clonevm(name=None, uuid=None, new_name=None, snapshot_uuid=None, snapshot_name=None, mode='machine', options=None, basefolder=None, new_uuid=None, register=False, groups=None, **kwargs...
def clonevm(name=None, uuid=None, new_name=None, snapshot_uuid=None, snapshot_name=None, mode='machine', options=None, basefolder=None, new_uuid=None, register=False, groups=None, **kwargs...
[ "Clone", "a", "new", "VM", "from", "an", "existing", "VM" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/vboxmanage.py#L297-L401
[ "def", "clonevm", "(", "name", "=", "None", ",", "uuid", "=", "None", ",", "new_name", "=", "None", ",", "snapshot_uuid", "=", "None", ",", "snapshot_name", "=", "None", ",", "mode", "=", "'machine'", ",", "options", "=", "None", ",", "basefolder", "="...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
clonemedium
Clone a new VM from an existing VM CLI Example: .. code-block:: bash salt 'hypervisor' vboxmanage.clonemedium <name> <new_name>
salt/modules/vboxmanage.py
def clonemedium(medium, uuid_in=None, file_in=None, uuid_out=None, file_out=None, mformat=None, variant=None, existing=False, **kwargs): ''' Clone a new VM from an existing VM CLI...
def clonemedium(medium, uuid_in=None, file_in=None, uuid_out=None, file_out=None, mformat=None, variant=None, existing=False, **kwargs): ''' Clone a new VM from an existing VM CLI...
[ "Clone", "a", "new", "VM", "from", "an", "existing", "VM" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/vboxmanage.py#L404-L494
[ "def", "clonemedium", "(", "medium", ",", "uuid_in", "=", "None", ",", "file_in", "=", "None", ",", "uuid_out", "=", "None", ",", "file_out", "=", "None", ",", "mformat", "=", "None", ",", "variant", "=", "None", ",", "existing", "=", "False", ",", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
list_items
Return a list of a specific type of item. The following items are available: vms runningvms ostypes hostdvds hostfloppies intnets bridgedifs hostonlyifs natnets dhcpservers hostinfo hostcpuids hddbackends hd...
salt/modules/vboxmanage.py
def list_items(item, details=False, group_by='UUID'): ''' Return a list of a specific type of item. The following items are available: vms runningvms ostypes hostdvds hostfloppies intnets bridgedifs hostonlyifs natnets dhcpservers ...
def list_items(item, details=False, group_by='UUID'): ''' Return a list of a specific type of item. The following items are available: vms runningvms ostypes hostdvds hostfloppies intnets bridgedifs hostonlyifs natnets dhcpservers ...
[ "Return", "a", "list", "of", "a", "specific", "type", "of", "item", ".", "The", "following", "items", "are", "available", ":" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/vboxmanage.py#L497-L571
[ "def", "list_items", "(", "item", ",", "details", "=", "False", ",", "group_by", "=", "'UUID'", ")", ":", "types", "=", "(", "'vms'", ",", "'runningvms'", ",", "'ostypes'", ",", "'hostdvds'", ",", "'hostfloppies'", ",", "'intnets'", ",", "'bridgedifs'", ",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_unicode_output
Return strings values as python unicode string http://www.oracle.com/technetwork/articles/dsl/tuininga-cx-oracle-084866.html
salt/modules/oracle.py
def _unicode_output(cursor, name, default_type, size, precision, scale): ''' Return strings values as python unicode string http://www.oracle.com/technetwork/articles/dsl/tuininga-cx-oracle-084866.html ''' if default_type in (cx_Oracle.STRING, cx_Oracle.LONG_STRING, cx_Oracl...
def _unicode_output(cursor, name, default_type, size, precision, scale): ''' Return strings values as python unicode string http://www.oracle.com/technetwork/articles/dsl/tuininga-cx-oracle-084866.html ''' if default_type in (cx_Oracle.STRING, cx_Oracle.LONG_STRING, cx_Oracl...
[ "Return", "strings", "values", "as", "python", "unicode", "string" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/oracle.py#L80-L88
[ "def", "_unicode_output", "(", "cursor", ",", "name", ",", "default_type", ",", "size", ",", "precision", ",", "scale", ")", ":", "if", "default_type", "in", "(", "cx_Oracle", ".", "STRING", ",", "cx_Oracle", ".", "LONG_STRING", ",", "cx_Oracle", ".", "FIX...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_connect
uri = user/password@host[:port]/sid[servicename as {sysdba|sysoper}] or uri = sid[ as {sysdba|sysoper}] (this syntax only makes sense on non-Windows minions, ORAHOME is taken from oratab) Return cx_Oracle.Connection instance
salt/modules/oracle.py
def _connect(uri): ''' uri = user/password@host[:port]/sid[servicename as {sysdba|sysoper}] or uri = sid[ as {sysdba|sysoper}] (this syntax only makes sense on non-Windows minions, ORAHOME is taken from oratab) Return cx_Oracle.Connection instance ''' # cx_Oracle.Connection() does not...
def _connect(uri): ''' uri = user/password@host[:port]/sid[servicename as {sysdba|sysoper}] or uri = sid[ as {sysdba|sysoper}] (this syntax only makes sense on non-Windows minions, ORAHOME is taken from oratab) Return cx_Oracle.Connection instance ''' # cx_Oracle.Connection() does not...
[ "uri", "=", "user", "/", "password@host", "[", ":", "port", "]", "/", "sid", "[", "servicename", "as", "{", "sysdba|sysoper", "}", "]", "or", "uri", "=", "sid", "[", "as", "{", "sysdba|sysoper", "}", "]", "(", "this", "syntax", "only", "makes", "sens...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/oracle.py#L91-L140
[ "def", "_connect", "(", "uri", ")", ":", "# cx_Oracle.Connection() does not support 'as sysdba' syntax", "uri_l", "=", "uri", ".", "rsplit", "(", "' as '", ",", "1", ")", "if", "len", "(", "uri_l", ")", "==", "2", ":", "credentials", ",", "mode", "=", "uri_l...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_parse_oratab
Return ORACLE_HOME for a given SID found in oratab Note: only works with Unix-like minions
salt/modules/oracle.py
def _parse_oratab(sid): ''' Return ORACLE_HOME for a given SID found in oratab Note: only works with Unix-like minions ''' if __grains__.get('kernel') in ('Linux', 'AIX', 'FreeBSD', 'OpenBSD', 'NetBSD'): ORATAB = '/etc/oratab' elif __grains__.get('kernel') in 'SunOS': ORATAB = '...
def _parse_oratab(sid): ''' Return ORACLE_HOME for a given SID found in oratab Note: only works with Unix-like minions ''' if __grains__.get('kernel') in ('Linux', 'AIX', 'FreeBSD', 'OpenBSD', 'NetBSD'): ORATAB = '/etc/oratab' elif __grains__.get('kernel') in 'SunOS': ORATAB = '...
[ "Return", "ORACLE_HOME", "for", "a", "given", "SID", "found", "in", "oratab" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/oracle.py#L143-L166
[ "def", "_parse_oratab", "(", "sid", ")", ":", "if", "__grains__", ".", "get", "(", "'kernel'", ")", "in", "(", "'Linux'", ",", "'AIX'", ",", "'FreeBSD'", ",", "'OpenBSD'", ",", "'NetBSD'", ")", ":", "ORATAB", "=", "'/etc/oratab'", "elif", "__grains__", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
run_query
Run SQL query and return result CLI Example: .. code-block:: bash salt '*' oracle.run_query my_db "select * from my_table"
salt/modules/oracle.py
def run_query(db, query): ''' Run SQL query and return result CLI Example: .. code-block:: bash salt '*' oracle.run_query my_db "select * from my_table" ''' if db in [x.keys()[0] for x in show_dbs()]: conn = _connect(show_dbs(db)[db]['uri']) else: log.debug('No uri...
def run_query(db, query): ''' Run SQL query and return result CLI Example: .. code-block:: bash salt '*' oracle.run_query my_db "select * from my_table" ''' if db in [x.keys()[0] for x in show_dbs()]: conn = _connect(show_dbs(db)[db]['uri']) else: log.debug('No uri...
[ "Run", "SQL", "query", "and", "return", "result" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/oracle.py#L170-L187
[ "def", "run_query", "(", "db", ",", "query", ")", ":", "if", "db", "in", "[", "x", ".", "keys", "(", ")", "[", "0", "]", "for", "x", "in", "show_dbs", "(", ")", "]", ":", "conn", "=", "_connect", "(", "show_dbs", "(", "db", ")", "[", "db", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
show_dbs
Show databases configuration from pillar. Filter by `*args` CLI Example: .. code-block:: bash salt '*' oracle.show_dbs salt '*' oracle.show_dbs my_db
salt/modules/oracle.py
def show_dbs(*dbs): ''' Show databases configuration from pillar. Filter by `*args` CLI Example: .. code-block:: bash salt '*' oracle.show_dbs salt '*' oracle.show_dbs my_db ''' if dbs: log.debug('get db versions for: %s', dbs) result = {} for db in dbs...
def show_dbs(*dbs): ''' Show databases configuration from pillar. Filter by `*args` CLI Example: .. code-block:: bash salt '*' oracle.show_dbs salt '*' oracle.show_dbs my_db ''' if dbs: log.debug('get db versions for: %s', dbs) result = {} for db in dbs...
[ "Show", "databases", "configuration", "from", "pillar", ".", "Filter", "by", "*", "args" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/oracle.py#L190-L210
[ "def", "show_dbs", "(", "*", "dbs", ")", ":", "if", "dbs", ":", "log", ".", "debug", "(", "'get db versions for: %s'", ",", "dbs", ")", "result", "=", "{", "}", "for", "db", "in", "dbs", ":", "result", "[", "db", "]", "=", "__salt__", "[", "'pillar...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
version
Server Version (select banner from v$version) CLI Example: .. code-block:: bash salt '*' oracle.version salt '*' oracle.version my_db
salt/modules/oracle.py
def version(*dbs): ''' Server Version (select banner from v$version) CLI Example: .. code-block:: bash salt '*' oracle.version salt '*' oracle.version my_db ''' pillar_dbs = __salt__['pillar.get']('oracle:dbs') get_version = lambda x: [ r[0] for r in run_query(x, ...
def version(*dbs): ''' Server Version (select banner from v$version) CLI Example: .. code-block:: bash salt '*' oracle.version salt '*' oracle.version my_db ''' pillar_dbs = __salt__['pillar.get']('oracle:dbs') get_version = lambda x: [ r[0] for r in run_query(x, ...
[ "Server", "Version", "(", "select", "banner", "from", "v$version", ")" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/oracle.py#L214-L239
[ "def", "version", "(", "*", "dbs", ")", ":", "pillar_dbs", "=", "__salt__", "[", "'pillar.get'", "]", "(", "'oracle:dbs'", ")", "get_version", "=", "lambda", "x", ":", "[", "r", "[", "0", "]", "for", "r", "in", "run_query", "(", "x", ",", "\"select b...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
show_env
Show Environment used by Oracle Client CLI Example: .. code-block:: bash salt '*' oracle.show_env .. note:: at first _connect() ``NLS_LANG`` will forced to '.AL32UTF8'
salt/modules/oracle.py
def show_env(): ''' Show Environment used by Oracle Client CLI Example: .. code-block:: bash salt '*' oracle.show_env .. note:: at first _connect() ``NLS_LANG`` will forced to '.AL32UTF8' ''' envs = ['PATH', 'ORACLE_HOME', 'TNS_ADMIN', 'NLS_LANG'] result = {} for ...
def show_env(): ''' Show Environment used by Oracle Client CLI Example: .. code-block:: bash salt '*' oracle.show_env .. note:: at first _connect() ``NLS_LANG`` will forced to '.AL32UTF8' ''' envs = ['PATH', 'ORACLE_HOME', 'TNS_ADMIN', 'NLS_LANG'] result = {} for ...
[ "Show", "Environment", "used", "by", "Oracle", "Client" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/oracle.py#L273-L291
[ "def", "show_env", "(", ")", ":", "envs", "=", "[", "'PATH'", ",", "'ORACLE_HOME'", ",", "'TNS_ADMIN'", ",", "'NLS_LANG'", "]", "result", "=", "{", "}", "for", "env", "in", "envs", ":", "if", "env", "in", "os", ".", "environ", ":", "result", "[", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_get_gecos
Retrieve GECOS field info and return it in dictionary form
salt/modules/solaris_user.py
def _get_gecos(name): ''' Retrieve GECOS field info and return it in dictionary form ''' gecos_field = pwd.getpwnam(name).pw_gecos.split(',', 3) if not gecos_field: return {} else: # Assign empty strings for any unspecified trailing GECOS fields while len(gecos_field) < 4...
def _get_gecos(name): ''' Retrieve GECOS field info and return it in dictionary form ''' gecos_field = pwd.getpwnam(name).pw_gecos.split(',', 3) if not gecos_field: return {} else: # Assign empty strings for any unspecified trailing GECOS fields while len(gecos_field) < 4...
[ "Retrieve", "GECOS", "field", "info", "and", "return", "it", "in", "dictionary", "form" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solaris_user.py#L46-L60
[ "def", "_get_gecos", "(", "name", ")", ":", "gecos_field", "=", "pwd", ".", "getpwnam", "(", "name", ")", ".", "pw_gecos", ".", "split", "(", "','", ",", "3", ")", "if", "not", "gecos_field", ":", "return", "{", "}", "else", ":", "# Assign empty string...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_build_gecos
Accepts a dictionary entry containing GECOS field names and their values, and returns a full GECOS comment string, to be used with usermod.
salt/modules/solaris_user.py
def _build_gecos(gecos_dict): ''' Accepts a dictionary entry containing GECOS field names and their values, and returns a full GECOS comment string, to be used with usermod. ''' return '{0},{1},{2},{3}'.format(gecos_dict.get('fullname', ''), gecos_dict.get('roomnu...
def _build_gecos(gecos_dict): ''' Accepts a dictionary entry containing GECOS field names and their values, and returns a full GECOS comment string, to be used with usermod. ''' return '{0},{1},{2},{3}'.format(gecos_dict.get('fullname', ''), gecos_dict.get('roomnu...
[ "Accepts", "a", "dictionary", "entry", "containing", "GECOS", "field", "names", "and", "their", "values", "and", "returns", "a", "full", "GECOS", "comment", "string", "to", "be", "used", "with", "usermod", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solaris_user.py#L63-L71
[ "def", "_build_gecos", "(", "gecos_dict", ")", ":", "return", "'{0},{1},{2},{3}'", ".", "format", "(", "gecos_dict", ".", "get", "(", "'fullname'", ",", "''", ")", ",", "gecos_dict", ".", "get", "(", "'roomnumber'", ",", "''", ")", ",", "gecos_dict", ".", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_update_gecos
Common code to change a user's GECOS information
salt/modules/solaris_user.py
def _update_gecos(name, key, value): ''' Common code to change a user's GECOS information ''' if not isinstance(value, six.string_types): value = six.text_type(value) pre_info = _get_gecos(name) if not pre_info: return False if value == pre_info[key]: return True ...
def _update_gecos(name, key, value): ''' Common code to change a user's GECOS information ''' if not isinstance(value, six.string_types): value = six.text_type(value) pre_info = _get_gecos(name) if not pre_info: return False if value == pre_info[key]: return True ...
[ "Common", "code", "to", "change", "a", "user", "s", "GECOS", "information" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solaris_user.py#L74-L90
[ "def", "_update_gecos", "(", "name", ",", "key", ",", "value", ")", ":", "if", "not", "isinstance", "(", "value", ",", "six", ".", "string_types", ")", ":", "value", "=", "six", ".", "text_type", "(", "value", ")", "pre_info", "=", "_get_gecos", "(", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
add
Add a user to the minion CLI Example: .. code-block:: bash salt '*' user.add name <uid> <gid> <groups> <home> <shell>
salt/modules/solaris_user.py
def add(name, uid=None, gid=None, groups=None, home=None, shell=None, unique=True, fullname='', roomnumber='', workphone='', homephone='', createhome=True, **kwargs): ''' Add a user to the minion CLI Example: ...
def add(name, uid=None, gid=None, groups=None, home=None, shell=None, unique=True, fullname='', roomnumber='', workphone='', homephone='', createhome=True, **kwargs): ''' Add a user to the minion CLI Example: ...
[ "Add", "a", "user", "to", "the", "minion" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solaris_user.py#L93-L159
[ "def", "add", "(", "name", ",", "uid", "=", "None", ",", "gid", "=", "None", ",", "groups", "=", "None", ",", "home", "=", "None", ",", "shell", "=", "None", ",", "unique", "=", "True", ",", "fullname", "=", "''", ",", "roomnumber", "=", "''", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
delete
Remove a user from the minion CLI Example: .. code-block:: bash salt '*' user.delete name remove=True force=True
salt/modules/solaris_user.py
def delete(name, remove=False, force=False): ''' Remove a user from the minion CLI Example: .. code-block:: bash salt '*' user.delete name remove=True force=True ''' if salt.utils.data.is_true(force): log.warning( 'userdel does not support force-deleting user while...
def delete(name, remove=False, force=False): ''' Remove a user from the minion CLI Example: .. code-block:: bash salt '*' user.delete name remove=True force=True ''' if salt.utils.data.is_true(force): log.warning( 'userdel does not support force-deleting user while...
[ "Remove", "a", "user", "from", "the", "minion" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solaris_user.py#L162-L181
[ "def", "delete", "(", "name", ",", "remove", "=", "False", ",", "force", "=", "False", ")", ":", "if", "salt", ".", "utils", ".", "data", ".", "is_true", "(", "force", ")", ":", "log", ".", "warning", "(", "'userdel does not support force-deleting user whi...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
chgid
Change the default group of the user CLI Example: .. code-block:: bash salt '*' user.chgid foo 4376
salt/modules/solaris_user.py
def chgid(name, gid): ''' Change the default group of the user CLI Example: .. code-block:: bash salt '*' user.chgid foo 4376 ''' pre_info = info(name) if not pre_info: raise CommandExecutionError( 'User \'{0}\' does not exist'.format(name) ) if gid...
def chgid(name, gid): ''' Change the default group of the user CLI Example: .. code-block:: bash salt '*' user.chgid foo 4376 ''' pre_info = info(name) if not pre_info: raise CommandExecutionError( 'User \'{0}\' does not exist'.format(name) ) if gid...
[ "Change", "the", "default", "group", "of", "the", "user" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solaris_user.py#L226-L245
[ "def", "chgid", "(", "name", ",", "gid", ")", ":", "pre_info", "=", "info", "(", "name", ")", "if", "not", "pre_info", ":", "raise", "CommandExecutionError", "(", "'User \\'{0}\\' does not exist'", ".", "format", "(", "name", ")", ")", "if", "gid", "==", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
chshell
Change the default shell of the user CLI Example: .. code-block:: bash salt '*' user.chshell foo /bin/zsh
salt/modules/solaris_user.py
def chshell(name, shell): ''' Change the default shell of the user CLI Example: .. code-block:: bash salt '*' user.chshell foo /bin/zsh ''' pre_info = info(name) if not pre_info: raise CommandExecutionError( 'User \'{0}\' does not exist'.format(name) ) ...
def chshell(name, shell): ''' Change the default shell of the user CLI Example: .. code-block:: bash salt '*' user.chshell foo /bin/zsh ''' pre_info = info(name) if not pre_info: raise CommandExecutionError( 'User \'{0}\' does not exist'.format(name) ) ...
[ "Change", "the", "default", "shell", "of", "the", "user" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solaris_user.py#L248-L267
[ "def", "chshell", "(", "name", ",", "shell", ")", ":", "pre_info", "=", "info", "(", "name", ")", "if", "not", "pre_info", ":", "raise", "CommandExecutionError", "(", "'User \\'{0}\\' does not exist'", ".", "format", "(", "name", ")", ")", "if", "shell", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
chhome
Set a new home directory for an existing user name Username to modify home New home directory to set persist : False Set to ``True`` to prevent configuration files in the new home directory from being overwritten by the files from the skeleton directory. CLI E...
salt/modules/solaris_user.py
def chhome(name, home, persist=False): ''' Set a new home directory for an existing user name Username to modify home New home directory to set persist : False Set to ``True`` to prevent configuration files in the new home directory from being overwritten by the fi...
def chhome(name, home, persist=False): ''' Set a new home directory for an existing user name Username to modify home New home directory to set persist : False Set to ``True`` to prevent configuration files in the new home directory from being overwritten by the fi...
[ "Set", "a", "new", "home", "directory", "for", "an", "existing", "user" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solaris_user.py#L270-L303
[ "def", "chhome", "(", "name", ",", "home", ",", "persist", "=", "False", ")", ":", "pre_info", "=", "info", "(", "name", ")", "if", "not", "pre_info", ":", "raise", "CommandExecutionError", "(", "'User \\'{0}\\' does not exist'", ".", "format", "(", "name", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
chgroups
Change the groups to which a user belongs name Username to modify groups List of groups to set for the user. Can be passed as a comma-separated list or a Python list. append : False Set to ``True`` to append these groups to the user's existing list of groups. Other...
salt/modules/solaris_user.py
def chgroups(name, groups, append=False): ''' Change the groups to which a user belongs name Username to modify groups List of groups to set for the user. Can be passed as a comma-separated list or a Python list. append : False Set to ``True`` to append these group...
def chgroups(name, groups, append=False): ''' Change the groups to which a user belongs name Username to modify groups List of groups to set for the user. Can be passed as a comma-separated list or a Python list. append : False Set to ``True`` to append these group...
[ "Change", "the", "groups", "to", "which", "a", "user", "belongs" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solaris_user.py#L306-L336
[ "def", "chgroups", "(", "name", ",", "groups", ",", "append", "=", "False", ")", ":", "if", "isinstance", "(", "groups", ",", "six", ".", "string_types", ")", ":", "groups", "=", "groups", ".", "split", "(", "','", ")", "ugrps", "=", "set", "(", "l...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
rename
Change the username for a named user CLI Example: .. code-block:: bash salt '*' user.rename name new_name
salt/modules/solaris_user.py
def rename(name, new_name): ''' Change the username for a named user CLI Example: .. code-block:: bash salt '*' user.rename name new_name ''' current_info = info(name) if not current_info: raise CommandExecutionError('User \'{0}\' does not exist'.format(name)) new_info...
def rename(name, new_name): ''' Change the username for a named user CLI Example: .. code-block:: bash salt '*' user.rename name new_name ''' current_info = info(name) if not current_info: raise CommandExecutionError('User \'{0}\' does not exist'.format(name)) new_info...
[ "Change", "the", "username", "for", "a", "named", "user" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solaris_user.py#L451-L471
[ "def", "rename", "(", "name", ",", "new_name", ")", ":", "current_info", "=", "info", "(", "name", ")", "if", "not", "current_info", ":", "raise", "CommandExecutionError", "(", "'User \\'{0}\\' does not exist'", ".", "format", "(", "name", ")", ")", "new_info"...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
vb_get_manager
Creates a 'singleton' manager to communicate with a local virtualbox hypervisor. @return: @rtype: VirtualBoxManager
salt/utils/virtualbox.py
def vb_get_manager(): ''' Creates a 'singleton' manager to communicate with a local virtualbox hypervisor. @return: @rtype: VirtualBoxManager ''' global _virtualboxManager if _virtualboxManager is None and HAS_LIBS: salt.utils.compat.reload(vboxapi) _virtualboxManager = vboxa...
def vb_get_manager(): ''' Creates a 'singleton' manager to communicate with a local virtualbox hypervisor. @return: @rtype: VirtualBoxManager ''' global _virtualboxManager if _virtualboxManager is None and HAS_LIBS: salt.utils.compat.reload(vboxapi) _virtualboxManager = vboxa...
[ "Creates", "a", "singleton", "manager", "to", "communicate", "with", "a", "local", "virtualbox", "hypervisor", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/virtualbox.py#L133-L144
[ "def", "vb_get_manager", "(", ")", ":", "global", "_virtualboxManager", "if", "_virtualboxManager", "is", "None", "and", "HAS_LIBS", ":", "salt", ".", "utils", ".", "compat", ".", "reload", "(", "vboxapi", ")", "_virtualboxManager", "=", "vboxapi", ".", "Virtu...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
vb_get_box
Needed for certain operations in the SDK e.g creating sessions @return: @rtype: IVirtualBox
salt/utils/virtualbox.py
def vb_get_box(): ''' Needed for certain operations in the SDK e.g creating sessions @return: @rtype: IVirtualBox ''' vb_get_manager() try: # This works in older versions of the SDK, but does not seem to work anymore. vbox = _virtualboxManager.vbox except AttributeError:...
def vb_get_box(): ''' Needed for certain operations in the SDK e.g creating sessions @return: @rtype: IVirtualBox ''' vb_get_manager() try: # This works in older versions of the SDK, but does not seem to work anymore. vbox = _virtualboxManager.vbox except AttributeError:...
[ "Needed", "for", "certain", "operations", "in", "the", "SDK", "e", ".", "g", "creating", "sessions" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/virtualbox.py#L147-L161
[ "def", "vb_get_box", "(", ")", ":", "vb_get_manager", "(", ")", "try", ":", "# This works in older versions of the SDK, but does not seem to work anymore.", "vbox", "=", "_virtualboxManager", ".", "vbox", "except", "AttributeError", ":", "vbox", "=", "_virtualboxManager", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
vb_get_max_network_slots
Max number of slots any machine can have @return: @rtype: number
salt/utils/virtualbox.py
def vb_get_max_network_slots(): ''' Max number of slots any machine can have @return: @rtype: number ''' sysprops = vb_get_box().systemProperties totals = [ sysprops.getMaxNetworkAdapters(adapter_type) for adapter_type in [ 1, # PIIX3 A PIIX3 (PCI IDE ISA Xcelera...
def vb_get_max_network_slots(): ''' Max number of slots any machine can have @return: @rtype: number ''' sysprops = vb_get_box().systemProperties totals = [ sysprops.getMaxNetworkAdapters(adapter_type) for adapter_type in [ 1, # PIIX3 A PIIX3 (PCI IDE ISA Xcelera...
[ "Max", "number", "of", "slots", "any", "machine", "can", "have" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/virtualbox.py#L164-L178
[ "def", "vb_get_max_network_slots", "(", ")", ":", "sysprops", "=", "vb_get_box", "(", ")", ".", "systemProperties", "totals", "=", "[", "sysprops", ".", "getMaxNetworkAdapters", "(", "adapter_type", ")", "for", "adapter_type", "in", "[", "1", ",", "# PIIX3 A PII...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
vb_get_network_adapters
A valid machine_name or a machine is needed to make this work! @param machine_name: @type machine_name: str @param machine: @type machine: IMachine @return: INetorkAdapter's converted to dicts @rtype: [dict]
salt/utils/virtualbox.py
def vb_get_network_adapters(machine_name=None, machine=None): ''' A valid machine_name or a machine is needed to make this work! @param machine_name: @type machine_name: str @param machine: @type machine: IMachine @return: INetorkAdapter's converted to dicts @rtype: [dict] ''' ...
def vb_get_network_adapters(machine_name=None, machine=None): ''' A valid machine_name or a machine is needed to make this work! @param machine_name: @type machine_name: str @param machine: @type machine: IMachine @return: INetorkAdapter's converted to dicts @rtype: [dict] ''' ...
[ "A", "valid", "machine_name", "or", "a", "machine", "is", "needed", "to", "make", "this", "work!" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/virtualbox.py#L181-L208
[ "def", "vb_get_network_adapters", "(", "machine_name", "=", "None", ",", "machine", "=", "None", ")", ":", "if", "machine_name", ":", "machine", "=", "vb_get_box", "(", ")", ".", "findMachine", "(", "machine_name", ")", "network_adapters", "=", "[", "]", "fo...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
vb_wait_for_network_address
Wait until a machine has a network address to return or quit after the timeout @param timeout: in seconds @type timeout: float @param step: How regularly we want to check for ips (in seconds) @type step: float @param machine_name: @type machine_name: str @param machine: @type machine: I...
salt/utils/virtualbox.py
def vb_wait_for_network_address(timeout, step=None, machine_name=None, machine=None, wait_for_pattern=None): ''' Wait until a machine has a network address to return or quit after the timeout @param timeout: in seconds @type timeout: float @param step: How regularly we want to check for ips (in sec...
def vb_wait_for_network_address(timeout, step=None, machine_name=None, machine=None, wait_for_pattern=None): ''' Wait until a machine has a network address to return or quit after the timeout @param timeout: in seconds @type timeout: float @param step: How regularly we want to check for ips (in sec...
[ "Wait", "until", "a", "machine", "has", "a", "network", "address", "to", "return", "or", "quit", "after", "the", "timeout" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/virtualbox.py#L211-L234
[ "def", "vb_wait_for_network_address", "(", "timeout", ",", "step", "=", "None", ",", "machine_name", "=", "None", ",", "machine", "=", "None", ",", "wait_for_pattern", "=", "None", ")", ":", "kwargs", "=", "{", "'machine_name'", ":", "machine_name", ",", "'m...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
vb_wait_for_session_state
Waits until a session state has been reached, checking at regular intervals. @param xp_session: @type xp_session: ISession from the Virtualbox API @param state: The constant descriptor according to the docs @type state: str @param timeout: in seconds @type timeout: int | float @param step: ...
salt/utils/virtualbox.py
def vb_wait_for_session_state(xp_session, state='Unlocked', timeout=10, step=None): ''' Waits until a session state has been reached, checking at regular intervals. @param xp_session: @type xp_session: ISession from the Virtualbox API @param state: The constant descriptor according to the docs ...
def vb_wait_for_session_state(xp_session, state='Unlocked', timeout=10, step=None): ''' Waits until a session state has been reached, checking at regular intervals. @param xp_session: @type xp_session: ISession from the Virtualbox API @param state: The constant descriptor according to the docs ...
[ "Waits", "until", "a", "session", "state", "has", "been", "reached", "checking", "at", "regular", "intervals", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/virtualbox.py#L250-L266
[ "def", "vb_wait_for_session_state", "(", "xp_session", ",", "state", "=", "'Unlocked'", ",", "timeout", "=", "10", ",", "step", "=", "None", ")", ":", "args", "=", "(", "xp_session", ",", "state", ")", "wait_for", "(", "_check_session_state", ",", "timeout",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
vb_get_network_addresses
TODO distinguish between private and public addresses A valid machine_name or a machine is needed to make this work! !!! Guest prerequisite: GuestAddition !!! Thanks to Shrikant Havale for the StackOverflow answer http://stackoverflow.com/a/29335390 More information on guest properties: http...
salt/utils/virtualbox.py
def vb_get_network_addresses(machine_name=None, machine=None, wait_for_pattern=None): ''' TODO distinguish between private and public addresses A valid machine_name or a machine is needed to make this work! !!! Guest prerequisite: GuestAddition !!! Thanks to Shrikant Havale for the StackO...
def vb_get_network_addresses(machine_name=None, machine=None, wait_for_pattern=None): ''' TODO distinguish between private and public addresses A valid machine_name or a machine is needed to make this work! !!! Guest prerequisite: GuestAddition !!! Thanks to Shrikant Havale for the StackO...
[ "TODO", "distinguish", "between", "private", "and", "public", "addresses" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/virtualbox.py#L269-L326
[ "def", "vb_get_network_addresses", "(", "machine_name", "=", "None", ",", "machine", "=", "None", ",", "wait_for_pattern", "=", "None", ")", ":", "if", "machine_name", ":", "machine", "=", "vb_get_box", "(", ")", ".", "findMachine", "(", "machine_name", ")", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
vb_list_machines
Which machines does the hypervisor have @param kwargs: Passed to vb_xpcom_to_attribute_dict to filter the attributes @type kwargs: dict @return: Untreated dicts of the machines known to the hypervisor @rtype: [{}]
salt/utils/virtualbox.py
def vb_list_machines(**kwargs): ''' Which machines does the hypervisor have @param kwargs: Passed to vb_xpcom_to_attribute_dict to filter the attributes @type kwargs: dict @return: Untreated dicts of the machines known to the hypervisor @rtype: [{}] ''' manager = vb_get_manager() mac...
def vb_list_machines(**kwargs): ''' Which machines does the hypervisor have @param kwargs: Passed to vb_xpcom_to_attribute_dict to filter the attributes @type kwargs: dict @return: Untreated dicts of the machines known to the hypervisor @rtype: [{}] ''' manager = vb_get_manager() mac...
[ "Which", "machines", "does", "the", "hypervisor", "have" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/virtualbox.py#L329-L342
[ "def", "vb_list_machines", "(", "*", "*", "kwargs", ")", ":", "manager", "=", "vb_get_manager", "(", ")", "machines", "=", "manager", ".", "getArray", "(", "vb_get_box", "(", ")", ",", "'machines'", ")", "return", "[", "vb_xpcom_to_attribute_dict", "(", "mac...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
vb_create_machine
Creates a machine on the virtualbox hypervisor TODO pass more params to customize machine creation @param name: @type name: str @return: Representation of the created machine @rtype: dict
salt/utils/virtualbox.py
def vb_create_machine(name=None): ''' Creates a machine on the virtualbox hypervisor TODO pass more params to customize machine creation @param name: @type name: str @return: Representation of the created machine @rtype: dict ''' vbox = vb_get_box() log.info('Create virtualbox m...
def vb_create_machine(name=None): ''' Creates a machine on the virtualbox hypervisor TODO pass more params to customize machine creation @param name: @type name: str @return: Representation of the created machine @rtype: dict ''' vbox = vb_get_box() log.info('Create virtualbox m...
[ "Creates", "a", "machine", "on", "the", "virtualbox", "hypervisor" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/virtualbox.py#L345-L368
[ "def", "vb_create_machine", "(", "name", "=", "None", ")", ":", "vbox", "=", "vb_get_box", "(", ")", "log", ".", "info", "(", "'Create virtualbox machine %s '", ",", "name", ")", "groups", "=", "None", "os_type_id", "=", "'Other'", "new_machine", "=", "vbox"...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
vb_clone_vm
Tells virtualbox to create a VM by cloning from an existing one @param name: Name for the new VM @type name: str @param clone_from: @type clone_from: str @param timeout: maximum time in milliseconds to wait or -1 to wait indefinitely @type timeout: int @return dict of resulting VM
salt/utils/virtualbox.py
def vb_clone_vm( name=None, clone_from=None, clone_mode=0, timeout=10000, **kwargs ): ''' Tells virtualbox to create a VM by cloning from an existing one @param name: Name for the new VM @type name: str @param clone_from: @type clone_from: str @param timeout: maximum tim...
def vb_clone_vm( name=None, clone_from=None, clone_mode=0, timeout=10000, **kwargs ): ''' Tells virtualbox to create a VM by cloning from an existing one @param name: Name for the new VM @type name: str @param clone_from: @type clone_from: str @param timeout: maximum tim...
[ "Tells", "virtualbox", "to", "create", "a", "VM", "by", "cloning", "from", "an", "existing", "one" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/virtualbox.py#L371-L415
[ "def", "vb_clone_vm", "(", "name", "=", "None", ",", "clone_from", "=", "None", ",", "clone_mode", "=", "0", ",", "timeout", "=", "10000", ",", "*", "*", "kwargs", ")", ":", "vbox", "=", "vb_get_box", "(", ")", "log", ".", "info", "(", "'Clone virtua...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_start_machine
Helper to try and start machines @param machine: @type machine: IMachine @param session: @type session: ISession @return: @rtype: IProgress or None
salt/utils/virtualbox.py
def _start_machine(machine, session): ''' Helper to try and start machines @param machine: @type machine: IMachine @param session: @type session: ISession @return: @rtype: IProgress or None ''' try: return machine.launchVMProcess(session, '', '') except Exception as ...
def _start_machine(machine, session): ''' Helper to try and start machines @param machine: @type machine: IMachine @param session: @type session: ISession @return: @rtype: IProgress or None ''' try: return machine.launchVMProcess(session, '', '') except Exception as ...
[ "Helper", "to", "try", "and", "start", "machines" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/virtualbox.py#L418-L433
[ "def", "_start_machine", "(", "machine", ",", "session", ")", ":", "try", ":", "return", "machine", ".", "launchVMProcess", "(", "session", ",", "''", ",", "''", ")", "except", "Exception", "as", "e", ":", "log", ".", "debug", "(", "e", ".", "message",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
vb_start_vm
Tells Virtualbox to start up a VM. Blocking function! @param name: @type name: str @param timeout: Maximum time in milliseconds to wait or -1 to wait indefinitely @type timeout: int @return untreated dict of started VM
salt/utils/virtualbox.py
def vb_start_vm(name=None, timeout=10000, **kwargs): ''' Tells Virtualbox to start up a VM. Blocking function! @param name: @type name: str @param timeout: Maximum time in milliseconds to wait or -1 to wait indefinitely @type timeout: int @return untreated dict of started VM ''' ...
def vb_start_vm(name=None, timeout=10000, **kwargs): ''' Tells Virtualbox to start up a VM. Blocking function! @param name: @type name: str @param timeout: Maximum time in milliseconds to wait or -1 to wait indefinitely @type timeout: int @return untreated dict of started VM ''' ...
[ "Tells", "Virtualbox", "to", "start", "up", "a", "VM", ".", "Blocking", "function!" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/virtualbox.py#L436-L475
[ "def", "vb_start_vm", "(", "name", "=", "None", ",", "timeout", "=", "10000", ",", "*", "*", "kwargs", ")", ":", "# Time tracking", "start_time", "=", "time", ".", "time", "(", ")", "timeout_in_seconds", "=", "timeout", "/", "1000", "max_time", "=", "sta...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
vb_stop_vm
Tells Virtualbox to stop a VM. This is a blocking function! @param name: @type name: str @param timeout: Maximum time in milliseconds to wait or -1 to wait indefinitely @type timeout: int @return untreated dict of stopped VM
salt/utils/virtualbox.py
def vb_stop_vm(name=None, timeout=10000, **kwargs): ''' Tells Virtualbox to stop a VM. This is a blocking function! @param name: @type name: str @param timeout: Maximum time in milliseconds to wait or -1 to wait indefinitely @type timeout: int @return untreated dict of stopped VM ''...
def vb_stop_vm(name=None, timeout=10000, **kwargs): ''' Tells Virtualbox to stop a VM. This is a blocking function! @param name: @type name: str @param timeout: Maximum time in milliseconds to wait or -1 to wait indefinitely @type timeout: int @return untreated dict of stopped VM ''...
[ "Tells", "Virtualbox", "to", "stop", "a", "VM", ".", "This", "is", "a", "blocking", "function!" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/virtualbox.py#L478-L501
[ "def", "vb_stop_vm", "(", "name", "=", "None", ",", "timeout", "=", "10000", ",", "*", "*", "kwargs", ")", ":", "vbox", "=", "vb_get_box", "(", ")", "machine", "=", "vbox", ".", "findMachine", "(", "name", ")", "log", ".", "info", "(", "'Stopping mac...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
vb_destroy_machine
Attempts to get rid of a machine and all its files from the hypervisor @param name: @type name: str @param timeout int timeout in milliseconds
salt/utils/virtualbox.py
def vb_destroy_machine(name=None, timeout=10000): ''' Attempts to get rid of a machine and all its files from the hypervisor @param name: @type name: str @param timeout int timeout in milliseconds ''' vbox = vb_get_box() log.info('Destroying machine %s', name) machine = vbox.findMach...
def vb_destroy_machine(name=None, timeout=10000): ''' Attempts to get rid of a machine and all its files from the hypervisor @param name: @type name: str @param timeout int timeout in milliseconds ''' vbox = vb_get_box() log.info('Destroying machine %s', name) machine = vbox.findMach...
[ "Attempts", "to", "get", "rid", "of", "a", "machine", "and", "all", "its", "files", "from", "the", "hypervisor" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/virtualbox.py#L504-L517
[ "def", "vb_destroy_machine", "(", "name", "=", "None", ",", "timeout", "=", "10000", ")", ":", "vbox", "=", "vb_get_box", "(", ")", "log", ".", "info", "(", "'Destroying machine %s'", ",", "name", ")", "machine", "=", "vbox", ".", "findMachine", "(", "na...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
vb_xpcom_to_attribute_dict
Attempts to build a dict from an XPCOM object. Attributes that don't exist in the object return an empty string. attribute_list = list of str or tuple(str,<a class>) e.g attributes=[('bad_attribute', list)] --> { 'bad_attribute': [] } @param xpcom: @type xpcom: @param interface_name: Which in...
salt/utils/virtualbox.py
def vb_xpcom_to_attribute_dict(xpcom, interface_name=None, attributes=None, excluded_attributes=None, extra_attributes=None ): ''' Attempts to build a dict f...
def vb_xpcom_to_attribute_dict(xpcom, interface_name=None, attributes=None, excluded_attributes=None, extra_attributes=None ): ''' Attempts to build a dict f...
[ "Attempts", "to", "build", "a", "dict", "from", "an", "XPCOM", "object", ".", "Attributes", "that", "don", "t", "exist", "in", "the", "object", "return", "an", "empty", "string", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/virtualbox.py#L520-L573
[ "def", "vb_xpcom_to_attribute_dict", "(", "xpcom", ",", "interface_name", "=", "None", ",", "attributes", "=", "None", ",", "excluded_attributes", "=", "None", ",", "extra_attributes", "=", "None", ")", ":", "# Check the interface", "if", "interface_name", ":", "m...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
treat_machine_dict
Make machine presentable for outside world. !!!Modifies the input machine!!! @param machine: @type machine: dict @return: the modified input machine @rtype: dict
salt/utils/virtualbox.py
def treat_machine_dict(machine): ''' Make machine presentable for outside world. !!!Modifies the input machine!!! @param machine: @type machine: dict @return: the modified input machine @rtype: dict ''' machine.update({ 'id': machine.get('id', ''), 'image': machine....
def treat_machine_dict(machine): ''' Make machine presentable for outside world. !!!Modifies the input machine!!! @param machine: @type machine: dict @return: the modified input machine @rtype: dict ''' machine.update({ 'id': machine.get('id', ''), 'image': machine....
[ "Make", "machine", "presentable", "for", "outside", "world", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/virtualbox.py#L576-L599
[ "def", "treat_machine_dict", "(", "machine", ")", ":", "machine", ".", "update", "(", "{", "'id'", ":", "machine", ".", "get", "(", "'id'", ",", "''", ")", ",", "'image'", ":", "machine", ".", "get", "(", "'image'", ",", "''", ")", ",", "'size'", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
vb_machine_exists
Checks in with the hypervisor to see if the machine with the given name is known @param name: @type name: @return: @rtype:
salt/utils/virtualbox.py
def vb_machine_exists(name): ''' Checks in with the hypervisor to see if the machine with the given name is known @param name: @type name: @return: @rtype: ''' try: vbox = vb_get_box() vbox.findMachine(name) return True except Exception as e: if isinst...
def vb_machine_exists(name): ''' Checks in with the hypervisor to see if the machine with the given name is known @param name: @type name: @return: @rtype: ''' try: vbox = vb_get_box() vbox.findMachine(name) return True except Exception as e: if isinst...
[ "Checks", "in", "with", "the", "hypervisor", "to", "see", "if", "the", "machine", "with", "the", "given", "name", "is", "known" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/virtualbox.py#L652-L674
[ "def", "vb_machine_exists", "(", "name", ")", ":", "try", ":", "vbox", "=", "vb_get_box", "(", ")", "vbox", ".", "findMachine", "(", "name", ")", "return", "True", "except", "Exception", "as", "e", ":", "if", "isinstance", "(", "e", ".", "message", ","...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
vb_get_machine
Attempts to fetch a machine from Virtualbox and convert it to a dict @param name: The unique name of the machine @type name: @param kwargs: To be passed to vb_xpcom_to_attribute_dict @type kwargs: @return: @rtype: dict
salt/utils/virtualbox.py
def vb_get_machine(name, **kwargs): ''' Attempts to fetch a machine from Virtualbox and convert it to a dict @param name: The unique name of the machine @type name: @param kwargs: To be passed to vb_xpcom_to_attribute_dict @type kwargs: @return: @rtype: dict ''' vbox = vb_get_bo...
def vb_get_machine(name, **kwargs): ''' Attempts to fetch a machine from Virtualbox and convert it to a dict @param name: The unique name of the machine @type name: @param kwargs: To be passed to vb_xpcom_to_attribute_dict @type kwargs: @return: @rtype: dict ''' vbox = vb_get_bo...
[ "Attempts", "to", "fetch", "a", "machine", "from", "Virtualbox", "and", "convert", "it", "to", "a", "dict" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/virtualbox.py#L677-L690
[ "def", "vb_get_machine", "(", "name", ",", "*", "*", "kwargs", ")", ":", "vbox", "=", "vb_get_box", "(", ")", "machine", "=", "vbox", ".", "findMachine", "(", "name", ")", "return", "vb_xpcom_to_attribute_dict", "(", "machine", ",", "'IMachine'", ",", "*",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
compare_dicts
Compare before and after results from various salt functions, returning a dict describing the changes that were made.
salt/utils/data.py
def compare_dicts(old=None, new=None): ''' Compare before and after results from various salt functions, returning a dict describing the changes that were made. ''' ret = {} for key in set((new or {})).union((old or {})): if key not in old: # New key ret[key] = {'...
def compare_dicts(old=None, new=None): ''' Compare before and after results from various salt functions, returning a dict describing the changes that were made. ''' ret = {} for key in set((new or {})).union((old or {})): if key not in old: # New key ret[key] = {'...
[ "Compare", "before", "and", "after", "results", "from", "various", "salt", "functions", "returning", "a", "dict", "describing", "the", "changes", "that", "were", "made", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/data.py#L124-L143
[ "def", "compare_dicts", "(", "old", "=", "None", ",", "new", "=", "None", ")", ":", "ret", "=", "{", "}", "for", "key", "in", "set", "(", "(", "new", "or", "{", "}", ")", ")", ".", "union", "(", "(", "old", "or", "{", "}", ")", ")", ":", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
compare_lists
Compare before and after results from various salt functions, returning a dict describing the changes that were made
salt/utils/data.py
def compare_lists(old=None, new=None): ''' Compare before and after results from various salt functions, returning a dict describing the changes that were made ''' ret = dict() for item in new: if item not in old: ret['new'] = item for item in old: if item not in ...
def compare_lists(old=None, new=None): ''' Compare before and after results from various salt functions, returning a dict describing the changes that were made ''' ret = dict() for item in new: if item not in old: ret['new'] = item for item in old: if item not in ...
[ "Compare", "before", "and", "after", "results", "from", "various", "salt", "functions", "returning", "a", "dict", "describing", "the", "changes", "that", "were", "made" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/data.py#L147-L159
[ "def", "compare_lists", "(", "old", "=", "None", ",", "new", "=", "None", ")", ":", "ret", "=", "dict", "(", ")", "for", "item", "in", "new", ":", "if", "item", "not", "in", "old", ":", "ret", "[", "'new'", "]", "=", "item", "for", "item", "in"...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
decode
Generic function which will decode whichever type is passed, if necessary. Optionally use to_str=True to ensure strings are str types and not unicode on Python 2. If `strict` is True, and `keep` is False, and we fail to decode, a UnicodeDecodeError will be raised. Passing `keep` as True allows for the ...
salt/utils/data.py
def decode(data, encoding=None, errors='strict', keep=False, normalize=False, preserve_dict_class=False, preserve_tuples=False, to_str=False): ''' Generic function which will decode whichever type is passed, if necessary. Optionally use to_str=True to ensure strings are str types and n...
def decode(data, encoding=None, errors='strict', keep=False, normalize=False, preserve_dict_class=False, preserve_tuples=False, to_str=False): ''' Generic function which will decode whichever type is passed, if necessary. Optionally use to_str=True to ensure strings are str types and n...
[ "Generic", "function", "which", "will", "decode", "whichever", "type", "is", "passed", "if", "necessary", ".", "Optionally", "use", "to_str", "=", "True", "to", "ensure", "strings", "are", "str", "types", "and", "not", "unicode", "on", "Python", "2", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/data.py#L162-L218
[ "def", "decode", "(", "data", ",", "encoding", "=", "None", ",", "errors", "=", "'strict'", ",", "keep", "=", "False", ",", "normalize", "=", "False", ",", "preserve_dict_class", "=", "False", ",", "preserve_tuples", "=", "False", ",", "to_str", "=", "Fa...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
decode_dict
Decode all string values to Unicode. Optionally use to_str=True to ensure strings are str types and not unicode on Python 2.
salt/utils/data.py
def decode_dict(data, encoding=None, errors='strict', keep=False, normalize=False, preserve_dict_class=False, preserve_tuples=False, to_str=False): ''' Decode all string values to Unicode. Optionally use to_str=True to ensure strings are str types and not unicode on Python 2....
def decode_dict(data, encoding=None, errors='strict', keep=False, normalize=False, preserve_dict_class=False, preserve_tuples=False, to_str=False): ''' Decode all string values to Unicode. Optionally use to_str=True to ensure strings are str types and not unicode on Python 2....
[ "Decode", "all", "string", "values", "to", "Unicode", ".", "Optionally", "use", "to_str", "=", "True", "to", "ensure", "strings", "are", "str", "types", "and", "not", "unicode", "on", "Python", "2", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/data.py#L221-L277
[ "def", "decode_dict", "(", "data", ",", "encoding", "=", "None", ",", "errors", "=", "'strict'", ",", "keep", "=", "False", ",", "normalize", "=", "False", ",", "preserve_dict_class", "=", "False", ",", "preserve_tuples", "=", "False", ",", "to_str", "=", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
decode_tuple
Decode all string values to Unicode. Optionally use to_str=True to ensure strings are str types and not unicode on Python 2.
salt/utils/data.py
def decode_tuple(data, encoding=None, errors='strict', keep=False, normalize=False, preserve_dict_class=False, to_str=False): ''' Decode all string values to Unicode. Optionally use to_str=True to ensure strings are str types and not unicode on Python 2. ''' return tuple( de...
def decode_tuple(data, encoding=None, errors='strict', keep=False, normalize=False, preserve_dict_class=False, to_str=False): ''' Decode all string values to Unicode. Optionally use to_str=True to ensure strings are str types and not unicode on Python 2. ''' return tuple( de...
[ "Decode", "all", "string", "values", "to", "Unicode", ".", "Optionally", "use", "to_str", "=", "True", "to", "ensure", "strings", "are", "str", "types", "and", "not", "unicode", "on", "Python", "2", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/data.py#L320-L329
[ "def", "decode_tuple", "(", "data", ",", "encoding", "=", "None", ",", "errors", "=", "'strict'", ",", "keep", "=", "False", ",", "normalize", "=", "False", ",", "preserve_dict_class", "=", "False", ",", "to_str", "=", "False", ")", ":", "return", "tuple...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
encode
Generic function which will encode whichever type is passed, if necessary If `strict` is True, and `keep` is False, and we fail to encode, a UnicodeEncodeError will be raised. Passing `keep` as True allows for the original value to silently be returned in cases where encoding fails. This can be useful ...
salt/utils/data.py
def encode(data, encoding=None, errors='strict', keep=False, preserve_dict_class=False, preserve_tuples=False): ''' Generic function which will encode whichever type is passed, if necessary If `strict` is True, and `keep` is False, and we fail to encode, a UnicodeEncodeError will be raised. ...
def encode(data, encoding=None, errors='strict', keep=False, preserve_dict_class=False, preserve_tuples=False): ''' Generic function which will encode whichever type is passed, if necessary If `strict` is True, and `keep` is False, and we fail to encode, a UnicodeEncodeError will be raised. ...
[ "Generic", "function", "which", "will", "encode", "whichever", "type", "is", "passed", "if", "necessary" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/data.py#L332-L365
[ "def", "encode", "(", "data", ",", "encoding", "=", "None", ",", "errors", "=", "'strict'", ",", "keep", "=", "False", ",", "preserve_dict_class", "=", "False", ",", "preserve_tuples", "=", "False", ")", ":", "if", "isinstance", "(", "data", ",", "Mappin...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
encode_dict
Encode all string values to bytes
salt/utils/data.py
def encode_dict(data, encoding=None, errors='strict', keep=False, preserve_dict_class=False, preserve_tuples=False): ''' Encode all string values to bytes ''' rv = data.__class__() if preserve_dict_class else {} for key, value in six.iteritems(data): if isinstance(key, tuple)...
def encode_dict(data, encoding=None, errors='strict', keep=False, preserve_dict_class=False, preserve_tuples=False): ''' Encode all string values to bytes ''' rv = data.__class__() if preserve_dict_class else {} for key, value in six.iteritems(data): if isinstance(key, tuple)...
[ "Encode", "all", "string", "values", "to", "bytes" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/data.py#L370-L418
[ "def", "encode_dict", "(", "data", ",", "encoding", "=", "None", ",", "errors", "=", "'strict'", ",", "keep", "=", "False", ",", "preserve_dict_class", "=", "False", ",", "preserve_tuples", "=", "False", ")", ":", "rv", "=", "data", ".", "__class__", "("...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
encode_list
Encode all string values to bytes
salt/utils/data.py
def encode_list(data, encoding=None, errors='strict', keep=False, preserve_dict_class=False, preserve_tuples=False): ''' Encode all string values to bytes ''' rv = [] for item in data: if isinstance(item, list): item = encode_list(item, encoding, errors, keep, ...
def encode_list(data, encoding=None, errors='strict', keep=False, preserve_dict_class=False, preserve_tuples=False): ''' Encode all string values to bytes ''' rv = [] for item in data: if isinstance(item, list): item = encode_list(item, encoding, errors, keep, ...
[ "Encode", "all", "string", "values", "to", "bytes" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/data.py#L423-L454
[ "def", "encode_list", "(", "data", ",", "encoding", "=", "None", ",", "errors", "=", "'strict'", ",", "keep", "=", "False", ",", "preserve_dict_class", "=", "False", ",", "preserve_tuples", "=", "False", ")", ":", "rv", "=", "[", "]", "for", "item", "i...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
encode_tuple
Encode all string values to Unicode
salt/utils/data.py
def encode_tuple(data, encoding=None, errors='strict', keep=False, preserve_dict_class=False): ''' Encode all string values to Unicode ''' return tuple( encode_list(data, encoding, errors, keep, preserve_dict_class, True))
def encode_tuple(data, encoding=None, errors='strict', keep=False, preserve_dict_class=False): ''' Encode all string values to Unicode ''' return tuple( encode_list(data, encoding, errors, keep, preserve_dict_class, True))
[ "Encode", "all", "string", "values", "to", "Unicode" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/data.py#L457-L463
[ "def", "encode_tuple", "(", "data", ",", "encoding", "=", "None", ",", "errors", "=", "'strict'", ",", "keep", "=", "False", ",", "preserve_dict_class", "=", "False", ")", ":", "return", "tuple", "(", "encode_list", "(", "data", ",", "encoding", ",", "er...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
filter_by
Common code to filter data structures like grains and pillar
salt/utils/data.py
def filter_by(lookup_dict, lookup, traverse, merge=None, default='default', base=None): ''' Common code to filter data structures like grains and pillar ''' ret = None # Default value would be an empty list if lookup not found ...
def filter_by(lookup_dict, lookup, traverse, merge=None, default='default', base=None): ''' Common code to filter data structures like grains and pillar ''' ret = None # Default value would be an empty list if lookup not found ...
[ "Common", "code", "to", "filter", "data", "structures", "like", "grains", "and", "pillar" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/data.py#L484-L536
[ "def", "filter_by", "(", "lookup_dict", ",", "lookup", ",", "traverse", ",", "merge", "=", "None", ",", "default", "=", "'default'", ",", "base", "=", "None", ")", ":", "ret", "=", "None", "# Default value would be an empty list if lookup not found", "val", "=",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
traverse_dict
Traverse a dict using a colon-delimited (or otherwise delimited, using the 'delimiter' param) target string. The target 'foo:bar:baz' will return data['foo']['bar']['baz'] if this value exists, and will otherwise return the dict in the default argument.
salt/utils/data.py
def traverse_dict(data, key, default=None, delimiter=DEFAULT_TARGET_DELIM): ''' Traverse a dict using a colon-delimited (or otherwise delimited, using the 'delimiter' param) target string. The target 'foo:bar:baz' will return data['foo']['bar']['baz'] if this value exists, and will otherwise return ...
def traverse_dict(data, key, default=None, delimiter=DEFAULT_TARGET_DELIM): ''' Traverse a dict using a colon-delimited (or otherwise delimited, using the 'delimiter' param) target string. The target 'foo:bar:baz' will return data['foo']['bar']['baz'] if this value exists, and will otherwise return ...
[ "Traverse", "a", "dict", "using", "a", "colon", "-", "delimited", "(", "or", "otherwise", "delimited", "using", "the", "delimiter", "param", ")", "target", "string", ".", "The", "target", "foo", ":", "bar", ":", "baz", "will", "return", "data", "[", "foo...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/data.py#L539-L553
[ "def", "traverse_dict", "(", "data", ",", "key", ",", "default", "=", "None", ",", "delimiter", "=", "DEFAULT_TARGET_DELIM", ")", ":", "ptr", "=", "data", "try", ":", "for", "each", "in", "key", ".", "split", "(", "delimiter", ")", ":", "ptr", "=", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
traverse_dict_and_list
Traverse a dict or list using a colon-delimited (or otherwise delimited, using the 'delimiter' param) target string. The target 'foo:bar:0' will return data['foo']['bar'][0] if this value exists, and will otherwise return the dict in the default argument. Function will automatically determine the target...
salt/utils/data.py
def traverse_dict_and_list(data, key, default=None, delimiter=DEFAULT_TARGET_DELIM): ''' Traverse a dict or list using a colon-delimited (or otherwise delimited, using the 'delimiter' param) target string. The target 'foo:bar:0' will return data['foo']['bar'][0] if this value exists, and will otherwise ...
def traverse_dict_and_list(data, key, default=None, delimiter=DEFAULT_TARGET_DELIM): ''' Traverse a dict or list using a colon-delimited (or otherwise delimited, using the 'delimiter' param) target string. The target 'foo:bar:0' will return data['foo']['bar'][0] if this value exists, and will otherwise ...
[ "Traverse", "a", "dict", "or", "list", "using", "a", "colon", "-", "delimited", "(", "or", "otherwise", "delimited", "using", "the", "delimiter", "param", ")", "target", "string", ".", "The", "target", "foo", ":", "bar", ":", "0", "will", "return", "data...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/data.py#L557-L596
[ "def", "traverse_dict_and_list", "(", "data", ",", "key", ",", "default", "=", "None", ",", "delimiter", "=", "DEFAULT_TARGET_DELIM", ")", ":", "ptr", "=", "data", "for", "each", "in", "key", ".", "split", "(", "delimiter", ")", ":", "if", "isinstance", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
subdict_match
Check for a match in a dictionary using a delimiter character to denote levels of subdicts, and also allowing the delimiter character to be matched. Thus, 'foo:bar:baz' will match data['foo'] == 'bar:baz' and data['foo']['bar'] == 'baz'. The latter would take priority over the former, as more deeply-nes...
salt/utils/data.py
def subdict_match(data, expr, delimiter=DEFAULT_TARGET_DELIM, regex_match=False, exact_match=False): ''' Check for a match in a dictionary using a delimiter character to denote levels of subdicts, and also allowing the delimiter charact...
def subdict_match(data, expr, delimiter=DEFAULT_TARGET_DELIM, regex_match=False, exact_match=False): ''' Check for a match in a dictionary using a delimiter character to denote levels of subdicts, and also allowing the delimiter charact...
[ "Check", "for", "a", "match", "in", "a", "dictionary", "using", "a", "delimiter", "character", "to", "denote", "levels", "of", "subdicts", "and", "also", "allowing", "the", "delimiter", "character", "to", "be", "matched", ".", "Thus", "foo", ":", "bar", ":...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/data.py#L599-L733
[ "def", "subdict_match", "(", "data", ",", "expr", ",", "delimiter", "=", "DEFAULT_TARGET_DELIM", ",", "regex_match", "=", "False", ",", "exact_match", "=", "False", ")", ":", "def", "_match", "(", "target", ",", "pattern", ",", "regex_match", "=", "False", ...
e8541fd6e744ab0df786c0f76102e41631f45d46