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 | id | Return a unique ID for this proxy minion. This ID MUST NOT CHANGE.
If it changes while the proxy is running the salt-master will get
really confused and may stop talking to this minion | salt/proxy/rest_sample.py | def id(opts):
'''
Return a unique ID for this proxy minion. This ID MUST NOT CHANGE.
If it changes while the proxy is running the salt-master will get
really confused and may stop talking to this minion
'''
r = salt.utils.http.query(opts['proxy']['url']+'id', decode_type='json', decode=True)
... | def id(opts):
'''
Return a unique ID for this proxy minion. This ID MUST NOT CHANGE.
If it changes while the proxy is running the salt-master will get
really confused and may stop talking to this minion
'''
r = salt.utils.http.query(opts['proxy']['url']+'id', decode_type='json', decode=True)
... | [
"Return",
"a",
"unique",
"ID",
"for",
"this",
"proxy",
"minion",
".",
"This",
"ID",
"MUST",
"NOT",
"CHANGE",
".",
"If",
"it",
"changes",
"while",
"the",
"proxy",
"is",
"running",
"the",
"salt",
"-",
"master",
"will",
"get",
"really",
"confused",
"and",
... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/rest_sample.py#L69-L76 | [
"def",
"id",
"(",
"opts",
")",
":",
"r",
"=",
"salt",
".",
"utils",
".",
"http",
".",
"query",
"(",
"opts",
"[",
"'proxy'",
"]",
"[",
"'url'",
"]",
"+",
"'id'",
",",
"decode_type",
"=",
"'json'",
",",
"decode",
"=",
"True",
")",
"return",
"r",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | grains | Get the grains from the proxied device | salt/proxy/rest_sample.py | def grains():
'''
Get the grains from the proxied device
'''
if not DETAILS.get('grains_cache', {}):
r = salt.utils.http.query(DETAILS['url']+'info', decode_type='json', decode=True)
DETAILS['grains_cache'] = r['dict']
return DETAILS['grains_cache'] | def grains():
'''
Get the grains from the proxied device
'''
if not DETAILS.get('grains_cache', {}):
r = salt.utils.http.query(DETAILS['url']+'info', decode_type='json', decode=True)
DETAILS['grains_cache'] = r['dict']
return DETAILS['grains_cache'] | [
"Get",
"the",
"grains",
"from",
"the",
"proxied",
"device"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/rest_sample.py#L79-L86 | [
"def",
"grains",
"(",
")",
":",
"if",
"not",
"DETAILS",
".",
"get",
"(",
"'grains_cache'",
",",
"{",
"}",
")",
":",
"r",
"=",
"salt",
".",
"utils",
".",
"http",
".",
"query",
"(",
"DETAILS",
"[",
"'url'",
"]",
"+",
"'info'",
",",
"decode_type",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | service_start | Start a "service" on the REST server | salt/proxy/rest_sample.py | def service_start(name):
'''
Start a "service" on the REST server
'''
r = salt.utils.http.query(DETAILS['url']+'service/start/'+name, decode_type='json', decode=True)
return r['dict'] | def service_start(name):
'''
Start a "service" on the REST server
'''
r = salt.utils.http.query(DETAILS['url']+'service/start/'+name, decode_type='json', decode=True)
return r['dict'] | [
"Start",
"a",
"service",
"on",
"the",
"REST",
"server"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/rest_sample.py#L102-L107 | [
"def",
"service_start",
"(",
"name",
")",
":",
"r",
"=",
"salt",
".",
"utils",
".",
"http",
".",
"query",
"(",
"DETAILS",
"[",
"'url'",
"]",
"+",
"'service/start/'",
"+",
"name",
",",
"decode_type",
"=",
"'json'",
",",
"decode",
"=",
"True",
")",
"re... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | service_list | List "services" on the REST server | salt/proxy/rest_sample.py | def service_list():
'''
List "services" on the REST server
'''
r = salt.utils.http.query(DETAILS['url']+'service/list', decode_type='json', decode=True)
return r['dict'] | def service_list():
'''
List "services" on the REST server
'''
r = salt.utils.http.query(DETAILS['url']+'service/list', decode_type='json', decode=True)
return r['dict'] | [
"List",
"services",
"on",
"the",
"REST",
"server"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/rest_sample.py#L126-L131 | [
"def",
"service_list",
"(",
")",
":",
"r",
"=",
"salt",
".",
"utils",
".",
"http",
".",
"query",
"(",
"DETAILS",
"[",
"'url'",
"]",
"+",
"'service/list'",
",",
"decode_type",
"=",
"'json'",
",",
"decode",
"=",
"True",
")",
"return",
"r",
"[",
"'dict'... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | package_install | Install a "package" on the REST server | salt/proxy/rest_sample.py | def package_install(name, **kwargs):
'''
Install a "package" on the REST server
'''
cmd = DETAILS['url']+'package/install/'+name
if kwargs.get('version', False):
cmd += '/'+kwargs['version']
else:
cmd += '/1.0'
r = salt.utils.http.query(cmd, decode_type='json', decode=True)
... | def package_install(name, **kwargs):
'''
Install a "package" on the REST server
'''
cmd = DETAILS['url']+'package/install/'+name
if kwargs.get('version', False):
cmd += '/'+kwargs['version']
else:
cmd += '/1.0'
r = salt.utils.http.query(cmd, decode_type='json', decode=True)
... | [
"Install",
"a",
"package",
"on",
"the",
"REST",
"server"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/rest_sample.py#L150-L160 | [
"def",
"package_install",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"cmd",
"=",
"DETAILS",
"[",
"'url'",
"]",
"+",
"'package/install/'",
"+",
"name",
"if",
"kwargs",
".",
"get",
"(",
"'version'",
",",
"False",
")",
":",
"cmd",
"+=",
"'/'",
"+",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | ping | Is the REST server up? | salt/proxy/rest_sample.py | def ping():
'''
Is the REST server up?
'''
r = salt.utils.http.query(DETAILS['url']+'ping', decode_type='json', decode=True)
try:
return r['dict'].get('ret', False)
except Exception:
return False | def ping():
'''
Is the REST server up?
'''
r = salt.utils.http.query(DETAILS['url']+'ping', decode_type='json', decode=True)
try:
return r['dict'].get('ret', False)
except Exception:
return False | [
"Is",
"the",
"REST",
"server",
"up?"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/rest_sample.py#L194-L202 | [
"def",
"ping",
"(",
")",
":",
"r",
"=",
"salt",
".",
"utils",
".",
"http",
".",
"query",
"(",
"DETAILS",
"[",
"'url'",
"]",
"+",
"'ping'",
",",
"decode_type",
"=",
"'json'",
",",
"decode",
"=",
"True",
")",
"try",
":",
"return",
"r",
"[",
"'dict'... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | exists | Make sure the given attributes exist on the file/directory
name
The path to the file/directory
attributes
The attributes that should exist on the file/directory, this is accepted as
an array, with key and value split with an equals sign, if you want to specify
a hex value then ... | salt/states/mac_xattr.py | def exists(name, attributes):
'''
Make sure the given attributes exist on the file/directory
name
The path to the file/directory
attributes
The attributes that should exist on the file/directory, this is accepted as
an array, with key and value split with an equals sign, if you... | def exists(name, attributes):
'''
Make sure the given attributes exist on the file/directory
name
The path to the file/directory
attributes
The attributes that should exist on the file/directory, this is accepted as
an array, with key and value split with an equals sign, if you... | [
"Make",
"sure",
"the",
"given",
"attributes",
"exist",
"on",
"the",
"file",
"/",
"directory"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/mac_xattr.py#L35-L85 | [
"def",
"exists",
"(",
"name",
",",
"attributes",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",
"True",
",",
"'comment'",
":",
"''",
",",
"'changes'",
":",
"{",
"}",
"}",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"("... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | delete | Make sure the given attributes are deleted from the file/directory
name
The path to the file/directory
attributes
The attributes that should be removed from the file/directory, this is accepted as
an array. | salt/states/mac_xattr.py | def delete(name, attributes):
'''
Make sure the given attributes are deleted from the file/directory
name
The path to the file/directory
attributes
The attributes that should be removed from the file/directory, this is accepted as
an array.
'''
ret = {'name': name,
... | def delete(name, attributes):
'''
Make sure the given attributes are deleted from the file/directory
name
The path to the file/directory
attributes
The attributes that should be removed from the file/directory, this is accepted as
an array.
'''
ret = {'name': name,
... | [
"Make",
"sure",
"the",
"given",
"attributes",
"are",
"deleted",
"from",
"the",
"file",
"/",
"directory"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/mac_xattr.py#L88-L121 | [
"def",
"delete",
"(",
"name",
",",
"attributes",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",
"True",
",",
"'comment'",
":",
"''",
",",
"'changes'",
":",
"{",
"}",
"}",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"("... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | is_writeable | Check if a given path is writeable by the current user.
:param path: The path to check
:param check_parent: If the path to check does not exist, check for the
ability to write to the parent directory instead
:returns: True or False | salt/utils/validate/path.py | def is_writeable(path, check_parent=False):
'''
Check if a given path is writeable by the current user.
:param path: The path to check
:param check_parent: If the path to check does not exist, check for the
ability to write to the parent directory instead
:returns: True or False
'''
... | def is_writeable(path, check_parent=False):
'''
Check if a given path is writeable by the current user.
:param path: The path to check
:param check_parent: If the path to check does not exist, check for the
ability to write to the parent directory instead
:returns: True or False
'''
... | [
"Check",
"if",
"a",
"given",
"path",
"is",
"writeable",
"by",
"the",
"current",
"user",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/validate/path.py#L17-L50 | [
"def",
"is_writeable",
"(",
"path",
",",
"check_parent",
"=",
"False",
")",
":",
"if",
"os",
".",
"access",
"(",
"path",
",",
"os",
".",
"F_OK",
")",
"and",
"os",
".",
"access",
"(",
"path",
",",
"os",
".",
"W_OK",
")",
":",
"# The path exists and is... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | is_readable | Check if a given path is readable by the current user.
:param path: The path to check
:returns: True or False | salt/utils/validate/path.py | def is_readable(path):
'''
Check if a given path is readable by the current user.
:param path: The path to check
:returns: True or False
'''
if os.access(path, os.F_OK) and os.access(path, os.R_OK):
# The path exists and is readable
return True
# The path does not exist
... | def is_readable(path):
'''
Check if a given path is readable by the current user.
:param path: The path to check
:returns: True or False
'''
if os.access(path, os.F_OK) and os.access(path, os.R_OK):
# The path exists and is readable
return True
# The path does not exist
... | [
"Check",
"if",
"a",
"given",
"path",
"is",
"readable",
"by",
"the",
"current",
"user",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/validate/path.py#L53-L66 | [
"def",
"is_readable",
"(",
"path",
")",
":",
"if",
"os",
".",
"access",
"(",
"path",
",",
"os",
".",
"F_OK",
")",
"and",
"os",
".",
"access",
"(",
"path",
",",
"os",
".",
"R_OK",
")",
":",
"# The path exists and is readable",
"return",
"True",
"# The p... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _SyslogServerFactory.parseData | This function will parse the raw syslog data, dynamically create the
topic according to the topic specified by the user (if specified) and
decide whether to send the syslog data as an event on the master bus,
based on the constraints given by the user.
:param data: The raw syslog event ... | salt/engines/junos_syslog.py | def parseData(self, data, host, port, options):
'''
This function will parse the raw syslog data, dynamically create the
topic according to the topic specified by the user (if specified) and
decide whether to send the syslog data as an event on the master bus,
based on the constr... | def parseData(self, data, host, port, options):
'''
This function will parse the raw syslog data, dynamically create the
topic according to the topic specified by the user (if specified) and
decide whether to send the syslog data as an event on the master bus,
based on the constr... | [
"This",
"function",
"will",
"parse",
"the",
"raw",
"syslog",
"data",
"dynamically",
"create",
"the",
"topic",
"according",
"to",
"the",
"topic",
"specified",
"by",
"the",
"user",
"(",
"if",
"specified",
")",
"and",
"decide",
"whether",
"to",
"send",
"the",
... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/engines/junos_syslog.py#L289-L350 | [
"def",
"parseData",
"(",
"self",
",",
"data",
",",
"host",
",",
"port",
",",
"options",
")",
":",
"data",
"=",
"self",
".",
"obj",
".",
"parse",
"(",
"data",
")",
"data",
"[",
"'hostip'",
"]",
"=",
"host",
"log",
".",
"debug",
"(",
"'Junos Syslog -... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _SyslogServerFactory.send_event_to_salt | This function identifies whether the engine is running on the master
or the minion and sends the data to the master event bus accordingly.
:param result: It's a dictionary which has the final data and topic. | salt/engines/junos_syslog.py | def send_event_to_salt(self, result):
'''
This function identifies whether the engine is running on the master
or the minion and sends the data to the master event bus accordingly.
:param result: It's a dictionary which has the final data and topic.
'''
if result['send'... | def send_event_to_salt(self, result):
'''
This function identifies whether the engine is running on the master
or the minion and sends the data to the master event bus accordingly.
:param result: It's a dictionary which has the final data and topic.
'''
if result['send'... | [
"This",
"function",
"identifies",
"whether",
"the",
"engine",
"is",
"running",
"on",
"the",
"master",
"or",
"the",
"minion",
"and",
"sends",
"the",
"data",
"to",
"the",
"master",
"event",
"bus",
"accordingly",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/engines/junos_syslog.py#L352-L372 | [
"def",
"send_event_to_salt",
"(",
"self",
",",
"result",
")",
":",
"if",
"result",
"[",
"'send'",
"]",
":",
"data",
"=",
"result",
"[",
"'data'",
"]",
"topic",
"=",
"result",
"[",
"'topic'",
"]",
"# If the engine is run on master, get the event bus and send the",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | sdb_get | Get a value from a db, using a uri in the form of ``sdb://<profile>/<key>``. If
the uri provided does not start with ``sdb://``, then it will be returned as-is. | salt/utils/sdb.py | def sdb_get(uri, opts, utils=None):
'''
Get a value from a db, using a uri in the form of ``sdb://<profile>/<key>``. If
the uri provided does not start with ``sdb://``, then it will be returned as-is.
'''
if not isinstance(uri, string_types) or not uri.startswith('sdb://'):
return uri
i... | def sdb_get(uri, opts, utils=None):
'''
Get a value from a db, using a uri in the form of ``sdb://<profile>/<key>``. If
the uri provided does not start with ``sdb://``, then it will be returned as-is.
'''
if not isinstance(uri, string_types) or not uri.startswith('sdb://'):
return uri
i... | [
"Get",
"a",
"value",
"from",
"a",
"db",
"using",
"a",
"uri",
"in",
"the",
"form",
"of",
"sdb",
":",
"//",
"<profile",
">",
"/",
"<key",
">",
".",
"If",
"the",
"uri",
"provided",
"does",
"not",
"start",
"with",
"sdb",
":",
"//",
"then",
"it",
"wil... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/sdb.py#L19-L46 | [
"def",
"sdb_get",
"(",
"uri",
",",
"opts",
",",
"utils",
"=",
"None",
")",
":",
"if",
"not",
"isinstance",
"(",
"uri",
",",
"string_types",
")",
"or",
"not",
"uri",
".",
"startswith",
"(",
"'sdb://'",
")",
":",
"return",
"uri",
"if",
"utils",
"is",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | sdb_get_or_set_hash | Check if value exists in sdb. If it does, return, otherwise generate a
random string and store it. This can be used for storing secrets in a
centralized place. | salt/utils/sdb.py | def sdb_get_or_set_hash(uri,
opts,
length=8,
chars='abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)',
utils=None):
'''
Check if value exists in sdb. If it does, return, otherwise generate a
random string and ... | def sdb_get_or_set_hash(uri,
opts,
length=8,
chars='abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)',
utils=None):
'''
Check if value exists in sdb. If it does, return, otherwise generate a
random string and ... | [
"Check",
"if",
"value",
"exists",
"in",
"sdb",
".",
"If",
"it",
"does",
"return",
"otherwise",
"generate",
"a",
"random",
"string",
"and",
"store",
"it",
".",
"This",
"can",
"be",
"used",
"for",
"storing",
"secrets",
"in",
"a",
"centralized",
"place",
".... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/sdb.py#L111-L133 | [
"def",
"sdb_get_or_set_hash",
"(",
"uri",
",",
"opts",
",",
"length",
"=",
"8",
",",
"chars",
"=",
"'abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'",
",",
"utils",
"=",
"None",
")",
":",
"if",
"not",
"isinstance",
"(",
"uri",
",",
"string_types",
")",
"or... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_users | List all users.
profile
Configuration profile used to connect to the Grafana instance.
Default is 'grafana'.
CLI Example:
.. code-block:: bash
salt '*' grafana4.get_users | salt/modules/grafana4.py | def get_users(profile='grafana'):
'''
List all users.
profile
Configuration profile used to connect to the Grafana instance.
Default is 'grafana'.
CLI Example:
.. code-block:: bash
salt '*' grafana4.get_users
'''
if isinstance(profile, string_types):
profi... | def get_users(profile='grafana'):
'''
List all users.
profile
Configuration profile used to connect to the Grafana instance.
Default is 'grafana'.
CLI Example:
.. code-block:: bash
salt '*' grafana4.get_users
'''
if isinstance(profile, string_types):
profi... | [
"List",
"all",
"users",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/grafana4.py#L65-L89 | [
"def",
"get_users",
"(",
"profile",
"=",
"'grafana'",
")",
":",
"if",
"isinstance",
"(",
"profile",
",",
"string_types",
")",
":",
"profile",
"=",
"__salt__",
"[",
"'config.option'",
"]",
"(",
"profile",
")",
"response",
"=",
"requests",
".",
"get",
"(",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_user | Show a single user.
login
Login of the user.
profile
Configuration profile used to connect to the Grafana instance.
Default is 'grafana'.
CLI Example:
.. code-block:: bash
salt '*' grafana4.get_user <login> | salt/modules/grafana4.py | def get_user(login, profile='grafana'):
'''
Show a single user.
login
Login of the user.
profile
Configuration profile used to connect to the Grafana instance.
Default is 'grafana'.
CLI Example:
.. code-block:: bash
salt '*' grafana4.get_user <login>
'''
... | def get_user(login, profile='grafana'):
'''
Show a single user.
login
Login of the user.
profile
Configuration profile used to connect to the Grafana instance.
Default is 'grafana'.
CLI Example:
.. code-block:: bash
salt '*' grafana4.get_user <login>
'''
... | [
"Show",
"a",
"single",
"user",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/grafana4.py#L92-L113 | [
"def",
"get_user",
"(",
"login",
",",
"profile",
"=",
"'grafana'",
")",
":",
"data",
"=",
"get_users",
"(",
"profile",
")",
"for",
"user",
"in",
"data",
":",
"if",
"user",
"[",
"'login'",
"]",
"==",
"login",
":",
"return",
"user",
"return",
"None"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | update_user | Update an existing user.
userid
Id of the user.
login
Optional - Login of the user.
email
Optional - Email of the user.
name
Optional - Full name of the user.
orgid
Optional - Default Organization of the user.
profile
Configuration profile us... | salt/modules/grafana4.py | def update_user(userid, profile='grafana', orgid=None, **kwargs):
'''
Update an existing user.
userid
Id of the user.
login
Optional - Login of the user.
email
Optional - Email of the user.
name
Optional - Full name of the user.
orgid
Optional - D... | def update_user(userid, profile='grafana', orgid=None, **kwargs):
'''
Update an existing user.
userid
Id of the user.
login
Optional - Login of the user.
email
Optional - Email of the user.
name
Optional - Full name of the user.
orgid
Optional - D... | [
"Update",
"an",
"existing",
"user",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/grafana4.py#L186-L235 | [
"def",
"update_user",
"(",
"userid",
",",
"profile",
"=",
"'grafana'",
",",
"orgid",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"isinstance",
"(",
"profile",
",",
"string_types",
")",
":",
"profile",
"=",
"__salt__",
"[",
"'config.option'",
"]... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | switch_org | Switch the current organization.
name
Name of the organization to switch to.
profile
Configuration profile used to connect to the Grafana instance.
Default is 'grafana'.
CLI Example:
.. code-block:: bash
salt '*' grafana4.switch_org <name> | salt/modules/grafana4.py | def switch_org(orgname, profile='grafana'):
'''
Switch the current organization.
name
Name of the organization to switch to.
profile
Configuration profile used to connect to the Grafana instance.
Default is 'grafana'.
CLI Example:
.. code-block:: bash
salt '*... | def switch_org(orgname, profile='grafana'):
'''
Switch the current organization.
name
Name of the organization to switch to.
profile
Configuration profile used to connect to the Grafana instance.
Default is 'grafana'.
CLI Example:
.. code-block:: bash
salt '*... | [
"Switch",
"the",
"current",
"organization",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/grafana4.py#L459-L487 | [
"def",
"switch_org",
"(",
"orgname",
",",
"profile",
"=",
"'grafana'",
")",
":",
"if",
"isinstance",
"(",
"profile",
",",
"string_types",
")",
":",
"profile",
"=",
"__salt__",
"[",
"'config.option'",
"]",
"(",
"profile",
")",
"org",
"=",
"get_org",
"(",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | update_org_user | Update user role in the organization.
userid
Id of the user.
loginOrEmail
Login or email of the user.
role
Role of the user for this organization. Should be one of:
- Admin
- Editor
- Read Only Editor
- Viewer
orgname
Na... | salt/modules/grafana4.py | def update_org_user(userid, orgname=None, profile='grafana', **kwargs):
'''
Update user role in the organization.
userid
Id of the user.
loginOrEmail
Login or email of the user.
role
Role of the user for this organization. Should be one of:
- Admin
... | def update_org_user(userid, orgname=None, profile='grafana', **kwargs):
'''
Update user role in the organization.
userid
Id of the user.
loginOrEmail
Login or email of the user.
role
Role of the user for this organization. Should be one of:
- Admin
... | [
"Update",
"user",
"role",
"in",
"the",
"organization",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/grafana4.py#L565-L608 | [
"def",
"update_org_user",
"(",
"userid",
",",
"orgname",
"=",
"None",
",",
"profile",
"=",
"'grafana'",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"isinstance",
"(",
"profile",
",",
"string_types",
")",
":",
"profile",
"=",
"__salt__",
"[",
"'config.option'"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_datasource | Show a single datasource in an organisation.
name
Name of the datasource.
orgname
Name of the organization.
profile
Configuration profile used to connect to the Grafana instance.
Default is 'grafana'.
CLI Example:
.. code-block:: bash
salt '*' grafana4.g... | salt/modules/grafana4.py | def get_datasource(name, orgname=None, profile='grafana'):
'''
Show a single datasource in an organisation.
name
Name of the datasource.
orgname
Name of the organization.
profile
Configuration profile used to connect to the Grafana instance.
Default is 'grafana'.
... | def get_datasource(name, orgname=None, profile='grafana'):
'''
Show a single datasource in an organisation.
name
Name of the datasource.
orgname
Name of the organization.
profile
Configuration profile used to connect to the Grafana instance.
Default is 'grafana'.
... | [
"Show",
"a",
"single",
"datasource",
"in",
"an",
"organisation",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/grafana4.py#L930-L954 | [
"def",
"get_datasource",
"(",
"name",
",",
"orgname",
"=",
"None",
",",
"profile",
"=",
"'grafana'",
")",
":",
"data",
"=",
"get_datasources",
"(",
"orgname",
"=",
"orgname",
",",
"profile",
"=",
"profile",
")",
"for",
"datasource",
"in",
"data",
":",
"i... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | delete_datasource | Delete a datasource.
datasourceid
Id of the datasource.
profile
Configuration profile used to connect to the Grafana instance.
Default is 'grafana'.
CLI Example:
.. code-block:: bash
salt '*' grafana4.delete_datasource <datasource_id> | salt/modules/grafana4.py | def delete_datasource(datasourceid, orgname=None, profile='grafana'):
'''
Delete a datasource.
datasourceid
Id of the datasource.
profile
Configuration profile used to connect to the Grafana instance.
Default is 'grafana'.
CLI Example:
.. code-block:: bash
sa... | def delete_datasource(datasourceid, orgname=None, profile='grafana'):
'''
Delete a datasource.
datasourceid
Id of the datasource.
profile
Configuration profile used to connect to the Grafana instance.
Default is 'grafana'.
CLI Example:
.. code-block:: bash
sa... | [
"Delete",
"a",
"datasource",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/grafana4.py#L1113-L1140 | [
"def",
"delete_datasource",
"(",
"datasourceid",
",",
"orgname",
"=",
"None",
",",
"profile",
"=",
"'grafana'",
")",
":",
"if",
"isinstance",
"(",
"profile",
",",
"string_types",
")",
":",
"profile",
"=",
"__salt__",
"[",
"'config.option'",
"]",
"(",
"profil... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | ext_pillar | Read in the generated libvirt keys | salt/pillar/libvirt.py | def ext_pillar(minion_id,
pillar, # pylint: disable=W0613
command): # pylint: disable=W0613
'''
Read in the generated libvirt keys
'''
key_dir = os.path.join(
__opts__['pki_dir'],
'libvirt',
minion_id)
cacert = os.path.join(__opts__... | def ext_pillar(minion_id,
pillar, # pylint: disable=W0613
command): # pylint: disable=W0613
'''
Read in the generated libvirt keys
'''
key_dir = os.path.join(
__opts__['pki_dir'],
'libvirt',
minion_id)
cacert = os.path.join(__opts__... | [
"Read",
"in",
"the",
"generated",
"libvirt",
"keys"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/libvirt.py#L27-L61 | [
"def",
"ext_pillar",
"(",
"minion_id",
",",
"pillar",
",",
"# pylint: disable=W0613",
"command",
")",
":",
"# pylint: disable=W0613",
"key_dir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"__opts__",
"[",
"'pki_dir'",
"]",
",",
"'libvirt'",
",",
"minion_id",
")... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | gen_hyper_keys | Generate the keys to be used by libvirt hypervisors, this routine gens
the keys and applies them to the pillar for the hypervisor minions | salt/pillar/libvirt.py | def gen_hyper_keys(minion_id,
country='US',
state='Utah',
locality='Salt Lake City',
organization='Salted',
expiration_days='365'):
'''
Generate the keys to be used by libvirt hypervisors, this routine gens
the ke... | def gen_hyper_keys(minion_id,
country='US',
state='Utah',
locality='Salt Lake City',
organization='Salted',
expiration_days='365'):
'''
Generate the keys to be used by libvirt hypervisors, this routine gens
the ke... | [
"Generate",
"the",
"keys",
"to",
"be",
"used",
"by",
"libvirt",
"hypervisors",
"this",
"routine",
"gens",
"the",
"keys",
"and",
"applies",
"them",
"to",
"the",
"pillar",
"for",
"the",
"hypervisor",
"minions"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/libvirt.py#L64-L146 | [
"def",
"gen_hyper_keys",
"(",
"minion_id",
",",
"country",
"=",
"'US'",
",",
"state",
"=",
"'Utah'",
",",
"locality",
"=",
"'Salt Lake City'",
",",
"organization",
"=",
"'Salted'",
",",
"expiration_days",
"=",
"'365'",
")",
":",
"key_dir",
"=",
"os",
".",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | key_present | Ensure key pair is present. | salt/states/boto_ec2.py | def key_present(name, save_private=None, upload_public=None, region=None,
key=None, keyid=None, profile=None):
'''
Ensure key pair is present.
'''
ret = {'name': name,
'result': True,
'comment': '',
'changes': {}
}
exists = __salt__['boto_e... | def key_present(name, save_private=None, upload_public=None, region=None,
key=None, keyid=None, profile=None):
'''
Ensure key pair is present.
'''
ret = {'name': name,
'result': True,
'comment': '',
'changes': {}
}
exists = __salt__['boto_e... | [
"Ensure",
"key",
"pair",
"is",
"present",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_ec2.py#L79-L133 | [
"def",
"key_present",
"(",
"name",
",",
"save_private",
"=",
"None",
",",
"upload_public",
"=",
"None",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"'name'",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | key_absent | Deletes a key pair | salt/states/boto_ec2.py | def key_absent(name, region=None, key=None, keyid=None, profile=None):
'''
Deletes a key pair
'''
ret = {'name': name,
'result': True,
'comment': '',
'changes': {}
}
exists = __salt__['boto_ec2.get_key'](name, region, key, keyid, profile)
if exists:
... | def key_absent(name, region=None, key=None, keyid=None, profile=None):
'''
Deletes a key pair
'''
ret = {'name': name,
'result': True,
'comment': '',
'changes': {}
}
exists = __salt__['boto_ec2.get_key'](name, region, key, keyid, profile)
if exists:
... | [
"Deletes",
"a",
"key",
"pair"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_ec2.py#L136-L165 | [
"def",
"key_absent",
"(",
"name",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",
"True",
",",
"'comment'",
":",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | eni_present | Ensure the EC2 ENI exists.
.. versionadded:: 2016.3.0
name
Name tag associated with the ENI.
subnet_id
The VPC subnet ID the ENI will exist within.
subnet_name
The VPC subnet name the ENI will exist within.
private_ip_address
The private ip address to use for thi... | salt/states/boto_ec2.py | def eni_present(
name,
subnet_id=None,
subnet_name=None,
private_ip_address=None,
description=None,
groups=None,
source_dest_check=True,
allocate_eip=None,
arecords=None,
region=None,
key=None,
keyid=None,
profile=No... | def eni_present(
name,
subnet_id=None,
subnet_name=None,
private_ip_address=None,
description=None,
groups=None,
source_dest_check=True,
allocate_eip=None,
arecords=None,
region=None,
key=None,
keyid=None,
profile=No... | [
"Ensure",
"the",
"EC2",
"ENI",
"exists",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_ec2.py#L168-L393 | [
"def",
"eni_present",
"(",
"name",
",",
"subnet_id",
"=",
"None",
",",
"subnet_name",
"=",
"None",
",",
"private_ip_address",
"=",
"None",
",",
"description",
"=",
"None",
",",
"groups",
"=",
"None",
",",
"source_dest_check",
"=",
"True",
",",
"allocate_eip"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | eni_absent | Ensure the EC2 ENI is absent.
.. versionadded:: 2016.3.0
name
Name tag associated with the ENI.
release_eip
True/False - release any EIP associated with the ENI
region
Region to connect to.
key
Secret key to be used.
keyid
Access key to be used.
... | salt/states/boto_ec2.py | def eni_absent(
name,
release_eip=False,
region=None,
key=None,
keyid=None,
profile=None):
'''
Ensure the EC2 ENI is absent.
.. versionadded:: 2016.3.0
name
Name tag associated with the ENI.
release_eip
True/False - release any EIP a... | def eni_absent(
name,
release_eip=False,
region=None,
key=None,
keyid=None,
profile=None):
'''
Ensure the EC2 ENI is absent.
.. versionadded:: 2016.3.0
name
Name tag associated with the ENI.
release_eip
True/False - release any EIP a... | [
"Ensure",
"the",
"EC2",
"ENI",
"is",
"absent",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_ec2.py#L456-L547 | [
"def",
"eni_absent",
"(",
"name",
",",
"release_eip",
"=",
"False",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | snapshot_created | Create a snapshot from the given instance
.. versionadded:: 2016.3.0 | salt/states/boto_ec2.py | def snapshot_created(name, ami_name, instance_name, wait_until_available=True, wait_timeout_seconds=300, **kwargs):
'''
Create a snapshot from the given instance
.. versionadded:: 2016.3.0
'''
ret = {'name': name,
'result': True,
'comment': '',
'changes': {}
... | def snapshot_created(name, ami_name, instance_name, wait_until_available=True, wait_timeout_seconds=300, **kwargs):
'''
Create a snapshot from the given instance
.. versionadded:: 2016.3.0
'''
ret = {'name': name,
'result': True,
'comment': '',
'changes': {}
... | [
"Create",
"a",
"snapshot",
"from",
"the",
"given",
"instance"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_ec2.py#L550-L586 | [
"def",
"snapshot_created",
"(",
"name",
",",
"ami_name",
",",
"instance_name",
",",
"wait_until_available",
"=",
"True",
",",
"wait_timeout_seconds",
"=",
"300",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | instance_present | Ensure an EC2 instance is running with the given attributes and state.
name
(string) - The name of the state definition. Recommended that this
match the instance_name attribute (generally the FQDN of the instance).
instance_name
(string) - The name of the instance, generally its FQDN. ... | salt/states/boto_ec2.py | def instance_present(name, instance_name=None, instance_id=None, image_id=None,
image_name=None, tags=None, key_name=None,
security_groups=None, user_data=None, instance_type=None,
placement=None, kernel_id=None, ramdisk_id=None,
vpc_id... | def instance_present(name, instance_name=None, instance_id=None, image_id=None,
image_name=None, tags=None, key_name=None,
security_groups=None, user_data=None, instance_type=None,
placement=None, kernel_id=None, ramdisk_id=None,
vpc_id... | [
"Ensure",
"an",
"EC2",
"instance",
"is",
"running",
"with",
"the",
"given",
"attributes",
"and",
"state",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_ec2.py#L589-L988 | [
"def",
"instance_present",
"(",
"name",
",",
"instance_name",
"=",
"None",
",",
"instance_id",
"=",
"None",
",",
"image_id",
"=",
"None",
",",
"image_name",
"=",
"None",
",",
"tags",
"=",
"None",
",",
"key_name",
"=",
"None",
",",
"security_groups",
"=",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | instance_absent | Ensure an EC2 instance does not exist (is stopped and removed).
.. versionchanged:: 2016.11.0
name
(string) - The name of the state definition.
instance_name
(string) - The name of the instance.
instance_id
(string) - The ID of the instance.
release_eip
(bool) - R... | salt/states/boto_ec2.py | def instance_absent(name, instance_name=None, instance_id=None,
release_eip=False, region=None, key=None, keyid=None,
profile=None, filters=None):
'''
Ensure an EC2 instance does not exist (is stopped and removed).
.. versionchanged:: 2016.11.0
name
(str... | def instance_absent(name, instance_name=None, instance_id=None,
release_eip=False, region=None, key=None, keyid=None,
profile=None, filters=None):
'''
Ensure an EC2 instance does not exist (is stopped and removed).
.. versionchanged:: 2016.11.0
name
(str... | [
"Ensure",
"an",
"EC2",
"instance",
"does",
"not",
"exist",
"(",
"is",
"stopped",
"and",
"removed",
")",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_ec2.py#L991-L1115 | [
"def",
"instance_absent",
"(",
"name",
",",
"instance_name",
"=",
"None",
",",
"instance_id",
"=",
"None",
",",
"release_eip",
"=",
"False",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | volume_absent | Ensure the EC2 volume is detached and absent.
.. versionadded:: 2016.11.0
name
State definition name.
volume_name
Name tag associated with the volume. For safety, if this matches more than
one volume, the state will refuse to apply.
volume_id
Resource ID of the volum... | salt/states/boto_ec2.py | def volume_absent(name, volume_name=None, volume_id=None, instance_name=None,
instance_id=None, device=None, region=None, key=None, keyid=None, profile=None):
'''
Ensure the EC2 volume is detached and absent.
.. versionadded:: 2016.11.0
name
State definition name.
volume... | def volume_absent(name, volume_name=None, volume_id=None, instance_name=None,
instance_id=None, device=None, region=None, key=None, keyid=None, profile=None):
'''
Ensure the EC2 volume is detached and absent.
.. versionadded:: 2016.11.0
name
State definition name.
volume... | [
"Ensure",
"the",
"EC2",
"volume",
"is",
"detached",
"and",
"absent",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_ec2.py#L1118-L1218 | [
"def",
"volume_absent",
"(",
"name",
",",
"volume_name",
"=",
"None",
",",
"volume_id",
"=",
"None",
",",
"instance_name",
"=",
"None",
",",
"instance_id",
"=",
"None",
",",
"device",
"=",
"None",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | volumes_tagged | Ensure EC2 volume(s) matching the given filters have the defined tags.
.. versionadded:: 2016.11.0
name
State definition name.
tag_maps
List of dicts of filters and tags, where 'filters' is a dict suitable for passing
to the 'filters' argument of boto_ec2.get_all_volumes(), and 't... | salt/states/boto_ec2.py | def volumes_tagged(name, tag_maps, authoritative=False, region=None, key=None,
keyid=None, profile=None):
'''
Ensure EC2 volume(s) matching the given filters have the defined tags.
.. versionadded:: 2016.11.0
name
State definition name.
tag_maps
List of dicts of... | def volumes_tagged(name, tag_maps, authoritative=False, region=None, key=None,
keyid=None, profile=None):
'''
Ensure EC2 volume(s) matching the given filters have the defined tags.
.. versionadded:: 2016.11.0
name
State definition name.
tag_maps
List of dicts of... | [
"Ensure",
"EC2",
"volume",
"(",
"s",
")",
"matching",
"the",
"given",
"filters",
"have",
"the",
"defined",
"tags",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_ec2.py#L1221-L1309 | [
"def",
"volumes_tagged",
"(",
"name",
",",
"tag_maps",
",",
"authoritative",
"=",
"False",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | volume_present | Ensure the EC2 volume is present and attached.
..
name
State definition name.
volume_name
The Name tag value for the volume. If no volume with that matching name tag is found,
a new volume will be created. If multiple volumes are matched, the state will fail.
volume_id
... | salt/states/boto_ec2.py | def volume_present(name, volume_name=None, volume_id=None, instance_name=None,
instance_id=None, device=None, size=None, snapshot_id=None,
volume_type=None, iops=None, encrypted=False, kms_key_id=None,
region=None, key=None, keyid=None, profile=None):
'''
... | def volume_present(name, volume_name=None, volume_id=None, instance_name=None,
instance_id=None, device=None, size=None, snapshot_id=None,
volume_type=None, iops=None, encrypted=False, kms_key_id=None,
region=None, key=None, keyid=None, profile=None):
'''
... | [
"Ensure",
"the",
"EC2",
"volume",
"is",
"present",
"and",
"attached",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_ec2.py#L1312-L1509 | [
"def",
"volume_present",
"(",
"name",
",",
"volume_name",
"=",
"None",
",",
"volume_id",
"=",
"None",
",",
"instance_name",
"=",
"None",
",",
"instance_id",
"=",
"None",
",",
"device",
"=",
"None",
",",
"size",
"=",
"None",
",",
"snapshot_id",
"=",
"None... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | private_ips_present | Ensure an ENI has secondary private ip addresses associated with it
name
(String) - State definition name
network_interface_id
(String) - The EC2 network interface id, example eni-123456789
private_ip_addresses
(List or String) - The secondary private ip address(es) that should be p... | salt/states/boto_ec2.py | def private_ips_present(name, network_interface_name=None, network_interface_id=None,
private_ip_addresses=None, allow_reassignment=False, region=None, key=None,
keyid=None, profile=None):
'''
Ensure an ENI has secondary private ip addresses associated with it
... | def private_ips_present(name, network_interface_name=None, network_interface_id=None,
private_ip_addresses=None, allow_reassignment=False, region=None, key=None,
keyid=None, profile=None):
'''
Ensure an ENI has secondary private ip addresses associated with it
... | [
"Ensure",
"an",
"ENI",
"has",
"secondary",
"private",
"ip",
"addresses",
"associated",
"with",
"it"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_ec2.py#L1512-L1634 | [
"def",
"private_ips_present",
"(",
"name",
",",
"network_interface_name",
"=",
"None",
",",
"network_interface_id",
"=",
"None",
",",
"private_ip_addresses",
"=",
"None",
",",
"allow_reassignment",
"=",
"False",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | private_ips_absent | Ensure an ENI does not have secondary private ip addresses associated with it
name
(String) - State definition name
network_interface_id
(String) - The EC2 network interface id, example eni-123456789
private_ip_addresses
(List or String) - The secondary private ip address(es) that s... | salt/states/boto_ec2.py | def private_ips_absent(name, network_interface_name=None, network_interface_id=None,
private_ip_addresses=None, region=None, key=None, keyid=None, profile=None):
'''
Ensure an ENI does not have secondary private ip addresses associated with it
name
(String) - State definitio... | def private_ips_absent(name, network_interface_name=None, network_interface_id=None,
private_ip_addresses=None, region=None, key=None, keyid=None, profile=None):
'''
Ensure an ENI does not have secondary private ip addresses associated with it
name
(String) - State definitio... | [
"Ensure",
"an",
"ENI",
"does",
"not",
"have",
"secondary",
"private",
"ip",
"addresses",
"associated",
"with",
"it"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_ec2.py#L1637-L1767 | [
"def",
"private_ips_absent",
"(",
"name",
",",
"network_interface_name",
"=",
"None",
",",
"network_interface_id",
"=",
"None",
",",
"private_ip_addresses",
"=",
"None",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"pr... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _post_processing | Additional network-specific post-translation processing | salt/utils/docker/translate/network.py | def _post_processing(kwargs, skip_translate, invalid): # pylint: disable=unused-argument
'''
Additional network-specific post-translation processing
'''
# If any defaults were not expicitly passed, add them
for item in DEFAULTS:
if item not in kwargs:
kwargs[item] = DEFAULTS[ite... | def _post_processing(kwargs, skip_translate, invalid): # pylint: disable=unused-argument
'''
Additional network-specific post-translation processing
'''
# If any defaults were not expicitly passed, add them
for item in DEFAULTS:
if item not in kwargs:
kwargs[item] = DEFAULTS[ite... | [
"Additional",
"network",
"-",
"specific",
"post",
"-",
"translation",
"processing"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/docker/translate/network.py#L33-L40 | [
"def",
"_post_processing",
"(",
"kwargs",
",",
"skip_translate",
",",
"invalid",
")",
":",
"# pylint: disable=unused-argument",
"# If any defaults were not expicitly passed, add them",
"for",
"item",
"in",
"DEFAULTS",
":",
"if",
"item",
"not",
"in",
"kwargs",
":",
"kwar... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_local_client | .. versionadded:: 2014.7.0
Read in the config and return the correct LocalClient object based on
the configured transport
:param IOLoop io_loop: io_loop used for events.
Pass in an io_loop if you want asynchronous
operation for obtaining events. Eg use... | salt/client/__init__.py | def get_local_client(
c_path=os.path.join(syspaths.CONFIG_DIR, 'master'),
mopts=None,
skip_perm_errors=False,
io_loop=None,
auto_reconnect=False):
'''
.. versionadded:: 2014.7.0
Read in the config and return the correct LocalClient object based on
the configured ... | def get_local_client(
c_path=os.path.join(syspaths.CONFIG_DIR, 'master'),
mopts=None,
skip_perm_errors=False,
io_loop=None,
auto_reconnect=False):
'''
.. versionadded:: 2014.7.0
Read in the config and return the correct LocalClient object based on
the configured ... | [
"..",
"versionadded",
"::",
"2014",
".",
"7",
".",
"0"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L76-L106 | [
"def",
"get_local_client",
"(",
"c_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"syspaths",
".",
"CONFIG_DIR",
",",
"'master'",
")",
",",
"mopts",
"=",
"None",
",",
"skip_perm_errors",
"=",
"False",
",",
"io_loop",
"=",
"None",
",",
"auto_reconnect",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | LocalClient.__read_master_key | Read in the rotating master authentication key | salt/client/__init__.py | def __read_master_key(self):
'''
Read in the rotating master authentication key
'''
key_user = self.salt_user
if key_user == 'root':
if self.opts.get('user', 'root') != 'root':
key_user = self.opts.get('user', 'root')
if key_user.startswith('su... | def __read_master_key(self):
'''
Read in the rotating master authentication key
'''
key_user = self.salt_user
if key_user == 'root':
if self.opts.get('user', 'root') != 'root':
key_user = self.opts.get('user', 'root')
if key_user.startswith('su... | [
"Read",
"in",
"the",
"rotating",
"master",
"authentication",
"key"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L175-L200 | [
"def",
"__read_master_key",
"(",
"self",
")",
":",
"key_user",
"=",
"self",
".",
"salt_user",
"if",
"key_user",
"==",
"'root'",
":",
"if",
"self",
".",
"opts",
".",
"get",
"(",
"'user'",
",",
"'root'",
")",
"!=",
"'root'",
":",
"key_user",
"=",
"self",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | LocalClient._convert_range_to_list | convert a seco.range range into a list target | salt/client/__init__.py | def _convert_range_to_list(self, tgt):
'''
convert a seco.range range into a list target
'''
range_ = seco.range.Range(self.opts['range_server'])
try:
return range_.expand(tgt)
except seco.range.RangeException as err:
print('Range server exception:... | def _convert_range_to_list(self, tgt):
'''
convert a seco.range range into a list target
'''
range_ = seco.range.Range(self.opts['range_server'])
try:
return range_.expand(tgt)
except seco.range.RangeException as err:
print('Range server exception:... | [
"convert",
"a",
"seco",
".",
"range",
"range",
"into",
"a",
"list",
"target"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L202-L211 | [
"def",
"_convert_range_to_list",
"(",
"self",
",",
"tgt",
")",
":",
"range_",
"=",
"seco",
".",
"range",
".",
"Range",
"(",
"self",
".",
"opts",
"[",
"'range_server'",
"]",
")",
"try",
":",
"return",
"range_",
".",
"expand",
"(",
"tgt",
")",
"except",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | LocalClient._get_timeout | Return the timeout to use | salt/client/__init__.py | def _get_timeout(self, timeout):
'''
Return the timeout to use
'''
if timeout is None:
return self.opts['timeout']
if isinstance(timeout, int):
return timeout
if isinstance(timeout, six.string_types):
try:
return int(tim... | def _get_timeout(self, timeout):
'''
Return the timeout to use
'''
if timeout is None:
return self.opts['timeout']
if isinstance(timeout, int):
return timeout
if isinstance(timeout, six.string_types):
try:
return int(tim... | [
"Return",
"the",
"timeout",
"to",
"use"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L213-L227 | [
"def",
"_get_timeout",
"(",
"self",
",",
"timeout",
")",
":",
"if",
"timeout",
"is",
"None",
":",
"return",
"self",
".",
"opts",
"[",
"'timeout'",
"]",
"if",
"isinstance",
"(",
"timeout",
",",
"int",
")",
":",
"return",
"timeout",
"if",
"isinstance",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | LocalClient.gather_job_info | Return the information about a given job | salt/client/__init__.py | def gather_job_info(self, jid, tgt, tgt_type, listen=True, **kwargs):
'''
Return the information about a given job
'''
log.debug('Checking whether jid %s is still running', jid)
timeout = int(kwargs.get('gather_job_timeout', self.opts['gather_job_timeout']))
pub_data = s... | def gather_job_info(self, jid, tgt, tgt_type, listen=True, **kwargs):
'''
Return the information about a given job
'''
log.debug('Checking whether jid %s is still running', jid)
timeout = int(kwargs.get('gather_job_timeout', self.opts['gather_job_timeout']))
pub_data = s... | [
"Return",
"the",
"information",
"about",
"a",
"given",
"job"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L229-L248 | [
"def",
"gather_job_info",
"(",
"self",
",",
"jid",
",",
"tgt",
",",
"tgt_type",
",",
"listen",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"log",
".",
"debug",
"(",
"'Checking whether jid %s is still running'",
",",
"jid",
")",
"timeout",
"=",
"int",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | LocalClient._check_pub_data | Common checks on the pub_data data structure returned from running pub | salt/client/__init__.py | def _check_pub_data(self, pub_data, listen=True):
'''
Common checks on the pub_data data structure returned from running pub
'''
if pub_data == '':
# Failed to authenticate, this could be a bunch of things
raise EauthAuthenticationError(
'Failed to... | def _check_pub_data(self, pub_data, listen=True):
'''
Common checks on the pub_data data structure returned from running pub
'''
if pub_data == '':
# Failed to authenticate, this could be a bunch of things
raise EauthAuthenticationError(
'Failed to... | [
"Common",
"checks",
"on",
"the",
"pub_data",
"data",
"structure",
"returned",
"from",
"running",
"pub"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L250-L294 | [
"def",
"_check_pub_data",
"(",
"self",
",",
"pub_data",
",",
"listen",
"=",
"True",
")",
":",
"if",
"pub_data",
"==",
"''",
":",
"# Failed to authenticate, this could be a bunch of things",
"raise",
"EauthAuthenticationError",
"(",
"'Failed to authenticate! This is most lik... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | LocalClient.run_job | Asynchronously send a command to connected minions
Prep the job directory and publish a command to any targeted minions.
:return: A dictionary of (validated) ``pub_data`` or an empty
dictionary on failure. The ``pub_data`` contains the job ID and a
list of all minions that are ... | salt/client/__init__.py | def run_job(
self,
tgt,
fun,
arg=(),
tgt_type='glob',
ret='',
timeout=None,
jid='',
kwarg=None,
listen=False,
**kwargs):
'''
Asynchronously send a command to connected mini... | def run_job(
self,
tgt,
fun,
arg=(),
tgt_type='glob',
ret='',
timeout=None,
jid='',
kwarg=None,
listen=False,
**kwargs):
'''
Asynchronously send a command to connected mini... | [
"Asynchronously",
"send",
"a",
"command",
"to",
"connected",
"minions"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L296-L348 | [
"def",
"run_job",
"(",
"self",
",",
"tgt",
",",
"fun",
",",
"arg",
"=",
"(",
")",
",",
"tgt_type",
"=",
"'glob'",
",",
"ret",
"=",
"''",
",",
"timeout",
"=",
"None",
",",
"jid",
"=",
"''",
",",
"kwarg",
"=",
"None",
",",
"listen",
"=",
"False",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | LocalClient.run_job_async | Asynchronously send a command to connected minions
Prep the job directory and publish a command to any targeted minions.
:return: A dictionary of (validated) ``pub_data`` or an empty
dictionary on failure. The ``pub_data`` contains the job ID and a
list of all minions that are ... | salt/client/__init__.py | def run_job_async(
self,
tgt,
fun,
arg=(),
tgt_type='glob',
ret='',
timeout=None,
jid='',
kwarg=None,
listen=True,
io_loop=None,
**kwargs):
'''
Asynchronously s... | def run_job_async(
self,
tgt,
fun,
arg=(),
tgt_type='glob',
ret='',
timeout=None,
jid='',
kwarg=None,
listen=True,
io_loop=None,
**kwargs):
'''
Asynchronously s... | [
"Asynchronously",
"send",
"a",
"command",
"to",
"connected",
"minions"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L355-L409 | [
"def",
"run_job_async",
"(",
"self",
",",
"tgt",
",",
"fun",
",",
"arg",
"=",
"(",
")",
",",
"tgt_type",
"=",
"'glob'",
",",
"ret",
"=",
"''",
",",
"timeout",
"=",
"None",
",",
"jid",
"=",
"''",
",",
"kwarg",
"=",
"None",
",",
"listen",
"=",
"T... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | LocalClient.cmd_async | Asynchronously send a command to connected minions
The function signature is the same as :py:meth:`cmd` with the
following exceptions.
:returns: A job ID or 0 on failure.
.. code-block:: python
>>> local.cmd_async('*', 'test.sleep', [300])
'2013121921592185771... | salt/client/__init__.py | def cmd_async(
self,
tgt,
fun,
arg=(),
tgt_type='glob',
ret='',
jid='',
kwarg=None,
**kwargs):
'''
Asynchronously send a command to connected minions
The function signature is the same as... | def cmd_async(
self,
tgt,
fun,
arg=(),
tgt_type='glob',
ret='',
jid='',
kwarg=None,
**kwargs):
'''
Asynchronously send a command to connected minions
The function signature is the same as... | [
"Asynchronously",
"send",
"a",
"command",
"to",
"connected",
"minions"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L411-L446 | [
"def",
"cmd_async",
"(",
"self",
",",
"tgt",
",",
"fun",
",",
"arg",
"=",
"(",
")",
",",
"tgt_type",
"=",
"'glob'",
",",
"ret",
"=",
"''",
",",
"jid",
"=",
"''",
",",
"kwarg",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"pub_data",
"=",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | LocalClient.cmd_subset | Execute a command on a random subset of the targeted systems
The function signature is the same as :py:meth:`cmd` with the
following exceptions.
:param sub: The number of systems to execute on
:param cli: When this is set to True, a generator is returned,
otherwise ... | salt/client/__init__.py | def cmd_subset(
self,
tgt,
fun,
arg=(),
tgt_type='glob',
ret='',
kwarg=None,
sub=3,
cli=False,
progress=False,
full_return=False,
**kwargs):
'''
Execute a comma... | def cmd_subset(
self,
tgt,
fun,
arg=(),
tgt_type='glob',
ret='',
kwarg=None,
sub=3,
cli=False,
progress=False,
full_return=False,
**kwargs):
'''
Execute a comma... | [
"Execute",
"a",
"command",
"on",
"a",
"random",
"subset",
"of",
"the",
"targeted",
"systems"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L448-L500 | [
"def",
"cmd_subset",
"(",
"self",
",",
"tgt",
",",
"fun",
",",
"arg",
"=",
"(",
")",
",",
"tgt_type",
"=",
"'glob'",
",",
"ret",
"=",
"''",
",",
"kwarg",
"=",
"None",
",",
"sub",
"=",
"3",
",",
"cli",
"=",
"False",
",",
"progress",
"=",
"False"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | LocalClient.cmd_batch | Iteratively execute a command on subsets of minions at a time
The function signature is the same as :py:meth:`cmd` with the
following exceptions.
:param batch: The batch identifier of systems to execute on
:returns: A generator of minion returns
.. code-block:: python
... | salt/client/__init__.py | def cmd_batch(
self,
tgt,
fun,
arg=(),
tgt_type='glob',
ret='',
kwarg=None,
batch='10%',
**kwargs):
'''
Iteratively execute a command on subsets of minions at a time
The function signatur... | def cmd_batch(
self,
tgt,
fun,
arg=(),
tgt_type='glob',
ret='',
kwarg=None,
batch='10%',
**kwargs):
'''
Iteratively execute a command on subsets of minions at a time
The function signatur... | [
"Iteratively",
"execute",
"a",
"command",
"on",
"subsets",
"of",
"minions",
"at",
"a",
"time"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L502-L572 | [
"def",
"cmd_batch",
"(",
"self",
",",
"tgt",
",",
"fun",
",",
"arg",
"=",
"(",
")",
",",
"tgt_type",
"=",
"'glob'",
",",
"ret",
"=",
"''",
",",
"kwarg",
"=",
"None",
",",
"batch",
"=",
"'10%'",
",",
"*",
"*",
"kwargs",
")",
":",
"# Late import - ... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | LocalClient.cmd | Synchronously execute a command on targeted minions
The cmd method will execute and wait for the timeout period for all
minions to reply, then it will return all minion data at once.
.. code-block:: python
>>> import salt.client
>>> local = salt.client.LocalClient()
... | salt/client/__init__.py | def cmd(self,
tgt,
fun,
arg=(),
timeout=None,
tgt_type='glob',
ret='',
jid='',
full_return=False,
kwarg=None,
**kwargs):
'''
Synchronously execute a command on targeted minions
... | def cmd(self,
tgt,
fun,
arg=(),
timeout=None,
tgt_type='glob',
ret='',
jid='',
full_return=False,
kwarg=None,
**kwargs):
'''
Synchronously execute a command on targeted minions
... | [
"Synchronously",
"execute",
"a",
"command",
"on",
"targeted",
"minions"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L574-L724 | [
"def",
"cmd",
"(",
"self",
",",
"tgt",
",",
"fun",
",",
"arg",
"=",
"(",
")",
",",
"timeout",
"=",
"None",
",",
"tgt_type",
"=",
"'glob'",
",",
"ret",
"=",
"''",
",",
"jid",
"=",
"''",
",",
"full_return",
"=",
"False",
",",
"kwarg",
"=",
"None"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | LocalClient.cmd_cli | Used by the :command:`salt` CLI. This method returns minion returns as
they come back and attempts to block until all minions return.
The function signature is the same as :py:meth:`cmd` with the
following exceptions.
:param verbose: Print extra information about the running command
... | salt/client/__init__.py | def cmd_cli(
self,
tgt,
fun,
arg=(),
timeout=None,
tgt_type='glob',
ret='',
verbose=False,
kwarg=None,
progress=False,
**kwargs):
'''
Used by the :command:`salt` CLI. This ... | def cmd_cli(
self,
tgt,
fun,
arg=(),
timeout=None,
tgt_type='glob',
ret='',
verbose=False,
kwarg=None,
progress=False,
**kwargs):
'''
Used by the :command:`salt` CLI. This ... | [
"Used",
"by",
"the",
":",
"command",
":",
"salt",
"CLI",
".",
"This",
"method",
"returns",
"minion",
"returns",
"as",
"they",
"come",
"back",
"and",
"attempts",
"to",
"block",
"until",
"all",
"minions",
"return",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L726-L820 | [
"def",
"cmd_cli",
"(",
"self",
",",
"tgt",
",",
"fun",
",",
"arg",
"=",
"(",
")",
",",
"timeout",
"=",
"None",
",",
"tgt_type",
"=",
"'glob'",
",",
"ret",
"=",
"''",
",",
"verbose",
"=",
"False",
",",
"kwarg",
"=",
"None",
",",
"progress",
"=",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | LocalClient.cmd_iter | Yields the individual minion returns as they come in
The function signature is the same as :py:meth:`cmd` with the
following exceptions.
Normally :py:meth:`cmd_iter` does not yield results for minions that
are not connected. If you want it to return results for disconnected
min... | salt/client/__init__.py | def cmd_iter(
self,
tgt,
fun,
arg=(),
timeout=None,
tgt_type='glob',
ret='',
kwarg=None,
**kwargs):
'''
Yields the individual minion returns as they come in
The function signature is the ... | def cmd_iter(
self,
tgt,
fun,
arg=(),
timeout=None,
tgt_type='glob',
ret='',
kwarg=None,
**kwargs):
'''
Yields the individual minion returns as they come in
The function signature is the ... | [
"Yields",
"the",
"individual",
"minion",
"returns",
"as",
"they",
"come",
"in"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L822-L884 | [
"def",
"cmd_iter",
"(",
"self",
",",
"tgt",
",",
"fun",
",",
"arg",
"=",
"(",
")",
",",
"timeout",
"=",
"None",
",",
"tgt_type",
"=",
"'glob'",
",",
"ret",
"=",
"''",
",",
"kwarg",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"was_listening",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | LocalClient.cmd_iter_no_block | Yields the individual minion returns as they come in, or None
when no returns are available.
The function signature is the same as :py:meth:`cmd` with the
following exceptions.
:returns: A generator yielding the individual minion returns, or None
when no returns are ava... | salt/client/__init__.py | def cmd_iter_no_block(
self,
tgt,
fun,
arg=(),
timeout=None,
tgt_type='glob',
ret='',
kwarg=None,
show_jid=False,
verbose=False,
**kwargs):
'''
Yields the individual minion... | def cmd_iter_no_block(
self,
tgt,
fun,
arg=(),
timeout=None,
tgt_type='glob',
ret='',
kwarg=None,
show_jid=False,
verbose=False,
**kwargs):
'''
Yields the individual minion... | [
"Yields",
"the",
"individual",
"minion",
"returns",
"as",
"they",
"come",
"in",
"or",
"None",
"when",
"no",
"returns",
"are",
"available",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L886-L952 | [
"def",
"cmd_iter_no_block",
"(",
"self",
",",
"tgt",
",",
"fun",
",",
"arg",
"=",
"(",
")",
",",
"timeout",
"=",
"None",
",",
"tgt_type",
"=",
"'glob'",
",",
"ret",
"=",
"''",
",",
"kwarg",
"=",
"None",
",",
"show_jid",
"=",
"False",
",",
"verbose"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | LocalClient.cmd_full_return | Execute a salt command and return | salt/client/__init__.py | def cmd_full_return(
self,
tgt,
fun,
arg=(),
timeout=None,
tgt_type='glob',
ret='',
verbose=False,
kwarg=None,
**kwargs):
'''
Execute a salt command and return
'''
was_... | def cmd_full_return(
self,
tgt,
fun,
arg=(),
timeout=None,
tgt_type='glob',
ret='',
verbose=False,
kwarg=None,
**kwargs):
'''
Execute a salt command and return
'''
was_... | [
"Execute",
"a",
"salt",
"command",
"and",
"return"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L954-L993 | [
"def",
"cmd_full_return",
"(",
"self",
",",
"tgt",
",",
"fun",
",",
"arg",
"=",
"(",
")",
",",
"timeout",
"=",
"None",
",",
"tgt_type",
"=",
"'glob'",
",",
"ret",
"=",
"''",
",",
"verbose",
"=",
"False",
",",
"kwarg",
"=",
"None",
",",
"*",
"*",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | LocalClient.get_cli_returns | Starts a watcher looking at the return data for a specified JID
:returns: all of the information for the JID | salt/client/__init__.py | def get_cli_returns(
self,
jid,
minions,
timeout=None,
tgt='*',
tgt_type='glob',
verbose=False,
show_jid=False,
**kwargs):
'''
Starts a watcher looking at the return data for a specified JID
... | def get_cli_returns(
self,
jid,
minions,
timeout=None,
tgt='*',
tgt_type='glob',
verbose=False,
show_jid=False,
**kwargs):
'''
Starts a watcher looking at the return data for a specified JID
... | [
"Starts",
"a",
"watcher",
"looking",
"at",
"the",
"return",
"data",
"for",
"a",
"specified",
"JID"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L995-L1043 | [
"def",
"get_cli_returns",
"(",
"self",
",",
"jid",
",",
"minions",
",",
"timeout",
"=",
"None",
",",
"tgt",
"=",
"'*'",
",",
"tgt_type",
"=",
"'glob'",
",",
"verbose",
"=",
"False",
",",
"show_jid",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | LocalClient.get_returns_no_block | Raw function to just return events of jid excluding timeout logic
Yield either the raw event data or None
Pass a list of additional regular expressions as `tags_regex` to search
the event bus for non-return data, such as minion lists returned from
syndics. | salt/client/__init__.py | def get_returns_no_block(
self,
tag,
match_type=None):
'''
Raw function to just return events of jid excluding timeout logic
Yield either the raw event data or None
Pass a list of additional regular expressions as `tags_regex` to search
the e... | def get_returns_no_block(
self,
tag,
match_type=None):
'''
Raw function to just return events of jid excluding timeout logic
Yield either the raw event data or None
Pass a list of additional regular expressions as `tags_regex` to search
the e... | [
"Raw",
"function",
"to",
"just",
"return",
"events",
"of",
"jid",
"excluding",
"timeout",
"logic"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L1046-L1063 | [
"def",
"get_returns_no_block",
"(",
"self",
",",
"tag",
",",
"match_type",
"=",
"None",
")",
":",
"while",
"True",
":",
"raw",
"=",
"self",
".",
"event",
".",
"get_event",
"(",
"wait",
"=",
"0.01",
",",
"tag",
"=",
"tag",
",",
"match_type",
"=",
"mat... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | LocalClient.get_iter_returns | Watch the event system and return job data as it comes in
:returns: all of the information for the JID | salt/client/__init__.py | def get_iter_returns(
self,
jid,
minions,
timeout=None,
tgt='*',
tgt_type='glob',
expect_minions=False,
block=True,
**kwargs):
'''
Watch the event system and return job data as it comes in
... | def get_iter_returns(
self,
jid,
minions,
timeout=None,
tgt='*',
tgt_type='glob',
expect_minions=False,
block=True,
**kwargs):
'''
Watch the event system and return job data as it comes in
... | [
"Watch",
"the",
"event",
"system",
"and",
"return",
"job",
"data",
"as",
"it",
"comes",
"in"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L1065-L1292 | [
"def",
"get_iter_returns",
"(",
"self",
",",
"jid",
",",
"minions",
",",
"timeout",
"=",
"None",
",",
"tgt",
"=",
"'*'",
",",
"tgt_type",
"=",
"'glob'",
",",
"expect_minions",
"=",
"False",
",",
"block",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | LocalClient.get_returns | Get the returns for the command line interface via the event system | salt/client/__init__.py | def get_returns(
self,
jid,
minions,
timeout=None):
'''
Get the returns for the command line interface via the event system
'''
minions = set(minions)
if timeout is None:
timeout = self.opts['timeout']
start = in... | def get_returns(
self,
jid,
minions,
timeout=None):
'''
Get the returns for the command line interface via the event system
'''
minions = set(minions)
if timeout is None:
timeout = self.opts['timeout']
start = in... | [
"Get",
"the",
"returns",
"for",
"the",
"command",
"line",
"interface",
"via",
"the",
"event",
"system"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L1294-L1348 | [
"def",
"get_returns",
"(",
"self",
",",
"jid",
",",
"minions",
",",
"timeout",
"=",
"None",
")",
":",
"minions",
"=",
"set",
"(",
"minions",
")",
"if",
"timeout",
"is",
"None",
":",
"timeout",
"=",
"self",
".",
"opts",
"[",
"'timeout'",
"]",
"start",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | LocalClient.get_full_returns | This method starts off a watcher looking at the return data for
a specified jid, it returns all of the information for the jid | salt/client/__init__.py | def get_full_returns(self, jid, minions, timeout=None):
'''
This method starts off a watcher looking at the return data for
a specified jid, it returns all of the information for the jid
'''
# TODO: change this from ret to return... or the other way.
# Its inconsist... | def get_full_returns(self, jid, minions, timeout=None):
'''
This method starts off a watcher looking at the return data for
a specified jid, it returns all of the information for the jid
'''
# TODO: change this from ret to return... or the other way.
# Its inconsist... | [
"This",
"method",
"starts",
"off",
"a",
"watcher",
"looking",
"at",
"the",
"return",
"data",
"for",
"a",
"specified",
"jid",
"it",
"returns",
"all",
"of",
"the",
"information",
"for",
"the",
"jid"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L1350-L1403 | [
"def",
"get_full_returns",
"(",
"self",
",",
"jid",
",",
"minions",
",",
"timeout",
"=",
"None",
")",
":",
"# TODO: change this from ret to return... or the other way.",
"# Its inconsistent, we should pick one",
"ret",
"=",
"{",
"}",
"# create the iterator-- since we wa... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | LocalClient.get_cache_returns | Execute a single pass to gather the contents of the job cache | salt/client/__init__.py | def get_cache_returns(self, jid):
'''
Execute a single pass to gather the contents of the job cache
'''
ret = {}
try:
data = self.returners['{0}.get_jid'.format(self.opts['master_job_cache'])](jid)
except Exception as exc:
raise SaltClientError('C... | def get_cache_returns(self, jid):
'''
Execute a single pass to gather the contents of the job cache
'''
ret = {}
try:
data = self.returners['{0}.get_jid'.format(self.opts['master_job_cache'])](jid)
except Exception as exc:
raise SaltClientError('C... | [
"Execute",
"a",
"single",
"pass",
"to",
"gather",
"the",
"contents",
"of",
"the",
"job",
"cache"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L1405-L1431 | [
"def",
"get_cache_returns",
"(",
"self",
",",
"jid",
")",
":",
"ret",
"=",
"{",
"}",
"try",
":",
"data",
"=",
"self",
".",
"returners",
"[",
"'{0}.get_jid'",
".",
"format",
"(",
"self",
".",
"opts",
"[",
"'master_job_cache'",
"]",
")",
"]",
"(",
"jid... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | LocalClient.get_cli_static_event_returns | Get the returns for the command line interface via the event system | salt/client/__init__.py | def get_cli_static_event_returns(
self,
jid,
minions,
timeout=None,
tgt='*',
tgt_type='glob',
verbose=False,
show_timeout=False,
show_jid=False):
'''
Get the returns for the command line interface... | def get_cli_static_event_returns(
self,
jid,
minions,
timeout=None,
tgt='*',
tgt_type='glob',
verbose=False,
show_timeout=False,
show_jid=False):
'''
Get the returns for the command line interface... | [
"Get",
"the",
"returns",
"for",
"the",
"command",
"line",
"interface",
"via",
"the",
"event",
"system"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L1433-L1512 | [
"def",
"get_cli_static_event_returns",
"(",
"self",
",",
"jid",
",",
"minions",
",",
"timeout",
"=",
"None",
",",
"tgt",
"=",
"'*'",
",",
"tgt_type",
"=",
"'glob'",
",",
"verbose",
"=",
"False",
",",
"show_timeout",
"=",
"False",
",",
"show_jid",
"=",
"F... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | LocalClient.get_cli_event_returns | Get the returns for the command line interface via the event system | salt/client/__init__.py | def get_cli_event_returns(
self,
jid,
minions,
timeout=None,
tgt='*',
tgt_type='glob',
verbose=False,
progress=False,
show_timeout=False,
show_jid=False,
**kwargs):
'''
Get... | def get_cli_event_returns(
self,
jid,
minions,
timeout=None,
tgt='*',
tgt_type='glob',
verbose=False,
progress=False,
show_timeout=False,
show_jid=False,
**kwargs):
'''
Get... | [
"Get",
"the",
"returns",
"for",
"the",
"command",
"line",
"interface",
"via",
"the",
"event",
"system"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L1514-L1594 | [
"def",
"get_cli_event_returns",
"(",
"self",
",",
"jid",
",",
"minions",
",",
"timeout",
"=",
"None",
",",
"tgt",
"=",
"'*'",
",",
"tgt_type",
"=",
"'glob'",
",",
"verbose",
"=",
"False",
",",
"progress",
"=",
"False",
",",
"show_timeout",
"=",
"False",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | LocalClient.get_event_iter_returns | Gather the return data from the event system, break hard when timeout
is reached. | salt/client/__init__.py | def get_event_iter_returns(self, jid, minions, timeout=None):
'''
Gather the return data from the event system, break hard when timeout
is reached.
'''
log.trace('entered - function get_event_iter_returns()')
if timeout is None:
timeout = self.opts['timeout']
... | def get_event_iter_returns(self, jid, minions, timeout=None):
'''
Gather the return data from the event system, break hard when timeout
is reached.
'''
log.trace('entered - function get_event_iter_returns()')
if timeout is None:
timeout = self.opts['timeout']
... | [
"Gather",
"the",
"return",
"data",
"from",
"the",
"event",
"system",
"break",
"hard",
"when",
"timeout",
"is",
"reached",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L1596-L1631 | [
"def",
"get_event_iter_returns",
"(",
"self",
",",
"jid",
",",
"minions",
",",
"timeout",
"=",
"None",
")",
":",
"log",
".",
"trace",
"(",
"'entered - function get_event_iter_returns()'",
")",
"if",
"timeout",
"is",
"None",
":",
"timeout",
"=",
"self",
".",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | LocalClient._prep_pub | Set up the payload_kwargs to be sent down to the master | salt/client/__init__.py | def _prep_pub(self,
tgt,
fun,
arg,
tgt_type,
ret,
jid,
timeout,
**kwargs):
'''
Set up the payload_kwargs to be sent down to the master
'''
if tg... | def _prep_pub(self,
tgt,
fun,
arg,
tgt_type,
ret,
jid,
timeout,
**kwargs):
'''
Set up the payload_kwargs to be sent down to the master
'''
if tg... | [
"Set",
"up",
"the",
"payload_kwargs",
"to",
"be",
"sent",
"down",
"to",
"the",
"master"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L1633-L1699 | [
"def",
"_prep_pub",
"(",
"self",
",",
"tgt",
",",
"fun",
",",
"arg",
",",
"tgt_type",
",",
"ret",
",",
"jid",
",",
"timeout",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"tgt_type",
"==",
"'nodegroup'",
":",
"if",
"tgt",
"not",
"in",
"self",
".",
"o... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | LocalClient.pub_async | Take the required arguments and publish the given command.
Arguments:
tgt:
The tgt is a regex or a glob used to match up the ids on
the minions. Salt works by always publishing every command
to all of the minions and then the minions determine if
... | salt/client/__init__.py | def pub_async(self,
tgt,
fun,
arg=(),
tgt_type='glob',
ret='',
jid='',
timeout=5,
io_loop=None,
listen=True,
**kwargs):
'''
... | def pub_async(self,
tgt,
fun,
arg=(),
tgt_type='glob',
ret='',
jid='',
timeout=5,
io_loop=None,
listen=True,
**kwargs):
'''
... | [
"Take",
"the",
"required",
"arguments",
"and",
"publish",
"the",
"given",
"command",
".",
"Arguments",
":",
"tgt",
":",
"The",
"tgt",
"is",
"a",
"regex",
"or",
"a",
"glob",
"used",
"to",
"match",
"up",
"the",
"ids",
"on",
"the",
"minions",
".",
"Salt",... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L1808-L1913 | [
"def",
"pub_async",
"(",
"self",
",",
"tgt",
",",
"fun",
",",
"arg",
"=",
"(",
")",
",",
"tgt_type",
"=",
"'glob'",
",",
"ret",
"=",
"''",
",",
"jid",
"=",
"''",
",",
"timeout",
"=",
"5",
",",
"io_loop",
"=",
"None",
",",
"listen",
"=",
"True",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | FunctionWrapper.__load_functions | Find out what functions are available on the minion | salt/client/__init__.py | def __load_functions(self):
'''
Find out what functions are available on the minion
'''
return set(self.local.cmd(self.minion,
'sys.list_functions').get(self.minion, [])) | def __load_functions(self):
'''
Find out what functions are available on the minion
'''
return set(self.local.cmd(self.minion,
'sys.list_functions').get(self.minion, [])) | [
"Find",
"out",
"what",
"functions",
"are",
"available",
"on",
"the",
"minion"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L1953-L1958 | [
"def",
"__load_functions",
"(",
"self",
")",
":",
"return",
"set",
"(",
"self",
".",
"local",
".",
"cmd",
"(",
"self",
".",
"minion",
",",
"'sys.list_functions'",
")",
".",
"get",
"(",
"self",
".",
"minion",
",",
"[",
"]",
")",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | FunctionWrapper.run_key | Return a function that executes the arguments passed via the local
client | salt/client/__init__.py | def run_key(self, key):
'''
Return a function that executes the arguments passed via the local
client
'''
def func(*args, **kwargs):
'''
Run a remote call
'''
args = list(args)
for _key, _val in kwargs:
a... | def run_key(self, key):
'''
Return a function that executes the arguments passed via the local
client
'''
def func(*args, **kwargs):
'''
Run a remote call
'''
args = list(args)
for _key, _val in kwargs:
a... | [
"Return",
"a",
"function",
"that",
"executes",
"the",
"arguments",
"passed",
"via",
"the",
"local",
"client"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L1960-L1973 | [
"def",
"run_key",
"(",
"self",
",",
"key",
")",
":",
"def",
"func",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"'''\n Run a remote call\n '''",
"args",
"=",
"list",
"(",
"args",
")",
"for",
"_key",
",",
"_val",
"in",
"kwar... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Caller.cmd | Call an execution module with the given arguments and keyword arguments
.. versionchanged:: 2015.8.0
Added the ``cmd`` method for consistency with the other Salt clients.
The existing ``function`` and ``sminion.functions`` interfaces still
exist but have been removed from th... | salt/client/__init__.py | def cmd(self, fun, *args, **kwargs):
'''
Call an execution module with the given arguments and keyword arguments
.. versionchanged:: 2015.8.0
Added the ``cmd`` method for consistency with the other Salt clients.
The existing ``function`` and ``sminion.functions`` interfa... | def cmd(self, fun, *args, **kwargs):
'''
Call an execution module with the given arguments and keyword arguments
.. versionchanged:: 2015.8.0
Added the ``cmd`` method for consistency with the other Salt clients.
The existing ``function`` and ``sminion.functions`` interfa... | [
"Call",
"an",
"execution",
"module",
"with",
"the",
"given",
"arguments",
"and",
"keyword",
"arguments"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L2024-L2040 | [
"def",
"cmd",
"(",
"self",
",",
"fun",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"sminion",
".",
"functions",
"[",
"fun",
"]",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Caller.function | Call a single salt function | salt/client/__init__.py | def function(self, fun, *args, **kwargs):
'''
Call a single salt function
'''
func = self.sminion.functions[fun]
args, kwargs = salt.minion.load_args_and_kwargs(
func,
salt.utils.args.parse_input(args, kwargs=kwargs),)
return func(*args, **kwargs) | def function(self, fun, *args, **kwargs):
'''
Call a single salt function
'''
func = self.sminion.functions[fun]
args, kwargs = salt.minion.load_args_and_kwargs(
func,
salt.utils.args.parse_input(args, kwargs=kwargs),)
return func(*args, **kwargs) | [
"Call",
"a",
"single",
"salt",
"function"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L2042-L2050 | [
"def",
"function",
"(",
"self",
",",
"fun",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"func",
"=",
"self",
".",
"sminion",
".",
"functions",
"[",
"fun",
"]",
"args",
",",
"kwargs",
"=",
"salt",
".",
"minion",
".",
"load_args_and_kwargs",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | ProxyCaller.cmd | Call an execution module with the given arguments and keyword arguments
.. code-block:: python
caller.cmd('test.arg', 'Foo', 'Bar', baz='Baz')
caller.cmd('event.send', 'myco/myevent/something',
data={'foo': 'Foo'}, with_env=['GIT_COMMIT'], with_grains=True) | salt/client/__init__.py | def cmd(self, fun, *args, **kwargs):
'''
Call an execution module with the given arguments and keyword arguments
.. code-block:: python
caller.cmd('test.arg', 'Foo', 'Bar', baz='Baz')
caller.cmd('event.send', 'myco/myevent/something',
data={'foo': 'Foo'... | def cmd(self, fun, *args, **kwargs):
'''
Call an execution module with the given arguments and keyword arguments
.. code-block:: python
caller.cmd('test.arg', 'Foo', 'Bar', baz='Baz')
caller.cmd('event.send', 'myco/myevent/something',
data={'foo': 'Foo'... | [
"Call",
"an",
"execution",
"module",
"with",
"the",
"given",
"arguments",
"and",
"keyword",
"arguments"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/__init__.py#L2097-L2125 | [
"def",
"cmd",
"(",
"self",
",",
"fun",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"func",
"=",
"self",
".",
"sminion",
".",
"functions",
"[",
"fun",
"]",
"data",
"=",
"{",
"'arg'",
":",
"args",
",",
"'fun'",
":",
"fun",
"}",
"data",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _get_wmi_setting | Get the value of the setting for the provided class. | salt/modules/win_smtp_server.py | def _get_wmi_setting(wmi_class_name, setting, server):
'''
Get the value of the setting for the provided class.
'''
with salt.utils.winapi.Com():
try:
connection = wmi.WMI(namespace=_WMI_NAMESPACE)
wmi_class = getattr(connection, wmi_class_name)
objs = wmi_cl... | def _get_wmi_setting(wmi_class_name, setting, server):
'''
Get the value of the setting for the provided class.
'''
with salt.utils.winapi.Com():
try:
connection = wmi.WMI(namespace=_WMI_NAMESPACE)
wmi_class = getattr(connection, wmi_class_name)
objs = wmi_cl... | [
"Get",
"the",
"value",
"of",
"the",
"setting",
"for",
"the",
"provided",
"class",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_smtp_server.py#L58-L73 | [
"def",
"_get_wmi_setting",
"(",
"wmi_class_name",
",",
"setting",
",",
"server",
")",
":",
"with",
"salt",
".",
"utils",
".",
"winapi",
".",
"Com",
"(",
")",
":",
"try",
":",
"connection",
"=",
"wmi",
".",
"WMI",
"(",
"namespace",
"=",
"_WMI_NAMESPACE",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _set_wmi_setting | Set the value of the setting for the provided class. | salt/modules/win_smtp_server.py | def _set_wmi_setting(wmi_class_name, setting, value, server):
'''
Set the value of the setting for the provided class.
'''
with salt.utils.winapi.Com():
try:
connection = wmi.WMI(namespace=_WMI_NAMESPACE)
wmi_class = getattr(connection, wmi_class_name)
objs =... | def _set_wmi_setting(wmi_class_name, setting, value, server):
'''
Set the value of the setting for the provided class.
'''
with salt.utils.winapi.Com():
try:
connection = wmi.WMI(namespace=_WMI_NAMESPACE)
wmi_class = getattr(connection, wmi_class_name)
objs =... | [
"Set",
"the",
"value",
"of",
"the",
"setting",
"for",
"the",
"provided",
"class",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_smtp_server.py#L76-L98 | [
"def",
"_set_wmi_setting",
"(",
"wmi_class_name",
",",
"setting",
",",
"value",
",",
"server",
")",
":",
"with",
"salt",
".",
"utils",
".",
"winapi",
".",
"Com",
"(",
")",
":",
"try",
":",
"connection",
"=",
"wmi",
".",
"WMI",
"(",
"namespace",
"=",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_log_format_types | Get all available log format names and ids.
:return: A dictionary of the log format names and ids.
:rtype: dict
CLI Example:
.. code-block:: bash
salt '*' win_smtp_server.get_log_format_types | salt/modules/win_smtp_server.py | def get_log_format_types():
'''
Get all available log format names and ids.
:return: A dictionary of the log format names and ids.
:rtype: dict
CLI Example:
.. code-block:: bash
salt '*' win_smtp_server.get_log_format_types
'''
ret = dict()
prefix = 'logging/'
with s... | def get_log_format_types():
'''
Get all available log format names and ids.
:return: A dictionary of the log format names and ids.
:rtype: dict
CLI Example:
.. code-block:: bash
salt '*' win_smtp_server.get_log_format_types
'''
ret = dict()
prefix = 'logging/'
with s... | [
"Get",
"all",
"available",
"log",
"format",
"names",
"and",
"ids",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_smtp_server.py#L119-L151 | [
"def",
"get_log_format_types",
"(",
")",
":",
"ret",
"=",
"dict",
"(",
")",
"prefix",
"=",
"'logging/'",
"with",
"salt",
".",
"utils",
".",
"winapi",
".",
"Com",
"(",
")",
":",
"try",
":",
"connection",
"=",
"wmi",
".",
"WMI",
"(",
"namespace",
"=",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_servers | Get the SMTP virtual server names.
:return: A list of the SMTP virtual servers.
:rtype: list
CLI Example:
.. code-block:: bash
salt '*' win_smtp_server.get_servers | salt/modules/win_smtp_server.py | def get_servers():
'''
Get the SMTP virtual server names.
:return: A list of the SMTP virtual servers.
:rtype: list
CLI Example:
.. code-block:: bash
salt '*' win_smtp_server.get_servers
'''
ret = list()
with salt.utils.winapi.Com():
try:
connection =... | def get_servers():
'''
Get the SMTP virtual server names.
:return: A list of the SMTP virtual servers.
:rtype: list
CLI Example:
.. code-block:: bash
salt '*' win_smtp_server.get_servers
'''
ret = list()
with salt.utils.winapi.Com():
try:
connection =... | [
"Get",
"the",
"SMTP",
"virtual",
"server",
"names",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_smtp_server.py#L154-L182 | [
"def",
"get_servers",
"(",
")",
":",
"ret",
"=",
"list",
"(",
")",
"with",
"salt",
".",
"utils",
".",
"winapi",
".",
"Com",
"(",
")",
":",
"try",
":",
"connection",
"=",
"wmi",
".",
"WMI",
"(",
"namespace",
"=",
"_WMI_NAMESPACE",
")",
"objs",
"=",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_server_setting | Get the value of the setting for the SMTP virtual server.
:param str settings: A list of the setting names.
:param str server: The SMTP server name.
:return: A dictionary of the provided settings and their values.
:rtype: dict
CLI Example:
.. code-block:: bash
salt '*' win_smtp_serv... | salt/modules/win_smtp_server.py | def get_server_setting(settings, server=_DEFAULT_SERVER):
'''
Get the value of the setting for the SMTP virtual server.
:param str settings: A list of the setting names.
:param str server: The SMTP server name.
:return: A dictionary of the provided settings and their values.
:rtype: dict
... | def get_server_setting(settings, server=_DEFAULT_SERVER):
'''
Get the value of the setting for the SMTP virtual server.
:param str settings: A list of the setting names.
:param str server: The SMTP server name.
:return: A dictionary of the provided settings and their values.
:rtype: dict
... | [
"Get",
"the",
"value",
"of",
"the",
"setting",
"for",
"the",
"SMTP",
"virtual",
"server",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_smtp_server.py#L185-L218 | [
"def",
"get_server_setting",
"(",
"settings",
",",
"server",
"=",
"_DEFAULT_SERVER",
")",
":",
"ret",
"=",
"dict",
"(",
")",
"if",
"not",
"settings",
":",
"_LOG",
".",
"warning",
"(",
"'No settings provided.'",
")",
"return",
"ret",
"with",
"salt",
".",
"u... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | set_server_setting | Set the value of the setting for the SMTP virtual server.
.. note::
The setting names are case-sensitive.
:param str settings: A dictionary of the setting names and their values.
:param str server: The SMTP server name.
:return: A boolean representing whether all changes succeeded.
:rtyp... | salt/modules/win_smtp_server.py | def set_server_setting(settings, server=_DEFAULT_SERVER):
'''
Set the value of the setting for the SMTP virtual server.
.. note::
The setting names are case-sensitive.
:param str settings: A dictionary of the setting names and their values.
:param str server: The SMTP server name.
:r... | def set_server_setting(settings, server=_DEFAULT_SERVER):
'''
Set the value of the setting for the SMTP virtual server.
.. note::
The setting names are case-sensitive.
:param str settings: A dictionary of the setting names and their values.
:param str server: The SMTP server name.
:r... | [
"Set",
"the",
"value",
"of",
"the",
"setting",
"for",
"the",
"SMTP",
"virtual",
"server",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_smtp_server.py#L221-L289 | [
"def",
"set_server_setting",
"(",
"settings",
",",
"server",
"=",
"_DEFAULT_SERVER",
")",
":",
"if",
"not",
"settings",
":",
"_LOG",
".",
"warning",
"(",
"'No settings provided'",
")",
"return",
"False",
"# Some fields are formatted like '{data}'. Salt tries to convert th... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_log_format | Get the active log format for the SMTP virtual server.
:param str server: The SMTP server name.
:return: A string of the log format name.
:rtype: str
CLI Example:
.. code-block:: bash
salt '*' win_smtp_server.get_log_format | salt/modules/win_smtp_server.py | def get_log_format(server=_DEFAULT_SERVER):
'''
Get the active log format for the SMTP virtual server.
:param str server: The SMTP server name.
:return: A string of the log format name.
:rtype: str
CLI Example:
.. code-block:: bash
salt '*' win_smtp_server.get_log_format
'''... | def get_log_format(server=_DEFAULT_SERVER):
'''
Get the active log format for the SMTP virtual server.
:param str server: The SMTP server name.
:return: A string of the log format name.
:rtype: str
CLI Example:
.. code-block:: bash
salt '*' win_smtp_server.get_log_format
'''... | [
"Get",
"the",
"active",
"log",
"format",
"for",
"the",
"SMTP",
"virtual",
"server",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_smtp_server.py#L292-L316 | [
"def",
"get_log_format",
"(",
"server",
"=",
"_DEFAULT_SERVER",
")",
":",
"log_format_types",
"=",
"get_log_format_types",
"(",
")",
"format_id",
"=",
"_get_wmi_setting",
"(",
"'IIsSmtpServerSetting'",
",",
"'LogPluginClsid'",
",",
"server",
")",
"# Since IIsSmtpServerS... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | set_log_format | Set the active log format for the SMTP virtual server.
:param str log_format: The log format name.
:param str server: The SMTP server name.
:return: A boolean representing whether the change succeeded.
:rtype: bool
CLI Example:
.. code-block:: bash
salt '*' win_smtp_server.set_log_f... | salt/modules/win_smtp_server.py | def set_log_format(log_format, server=_DEFAULT_SERVER):
'''
Set the active log format for the SMTP virtual server.
:param str log_format: The log format name.
:param str server: The SMTP server name.
:return: A boolean representing whether the change succeeded.
:rtype: bool
CLI Example:
... | def set_log_format(log_format, server=_DEFAULT_SERVER):
'''
Set the active log format for the SMTP virtual server.
:param str log_format: The log format name.
:param str server: The SMTP server name.
:return: A boolean representing whether the change succeeded.
:rtype: bool
CLI Example:
... | [
"Set",
"the",
"active",
"log",
"format",
"for",
"the",
"SMTP",
"virtual",
"server",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_smtp_server.py#L319-L361 | [
"def",
"set_log_format",
"(",
"log_format",
",",
"server",
"=",
"_DEFAULT_SERVER",
")",
":",
"setting",
"=",
"'LogPluginClsid'",
"log_format_types",
"=",
"get_log_format_types",
"(",
")",
"format_id",
"=",
"log_format_types",
".",
"get",
"(",
"log_format",
",",
"N... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_connection_ip_list | Get the IPGrant list for the SMTP virtual server.
:param bool as_wmi_format: Returns the connection IPs as a list in the format WMI expects.
:param str server: The SMTP server name.
:return: A dictionary of the IP and subnet pairs.
:rtype: dict
CLI Example:
.. code-block:: bash
salt... | salt/modules/win_smtp_server.py | def get_connection_ip_list(as_wmi_format=False, server=_DEFAULT_SERVER):
'''
Get the IPGrant list for the SMTP virtual server.
:param bool as_wmi_format: Returns the connection IPs as a list in the format WMI expects.
:param str server: The SMTP server name.
:return: A dictionary of the IP and sub... | def get_connection_ip_list(as_wmi_format=False, server=_DEFAULT_SERVER):
'''
Get the IPGrant list for the SMTP virtual server.
:param bool as_wmi_format: Returns the connection IPs as a list in the format WMI expects.
:param str server: The SMTP server name.
:return: A dictionary of the IP and sub... | [
"Get",
"the",
"IPGrant",
"list",
"for",
"the",
"SMTP",
"virtual",
"server",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_smtp_server.py#L364-L400 | [
"def",
"get_connection_ip_list",
"(",
"as_wmi_format",
"=",
"False",
",",
"server",
"=",
"_DEFAULT_SERVER",
")",
":",
"ret",
"=",
"dict",
"(",
")",
"setting",
"=",
"'IPGrant'",
"reg_separator",
"=",
"r',\\s*'",
"if",
"as_wmi_format",
":",
"ret",
"=",
"list",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | set_connection_ip_list | Set the IPGrant list for the SMTP virtual server.
:param str addresses: A dictionary of IP + subnet pairs.
:param bool grant_by_default: Whether the addresses should be a blacklist or whitelist.
:param str server: The SMTP server name.
:return: A boolean representing whether the change succeeded.
... | salt/modules/win_smtp_server.py | def set_connection_ip_list(addresses=None, grant_by_default=False, server=_DEFAULT_SERVER):
'''
Set the IPGrant list for the SMTP virtual server.
:param str addresses: A dictionary of IP + subnet pairs.
:param bool grant_by_default: Whether the addresses should be a blacklist or whitelist.
:param s... | def set_connection_ip_list(addresses=None, grant_by_default=False, server=_DEFAULT_SERVER):
'''
Set the IPGrant list for the SMTP virtual server.
:param str addresses: A dictionary of IP + subnet pairs.
:param bool grant_by_default: Whether the addresses should be a blacklist or whitelist.
:param s... | [
"Set",
"the",
"IPGrant",
"list",
"for",
"the",
"SMTP",
"virtual",
"server",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_smtp_server.py#L403-L458 | [
"def",
"set_connection_ip_list",
"(",
"addresses",
"=",
"None",
",",
"grant_by_default",
"=",
"False",
",",
"server",
"=",
"_DEFAULT_SERVER",
")",
":",
"setting",
"=",
"'IPGrant'",
"formatted_addresses",
"=",
"list",
"(",
")",
"# It's okay to accept an empty list for ... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_relay_ip_list | Get the RelayIpList list for the SMTP virtual server.
:param str server: The SMTP server name.
:return: A list of the relay IPs.
:rtype: list
.. note::
A return value of None corresponds to the restrictive 'Only the list below' GUI parameter
with an empty access list, and setting an ... | salt/modules/win_smtp_server.py | def get_relay_ip_list(server=_DEFAULT_SERVER):
'''
Get the RelayIpList list for the SMTP virtual server.
:param str server: The SMTP server name.
:return: A list of the relay IPs.
:rtype: list
.. note::
A return value of None corresponds to the restrictive 'Only the list below' GUI p... | def get_relay_ip_list(server=_DEFAULT_SERVER):
'''
Get the RelayIpList list for the SMTP virtual server.
:param str server: The SMTP server name.
:return: A list of the relay IPs.
:rtype: list
.. note::
A return value of None corresponds to the restrictive 'Only the list below' GUI p... | [
"Get",
"the",
"RelayIpList",
"list",
"for",
"the",
"SMTP",
"virtual",
"server",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_smtp_server.py#L461-L501 | [
"def",
"get_relay_ip_list",
"(",
"server",
"=",
"_DEFAULT_SERVER",
")",
":",
"ret",
"=",
"list",
"(",
")",
"setting",
"=",
"'RelayIpList'",
"lines",
"=",
"_get_wmi_setting",
"(",
"'IIsSmtpServerSetting'",
",",
"setting",
",",
"server",
")",
"if",
"not",
"lines... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | set_relay_ip_list | Set the RelayIpList list for the SMTP virtual server.
Due to the unusual way that Windows stores the relay IPs, it is advisable to retrieve
the existing list you wish to set from a pre-configured server.
For example, setting '127.0.0.1' as an allowed relay IP through the GUI would generate
an actual r... | salt/modules/win_smtp_server.py | def set_relay_ip_list(addresses=None, server=_DEFAULT_SERVER):
'''
Set the RelayIpList list for the SMTP virtual server.
Due to the unusual way that Windows stores the relay IPs, it is advisable to retrieve
the existing list you wish to set from a pre-configured server.
For example, setting '127.0... | def set_relay_ip_list(addresses=None, server=_DEFAULT_SERVER):
'''
Set the RelayIpList list for the SMTP virtual server.
Due to the unusual way that Windows stores the relay IPs, it is advisable to retrieve
the existing list you wish to set from a pre-configured server.
For example, setting '127.0... | [
"Set",
"the",
"RelayIpList",
"list",
"for",
"the",
"SMTP",
"virtual",
"server",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_smtp_server.py#L504-L571 | [
"def",
"set_relay_ip_list",
"(",
"addresses",
"=",
"None",
",",
"server",
"=",
"_DEFAULT_SERVER",
")",
":",
"setting",
"=",
"'RelayIpList'",
"formatted_addresses",
"=",
"list",
"(",
")",
"current_addresses",
"=",
"get_relay_ip_list",
"(",
"server",
")",
"if",
"l... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _prepare_connection | Prepare the connection with the remote network device, and clean up the key
value pairs, removing the args used for the connection init. | salt/modules/netmiko_mod.py | def _prepare_connection(**kwargs):
'''
Prepare the connection with the remote network device, and clean up the key
value pairs, removing the args used for the connection init.
'''
init_args = {}
fun_kwargs = {}
netmiko_kwargs = __salt__['config.get']('netmiko', {})
netmiko_kwargs.update(... | def _prepare_connection(**kwargs):
'''
Prepare the connection with the remote network device, and clean up the key
value pairs, removing the args used for the connection init.
'''
init_args = {}
fun_kwargs = {}
netmiko_kwargs = __salt__['config.get']('netmiko', {})
netmiko_kwargs.update(... | [
"Prepare",
"the",
"connection",
"with",
"the",
"remote",
"network",
"device",
"and",
"clean",
"up",
"the",
"key",
"value",
"pairs",
"removing",
"the",
"args",
"used",
"for",
"the",
"connection",
"init",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netmiko_mod.py#L241-L260 | [
"def",
"_prepare_connection",
"(",
"*",
"*",
"kwargs",
")",
":",
"init_args",
"=",
"{",
"}",
"fun_kwargs",
"=",
"{",
"}",
"netmiko_kwargs",
"=",
"__salt__",
"[",
"'config.get'",
"]",
"(",
"'netmiko'",
",",
"{",
"}",
")",
"netmiko_kwargs",
".",
"update",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | multi_call | Invoke multiple Netmiko methods at once, and return their output, as list.
methods
A list of dictionaries with the following keys:
- ``name``: the name of the Netmiko method to be executed.
- ``args``: list of arguments to be sent to the Netmiko method.
- ``kwargs``: dictionary of ... | salt/modules/netmiko_mod.py | def multi_call(*methods, **kwargs):
'''
Invoke multiple Netmiko methods at once, and return their output, as list.
methods
A list of dictionaries with the following keys:
- ``name``: the name of the Netmiko method to be executed.
- ``args``: list of arguments to be sent to the Netm... | def multi_call(*methods, **kwargs):
'''
Invoke multiple Netmiko methods at once, and return their output, as list.
methods
A list of dictionaries with the following keys:
- ``name``: the name of the Netmiko method to be executed.
- ``args``: list of arguments to be sent to the Netm... | [
"Invoke",
"multiple",
"Netmiko",
"methods",
"at",
"once",
"and",
"return",
"their",
"output",
"as",
"list",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netmiko_mod.py#L319-L348 | [
"def",
"multi_call",
"(",
"*",
"methods",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"=",
"clean_kwargs",
"(",
"*",
"*",
"kwargs",
")",
"if",
"'netmiko.conn'",
"in",
"__proxy__",
":",
"conn",
"=",
"__proxy__",
"[",
"'netmiko.conn'",
"]",
"(",
")",
"e... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | send_config | Send configuration commands down the SSH channel.
Return the configuration lines sent to the device.
The function is flexible to send the configuration from a local or remote
file, or simply the commands as list.
config_file
The source file with the configuration commands to be sent to the
... | salt/modules/netmiko_mod.py | def send_config(config_file=None,
config_commands=None,
template_engine='jinja',
commit=False,
context=None,
defaults=None,
saltenv='base',
**kwargs):
'''
Send configuration commands down the SSH chan... | def send_config(config_file=None,
config_commands=None,
template_engine='jinja',
commit=False,
context=None,
defaults=None,
saltenv='base',
**kwargs):
'''
Send configuration commands down the SSH chan... | [
"Send",
"configuration",
"commands",
"down",
"the",
"SSH",
"channel",
".",
"Return",
"the",
"configuration",
"lines",
"sent",
"to",
"the",
"device",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netmiko_mod.py#L474-L583 | [
"def",
"send_config",
"(",
"config_file",
"=",
"None",
",",
"config_commands",
"=",
"None",
",",
"template_engine",
"=",
"'jinja'",
",",
"commit",
"=",
"False",
",",
"context",
"=",
"None",
",",
"defaults",
"=",
"None",
",",
"saltenv",
"=",
"'base'",
",",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | connect | Activate nbd for an image file.
CLI Example:
.. code-block:: bash
salt '*' qemu_nbd.connect /tmp/image.raw | salt/modules/qemu_nbd.py | def connect(image):
'''
Activate nbd for an image file.
CLI Example:
.. code-block:: bash
salt '*' qemu_nbd.connect /tmp/image.raw
'''
if not os.path.isfile(image):
log.warning('Could not connect image: %s does not exist', image)
return ''
if salt.utils.path.which... | def connect(image):
'''
Activate nbd for an image file.
CLI Example:
.. code-block:: bash
salt '*' qemu_nbd.connect /tmp/image.raw
'''
if not os.path.isfile(image):
log.warning('Could not connect image: %s does not exist', image)
return ''
if salt.utils.path.which... | [
"Activate",
"nbd",
"for",
"an",
"image",
"file",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/qemu_nbd.py#L37-L68 | [
"def",
"connect",
"(",
"image",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"isfile",
"(",
"image",
")",
":",
"log",
".",
"warning",
"(",
"'Could not connect image: %s does not exist'",
",",
"image",
")",
"return",
"''",
"if",
"salt",
".",
"utils",
".... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | mount | Pass in the nbd connection device location, mount all partitions and return
a dict of mount points
CLI Example:
.. code-block:: bash
salt '*' qemu_nbd.mount /dev/nbd0 | salt/modules/qemu_nbd.py | def mount(nbd, root=None):
'''
Pass in the nbd connection device location, mount all partitions and return
a dict of mount points
CLI Example:
.. code-block:: bash
salt '*' qemu_nbd.mount /dev/nbd0
'''
__salt__['cmd.run'](
'partprobe {0}'.format(nbd),
pytho... | def mount(nbd, root=None):
'''
Pass in the nbd connection device location, mount all partitions and return
a dict of mount points
CLI Example:
.. code-block:: bash
salt '*' qemu_nbd.mount /dev/nbd0
'''
__salt__['cmd.run'](
'partprobe {0}'.format(nbd),
pytho... | [
"Pass",
"in",
"the",
"nbd",
"connection",
"device",
"location",
"mount",
"all",
"partitions",
"and",
"return",
"a",
"dict",
"of",
"mount",
"points"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/qemu_nbd.py#L71-L100 | [
"def",
"mount",
"(",
"nbd",
",",
"root",
"=",
"None",
")",
":",
"__salt__",
"[",
"'cmd.run'",
"]",
"(",
"'partprobe {0}'",
".",
"format",
"(",
"nbd",
")",
",",
"python_shell",
"=",
"False",
",",
")",
"ret",
"=",
"{",
"}",
"if",
"root",
"is",
"None"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | init | Mount the named image via qemu-nbd and return the mounted roots
CLI Example:
.. code-block:: bash
salt '*' qemu_nbd.init /srv/image.qcow2 | salt/modules/qemu_nbd.py | def init(image, root=None):
'''
Mount the named image via qemu-nbd and return the mounted roots
CLI Example:
.. code-block:: bash
salt '*' qemu_nbd.init /srv/image.qcow2
'''
nbd = connect(image)
if not nbd:
return ''
return mount(nbd, root) | def init(image, root=None):
'''
Mount the named image via qemu-nbd and return the mounted roots
CLI Example:
.. code-block:: bash
salt '*' qemu_nbd.init /srv/image.qcow2
'''
nbd = connect(image)
if not nbd:
return ''
return mount(nbd, root) | [
"Mount",
"the",
"named",
"image",
"via",
"qemu",
"-",
"nbd",
"and",
"return",
"the",
"mounted",
"roots"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/qemu_nbd.py#L103-L116 | [
"def",
"init",
"(",
"image",
",",
"root",
"=",
"None",
")",
":",
"nbd",
"=",
"connect",
"(",
"image",
")",
"if",
"not",
"nbd",
":",
"return",
"''",
"return",
"mount",
"(",
"nbd",
",",
"root",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | clear | Pass in the mnt dict returned from nbd_mount to unmount and disconnect
the image from nbd. If all of the partitions are unmounted return an
empty dict, otherwise return a dict containing the still mounted
partitions
CLI Example:
.. code-block:: bash
salt '*' qemu_nbd.clear '{"/mnt/foo": "... | salt/modules/qemu_nbd.py | def clear(mnt):
'''
Pass in the mnt dict returned from nbd_mount to unmount and disconnect
the image from nbd. If all of the partitions are unmounted return an
empty dict, otherwise return a dict containing the still mounted
partitions
CLI Example:
.. code-block:: bash
salt '*' qe... | def clear(mnt):
'''
Pass in the mnt dict returned from nbd_mount to unmount and disconnect
the image from nbd. If all of the partitions are unmounted return an
empty dict, otherwise return a dict containing the still mounted
partitions
CLI Example:
.. code-block:: bash
salt '*' qe... | [
"Pass",
"in",
"the",
"mnt",
"dict",
"returned",
"from",
"nbd_mount",
"to",
"unmount",
"and",
"disconnect",
"the",
"image",
"from",
"nbd",
".",
"If",
"all",
"of",
"the",
"partitions",
"are",
"unmounted",
"return",
"an",
"empty",
"dict",
"otherwise",
"return",... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/qemu_nbd.py#L119-L143 | [
"def",
"clear",
"(",
"mnt",
")",
":",
"ret",
"=",
"{",
"}",
"nbds",
"=",
"set",
"(",
")",
"for",
"m_pt",
",",
"dev",
"in",
"six",
".",
"iteritems",
"(",
"mnt",
")",
":",
"mnt_ret",
"=",
"__salt__",
"[",
"'mount.umount'",
"]",
"(",
"m_pt",
")",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _handle_interrupt | if hardfailing:
If we got the original stacktrace, log it
If all cases, raise the original exception
but this is logically part the initial
stack.
else just let salt exit gracefully | salt/scripts.py | def _handle_interrupt(exc, original_exc, hardfail=False, trace=''):
'''
if hardfailing:
If we got the original stacktrace, log it
If all cases, raise the original exception
but this is logically part the initial
stack.
else just let salt exit gracefully
'''
if hardfa... | def _handle_interrupt(exc, original_exc, hardfail=False, trace=''):
'''
if hardfailing:
If we got the original stacktrace, log it
If all cases, raise the original exception
but this is logically part the initial
stack.
else just let salt exit gracefully
'''
if hardfa... | [
"if",
"hardfailing",
":",
"If",
"we",
"got",
"the",
"original",
"stacktrace",
"log",
"it",
"If",
"all",
"cases",
"raise",
"the",
"original",
"exception",
"but",
"this",
"is",
"logically",
"part",
"the",
"initial",
"stack",
".",
"else",
"just",
"let",
"salt... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/scripts.py#L28-L43 | [
"def",
"_handle_interrupt",
"(",
"exc",
",",
"original_exc",
",",
"hardfail",
"=",
"False",
",",
"trace",
"=",
"''",
")",
":",
"if",
"hardfail",
":",
"if",
"trace",
":",
"log",
".",
"error",
"(",
"trace",
")",
"raise",
"original_exc",
"else",
":",
"rai... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | salt_master | Start the salt master. | salt/scripts.py | def salt_master():
'''
Start the salt master.
'''
import salt.cli.daemons
# REMOVEME after Python 2.7 support is dropped (also the six import)
if six.PY2:
from salt.utils.versions import warn_until
# Message borrowed from pip's deprecation warning
warn_until('Sodium',
... | def salt_master():
'''
Start the salt master.
'''
import salt.cli.daemons
# REMOVEME after Python 2.7 support is dropped (also the six import)
if six.PY2:
from salt.utils.versions import warn_until
# Message borrowed from pip's deprecation warning
warn_until('Sodium',
... | [
"Start",
"the",
"salt",
"master",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/scripts.py#L100-L116 | [
"def",
"salt_master",
"(",
")",
":",
"import",
"salt",
".",
"cli",
".",
"daemons",
"# REMOVEME after Python 2.7 support is dropped (also the six import)",
"if",
"six",
".",
"PY2",
":",
"from",
"salt",
".",
"utils",
".",
"versions",
"import",
"warn_until",
"# Message... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | minion_process | Start a minion process | salt/scripts.py | def minion_process():
'''
Start a minion process
'''
import salt.utils.platform
import salt.utils.process
import salt.cli.daemons
# salt_minion spawns this function in a new process
salt.utils.process.appendproctitle('KeepAlive')
def handle_hup(manager, sig, frame):
manage... | def minion_process():
'''
Start a minion process
'''
import salt.utils.platform
import salt.utils.process
import salt.cli.daemons
# salt_minion spawns this function in a new process
salt.utils.process.appendproctitle('KeepAlive')
def handle_hup(manager, sig, frame):
manage... | [
"Start",
"a",
"minion",
"process"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/scripts.py#L119-L178 | [
"def",
"minion_process",
"(",
")",
":",
"import",
"salt",
".",
"utils",
".",
"platform",
"import",
"salt",
".",
"utils",
".",
"process",
"import",
"salt",
".",
"cli",
".",
"daemons",
"# salt_minion spawns this function in a new process",
"salt",
".",
"utils",
".... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | salt_minion | Start the salt minion in a subprocess.
Auto restart minion on error. | salt/scripts.py | def salt_minion():
'''
Start the salt minion in a subprocess.
Auto restart minion on error.
'''
import signal
import salt.utils.platform
import salt.utils.process
salt.utils.process.notify_systemd()
import salt.cli.daemons
import multiprocessing
if '' in sys.path:
s... | def salt_minion():
'''
Start the salt minion in a subprocess.
Auto restart minion on error.
'''
import signal
import salt.utils.platform
import salt.utils.process
salt.utils.process.notify_systemd()
import salt.cli.daemons
import multiprocessing
if '' in sys.path:
s... | [
"Start",
"the",
"salt",
"minion",
"in",
"a",
"subprocess",
".",
"Auto",
"restart",
"minion",
"on",
"error",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/scripts.py#L181-L266 | [
"def",
"salt_minion",
"(",
")",
":",
"import",
"signal",
"import",
"salt",
".",
"utils",
".",
"platform",
"import",
"salt",
".",
"utils",
".",
"process",
"salt",
".",
"utils",
".",
"process",
".",
"notify_systemd",
"(",
")",
"import",
"salt",
".",
"cli",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | proxy_minion_process | Start a proxy minion process | salt/scripts.py | def proxy_minion_process(queue):
'''
Start a proxy minion process
'''
import salt.cli.daemons
import salt.utils.platform
# salt_minion spawns this function in a new process
lock = threading.RLock()
def suicide_when_without_parent(parent_pid):
'''
Have the minion suicide... | def proxy_minion_process(queue):
'''
Start a proxy minion process
'''
import salt.cli.daemons
import salt.utils.platform
# salt_minion spawns this function in a new process
lock = threading.RLock()
def suicide_when_without_parent(parent_pid):
'''
Have the minion suicide... | [
"Start",
"a",
"proxy",
"minion",
"process"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/scripts.py#L269-L330 | [
"def",
"proxy_minion_process",
"(",
"queue",
")",
":",
"import",
"salt",
".",
"cli",
".",
"daemons",
"import",
"salt",
".",
"utils",
".",
"platform",
"# salt_minion spawns this function in a new process",
"lock",
"=",
"threading",
".",
"RLock",
"(",
")",
"def",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | salt_proxy | Start a proxy minion. | salt/scripts.py | def salt_proxy():
'''
Start a proxy minion.
'''
import salt.cli.daemons
import salt.utils.platform
import multiprocessing
if '' in sys.path:
sys.path.remove('')
if salt.utils.platform.is_windows():
proxyminion = salt.cli.daemons.ProxyMinion()
proxyminion.start()
... | def salt_proxy():
'''
Start a proxy minion.
'''
import salt.cli.daemons
import salt.utils.platform
import multiprocessing
if '' in sys.path:
sys.path.remove('')
if salt.utils.platform.is_windows():
proxyminion = salt.cli.daemons.ProxyMinion()
proxyminion.start()
... | [
"Start",
"a",
"proxy",
"minion",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/scripts.py#L333-L386 | [
"def",
"salt_proxy",
"(",
")",
":",
"import",
"salt",
".",
"cli",
".",
"daemons",
"import",
"salt",
".",
"utils",
".",
"platform",
"import",
"multiprocessing",
"if",
"''",
"in",
"sys",
".",
"path",
":",
"sys",
".",
"path",
".",
"remove",
"(",
"''",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | salt_syndic | Start the salt syndic. | salt/scripts.py | def salt_syndic():
'''
Start the salt syndic.
'''
import salt.utils.process
salt.utils.process.notify_systemd()
import salt.cli.daemons
pid = os.getpid()
try:
syndic = salt.cli.daemons.Syndic()
syndic.start()
except KeyboardInterrupt:
os.kill(pid, 15) | def salt_syndic():
'''
Start the salt syndic.
'''
import salt.utils.process
salt.utils.process.notify_systemd()
import salt.cli.daemons
pid = os.getpid()
try:
syndic = salt.cli.daemons.Syndic()
syndic.start()
except KeyboardInterrupt:
os.kill(pid, 15) | [
"Start",
"the",
"salt",
"syndic",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/scripts.py#L389-L402 | [
"def",
"salt_syndic",
"(",
")",
":",
"import",
"salt",
".",
"utils",
".",
"process",
"salt",
".",
"utils",
".",
"process",
".",
"notify_systemd",
"(",
")",
"import",
"salt",
".",
"cli",
".",
"daemons",
"pid",
"=",
"os",
".",
"getpid",
"(",
")",
"try"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | salt_key | Manage the authentication keys with salt-key. | salt/scripts.py | def salt_key():
'''
Manage the authentication keys with salt-key.
'''
import salt.cli.key
try:
client = salt.cli.key.SaltKey()
_install_signal_handlers(client)
client.run()
except Exception as err:
sys.stderr.write("Error: {0}\n".format(err)) | def salt_key():
'''
Manage the authentication keys with salt-key.
'''
import salt.cli.key
try:
client = salt.cli.key.SaltKey()
_install_signal_handlers(client)
client.run()
except Exception as err:
sys.stderr.write("Error: {0}\n".format(err)) | [
"Manage",
"the",
"authentication",
"keys",
"with",
"salt",
"-",
"key",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/scripts.py#L405-L415 | [
"def",
"salt_key",
"(",
")",
":",
"import",
"salt",
".",
"cli",
".",
"key",
"try",
":",
"client",
"=",
"salt",
".",
"cli",
".",
"key",
".",
"SaltKey",
"(",
")",
"_install_signal_handlers",
"(",
"client",
")",
"client",
".",
"run",
"(",
")",
"except",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | salt_cp | Publish commands to the salt system from the command line on the
master. | salt/scripts.py | def salt_cp():
'''
Publish commands to the salt system from the command line on the
master.
'''
import salt.cli.cp
client = salt.cli.cp.SaltCPCli()
_install_signal_handlers(client)
client.run() | def salt_cp():
'''
Publish commands to the salt system from the command line on the
master.
'''
import salt.cli.cp
client = salt.cli.cp.SaltCPCli()
_install_signal_handlers(client)
client.run() | [
"Publish",
"commands",
"to",
"the",
"salt",
"system",
"from",
"the",
"command",
"line",
"on",
"the",
"master",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/scripts.py#L418-L426 | [
"def",
"salt_cp",
"(",
")",
":",
"import",
"salt",
".",
"cli",
".",
"cp",
"client",
"=",
"salt",
".",
"cli",
".",
"cp",
".",
"SaltCPCli",
"(",
")",
"_install_signal_handlers",
"(",
"client",
")",
"client",
".",
"run",
"(",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | salt_call | Directly call a salt command in the modules, does not require a running
salt minion to run. | salt/scripts.py | def salt_call():
'''
Directly call a salt command in the modules, does not require a running
salt minion to run.
'''
import salt.cli.call
if '' in sys.path:
sys.path.remove('')
client = salt.cli.call.SaltCall()
_install_signal_handlers(client)
client.run() | def salt_call():
'''
Directly call a salt command in the modules, does not require a running
salt minion to run.
'''
import salt.cli.call
if '' in sys.path:
sys.path.remove('')
client = salt.cli.call.SaltCall()
_install_signal_handlers(client)
client.run() | [
"Directly",
"call",
"a",
"salt",
"command",
"in",
"the",
"modules",
"does",
"not",
"require",
"a",
"running",
"salt",
"minion",
"to",
"run",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/scripts.py#L429-L439 | [
"def",
"salt_call",
"(",
")",
":",
"import",
"salt",
".",
"cli",
".",
"call",
"if",
"''",
"in",
"sys",
".",
"path",
":",
"sys",
".",
"path",
".",
"remove",
"(",
"''",
")",
"client",
"=",
"salt",
".",
"cli",
".",
"call",
".",
"SaltCall",
"(",
")... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | salt_run | Execute a salt convenience routine. | salt/scripts.py | def salt_run():
'''
Execute a salt convenience routine.
'''
import salt.cli.run
if '' in sys.path:
sys.path.remove('')
client = salt.cli.run.SaltRun()
_install_signal_handlers(client)
client.run() | def salt_run():
'''
Execute a salt convenience routine.
'''
import salt.cli.run
if '' in sys.path:
sys.path.remove('')
client = salt.cli.run.SaltRun()
_install_signal_handlers(client)
client.run() | [
"Execute",
"a",
"salt",
"convenience",
"routine",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/scripts.py#L442-L451 | [
"def",
"salt_run",
"(",
")",
":",
"import",
"salt",
".",
"cli",
".",
"run",
"if",
"''",
"in",
"sys",
".",
"path",
":",
"sys",
".",
"path",
".",
"remove",
"(",
"''",
")",
"client",
"=",
"salt",
".",
"cli",
".",
"run",
".",
"SaltRun",
"(",
")",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | salt_ssh | Execute the salt-ssh system | salt/scripts.py | def salt_ssh():
'''
Execute the salt-ssh system
'''
import salt.cli.ssh
if '' in sys.path:
sys.path.remove('')
try:
client = salt.cli.ssh.SaltSSH()
_install_signal_handlers(client)
client.run()
except SaltClientError as err:
trace = traceback.format_ex... | def salt_ssh():
'''
Execute the salt-ssh system
'''
import salt.cli.ssh
if '' in sys.path:
sys.path.remove('')
try:
client = salt.cli.ssh.SaltSSH()
_install_signal_handlers(client)
client.run()
except SaltClientError as err:
trace = traceback.format_ex... | [
"Execute",
"the",
"salt",
"-",
"ssh",
"system"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/scripts.py#L454-L474 | [
"def",
"salt_ssh",
"(",
")",
":",
"import",
"salt",
".",
"cli",
".",
"ssh",
"if",
"''",
"in",
"sys",
".",
"path",
":",
"sys",
".",
"path",
".",
"remove",
"(",
"''",
")",
"try",
":",
"client",
"=",
"salt",
".",
"cli",
".",
"ssh",
".",
"SaltSSH",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | salt_cloud | The main function for salt-cloud | salt/scripts.py | def salt_cloud():
'''
The main function for salt-cloud
'''
# Define 'salt' global so we may use it after ImportError. Otherwise,
# UnboundLocalError will be raised.
global salt # pylint: disable=W0602
try:
# Late-imports for CLI performance
import salt.cloud
import ... | def salt_cloud():
'''
The main function for salt-cloud
'''
# Define 'salt' global so we may use it after ImportError. Otherwise,
# UnboundLocalError will be raised.
global salt # pylint: disable=W0602
try:
# Late-imports for CLI performance
import salt.cloud
import ... | [
"The",
"main",
"function",
"for",
"salt",
"-",
"cloud"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/scripts.py#L477-L499 | [
"def",
"salt_cloud",
"(",
")",
":",
"# Define 'salt' global so we may use it after ImportError. Otherwise,",
"# UnboundLocalError will be raised.",
"global",
"salt",
"# pylint: disable=W0602",
"try",
":",
"# Late-imports for CLI performance",
"import",
"salt",
".",
"cloud",
"import... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.