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 | managed | Manages the configuration of the users on the device, as specified in the state SLS file. Users not defined in that
file will be remove whilst users not configured on the device, will be added.
SLS Example:
.. code-block:: yaml
netusers_example:
netusers.managed:
- us... | salt/states/netusers.py | def managed(name, users=None, defaults=None):
'''
Manages the configuration of the users on the device, as specified in the state SLS file. Users not defined in that
file will be remove whilst users not configured on the device, will be added.
SLS Example:
.. code-block:: yaml
netusers_e... | def managed(name, users=None, defaults=None):
'''
Manages the configuration of the users on the device, as specified in the state SLS file. Users not defined in that
file will be remove whilst users not configured on the device, will be added.
SLS Example:
.. code-block:: yaml
netusers_e... | [
"Manages",
"the",
"configuration",
"of",
"the",
"users",
"on",
"the",
"device",
"as",
"specified",
"in",
"the",
"state",
"SLS",
"file",
".",
"Users",
"not",
"defined",
"in",
"that",
"file",
"will",
"be",
"remove",
"whilst",
"users",
"not",
"configured",
"o... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/netusers.py#L169-L443 | [
"def",
"managed",
"(",
"name",
",",
"users",
"=",
"None",
",",
"defaults",
"=",
"None",
")",
":",
"result",
"=",
"False",
"comment",
"=",
"''",
"changes",
"=",
"{",
"}",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"changes",
",",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | SynchronizingWebsocket.received_message | Checks if the client has sent a ready message.
A ready message causes ``send()`` to be called on the
``parent end`` of the pipe.
Clients need to ensure that the pipe assigned to ``self.pipe`` is
the ``parent end`` of a pipe.
This ensures completion of the underlying websocket c... | salt/netapi/rest_cherrypy/tools/websockets.py | def received_message(self, message):
'''
Checks if the client has sent a ready message.
A ready message causes ``send()`` to be called on the
``parent end`` of the pipe.
Clients need to ensure that the pipe assigned to ``self.pipe`` is
the ``parent end`` of a pipe.
... | def received_message(self, message):
'''
Checks if the client has sent a ready message.
A ready message causes ``send()`` to be called on the
``parent end`` of the pipe.
Clients need to ensure that the pipe assigned to ``self.pipe`` is
the ``parent end`` of a pipe.
... | [
"Checks",
"if",
"the",
"client",
"has",
"sent",
"a",
"ready",
"message",
".",
"A",
"ready",
"message",
"causes",
"send",
"()",
"to",
"be",
"called",
"on",
"the",
"parent",
"end",
"of",
"the",
"pipe",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_cherrypy/tools/websockets.py#L45-L59 | [
"def",
"received_message",
"(",
"self",
",",
"message",
")",
":",
"if",
"message",
".",
"data",
".",
"decode",
"(",
"'utf-8'",
")",
"==",
"'websocket client ready'",
":",
"self",
".",
"pipe",
".",
"send",
"(",
"message",
")",
"self",
".",
"send",
"(",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | cli_info | Prints an info on CLI with the title.
Useful for infos, general errors etc.
:param data:
:param title:
:return: | salt/utils/text.py | def cli_info(data, title='Info'):
'''
Prints an info on CLI with the title.
Useful for infos, general errors etc.
:param data:
:param title:
:return:
'''
wrapper = textwrap.TextWrapper()
wrapper.initial_indent = ' ' * 4
wrapper.subsequent_indent = wrapper.initial_indent
re... | def cli_info(data, title='Info'):
'''
Prints an info on CLI with the title.
Useful for infos, general errors etc.
:param data:
:param title:
:return:
'''
wrapper = textwrap.TextWrapper()
wrapper.initial_indent = ' ' * 4
wrapper.subsequent_indent = wrapper.initial_indent
re... | [
"Prints",
"an",
"info",
"on",
"CLI",
"with",
"the",
"title",
".",
"Useful",
"for",
"infos",
"general",
"errors",
"etc",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/text.py#L9-L23 | [
"def",
"cli_info",
"(",
"data",
",",
"title",
"=",
"'Info'",
")",
":",
"wrapper",
"=",
"textwrap",
".",
"TextWrapper",
"(",
")",
"wrapper",
".",
"initial_indent",
"=",
"' '",
"*",
"4",
"wrapper",
".",
"subsequent_indent",
"=",
"wrapper",
".",
"initial_inde... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_users | List users belonging to this account
CLI Example:
salt myminion pagerduty.get_users | salt/modules/pagerduty_util.py | def get_users(profile='pagerduty', subdomain=None, api_key=None):
'''
List users belonging to this account
CLI Example:
salt myminion pagerduty.get_users
'''
return _list_items(
'users',
'id',
profile=profile,
subdomain=subdomain,
api_key=api_key,
... | def get_users(profile='pagerduty', subdomain=None, api_key=None):
'''
List users belonging to this account
CLI Example:
salt myminion pagerduty.get_users
'''
return _list_items(
'users',
'id',
profile=profile,
subdomain=subdomain,
api_key=api_key,
... | [
"List",
"users",
"belonging",
"to",
"this",
"account"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pagerduty_util.py#L34-L49 | [
"def",
"get_users",
"(",
"profile",
"=",
"'pagerduty'",
",",
"subdomain",
"=",
"None",
",",
"api_key",
"=",
"None",
")",
":",
"return",
"_list_items",
"(",
"'users'",
",",
"'id'",
",",
"profile",
"=",
"profile",
",",
"subdomain",
"=",
"subdomain",
",",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_services | List services belonging to this account
CLI Example:
salt myminion pagerduty.get_services | salt/modules/pagerduty_util.py | def get_services(profile='pagerduty', subdomain=None, api_key=None):
'''
List services belonging to this account
CLI Example:
salt myminion pagerduty.get_services
'''
return _list_items(
'services',
'id',
profile=profile,
subdomain=subdomain,
api_ke... | def get_services(profile='pagerduty', subdomain=None, api_key=None):
'''
List services belonging to this account
CLI Example:
salt myminion pagerduty.get_services
'''
return _list_items(
'services',
'id',
profile=profile,
subdomain=subdomain,
api_ke... | [
"List",
"services",
"belonging",
"to",
"this",
"account"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pagerduty_util.py#L52-L67 | [
"def",
"get_services",
"(",
"profile",
"=",
"'pagerduty'",
",",
"subdomain",
"=",
"None",
",",
"api_key",
"=",
"None",
")",
":",
"return",
"_list_items",
"(",
"'services'",
",",
"'id'",
",",
"profile",
"=",
"profile",
",",
"subdomain",
"=",
"subdomain",
",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_schedules | List schedules belonging to this account
CLI Example:
salt myminion pagerduty.get_schedules | salt/modules/pagerduty_util.py | def get_schedules(profile='pagerduty', subdomain=None, api_key=None):
'''
List schedules belonging to this account
CLI Example:
salt myminion pagerduty.get_schedules
'''
return _list_items(
'schedules',
'id',
profile=profile,
subdomain=subdomain,
ap... | def get_schedules(profile='pagerduty', subdomain=None, api_key=None):
'''
List schedules belonging to this account
CLI Example:
salt myminion pagerduty.get_schedules
'''
return _list_items(
'schedules',
'id',
profile=profile,
subdomain=subdomain,
ap... | [
"List",
"schedules",
"belonging",
"to",
"this",
"account"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pagerduty_util.py#L70-L85 | [
"def",
"get_schedules",
"(",
"profile",
"=",
"'pagerduty'",
",",
"subdomain",
"=",
"None",
",",
"api_key",
"=",
"None",
")",
":",
"return",
"_list_items",
"(",
"'schedules'",
",",
"'id'",
",",
"profile",
"=",
"profile",
",",
"subdomain",
"=",
"subdomain",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_escalation_policies | List escalation_policies belonging to this account
CLI Example:
salt myminion pagerduty.get_escalation_policies | salt/modules/pagerduty_util.py | def get_escalation_policies(profile='pagerduty', subdomain=None, api_key=None):
'''
List escalation_policies belonging to this account
CLI Example:
salt myminion pagerduty.get_escalation_policies
'''
return _list_items(
'escalation_policies',
'id',
profile=profile,... | def get_escalation_policies(profile='pagerduty', subdomain=None, api_key=None):
'''
List escalation_policies belonging to this account
CLI Example:
salt myminion pagerduty.get_escalation_policies
'''
return _list_items(
'escalation_policies',
'id',
profile=profile,... | [
"List",
"escalation_policies",
"belonging",
"to",
"this",
"account"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pagerduty_util.py#L88-L103 | [
"def",
"get_escalation_policies",
"(",
"profile",
"=",
"'pagerduty'",
",",
"subdomain",
"=",
"None",
",",
"api_key",
"=",
"None",
")",
":",
"return",
"_list_items",
"(",
"'escalation_policies'",
",",
"'id'",
",",
"profile",
"=",
"profile",
",",
"subdomain",
"=... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _list_items | List items belonging to an API call.
This method should be in utils.pagerduty. | salt/modules/pagerduty_util.py | def _list_items(action, key, profile=None, subdomain=None, api_key=None):
'''
List items belonging to an API call.
This method should be in utils.pagerduty.
'''
items = _query(
profile=profile,
subdomain=subdomain,
api_key=api_key,
action=action
)
ret = {}
... | def _list_items(action, key, profile=None, subdomain=None, api_key=None):
'''
List items belonging to an API call.
This method should be in utils.pagerduty.
'''
items = _query(
profile=profile,
subdomain=subdomain,
api_key=api_key,
action=action
)
ret = {}
... | [
"List",
"items",
"belonging",
"to",
"an",
"API",
"call",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pagerduty_util.py#L106-L121 | [
"def",
"_list_items",
"(",
"action",
",",
"key",
",",
"profile",
"=",
"None",
",",
"subdomain",
"=",
"None",
",",
"api_key",
"=",
"None",
")",
":",
"items",
"=",
"_query",
"(",
"profile",
"=",
"profile",
",",
"subdomain",
"=",
"subdomain",
",",
"api_ke... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _query | Query the PagerDuty API.
This method should be in utils.pagerduty. | salt/modules/pagerduty_util.py | def _query(method='GET', profile=None, url=None, path='api/v1',
action=None, api_key=None, service=None, params=None,
data=None, subdomain=None, verify_ssl=True):
'''
Query the PagerDuty API.
This method should be in utils.pagerduty.
'''
if profile:
creds = __salt__[... | def _query(method='GET', profile=None, url=None, path='api/v1',
action=None, api_key=None, service=None, params=None,
data=None, subdomain=None, verify_ssl=True):
'''
Query the PagerDuty API.
This method should be in utils.pagerduty.
'''
if profile:
creds = __salt__[... | [
"Query",
"the",
"PagerDuty",
"API",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pagerduty_util.py#L124-L196 | [
"def",
"_query",
"(",
"method",
"=",
"'GET'",
",",
"profile",
"=",
"None",
",",
"url",
"=",
"None",
",",
"path",
"=",
"'api/v1'",
",",
"action",
"=",
"None",
",",
"api_key",
"=",
"None",
",",
"service",
"=",
"None",
",",
"params",
"=",
"None",
",",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_resource | Get any single pagerduty resource by key.
We allow flexible lookup by any of a list of identifier_fields.
So, for example, you can look up users by email address or name by calling:
get_resource('users', key, ['name', 'email'], ...)
This method is mainly used to translate state sls into pager... | salt/modules/pagerduty_util.py | def get_resource(resource_name, key, identifier_fields, profile='pagerduty', subdomain=None, api_key=None):
'''
Get any single pagerduty resource by key.
We allow flexible lookup by any of a list of identifier_fields.
So, for example, you can look up users by email address or name by calling:
... | def get_resource(resource_name, key, identifier_fields, profile='pagerduty', subdomain=None, api_key=None):
'''
Get any single pagerduty resource by key.
We allow flexible lookup by any of a list of identifier_fields.
So, for example, you can look up users by email address or name by calling:
... | [
"Get",
"any",
"single",
"pagerduty",
"resource",
"by",
"key",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pagerduty_util.py#L210-L252 | [
"def",
"get_resource",
"(",
"resource_name",
",",
"key",
",",
"identifier_fields",
",",
"profile",
"=",
"'pagerduty'",
",",
"subdomain",
"=",
"None",
",",
"api_key",
"=",
"None",
")",
":",
"# cache the expensive 'get all resources' calls into __context__ so that we do the... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | create_or_update_resource | create or update any pagerduty resource
Helper method for present().
Determining if two resources are the same is different for different PD resource, so this method accepts a diff function.
The diff function will be invoked as diff(state_information, object_returned_from_pagerduty), and
should return ... | salt/modules/pagerduty_util.py | def create_or_update_resource(resource_name, identifier_fields, data, diff=None, profile='pagerduty', subdomain=None, api_key=None):
'''
create or update any pagerduty resource
Helper method for present().
Determining if two resources are the same is different for different PD resource, so this method ... | def create_or_update_resource(resource_name, identifier_fields, data, diff=None, profile='pagerduty', subdomain=None, api_key=None):
'''
create or update any pagerduty resource
Helper method for present().
Determining if two resources are the same is different for different PD resource, so this method ... | [
"create",
"or",
"update",
"any",
"pagerduty",
"resource",
"Helper",
"method",
"for",
"present",
"()",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pagerduty_util.py#L255-L309 | [
"def",
"create_or_update_resource",
"(",
"resource_name",
",",
"identifier_fields",
",",
"data",
",",
"diff",
"=",
"None",
",",
"profile",
"=",
"'pagerduty'",
",",
"subdomain",
"=",
"None",
",",
"api_key",
"=",
"None",
")",
":",
"# try to locate the resource by an... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | delete_resource | delete any pagerduty resource
Helper method for absent()
example:
delete_resource("users", key, ["id","name","email"]) # delete by id or name or email | salt/modules/pagerduty_util.py | def delete_resource(resource_name, key, identifier_fields, profile='pagerduty', subdomain=None, api_key=None):
'''
delete any pagerduty resource
Helper method for absent()
example:
delete_resource("users", key, ["id","name","email"]) # delete by id or name or email
'''
resource = ... | def delete_resource(resource_name, key, identifier_fields, profile='pagerduty', subdomain=None, api_key=None):
'''
delete any pagerduty resource
Helper method for absent()
example:
delete_resource("users", key, ["id","name","email"]) # delete by id or name or email
'''
resource = ... | [
"delete",
"any",
"pagerduty",
"resource"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pagerduty_util.py#L312-L331 | [
"def",
"delete_resource",
"(",
"resource_name",
",",
"key",
",",
"identifier_fields",
",",
"profile",
"=",
"'pagerduty'",
",",
"subdomain",
"=",
"None",
",",
"api_key",
"=",
"None",
")",
":",
"resource",
"=",
"get_resource",
"(",
"resource_name",
",",
"key",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | resource_present | Generic resource.present state method. Pagerduty state modules should be a thin wrapper over this method,
with a custom diff function.
This method calls create_or_update_resource() and formats the result as a salt state return value.
example:
resource_present("users", ["id","name","email"]) | salt/modules/pagerduty_util.py | def resource_present(resource, identifier_fields, diff=None, profile='pagerduty', subdomain=None, api_key=None, **kwargs):
'''
Generic resource.present state method. Pagerduty state modules should be a thin wrapper over this method,
with a custom diff function.
This method calls create_or_update_reso... | def resource_present(resource, identifier_fields, diff=None, profile='pagerduty', subdomain=None, api_key=None, **kwargs):
'''
Generic resource.present state method. Pagerduty state modules should be a thin wrapper over this method,
with a custom diff function.
This method calls create_or_update_reso... | [
"Generic",
"resource",
".",
"present",
"state",
"method",
".",
"Pagerduty",
"state",
"modules",
"should",
"be",
"a",
"thin",
"wrapper",
"over",
"this",
"method",
"with",
"a",
"custom",
"diff",
"function",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pagerduty_util.py#L334-L368 | [
"def",
"resource_present",
"(",
"resource",
",",
"identifier_fields",
",",
"diff",
"=",
"None",
",",
"profile",
"=",
"'pagerduty'",
",",
"subdomain",
"=",
"None",
",",
"api_key",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | resource_absent | Generic resource.absent state method. Pagerduty state modules should be a thin wrapper over this method,
with a custom diff function.
This method calls delete_resource() and formats the result as a salt state return value.
example:
resource_absent("users", ["id","name","email"]) | salt/modules/pagerduty_util.py | def resource_absent(resource, identifier_fields, profile='pagerduty', subdomain=None, api_key=None, **kwargs):
'''
Generic resource.absent state method. Pagerduty state modules should be a thin wrapper over this method,
with a custom diff function.
This method calls delete_resource() and formats the ... | def resource_absent(resource, identifier_fields, profile='pagerduty', subdomain=None, api_key=None, **kwargs):
'''
Generic resource.absent state method. Pagerduty state modules should be a thin wrapper over this method,
with a custom diff function.
This method calls delete_resource() and formats the ... | [
"Generic",
"resource",
".",
"absent",
"state",
"method",
".",
"Pagerduty",
"state",
"modules",
"should",
"be",
"a",
"thin",
"wrapper",
"over",
"this",
"method",
"with",
"a",
"custom",
"diff",
"function",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pagerduty_util.py#L371-L407 | [
"def",
"resource_absent",
"(",
"resource",
",",
"identifier_fields",
",",
"profile",
"=",
"'pagerduty'",
",",
"subdomain",
"=",
"None",
",",
"api_key",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"kwargs",
"[",
"'name'... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | downloaded | Ensures that the artifact from nexus exists at given location. If it doesn't exist, then
it will be downloaded. If it already exists then the checksum of existing file is checked
against checksum in nexus. If it is different then the step will fail.
artifact
Details of the artifact to be downloaded... | salt/states/nexus.py | def downloaded(name, artifact, target_dir='/tmp', target_file=None):
'''
Ensures that the artifact from nexus exists at given location. If it doesn't exist, then
it will be downloaded. If it already exists then the checksum of existing file is checked
against checksum in nexus. If it is different then t... | def downloaded(name, artifact, target_dir='/tmp', target_file=None):
'''
Ensures that the artifact from nexus exists at given location. If it doesn't exist, then
it will be downloaded. If it already exists then the checksum of existing file is checked
against checksum in nexus. If it is different then t... | [
"Ensures",
"that",
"the",
"artifact",
"from",
"nexus",
"exists",
"at",
"given",
"location",
".",
"If",
"it",
"doesn",
"t",
"exist",
"then",
"it",
"will",
"be",
"downloaded",
".",
"If",
"it",
"already",
"exists",
"then",
"the",
"checksum",
"of",
"existing",... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/nexus.py#L27-L110 | [
"def",
"downloaded",
"(",
"name",
",",
"artifact",
",",
"target_dir",
"=",
"'/tmp'",
",",
"target_file",
"=",
"None",
")",
":",
"log",
".",
"debug",
"(",
"\" ======================== STATE: nexus.downloaded (name: %s) \"",
",",
"name",
")",
"ret",
"=",
"{",
"'na... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _jobs | Return the currently configured jobs. | salt/modules/chronos.py | def _jobs():
'''
Return the currently configured jobs.
'''
response = salt.utils.http.query(
"{0}/scheduler/jobs".format(_base_url()),
decode_type='json',
decode=True,
)
jobs = {}
for job in response['dict']:
jobs[job.pop('name')] = job
return jobs | def _jobs():
'''
Return the currently configured jobs.
'''
response = salt.utils.http.query(
"{0}/scheduler/jobs".format(_base_url()),
decode_type='json',
decode=True,
)
jobs = {}
for job in response['dict']:
jobs[job.pop('name')] = job
return jobs | [
"Return",
"the",
"currently",
"configured",
"jobs",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/chronos.py#L37-L49 | [
"def",
"_jobs",
"(",
")",
":",
"response",
"=",
"salt",
".",
"utils",
".",
"http",
".",
"query",
"(",
"\"{0}/scheduler/jobs\"",
".",
"format",
"(",
"_base_url",
"(",
")",
")",
",",
"decode_type",
"=",
"'json'",
",",
"decode",
"=",
"True",
",",
")",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | update_job | Update the specified job with the given configuration.
CLI Example:
.. code-block:: bash
salt chronos-minion-id chronos.update_job my-job '<config yaml>' | salt/modules/chronos.py | def update_job(name, config):
'''
Update the specified job with the given configuration.
CLI Example:
.. code-block:: bash
salt chronos-minion-id chronos.update_job my-job '<config yaml>'
'''
if 'name' not in config:
config['name'] = name
data = salt.utils.json.dumps(confi... | def update_job(name, config):
'''
Update the specified job with the given configuration.
CLI Example:
.. code-block:: bash
salt chronos-minion-id chronos.update_job my-job '<config yaml>'
'''
if 'name' not in config:
config['name'] = name
data = salt.utils.json.dumps(confi... | [
"Update",
"the",
"specified",
"job",
"with",
"the",
"given",
"configuration",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/chronos.py#L96-L126 | [
"def",
"update_job",
"(",
"name",
",",
"config",
")",
":",
"if",
"'name'",
"not",
"in",
"config",
":",
"config",
"[",
"'name'",
"]",
"=",
"name",
"data",
"=",
"salt",
".",
"utils",
".",
"json",
".",
"dumps",
"(",
"config",
")",
"try",
":",
"respons... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | rm_job | Remove the specified job from the server.
CLI Example:
.. code-block:: bash
salt chronos-minion-id chronos.rm_job my-job | salt/modules/chronos.py | def rm_job(name):
'''
Remove the specified job from the server.
CLI Example:
.. code-block:: bash
salt chronos-minion-id chronos.rm_job my-job
'''
response = salt.utils.http.query(
"{0}/scheduler/job/{1}".format(_base_url(), name),
method='DELETE',
)
return Tru... | def rm_job(name):
'''
Remove the specified job from the server.
CLI Example:
.. code-block:: bash
salt chronos-minion-id chronos.rm_job my-job
'''
response = salt.utils.http.query(
"{0}/scheduler/job/{1}".format(_base_url(), name),
method='DELETE',
)
return Tru... | [
"Remove",
"the",
"specified",
"job",
"from",
"the",
"server",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/chronos.py#L129-L143 | [
"def",
"rm_job",
"(",
"name",
")",
":",
"response",
"=",
"salt",
".",
"utils",
".",
"http",
".",
"query",
"(",
"\"{0}/scheduler/job/{1}\"",
".",
"format",
"(",
"_base_url",
"(",
")",
",",
"name",
")",
",",
"method",
"=",
"'DELETE'",
",",
")",
"return",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | iscsi_iqn | Return iSCSI IQN | salt/grains/iscsi.py | def iscsi_iqn():
'''
Return iSCSI IQN
'''
grains = {}
grains['iscsi_iqn'] = False
if salt.utils.platform.is_linux():
grains['iscsi_iqn'] = _linux_iqn()
elif salt.utils.platform.is_windows():
grains['iscsi_iqn'] = _windows_iqn()
elif salt.utils.platform.is_aix():
g... | def iscsi_iqn():
'''
Return iSCSI IQN
'''
grains = {}
grains['iscsi_iqn'] = False
if salt.utils.platform.is_linux():
grains['iscsi_iqn'] = _linux_iqn()
elif salt.utils.platform.is_windows():
grains['iscsi_iqn'] = _windows_iqn()
elif salt.utils.platform.is_aix():
g... | [
"Return",
"iSCSI",
"IQN"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/iscsi.py#L38-L50 | [
"def",
"iscsi_iqn",
"(",
")",
":",
"grains",
"=",
"{",
"}",
"grains",
"[",
"'iscsi_iqn'",
"]",
"=",
"False",
"if",
"salt",
".",
"utils",
".",
"platform",
".",
"is_linux",
"(",
")",
":",
"grains",
"[",
"'iscsi_iqn'",
"]",
"=",
"_linux_iqn",
"(",
")",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _linux_iqn | Return iSCSI IQN from a Linux host. | salt/grains/iscsi.py | def _linux_iqn():
'''
Return iSCSI IQN from a Linux host.
'''
ret = []
initiator = '/etc/iscsi/initiatorname.iscsi'
try:
with salt.utils.files.fopen(initiator, 'r') as _iscsi:
for line in _iscsi:
line = line.strip()
if line.startswith('Initiat... | def _linux_iqn():
'''
Return iSCSI IQN from a Linux host.
'''
ret = []
initiator = '/etc/iscsi/initiatorname.iscsi'
try:
with salt.utils.files.fopen(initiator, 'r') as _iscsi:
for line in _iscsi:
line = line.strip()
if line.startswith('Initiat... | [
"Return",
"iSCSI",
"IQN",
"from",
"a",
"Linux",
"host",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/iscsi.py#L53-L70 | [
"def",
"_linux_iqn",
"(",
")",
":",
"ret",
"=",
"[",
"]",
"initiator",
"=",
"'/etc/iscsi/initiatorname.iscsi'",
"try",
":",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"fopen",
"(",
"initiator",
",",
"'r'",
")",
"as",
"_iscsi",
":",
"for",
"line",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _aix_iqn | Return iSCSI IQN from an AIX host. | salt/grains/iscsi.py | def _aix_iqn():
'''
Return iSCSI IQN from an AIX host.
'''
ret = []
aix_cmd = 'lsattr -E -l iscsi0 | grep initiator_name'
aix_ret = salt.modules.cmdmod.run(aix_cmd)
if aix_ret[0].isalpha():
try:
ret.append(aix_ret.split()[1].rstrip())
except IndexError:
... | def _aix_iqn():
'''
Return iSCSI IQN from an AIX host.
'''
ret = []
aix_cmd = 'lsattr -E -l iscsi0 | grep initiator_name'
aix_ret = salt.modules.cmdmod.run(aix_cmd)
if aix_ret[0].isalpha():
try:
ret.append(aix_ret.split()[1].rstrip())
except IndexError:
... | [
"Return",
"iSCSI",
"IQN",
"from",
"an",
"AIX",
"host",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/iscsi.py#L73-L87 | [
"def",
"_aix_iqn",
"(",
")",
":",
"ret",
"=",
"[",
"]",
"aix_cmd",
"=",
"'lsattr -E -l iscsi0 | grep initiator_name'",
"aix_ret",
"=",
"salt",
".",
"modules",
".",
"cmdmod",
".",
"run",
"(",
"aix_cmd",
")",
"if",
"aix_ret",
"[",
"0",
"]",
".",
"isalpha",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _windows_iqn | Return iSCSI IQN from a Windows host. | salt/grains/iscsi.py | def _windows_iqn():
'''
Return iSCSI IQN from a Windows host.
'''
ret = []
wmic = salt.utils.path.which('wmic')
if not wmic:
return ret
namespace = r'\\root\WMI'
path = 'MSiSCSIInitiator_MethodClass'
get = 'iSCSINodeName'
cmd_ret = salt.modules.cmdmod.run_all(
... | def _windows_iqn():
'''
Return iSCSI IQN from a Windows host.
'''
ret = []
wmic = salt.utils.path.which('wmic')
if not wmic:
return ret
namespace = r'\\root\WMI'
path = 'MSiSCSIInitiator_MethodClass'
get = 'iSCSINodeName'
cmd_ret = salt.modules.cmdmod.run_all(
... | [
"Return",
"iSCSI",
"IQN",
"from",
"a",
"Windows",
"host",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/iscsi.py#L90-L114 | [
"def",
"_windows_iqn",
"(",
")",
":",
"ret",
"=",
"[",
"]",
"wmic",
"=",
"salt",
".",
"utils",
".",
"path",
".",
"which",
"(",
"'wmic'",
")",
"if",
"not",
"wmic",
":",
"return",
"ret",
"namespace",
"=",
"r'\\\\root\\WMI'",
"path",
"=",
"'MSiSCSIInitiat... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_jid | Return the information for a specified job id
CLI Example:
.. code-block:: bash
salt '*' ret.get_jid redis 20421104181954700505 | salt/modules/ret.py | def get_jid(returner, jid):
'''
Return the information for a specified job id
CLI Example:
.. code-block:: bash
salt '*' ret.get_jid redis 20421104181954700505
'''
returners = salt.loader.returners(__opts__, __salt__)
return returners['{0}.get_jid'.format(returner)](jid) | def get_jid(returner, jid):
'''
Return the information for a specified job id
CLI Example:
.. code-block:: bash
salt '*' ret.get_jid redis 20421104181954700505
'''
returners = salt.loader.returners(__opts__, __salt__)
return returners['{0}.get_jid'.format(returner)](jid) | [
"Return",
"the",
"information",
"for",
"a",
"specified",
"job",
"id"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ret.py#L11-L22 | [
"def",
"get_jid",
"(",
"returner",
",",
"jid",
")",
":",
"returners",
"=",
"salt",
".",
"loader",
".",
"returners",
"(",
"__opts__",
",",
"__salt__",
")",
"return",
"returners",
"[",
"'{0}.get_jid'",
".",
"format",
"(",
"returner",
")",
"]",
"(",
"jid",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_fun | Return info about last time fun was called on each minion
CLI Example:
.. code-block:: bash
salt '*' ret.get_fun mysql network.interfaces | salt/modules/ret.py | def get_fun(returner, fun):
'''
Return info about last time fun was called on each minion
CLI Example:
.. code-block:: bash
salt '*' ret.get_fun mysql network.interfaces
'''
returners = salt.loader.returners(__opts__, __salt__)
return returners['{0}.get_fun'.format(returner)](fun) | def get_fun(returner, fun):
'''
Return info about last time fun was called on each minion
CLI Example:
.. code-block:: bash
salt '*' ret.get_fun mysql network.interfaces
'''
returners = salt.loader.returners(__opts__, __salt__)
return returners['{0}.get_fun'.format(returner)](fun) | [
"Return",
"info",
"about",
"last",
"time",
"fun",
"was",
"called",
"on",
"each",
"minion"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ret.py#L25-L36 | [
"def",
"get_fun",
"(",
"returner",
",",
"fun",
")",
":",
"returners",
"=",
"salt",
".",
"loader",
".",
"returners",
"(",
"__opts__",
",",
"__salt__",
")",
"return",
"returners",
"[",
"'{0}.get_fun'",
".",
"format",
"(",
"returner",
")",
"]",
"(",
"fun",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_jids | Return a list of all job ids
CLI Example:
.. code-block:: bash
salt '*' ret.get_jids mysql | salt/modules/ret.py | def get_jids(returner):
'''
Return a list of all job ids
CLI Example:
.. code-block:: bash
salt '*' ret.get_jids mysql
'''
returners = salt.loader.returners(__opts__, __salt__)
return returners['{0}.get_jids'.format(returner)]() | def get_jids(returner):
'''
Return a list of all job ids
CLI Example:
.. code-block:: bash
salt '*' ret.get_jids mysql
'''
returners = salt.loader.returners(__opts__, __salt__)
return returners['{0}.get_jids'.format(returner)]() | [
"Return",
"a",
"list",
"of",
"all",
"job",
"ids"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ret.py#L39-L50 | [
"def",
"get_jids",
"(",
"returner",
")",
":",
"returners",
"=",
"salt",
".",
"loader",
".",
"returners",
"(",
"__opts__",
",",
"__salt__",
")",
"return",
"returners",
"[",
"'{0}.get_jids'",
".",
"format",
"(",
"returner",
")",
"]",
"(",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_minions | Return a list of all minions
CLI Example:
.. code-block:: bash
salt '*' ret.get_minions mysql | salt/modules/ret.py | def get_minions(returner):
'''
Return a list of all minions
CLI Example:
.. code-block:: bash
salt '*' ret.get_minions mysql
'''
returners = salt.loader.returners(__opts__, __salt__)
return returners['{0}.get_minions'.format(returner)]() | def get_minions(returner):
'''
Return a list of all minions
CLI Example:
.. code-block:: bash
salt '*' ret.get_minions mysql
'''
returners = salt.loader.returners(__opts__, __salt__)
return returners['{0}.get_minions'.format(returner)]() | [
"Return",
"a",
"list",
"of",
"all",
"minions"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ret.py#L53-L64 | [
"def",
"get_minions",
"(",
"returner",
")",
":",
"returners",
"=",
"salt",
".",
"loader",
".",
"returners",
"(",
"__opts__",
",",
"__salt__",
")",
"return",
"returners",
"[",
"'{0}.get_minions'",
".",
"format",
"(",
"returner",
")",
"]",
"(",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _enforce_txt_record_maxlen | Enforces the TXT record maximum length of 255 characters.
TXT record length includes key, value, and '='.
:param str key: Key of the TXT record
:param str value: Value of the TXT record
:rtype: str
:return: The value of the TXT record. It may be truncated if it exceeds
the maximum per... | salt/beacons/bonjour_announce.py | def _enforce_txt_record_maxlen(key, value):
'''
Enforces the TXT record maximum length of 255 characters.
TXT record length includes key, value, and '='.
:param str key: Key of the TXT record
:param str value: Value of the TXT record
:rtype: str
:return: The value of the TXT record. It may... | def _enforce_txt_record_maxlen(key, value):
'''
Enforces the TXT record maximum length of 255 characters.
TXT record length includes key, value, and '='.
:param str key: Key of the TXT record
:param str value: Value of the TXT record
:rtype: str
:return: The value of the TXT record. It may... | [
"Enforces",
"the",
"TXT",
"record",
"maximum",
"length",
"of",
"255",
"characters",
".",
"TXT",
"record",
"length",
"includes",
"key",
"value",
"and",
"=",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/beacons/bonjour_announce.py#L73-L90 | [
"def",
"_enforce_txt_record_maxlen",
"(",
"key",
",",
"value",
")",
":",
"# Add 1 for '=' seperator between key and value",
"if",
"len",
"(",
"key",
")",
"+",
"len",
"(",
"value",
")",
"+",
"1",
">",
"255",
":",
"# 255 - 3 ('...') - 1 ('=') = 251",
"return",
"valu... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | beacon | Broadcast values via zeroconf
If the announced values are static, it is advised to set run_once: True
(do not poll) on the beacon configuration.
The following are required configuration settings:
- ``servicetype`` - The service type to announce
- ``port`` - The port of the service to announce
... | salt/beacons/bonjour_announce.py | def beacon(config):
'''
Broadcast values via zeroconf
If the announced values are static, it is advised to set run_once: True
(do not poll) on the beacon configuration.
The following are required configuration settings:
- ``servicetype`` - The service type to announce
- ``port`` - The por... | def beacon(config):
'''
Broadcast values via zeroconf
If the announced values are static, it is advised to set run_once: True
(do not poll) on the beacon configuration.
The following are required configuration settings:
- ``servicetype`` - The service type to announce
- ``port`` - The por... | [
"Broadcast",
"values",
"via",
"zeroconf"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/beacons/bonjour_announce.py#L93-L247 | [
"def",
"beacon",
"(",
"config",
")",
":",
"ret",
"=",
"[",
"]",
"changes",
"=",
"{",
"}",
"txt",
"=",
"{",
"}",
"global",
"LAST_GRAINS",
"global",
"SD_REF",
"_config",
"=",
"{",
"}",
"list",
"(",
"map",
"(",
"_config",
".",
"update",
",",
"config",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | doc | Return the docstrings for all modules. Optionally, specify a module or a
function to narrow the selection.
The strings are aggregated into a single document on the master for easy
reading.
Multiple modules/functions can be specified.
CLI Example:
.. code-block:: bash
salt '*' sys.do... | salt/modules/sysmod.py | def doc(*args):
'''
Return the docstrings for all modules. Optionally, specify a module or a
function to narrow the selection.
The strings are aggregated into a single document on the master for easy
reading.
Multiple modules/functions can be specified.
CLI Example:
.. code-block:: b... | def doc(*args):
'''
Return the docstrings for all modules. Optionally, specify a module or a
function to narrow the selection.
The strings are aggregated into a single document on the master for easy
reading.
Multiple modules/functions can be specified.
CLI Example:
.. code-block:: b... | [
"Return",
"the",
"docstrings",
"for",
"all",
"modules",
".",
"Optionally",
"specify",
"a",
"module",
"or",
"a",
"function",
"to",
"narrow",
"the",
"selection",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/sysmod.py#L38-L91 | [
"def",
"doc",
"(",
"*",
"args",
")",
":",
"docs",
"=",
"{",
"}",
"if",
"not",
"args",
":",
"for",
"fun",
"in",
"__salt__",
":",
"docs",
"[",
"fun",
"]",
"=",
"__salt__",
"[",
"fun",
"]",
".",
"__doc__",
"return",
"_strip_rst",
"(",
"docs",
")",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | state_doc | Return the docstrings for all states. Optionally, specify a state or a
function to narrow the selection.
The strings are aggregated into a single document on the master for easy
reading.
Multiple states/functions can be specified.
.. versionadded:: 2014.7.0
CLI Example:
.. code-block:: ... | salt/modules/sysmod.py | def state_doc(*args):
'''
Return the docstrings for all states. Optionally, specify a state or a
function to narrow the selection.
The strings are aggregated into a single document on the master for easy
reading.
Multiple states/functions can be specified.
.. versionadded:: 2014.7.0
... | def state_doc(*args):
'''
Return the docstrings for all states. Optionally, specify a state or a
function to narrow the selection.
The strings are aggregated into a single document on the master for easy
reading.
Multiple states/functions can be specified.
.. versionadded:: 2014.7.0
... | [
"Return",
"the",
"docstrings",
"for",
"all",
"states",
".",
"Optionally",
"specify",
"a",
"state",
"or",
"a",
"function",
"to",
"narrow",
"the",
"selection",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/sysmod.py#L94-L161 | [
"def",
"state_doc",
"(",
"*",
"args",
")",
":",
"st_",
"=",
"salt",
".",
"state",
".",
"State",
"(",
"__opts__",
")",
"docs",
"=",
"{",
"}",
"if",
"not",
"args",
":",
"for",
"fun",
"in",
"st_",
".",
"states",
":",
"state",
"=",
"fun",
".",
"spl... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | runner_doc | Return the docstrings for all runners. Optionally, specify a runner or a
function to narrow the selection.
The strings are aggregated into a single document on the master for easy
reading.
Multiple runners/functions can be specified.
.. versionadded:: 2014.7.0
CLI Example:
.. code-block... | salt/modules/sysmod.py | def runner_doc(*args):
'''
Return the docstrings for all runners. Optionally, specify a runner or a
function to narrow the selection.
The strings are aggregated into a single document on the master for easy
reading.
Multiple runners/functions can be specified.
.. versionadded:: 2014.7.0
... | def runner_doc(*args):
'''
Return the docstrings for all runners. Optionally, specify a runner or a
function to narrow the selection.
The strings are aggregated into a single document on the master for easy
reading.
Multiple runners/functions can be specified.
.. versionadded:: 2014.7.0
... | [
"Return",
"the",
"docstrings",
"for",
"all",
"runners",
".",
"Optionally",
"specify",
"a",
"runner",
"or",
"a",
"function",
"to",
"narrow",
"the",
"selection",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/sysmod.py#L164-L219 | [
"def",
"runner_doc",
"(",
"*",
"args",
")",
":",
"run_",
"=",
"salt",
".",
"runner",
".",
"Runner",
"(",
"__opts__",
")",
"docs",
"=",
"{",
"}",
"if",
"not",
"args",
":",
"for",
"fun",
"in",
"run_",
".",
"functions",
":",
"docs",
"[",
"fun",
"]",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | returner_doc | Return the docstrings for all returners. Optionally, specify a returner or a
function to narrow the selection.
The strings are aggregated into a single document on the master for easy
reading.
Multiple returners/functions can be specified.
.. versionadded:: 2014.7.0
CLI Example:
.. code... | salt/modules/sysmod.py | def returner_doc(*args):
'''
Return the docstrings for all returners. Optionally, specify a returner or a
function to narrow the selection.
The strings are aggregated into a single document on the master for easy
reading.
Multiple returners/functions can be specified.
.. versionadded:: 20... | def returner_doc(*args):
'''
Return the docstrings for all returners. Optionally, specify a returner or a
function to narrow the selection.
The strings are aggregated into a single document on the master for easy
reading.
Multiple returners/functions can be specified.
.. versionadded:: 20... | [
"Return",
"the",
"docstrings",
"for",
"all",
"returners",
".",
"Optionally",
"specify",
"a",
"returner",
"or",
"a",
"function",
"to",
"narrow",
"the",
"selection",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/sysmod.py#L222-L279 | [
"def",
"returner_doc",
"(",
"*",
"args",
")",
":",
"returners_",
"=",
"salt",
".",
"loader",
".",
"returners",
"(",
"__opts__",
",",
"[",
"]",
")",
"docs",
"=",
"{",
"}",
"if",
"not",
"args",
":",
"for",
"fun",
"in",
"returners_",
":",
"docs",
"[",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | renderer_doc | Return the docstrings for all renderers. Optionally, specify a renderer or a
function to narrow the selection.
The strings are aggregated into a single document on the master for easy
reading.
Multiple renderers can be specified.
.. versionadded:: 2015.5.0
CLI Example:
.. code-block:: b... | salt/modules/sysmod.py | def renderer_doc(*args):
'''
Return the docstrings for all renderers. Optionally, specify a renderer or a
function to narrow the selection.
The strings are aggregated into a single document on the master for easy
reading.
Multiple renderers can be specified.
.. versionadded:: 2015.5.0
... | def renderer_doc(*args):
'''
Return the docstrings for all renderers. Optionally, specify a renderer or a
function to narrow the selection.
The strings are aggregated into a single document on the master for easy
reading.
Multiple renderers can be specified.
.. versionadded:: 2015.5.0
... | [
"Return",
"the",
"docstrings",
"for",
"all",
"renderers",
".",
"Optionally",
"specify",
"a",
"renderer",
"or",
"a",
"function",
"to",
"narrow",
"the",
"selection",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/sysmod.py#L282-L325 | [
"def",
"renderer_doc",
"(",
"*",
"args",
")",
":",
"renderers_",
"=",
"salt",
".",
"loader",
".",
"render",
"(",
"__opts__",
",",
"[",
"]",
")",
"docs",
"=",
"{",
"}",
"if",
"not",
"args",
":",
"for",
"func",
"in",
"six",
".",
"iterkeys",
"(",
"r... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | utils_doc | .. versionadded:: Neon
Return the docstrings for all utils modules. Optionally, specify a module
or a function to narrow the selection.
The strings are aggregated into a single document on the master for easy
reading.
Multiple modules/functions can be specified.
CLI Example:
.. code-blo... | salt/modules/sysmod.py | def utils_doc(*args):
'''
.. versionadded:: Neon
Return the docstrings for all utils modules. Optionally, specify a module
or a function to narrow the selection.
The strings are aggregated into a single document on the master for easy
reading.
Multiple modules/functions can be specified.
... | def utils_doc(*args):
'''
.. versionadded:: Neon
Return the docstrings for all utils modules. Optionally, specify a module
or a function to narrow the selection.
The strings are aggregated into a single document on the master for easy
reading.
Multiple modules/functions can be specified.
... | [
"..",
"versionadded",
"::",
"Neon"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/sysmod.py#L328-L374 | [
"def",
"utils_doc",
"(",
"*",
"args",
")",
":",
"docs",
"=",
"{",
"}",
"if",
"not",
"args",
":",
"for",
"fun",
"in",
"__utils__",
":",
"docs",
"[",
"fun",
"]",
"=",
"__utils__",
"[",
"fun",
"]",
".",
"__doc__",
"return",
"_strip_rst",
"(",
"docs",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | list_functions | List the functions for all modules. Optionally, specify a module or modules
from which to list.
CLI Example:
.. code-block:: bash
salt '*' sys.list_functions
salt '*' sys.list_functions sys
salt '*' sys.list_functions sys user
Function names can be specified as globs.
..... | salt/modules/sysmod.py | def list_functions(*args, **kwargs): # pylint: disable=unused-argument
'''
List the functions for all modules. Optionally, specify a module or modules
from which to list.
CLI Example:
.. code-block:: bash
salt '*' sys.list_functions
salt '*' sys.list_functions sys
salt '*... | def list_functions(*args, **kwargs): # pylint: disable=unused-argument
'''
List the functions for all modules. Optionally, specify a module or modules
from which to list.
CLI Example:
.. code-block:: bash
salt '*' sys.list_functions
salt '*' sys.list_functions sys
salt '*... | [
"List",
"the",
"functions",
"for",
"all",
"modules",
".",
"Optionally",
"specify",
"a",
"module",
"or",
"modules",
"from",
"which",
"to",
"list",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/sysmod.py#L377-L423 | [
"def",
"list_functions",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# pylint: disable=unused-argument",
"# ## NOTE: **kwargs is used here to prevent a traceback when garbage",
"# ## arguments are tacked on to the end.",
"if",
"not",
"args",
":",
"# We're being as... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | list_modules | List the modules loaded on the minion
.. versionadded:: 2015.5.0
CLI Example:
.. code-block:: bash
salt '*' sys.list_modules
Module names can be specified as globs.
.. code-block:: bash
salt '*' sys.list_modules 's*' | salt/modules/sysmod.py | def list_modules(*args):
'''
List the modules loaded on the minion
.. versionadded:: 2015.5.0
CLI Example:
.. code-block:: bash
salt '*' sys.list_modules
Module names can be specified as globs.
.. code-block:: bash
salt '*' sys.list_modules 's*'
'''
modules = ... | def list_modules(*args):
'''
List the modules loaded on the minion
.. versionadded:: 2015.5.0
CLI Example:
.. code-block:: bash
salt '*' sys.list_modules
Module names can be specified as globs.
.. code-block:: bash
salt '*' sys.list_modules 's*'
'''
modules = ... | [
"List",
"the",
"modules",
"loaded",
"on",
"the",
"minion"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/sysmod.py#L426-L460 | [
"def",
"list_modules",
"(",
"*",
"args",
")",
":",
"modules",
"=",
"set",
"(",
")",
"if",
"not",
"args",
":",
"for",
"func",
"in",
"__salt__",
":",
"modules",
".",
"add",
"(",
"func",
".",
"split",
"(",
"'.'",
")",
"[",
"0",
"]",
")",
"return",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | state_argspec | Return the argument specification of functions in Salt state
modules.
.. versionadded:: 2015.5.0
CLI Example:
.. code-block:: bash
salt '*' sys.state_argspec pkg.installed
salt '*' sys.state_argspec file
salt '*' sys.state_argspec
State names can be specified as globs.
... | salt/modules/sysmod.py | def state_argspec(module=''):
'''
Return the argument specification of functions in Salt state
modules.
.. versionadded:: 2015.5.0
CLI Example:
.. code-block:: bash
salt '*' sys.state_argspec pkg.installed
salt '*' sys.state_argspec file
salt '*' sys.state_argspec
... | def state_argspec(module=''):
'''
Return the argument specification of functions in Salt state
modules.
.. versionadded:: 2015.5.0
CLI Example:
.. code-block:: bash
salt '*' sys.state_argspec pkg.installed
salt '*' sys.state_argspec file
salt '*' sys.state_argspec
... | [
"Return",
"the",
"argument",
"specification",
"of",
"functions",
"in",
"Salt",
"state",
"modules",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/sysmod.py#L505-L528 | [
"def",
"state_argspec",
"(",
"module",
"=",
"''",
")",
":",
"st_",
"=",
"salt",
".",
"state",
".",
"State",
"(",
"__opts__",
")",
"return",
"salt",
".",
"utils",
".",
"args",
".",
"argspec_report",
"(",
"st_",
".",
"states",
",",
"module",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | returner_argspec | Return the argument specification of functions in Salt returner
modules.
.. versionadded:: 2015.5.0
CLI Example:
.. code-block:: bash
salt '*' sys.returner_argspec xmpp
salt '*' sys.returner_argspec xmpp smtp
salt '*' sys.returner_argspec
Returner names can be specified ... | salt/modules/sysmod.py | def returner_argspec(module=''):
'''
Return the argument specification of functions in Salt returner
modules.
.. versionadded:: 2015.5.0
CLI Example:
.. code-block:: bash
salt '*' sys.returner_argspec xmpp
salt '*' sys.returner_argspec xmpp smtp
salt '*' sys.returner_... | def returner_argspec(module=''):
'''
Return the argument specification of functions in Salt returner
modules.
.. versionadded:: 2015.5.0
CLI Example:
.. code-block:: bash
salt '*' sys.returner_argspec xmpp
salt '*' sys.returner_argspec xmpp smtp
salt '*' sys.returner_... | [
"Return",
"the",
"argument",
"specification",
"of",
"functions",
"in",
"Salt",
"returner",
"modules",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/sysmod.py#L531-L554 | [
"def",
"returner_argspec",
"(",
"module",
"=",
"''",
")",
":",
"returners_",
"=",
"salt",
".",
"loader",
".",
"returners",
"(",
"__opts__",
",",
"[",
"]",
")",
"return",
"salt",
".",
"utils",
".",
"args",
".",
"argspec_report",
"(",
"returners_",
",",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | runner_argspec | Return the argument specification of functions in Salt runner
modules.
.. versionadded:: 2015.5.0
CLI Example:
.. code-block:: bash
salt '*' sys.runner_argspec state
salt '*' sys.runner_argspec http
salt '*' sys.runner_argspec
Runner names can be specified as globs.
... | salt/modules/sysmod.py | def runner_argspec(module=''):
'''
Return the argument specification of functions in Salt runner
modules.
.. versionadded:: 2015.5.0
CLI Example:
.. code-block:: bash
salt '*' sys.runner_argspec state
salt '*' sys.runner_argspec http
salt '*' sys.runner_argspec
R... | def runner_argspec(module=''):
'''
Return the argument specification of functions in Salt runner
modules.
.. versionadded:: 2015.5.0
CLI Example:
.. code-block:: bash
salt '*' sys.runner_argspec state
salt '*' sys.runner_argspec http
salt '*' sys.runner_argspec
R... | [
"Return",
"the",
"argument",
"specification",
"of",
"functions",
"in",
"Salt",
"runner",
"modules",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/sysmod.py#L557-L579 | [
"def",
"runner_argspec",
"(",
"module",
"=",
"''",
")",
":",
"run_",
"=",
"salt",
".",
"runner",
".",
"Runner",
"(",
"__opts__",
")",
"return",
"salt",
".",
"utils",
".",
"args",
".",
"argspec_report",
"(",
"run_",
".",
"functions",
",",
"module",
")"
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | list_state_functions | List the functions for all state modules. Optionally, specify a state
module or modules from which to list.
.. versionadded:: 2014.7.0
CLI Example:
.. code-block:: bash
salt '*' sys.list_state_functions
salt '*' sys.list_state_functions file
salt '*' sys.list_state_functions ... | salt/modules/sysmod.py | def list_state_functions(*args, **kwargs): # pylint: disable=unused-argument
'''
List the functions for all state modules. Optionally, specify a state
module or modules from which to list.
.. versionadded:: 2014.7.0
CLI Example:
.. code-block:: bash
salt '*' sys.list_state_functions... | def list_state_functions(*args, **kwargs): # pylint: disable=unused-argument
'''
List the functions for all state modules. Optionally, specify a state
module or modules from which to list.
.. versionadded:: 2014.7.0
CLI Example:
.. code-block:: bash
salt '*' sys.list_state_functions... | [
"List",
"the",
"functions",
"for",
"all",
"state",
"modules",
".",
"Optionally",
"specify",
"a",
"state",
"module",
"or",
"modules",
"from",
"which",
"to",
"list",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/sysmod.py#L582-L632 | [
"def",
"list_state_functions",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# pylint: disable=unused-argument",
"# NOTE: **kwargs is used here to prevent a traceback when garbage",
"# arguments are tacked on to the end.",
"st_",
"=",
"salt",
".",
"state",
".",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | list_state_modules | List the modules loaded on the minion
.. versionadded:: 2014.7.0
CLI Example:
.. code-block:: bash
salt '*' sys.list_state_modules
State module names can be specified as globs.
.. versionadded:: 2015.5.0
.. code-block:: bash
salt '*' sys.list_state_modules 'mysql_*' | salt/modules/sysmod.py | def list_state_modules(*args):
'''
List the modules loaded on the minion
.. versionadded:: 2014.7.0
CLI Example:
.. code-block:: bash
salt '*' sys.list_state_modules
State module names can be specified as globs.
.. versionadded:: 2015.5.0
.. code-block:: bash
salt... | def list_state_modules(*args):
'''
List the modules loaded on the minion
.. versionadded:: 2014.7.0
CLI Example:
.. code-block:: bash
salt '*' sys.list_state_modules
State module names can be specified as globs.
.. versionadded:: 2015.5.0
.. code-block:: bash
salt... | [
"List",
"the",
"modules",
"loaded",
"on",
"the",
"minion"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/sysmod.py#L635-L674 | [
"def",
"list_state_modules",
"(",
"*",
"args",
")",
":",
"st_",
"=",
"salt",
".",
"state",
".",
"State",
"(",
"__opts__",
")",
"modules",
"=",
"set",
"(",
")",
"if",
"not",
"args",
":",
"for",
"func",
"in",
"st_",
".",
"states",
":",
"log",
".",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | list_runners | List the runners loaded on the minion
.. versionadded:: 2014.7.0
CLI Example:
.. code-block:: bash
salt '*' sys.list_runners
Runner names can be specified as globs.
.. versionadded:: 2015.5.0
.. code-block:: bash
salt '*' sys.list_runners 'm*' | salt/modules/sysmod.py | def list_runners(*args):
'''
List the runners loaded on the minion
.. versionadded:: 2014.7.0
CLI Example:
.. code-block:: bash
salt '*' sys.list_runners
Runner names can be specified as globs.
.. versionadded:: 2015.5.0
.. code-block:: bash
salt '*' sys.list_runn... | def list_runners(*args):
'''
List the runners loaded on the minion
.. versionadded:: 2014.7.0
CLI Example:
.. code-block:: bash
salt '*' sys.list_runners
Runner names can be specified as globs.
.. versionadded:: 2015.5.0
.. code-block:: bash
salt '*' sys.list_runn... | [
"List",
"the",
"runners",
"loaded",
"on",
"the",
"minion"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/sysmod.py#L677-L714 | [
"def",
"list_runners",
"(",
"*",
"args",
")",
":",
"run_",
"=",
"salt",
".",
"runner",
".",
"Runner",
"(",
"__opts__",
")",
"runners",
"=",
"set",
"(",
")",
"if",
"not",
"args",
":",
"for",
"func",
"in",
"run_",
".",
"functions",
":",
"runners",
".... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | list_runner_functions | List the functions for all runner modules. Optionally, specify a runner
module or modules from which to list.
.. versionadded:: 2014.7.0
CLI Example:
.. code-block:: bash
salt '*' sys.list_runner_functions
salt '*' sys.list_runner_functions state
salt '*' sys.list_runner_func... | salt/modules/sysmod.py | def list_runner_functions(*args, **kwargs): # pylint: disable=unused-argument
'''
List the functions for all runner modules. Optionally, specify a runner
module or modules from which to list.
.. versionadded:: 2014.7.0
CLI Example:
.. code-block:: bash
salt '*' sys.list_runner_funct... | def list_runner_functions(*args, **kwargs): # pylint: disable=unused-argument
'''
List the functions for all runner modules. Optionally, specify a runner
module or modules from which to list.
.. versionadded:: 2014.7.0
CLI Example:
.. code-block:: bash
salt '*' sys.list_runner_funct... | [
"List",
"the",
"functions",
"for",
"all",
"runner",
"modules",
".",
"Optionally",
"specify",
"a",
"runner",
"module",
"or",
"modules",
"from",
"which",
"to",
"list",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/sysmod.py#L717-L760 | [
"def",
"list_runner_functions",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# pylint: disable=unused-argument",
"# ## NOTE: **kwargs is used here to prevent a traceback when garbage",
"# ## arguments are tacked on to the end.",
"run_",
"=",
"salt",
".",
"runner",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | list_returners | List the returners loaded on the minion
.. versionadded:: 2014.7.0
CLI Example:
.. code-block:: bash
salt '*' sys.list_returners
Returner names can be specified as globs.
.. versionadded:: 2015.5.0
.. code-block:: bash
salt '*' sys.list_returners 's*' | salt/modules/sysmod.py | def list_returners(*args):
'''
List the returners loaded on the minion
.. versionadded:: 2014.7.0
CLI Example:
.. code-block:: bash
salt '*' sys.list_returners
Returner names can be specified as globs.
.. versionadded:: 2015.5.0
.. code-block:: bash
salt '*' sys.l... | def list_returners(*args):
'''
List the returners loaded on the minion
.. versionadded:: 2014.7.0
CLI Example:
.. code-block:: bash
salt '*' sys.list_returners
Returner names can be specified as globs.
.. versionadded:: 2015.5.0
.. code-block:: bash
salt '*' sys.l... | [
"List",
"the",
"returners",
"loaded",
"on",
"the",
"minion"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/sysmod.py#L763-L801 | [
"def",
"list_returners",
"(",
"*",
"args",
")",
":",
"returners_",
"=",
"salt",
".",
"loader",
".",
"returners",
"(",
"__opts__",
",",
"[",
"]",
")",
"returners",
"=",
"set",
"(",
")",
"if",
"not",
"args",
":",
"for",
"func",
"in",
"six",
".",
"ite... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | list_returner_functions | List the functions for all returner modules. Optionally, specify a returner
module or modules from which to list.
.. versionadded:: 2014.7.0
CLI Example:
.. code-block:: bash
salt '*' sys.list_returner_functions
salt '*' sys.list_returner_functions mysql
salt '*' sys.list_ret... | salt/modules/sysmod.py | def list_returner_functions(*args, **kwargs): # pylint: disable=unused-argument
'''
List the functions for all returner modules. Optionally, specify a returner
module or modules from which to list.
.. versionadded:: 2014.7.0
CLI Example:
.. code-block:: bash
salt '*' sys.list_return... | def list_returner_functions(*args, **kwargs): # pylint: disable=unused-argument
'''
List the functions for all returner modules. Optionally, specify a returner
module or modules from which to list.
.. versionadded:: 2014.7.0
CLI Example:
.. code-block:: bash
salt '*' sys.list_return... | [
"List",
"the",
"functions",
"for",
"all",
"returner",
"modules",
".",
"Optionally",
"specify",
"a",
"returner",
"module",
"or",
"modules",
"from",
"which",
"to",
"list",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/sysmod.py#L804-L847 | [
"def",
"list_returner_functions",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# pylint: disable=unused-argument",
"# NOTE: **kwargs is used here to prevent a traceback when garbage",
"# arguments are tacked on to the end.",
"returners_",
"=",
"salt",
".",
"loader"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | list_renderers | List the renderers loaded on the minion
.. versionadded:: 2015.5.0
CLI Example:
.. code-block:: bash
salt '*' sys.list_renderers
Render names can be specified as globs.
.. code-block:: bash
salt '*' sys.list_renderers 'yaml*' | salt/modules/sysmod.py | def list_renderers(*args):
'''
List the renderers loaded on the minion
.. versionadded:: 2015.5.0
CLI Example:
.. code-block:: bash
salt '*' sys.list_renderers
Render names can be specified as globs.
.. code-block:: bash
salt '*' sys.list_renderers 'yaml*'
'''
... | def list_renderers(*args):
'''
List the renderers loaded on the minion
.. versionadded:: 2015.5.0
CLI Example:
.. code-block:: bash
salt '*' sys.list_renderers
Render names can be specified as globs.
.. code-block:: bash
salt '*' sys.list_renderers 'yaml*'
'''
... | [
"List",
"the",
"renderers",
"loaded",
"on",
"the",
"minion"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/sysmod.py#L850-L880 | [
"def",
"list_renderers",
"(",
"*",
"args",
")",
":",
"renderers_",
"=",
"salt",
".",
"loader",
".",
"render",
"(",
"__opts__",
",",
"[",
"]",
")",
"renderers",
"=",
"set",
"(",
")",
"if",
"not",
"args",
":",
"for",
"rend",
"in",
"six",
".",
"iterke... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | state_schema | Return a JSON Schema for the given state function(s)
.. versionadded:: 2016.3.0
CLI Example:
.. code-block:: bash
salt '*' sys.state_schema
salt '*' sys.state_schema pkg.installed | salt/modules/sysmod.py | def state_schema(module=''):
'''
Return a JSON Schema for the given state function(s)
.. versionadded:: 2016.3.0
CLI Example:
.. code-block:: bash
salt '*' sys.state_schema
salt '*' sys.state_schema pkg.installed
'''
specs = state_argspec(module)
schemas = []
for... | def state_schema(module=''):
'''
Return a JSON Schema for the given state function(s)
.. versionadded:: 2016.3.0
CLI Example:
.. code-block:: bash
salt '*' sys.state_schema
salt '*' sys.state_schema pkg.installed
'''
specs = state_argspec(module)
schemas = []
for... | [
"Return",
"a",
"JSON",
"Schema",
"for",
"the",
"given",
"state",
"function",
"(",
"s",
")"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/sysmod.py#L920-L939 | [
"def",
"state_schema",
"(",
"module",
"=",
"''",
")",
":",
"specs",
"=",
"state_argspec",
"(",
"module",
")",
"schemas",
"=",
"[",
"]",
"for",
"state_mod",
",",
"state_spec",
"in",
"specs",
".",
"items",
"(",
")",
":",
"schemas",
".",
"append",
"(",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _find_pg_binary | ... versionadded:: 2016.3.2
Helper function to locate various psql related binaries | salt/modules/postgres.py | def _find_pg_binary(util):
'''
... versionadded:: 2016.3.2
Helper function to locate various psql related binaries
'''
pg_bin_dir = __salt__['config.option']('postgres.bins_dir')
util_bin = salt.utils.path.which(util)
if not util_bin:
if pg_bin_dir:
return salt.utils.pa... | def _find_pg_binary(util):
'''
... versionadded:: 2016.3.2
Helper function to locate various psql related binaries
'''
pg_bin_dir = __salt__['config.option']('postgres.bins_dir')
util_bin = salt.utils.path.which(util)
if not util_bin:
if pg_bin_dir:
return salt.utils.pa... | [
"...",
"versionadded",
"::",
"2016",
".",
"3",
".",
"2"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L159-L171 | [
"def",
"_find_pg_binary",
"(",
"util",
")",
":",
"pg_bin_dir",
"=",
"__salt__",
"[",
"'config.option'",
"]",
"(",
"'postgres.bins_dir'",
")",
"util_bin",
"=",
"salt",
".",
"utils",
".",
"path",
".",
"which",
"(",
"util",
")",
"if",
"not",
"util_bin",
":",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _run_psql | Helper function to call psql, because the password requirement
makes this too much code to be repeated in each function below | salt/modules/postgres.py | def _run_psql(cmd, runas=None, password=None, host=None, port=None, user=None):
'''
Helper function to call psql, because the password requirement
makes this too much code to be repeated in each function below
'''
kwargs = {
'reset_system_locale': False,
'clean_env': True,
}
... | def _run_psql(cmd, runas=None, password=None, host=None, port=None, user=None):
'''
Helper function to call psql, because the password requirement
makes this too much code to be repeated in each function below
'''
kwargs = {
'reset_system_locale': False,
'clean_env': True,
}
... | [
"Helper",
"function",
"to",
"call",
"psql",
"because",
"the",
"password",
"requirement",
"makes",
"this",
"too",
"much",
"code",
"to",
"be",
"repeated",
"in",
"each",
"function",
"below"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L174-L221 | [
"def",
"_run_psql",
"(",
"cmd",
",",
"runas",
"=",
"None",
",",
"password",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"user",
"=",
"None",
")",
":",
"kwargs",
"=",
"{",
"'reset_system_locale'",
":",
"False",
",",
"'clean_e... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _run_initdb | Helper function to call initdb | salt/modules/postgres.py | def _run_initdb(name,
auth='password',
user=None,
password=None,
encoding='UTF8',
locale=None,
runas=None,
waldir=None,
checksums=False):
'''
Helper function to call initdb
'''
if runas is None:
if 'FreeBSD' in __grains__['os_family... | def _run_initdb(name,
auth='password',
user=None,
password=None,
encoding='UTF8',
locale=None,
runas=None,
waldir=None,
checksums=False):
'''
Helper function to call initdb
'''
if runas is None:
if 'FreeBSD' in __grains__['os_family... | [
"Helper",
"function",
"to",
"call",
"initdb"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L224-L288 | [
"def",
"_run_initdb",
"(",
"name",
",",
"auth",
"=",
"'password'",
",",
"user",
"=",
"None",
",",
"password",
"=",
"None",
",",
"encoding",
"=",
"'UTF8'",
",",
"locale",
"=",
"None",
",",
"runas",
"=",
"None",
",",
"waldir",
"=",
"None",
",",
"checks... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | version | Return the version of a Postgres server.
CLI Example:
.. code-block:: bash
salt '*' postgres.version | salt/modules/postgres.py | def version(user=None, host=None, port=None, maintenance_db=None,
password=None, runas=None):
'''
Return the version of a Postgres server.
CLI Example:
.. code-block:: bash
salt '*' postgres.version
'''
query = 'SELECT setting FROM pg_catalog.pg_settings ' \
'W... | def version(user=None, host=None, port=None, maintenance_db=None,
password=None, runas=None):
'''
Return the version of a Postgres server.
CLI Example:
.. code-block:: bash
salt '*' postgres.version
'''
query = 'SELECT setting FROM pg_catalog.pg_settings ' \
'W... | [
"Return",
"the",
"version",
"of",
"a",
"Postgres",
"server",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L291-L316 | [
"def",
"version",
"(",
"user",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"maintenance_db",
"=",
"None",
",",
"password",
"=",
"None",
",",
"runas",
"=",
"None",
")",
":",
"query",
"=",
"'SELECT setting FROM pg_catalog.pg_setting... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _parsed_version | Returns the server version properly parsed and int casted for internal use.
If the Postgres server does not respond, None will be returned. | salt/modules/postgres.py | def _parsed_version(user=None, host=None, port=None, maintenance_db=None,
password=None, runas=None):
'''
Returns the server version properly parsed and int casted for internal use.
If the Postgres server does not respond, None will be returned.
'''
psql_version = version(
... | def _parsed_version(user=None, host=None, port=None, maintenance_db=None,
password=None, runas=None):
'''
Returns the server version properly parsed and int casted for internal use.
If the Postgres server does not respond, None will be returned.
'''
psql_version = version(
... | [
"Returns",
"the",
"server",
"version",
"properly",
"parsed",
"and",
"int",
"casted",
"for",
"internal",
"use",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L319-L341 | [
"def",
"_parsed_version",
"(",
"user",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"maintenance_db",
"=",
"None",
",",
"password",
"=",
"None",
",",
"runas",
"=",
"None",
")",
":",
"psql_version",
"=",
"version",
"(",
"user",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _connection_defaults | Returns a tuple of (user, host, port, db) with config, pillar, or default
values assigned to missing values. | salt/modules/postgres.py | def _connection_defaults(user=None, host=None, port=None, maintenance_db=None):
'''
Returns a tuple of (user, host, port, db) with config, pillar, or default
values assigned to missing values.
'''
if not user:
user = __salt__['config.option']('postgres.user')
if not host:
host = ... | def _connection_defaults(user=None, host=None, port=None, maintenance_db=None):
'''
Returns a tuple of (user, host, port, db) with config, pillar, or default
values assigned to missing values.
'''
if not user:
user = __salt__['config.option']('postgres.user')
if not host:
host = ... | [
"Returns",
"a",
"tuple",
"of",
"(",
"user",
"host",
"port",
"db",
")",
"with",
"config",
"pillar",
"or",
"default",
"values",
"assigned",
"to",
"missing",
"values",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L344-L358 | [
"def",
"_connection_defaults",
"(",
"user",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"maintenance_db",
"=",
"None",
")",
":",
"if",
"not",
"user",
":",
"user",
"=",
"__salt__",
"[",
"'config.option'",
"]",
"(",
"'postgres.use... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _psql_cmd | Return string with fully composed psql command.
Accepts optional keyword arguments: user, host, port and maintenance_db,
as well as any number of positional arguments to be added to the end of
the command. | salt/modules/postgres.py | def _psql_cmd(*args, **kwargs):
'''
Return string with fully composed psql command.
Accepts optional keyword arguments: user, host, port and maintenance_db,
as well as any number of positional arguments to be added to the end of
the command.
'''
(user, host, port, maintenance_db) = _connect... | def _psql_cmd(*args, **kwargs):
'''
Return string with fully composed psql command.
Accepts optional keyword arguments: user, host, port and maintenance_db,
as well as any number of positional arguments to be added to the end of
the command.
'''
(user, host, port, maintenance_db) = _connect... | [
"Return",
"string",
"with",
"fully",
"composed",
"psql",
"command",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L361-L390 | [
"def",
"_psql_cmd",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"(",
"user",
",",
"host",
",",
"port",
",",
"maintenance_db",
")",
"=",
"_connection_defaults",
"(",
"kwargs",
".",
"get",
"(",
"'user'",
")",
",",
"kwargs",
".",
"get",
"(",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | psql_query | Run an SQL-Query and return the results as a list. This command
only supports SELECT statements. This limitation can be worked around
with a query like this:
WITH updated AS (UPDATE pg_authid SET rolconnlimit = 2000 WHERE
rolname = 'rolename' RETURNING rolconnlimit) SELECT * FROM updated;
query
... | salt/modules/postgres.py | def psql_query(query, user=None, host=None, port=None, maintenance_db=None,
password=None, runas=None, write=False):
'''
Run an SQL-Query and return the results as a list. This command
only supports SELECT statements. This limitation can be worked around
with a query like this:
WITH... | def psql_query(query, user=None, host=None, port=None, maintenance_db=None,
password=None, runas=None, write=False):
'''
Run an SQL-Query and return the results as a list. This command
only supports SELECT statements. This limitation can be worked around
with a query like this:
WITH... | [
"Run",
"an",
"SQL",
"-",
"Query",
"and",
"return",
"the",
"results",
"as",
"a",
"list",
".",
"This",
"command",
"only",
"supports",
"SELECT",
"statements",
".",
"This",
"limitation",
"can",
"be",
"worked",
"around",
"with",
"a",
"query",
"like",
"this",
... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L409-L486 | [
"def",
"psql_query",
"(",
"query",
",",
"user",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"maintenance_db",
"=",
"None",
",",
"password",
"=",
"None",
",",
"runas",
"=",
"None",
",",
"write",
"=",
"False",
")",
":",
"ret... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | db_list | Return dictionary with information about databases of a Postgres server.
CLI Example:
.. code-block:: bash
salt '*' postgres.db_list | salt/modules/postgres.py | def db_list(user=None, host=None, port=None, maintenance_db=None,
password=None, runas=None):
'''
Return dictionary with information about databases of a Postgres server.
CLI Example:
.. code-block:: bash
salt '*' postgres.db_list
'''
ret = {}
query = (
'SELE... | def db_list(user=None, host=None, port=None, maintenance_db=None,
password=None, runas=None):
'''
Return dictionary with information about databases of a Postgres server.
CLI Example:
.. code-block:: bash
salt '*' postgres.db_list
'''
ret = {}
query = (
'SELE... | [
"Return",
"dictionary",
"with",
"information",
"about",
"databases",
"of",
"a",
"Postgres",
"server",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L491-L522 | [
"def",
"db_list",
"(",
"user",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"maintenance_db",
"=",
"None",
",",
"password",
"=",
"None",
",",
"runas",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"}",
"query",
"=",
"(",
"'SELE... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | db_exists | Checks if a database exists on the Postgres server.
CLI Example:
.. code-block:: bash
salt '*' postgres.db_exists 'dbname' | salt/modules/postgres.py | def db_exists(name, user=None, host=None, port=None, maintenance_db=None,
password=None, runas=None):
'''
Checks if a database exists on the Postgres server.
CLI Example:
.. code-block:: bash
salt '*' postgres.db_exists 'dbname'
'''
databases = db_list(user=user, host=h... | def db_exists(name, user=None, host=None, port=None, maintenance_db=None,
password=None, runas=None):
'''
Checks if a database exists on the Postgres server.
CLI Example:
.. code-block:: bash
salt '*' postgres.db_exists 'dbname'
'''
databases = db_list(user=user, host=h... | [
"Checks",
"if",
"a",
"database",
"exists",
"on",
"the",
"Postgres",
"server",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L525-L540 | [
"def",
"db_exists",
"(",
"name",
",",
"user",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"maintenance_db",
"=",
"None",
",",
"password",
"=",
"None",
",",
"runas",
"=",
"None",
")",
":",
"databases",
"=",
"db_list",
"(",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | db_create | Adds a databases to the Postgres server.
CLI Example:
.. code-block:: bash
salt '*' postgres.db_create 'dbname'
salt '*' postgres.db_create 'dbname' template=template_postgis | salt/modules/postgres.py | def db_create(name,
user=None,
host=None,
port=None,
maintenance_db=None,
password=None,
tablespace=None,
encoding=None,
lc_collate=None,
lc_ctype=None,
owner=None,
t... | def db_create(name,
user=None,
host=None,
port=None,
maintenance_db=None,
password=None,
tablespace=None,
encoding=None,
lc_collate=None,
lc_ctype=None,
owner=None,
t... | [
"Adds",
"a",
"databases",
"to",
"the",
"Postgres",
"server",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L553-L607 | [
"def",
"db_create",
"(",
"name",
",",
"user",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"maintenance_db",
"=",
"None",
",",
"password",
"=",
"None",
",",
"tablespace",
"=",
"None",
",",
"encoding",
"=",
"None",
",",
"lc_co... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | db_alter | Change tablespace or/and owner of database.
CLI Example:
.. code-block:: bash
salt '*' postgres.db_alter dbname owner=otheruser | salt/modules/postgres.py | def db_alter(name, user=None, host=None, port=None, maintenance_db=None,
password=None, tablespace=None, owner=None, owner_recurse=False,
runas=None):
'''
Change tablespace or/and owner of database.
CLI Example:
.. code-block:: bash
salt '*' postgres.db_alter dbname ... | def db_alter(name, user=None, host=None, port=None, maintenance_db=None,
password=None, tablespace=None, owner=None, owner_recurse=False,
runas=None):
'''
Change tablespace or/and owner of database.
CLI Example:
.. code-block:: bash
salt '*' postgres.db_alter dbname ... | [
"Change",
"tablespace",
"or",
"/",
"and",
"owner",
"of",
"database",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L610-L651 | [
"def",
"db_alter",
"(",
"name",
",",
"user",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"maintenance_db",
"=",
"None",
",",
"password",
"=",
"None",
",",
"tablespace",
"=",
"None",
",",
"owner",
"=",
"None",
",",
"owner_rec... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | tablespace_list | Return dictionary with information about tablespaces of a Postgres server.
CLI Example:
.. code-block:: bash
salt '*' postgres.tablespace_list
.. versionadded:: 2015.8.0 | salt/modules/postgres.py | def tablespace_list(user=None, host=None, port=None, maintenance_db=None,
password=None, runas=None):
'''
Return dictionary with information about tablespaces of a Postgres server.
CLI Example:
.. code-block:: bash
salt '*' postgres.tablespace_list
.. versionadded:: 2... | def tablespace_list(user=None, host=None, port=None, maintenance_db=None,
password=None, runas=None):
'''
Return dictionary with information about tablespaces of a Postgres server.
CLI Example:
.. code-block:: bash
salt '*' postgres.tablespace_list
.. versionadded:: 2... | [
"Return",
"dictionary",
"with",
"information",
"about",
"tablespaces",
"of",
"a",
"Postgres",
"server",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L680-L711 | [
"def",
"tablespace_list",
"(",
"user",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"maintenance_db",
"=",
"None",
",",
"password",
"=",
"None",
",",
"runas",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"}",
"query",
"=",
"(",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | tablespace_exists | Checks if a tablespace exists on the Postgres server.
CLI Example:
.. code-block:: bash
salt '*' postgres.tablespace_exists 'dbname'
.. versionadded:: 2015.8.0 | salt/modules/postgres.py | def tablespace_exists(name, user=None, host=None, port=None, maintenance_db=None,
password=None, runas=None):
'''
Checks if a tablespace exists on the Postgres server.
CLI Example:
.. code-block:: bash
salt '*' postgres.tablespace_exists 'dbname'
.. versionadded:: 2015.8.0
... | def tablespace_exists(name, user=None, host=None, port=None, maintenance_db=None,
password=None, runas=None):
'''
Checks if a tablespace exists on the Postgres server.
CLI Example:
.. code-block:: bash
salt '*' postgres.tablespace_exists 'dbname'
.. versionadded:: 2015.8.0
... | [
"Checks",
"if",
"a",
"tablespace",
"exists",
"on",
"the",
"Postgres",
"server",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L714-L731 | [
"def",
"tablespace_exists",
"(",
"name",
",",
"user",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"maintenance_db",
"=",
"None",
",",
"password",
"=",
"None",
",",
"runas",
"=",
"None",
")",
":",
"tablespaces",
"=",
"tablespac... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | tablespace_create | Adds a tablespace to the Postgres server.
CLI Example:
.. code-block:: bash
salt '*' postgres.tablespace_create tablespacename '/path/datadir'
.. versionadded:: 2015.8.0 | salt/modules/postgres.py | def tablespace_create(name, location, options=None, owner=None, user=None,
host=None, port=None, maintenance_db=None, password=None,
runas=None):
'''
Adds a tablespace to the Postgres server.
CLI Example:
.. code-block:: bash
salt '*' postgres.table... | def tablespace_create(name, location, options=None, owner=None, user=None,
host=None, port=None, maintenance_db=None, password=None,
runas=None):
'''
Adds a tablespace to the Postgres server.
CLI Example:
.. code-block:: bash
salt '*' postgres.table... | [
"Adds",
"a",
"tablespace",
"to",
"the",
"Postgres",
"server",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L734-L767 | [
"def",
"tablespace_create",
"(",
"name",
",",
"location",
",",
"options",
"=",
"None",
",",
"owner",
"=",
"None",
",",
"user",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"maintenance_db",
"=",
"None",
",",
"password",
"=",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | tablespace_alter | Change tablespace name, owner, or options.
CLI Example:
.. code-block:: bash
salt '*' postgres.tablespace_alter tsname new_owner=otheruser
salt '*' postgres.tablespace_alter index_space new_name=fast_raid
salt '*' postgres.tablespace_alter test set_option="{'seq_page_cost': '1.1'}"
... | salt/modules/postgres.py | def tablespace_alter(name, user=None, host=None, port=None, maintenance_db=None,
password=None, new_name=None, new_owner=None,
set_option=None, reset_option=None, runas=None):
'''
Change tablespace name, owner, or options.
CLI Example:
.. code-block:: bash
... | def tablespace_alter(name, user=None, host=None, port=None, maintenance_db=None,
password=None, new_name=None, new_owner=None,
set_option=None, reset_option=None, runas=None):
'''
Change tablespace name, owner, or options.
CLI Example:
.. code-block:: bash
... | [
"Change",
"tablespace",
"name",
"owner",
"or",
"options",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L770-L813 | [
"def",
"tablespace_alter",
"(",
"name",
",",
"user",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"maintenance_db",
"=",
"None",
",",
"password",
"=",
"None",
",",
"new_name",
"=",
"None",
",",
"new_owner",
"=",
"None",
",",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | tablespace_remove | Removes a tablespace from the Postgres server.
CLI Example:
.. code-block:: bash
salt '*' postgres.tablespace_remove tsname
.. versionadded:: 2015.8.0 | salt/modules/postgres.py | def tablespace_remove(name, user=None, host=None, port=None,
maintenance_db=None, password=None, runas=None):
'''
Removes a tablespace from the Postgres server.
CLI Example:
.. code-block:: bash
salt '*' postgres.tablespace_remove tsname
.. versionadded:: 2015.8.0
... | def tablespace_remove(name, user=None, host=None, port=None,
maintenance_db=None, password=None, runas=None):
'''
Removes a tablespace from the Postgres server.
CLI Example:
.. code-block:: bash
salt '*' postgres.tablespace_remove tsname
.. versionadded:: 2015.8.0
... | [
"Removes",
"a",
"tablespace",
"from",
"the",
"Postgres",
"server",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L816-L837 | [
"def",
"tablespace_remove",
"(",
"name",
",",
"user",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"maintenance_db",
"=",
"None",
",",
"password",
"=",
"None",
",",
"runas",
"=",
"None",
")",
":",
"query",
"=",
"'DROP TABLESPAC... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | user_list | Return a dict with information about users of a Postgres server.
Set return_password to True to get password hash in the result.
CLI Example:
.. code-block:: bash
salt '*' postgres.user_list | salt/modules/postgres.py | def user_list(user=None, host=None, port=None, maintenance_db=None,
password=None, runas=None, return_password=False):
'''
Return a dict with information about users of a Postgres server.
Set return_password to True to get password hash in the result.
CLI Example:
.. code-block:: ba... | def user_list(user=None, host=None, port=None, maintenance_db=None,
password=None, runas=None, return_password=False):
'''
Return a dict with information about users of a Postgres server.
Set return_password to True to get password hash in the result.
CLI Example:
.. code-block:: ba... | [
"Return",
"a",
"dict",
"with",
"information",
"about",
"users",
"of",
"a",
"Postgres",
"server",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L842-L941 | [
"def",
"user_list",
"(",
"user",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"maintenance_db",
"=",
"None",
",",
"password",
"=",
"None",
",",
"runas",
"=",
"None",
",",
"return_password",
"=",
"False",
")",
":",
"ret",
"=",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | role_get | Return a dict with information about users of a Postgres server.
Set return_password to True to get password hash in the result.
CLI Example:
.. code-block:: bash
salt '*' postgres.role_get postgres | salt/modules/postgres.py | def role_get(name, user=None, host=None, port=None, maintenance_db=None,
password=None, runas=None, return_password=False):
'''
Return a dict with information about users of a Postgres server.
Set return_password to True to get password hash in the result.
CLI Example:
.. code-block:... | def role_get(name, user=None, host=None, port=None, maintenance_db=None,
password=None, runas=None, return_password=False):
'''
Return a dict with information about users of a Postgres server.
Set return_password to True to get password hash in the result.
CLI Example:
.. code-block:... | [
"Return",
"a",
"dict",
"with",
"information",
"about",
"users",
"of",
"a",
"Postgres",
"server",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L944-L968 | [
"def",
"role_get",
"(",
"name",
",",
"user",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"maintenance_db",
"=",
"None",
",",
"password",
"=",
"None",
",",
"runas",
"=",
"None",
",",
"return_password",
"=",
"False",
")",
":",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | user_exists | Checks if a user exists on the Postgres server.
CLI Example:
.. code-block:: bash
salt '*' postgres.user_exists 'username' | salt/modules/postgres.py | def user_exists(name,
user=None, host=None, port=None, maintenance_db=None,
password=None,
runas=None):
'''
Checks if a user exists on the Postgres server.
CLI Example:
.. code-block:: bash
salt '*' postgres.user_exists 'username'
'''
re... | def user_exists(name,
user=None, host=None, port=None, maintenance_db=None,
password=None,
runas=None):
'''
Checks if a user exists on the Postgres server.
CLI Example:
.. code-block:: bash
salt '*' postgres.user_exists 'username'
'''
re... | [
"Checks",
"if",
"a",
"user",
"exists",
"on",
"the",
"Postgres",
"server",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L971-L992 | [
"def",
"user_exists",
"(",
"name",
",",
"user",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"maintenance_db",
"=",
"None",
",",
"password",
"=",
"None",
",",
"runas",
"=",
"None",
")",
":",
"return",
"bool",
"(",
"role_get",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _maybe_encrypt_password | pgsql passwords are md5 hashes of the string: 'md5{password}{rolename}' | salt/modules/postgres.py | def _maybe_encrypt_password(role,
password,
encrypted=_DEFAULT_PASSWORDS_ENCRYPTION):
'''
pgsql passwords are md5 hashes of the string: 'md5{password}{rolename}'
'''
if password is not None:
password = six.text_type(password)
if encrypt... | def _maybe_encrypt_password(role,
password,
encrypted=_DEFAULT_PASSWORDS_ENCRYPTION):
'''
pgsql passwords are md5 hashes of the string: 'md5{password}{rolename}'
'''
if password is not None:
password = six.text_type(password)
if encrypt... | [
"pgsql",
"passwords",
"are",
"md5",
"hashes",
"of",
"the",
"string",
":",
"md5",
"{",
"password",
"}",
"{",
"rolename",
"}"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L1015-L1026 | [
"def",
"_maybe_encrypt_password",
"(",
"role",
",",
"password",
",",
"encrypted",
"=",
"_DEFAULT_PASSWORDS_ENCRYPTION",
")",
":",
"if",
"password",
"is",
"not",
"None",
":",
"password",
"=",
"six",
".",
"text_type",
"(",
"password",
")",
"if",
"encrypted",
"an... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _role_create | Creates a Postgres role. Users and Groups are both roles in postgres.
However, users can login, groups cannot. | salt/modules/postgres.py | def _role_create(name,
user=None,
host=None,
port=None,
maintenance_db=None,
password=None,
createdb=None,
createroles=None,
encrypted=None,
superuser=None,
... | def _role_create(name,
user=None,
host=None,
port=None,
maintenance_db=None,
password=None,
createdb=None,
createroles=None,
encrypted=None,
superuser=None,
... | [
"Creates",
"a",
"Postgres",
"role",
".",
"Users",
"and",
"Groups",
"are",
"both",
"roles",
"in",
"postgres",
".",
"However",
"users",
"can",
"login",
"groups",
"cannot",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L1119-L1170 | [
"def",
"_role_create",
"(",
"name",
",",
"user",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"maintenance_db",
"=",
"None",
",",
"password",
"=",
"None",
",",
"createdb",
"=",
"None",
",",
"createroles",
"=",
"None",
",",
"e... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | user_create | Creates a Postgres user.
CLI Examples:
.. code-block:: bash
salt '*' postgres.user_create 'username' user='user' \\
host='hostname' port='port' password='password' \\
rolepassword='rolepassword' valid_until='valid_until' | salt/modules/postgres.py | def user_create(username,
user=None,
host=None,
port=None,
maintenance_db=None,
password=None,
createdb=None,
createroles=None,
inherit=None,
login=None,
connli... | def user_create(username,
user=None,
host=None,
port=None,
maintenance_db=None,
password=None,
createdb=None,
createroles=None,
inherit=None,
login=None,
connli... | [
"Creates",
"a",
"Postgres",
"user",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L1173-L1220 | [
"def",
"user_create",
"(",
"username",
",",
"user",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"maintenance_db",
"=",
"None",
",",
"password",
"=",
"None",
",",
"createdb",
"=",
"None",
",",
"createroles",
"=",
"None",
",",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _role_update | Updates a postgres role. | salt/modules/postgres.py | def _role_update(name,
user=None,
host=None,
port=None,
maintenance_db=None,
password=None,
createdb=None,
typ_='role',
createroles=None,
inherit=None,
... | def _role_update(name,
user=None,
host=None,
port=None,
maintenance_db=None,
password=None,
createdb=None,
typ_='role',
createroles=None,
inherit=None,
... | [
"Updates",
"a",
"postgres",
"role",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L1223-L1282 | [
"def",
"_role_update",
"(",
"name",
",",
"user",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"maintenance_db",
"=",
"None",
",",
"password",
"=",
"None",
",",
"createdb",
"=",
"None",
",",
"typ_",
"=",
"'role'",
",",
"create... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _role_remove | Removes a role from the Postgres Server | salt/modules/postgres.py | def _role_remove(name, user=None, host=None, port=None, maintenance_db=None,
password=None, runas=None):
'''
Removes a role from the Postgres Server
'''
# check if user exists
if not user_exists(name, user, host, port, maintenance_db,
password=password, runas... | def _role_remove(name, user=None, host=None, port=None, maintenance_db=None,
password=None, runas=None):
'''
Removes a role from the Postgres Server
'''
# check if user exists
if not user_exists(name, user, host, port, maintenance_db,
password=password, runas... | [
"Removes",
"a",
"role",
"from",
"the",
"Postgres",
"Server"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L1335-L1359 | [
"def",
"_role_remove",
"(",
"name",
",",
"user",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"maintenance_db",
"=",
"None",
",",
"password",
"=",
"None",
",",
"runas",
"=",
"None",
")",
":",
"# check if user exists",
"if",
"no... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | installed_extensions | List installed postgresql extensions
CLI Example:
.. code-block:: bash
salt '*' postgres.installed_extensions | salt/modules/postgres.py | def installed_extensions(user=None,
host=None,
port=None,
maintenance_db=None,
password=None,
runas=None):
'''
List installed postgresql extensions
CLI Example:
.. code-block:: ... | def installed_extensions(user=None,
host=None,
port=None,
maintenance_db=None,
password=None,
runas=None):
'''
List installed postgresql extensions
CLI Example:
.. code-block:: ... | [
"List",
"installed",
"postgresql",
"extensions"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L1393-L1421 | [
"def",
"installed_extensions",
"(",
"user",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"maintenance_db",
"=",
"None",
",",
"password",
"=",
"None",
",",
"runas",
"=",
"None",
")",
":",
"exts",
"=",
"[",
"]",
"query",
"=",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_available_extension | Get info about an available postgresql extension
CLI Example:
.. code-block:: bash
salt '*' postgres.get_available_extension plpgsql | salt/modules/postgres.py | def get_available_extension(name,
user=None,
host=None,
port=None,
maintenance_db=None,
password=None,
runas=None):
'''
Get info about an availa... | def get_available_extension(name,
user=None,
host=None,
port=None,
maintenance_db=None,
password=None,
runas=None):
'''
Get info about an availa... | [
"Get",
"info",
"about",
"an",
"available",
"postgresql",
"extension"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L1424-L1446 | [
"def",
"get_available_extension",
"(",
"name",
",",
"user",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"maintenance_db",
"=",
"None",
",",
"password",
"=",
"None",
",",
"runas",
"=",
"None",
")",
":",
"return",
"available_exten... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_installed_extension | Get info about an installed postgresql extension
CLI Example:
.. code-block:: bash
salt '*' postgres.get_installed_extension plpgsql | salt/modules/postgres.py | def get_installed_extension(name,
user=None,
host=None,
port=None,
maintenance_db=None,
password=None,
runas=None):
'''
Get info about an instal... | def get_installed_extension(name,
user=None,
host=None,
port=None,
maintenance_db=None,
password=None,
runas=None):
'''
Get info about an instal... | [
"Get",
"info",
"about",
"an",
"installed",
"postgresql",
"extension"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L1449-L1471 | [
"def",
"get_installed_extension",
"(",
"name",
",",
"user",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"maintenance_db",
"=",
"None",
",",
"password",
"=",
"None",
",",
"runas",
"=",
"None",
")",
":",
"return",
"installed_exten... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | is_available_extension | Test if a specific extension is available
CLI Example:
.. code-block:: bash
salt '*' postgres.is_available_extension | salt/modules/postgres.py | def is_available_extension(name,
user=None,
host=None,
port=None,
maintenance_db=None,
password=None,
runas=None):
'''
Test if a specific extension is... | def is_available_extension(name,
user=None,
host=None,
port=None,
maintenance_db=None,
password=None,
runas=None):
'''
Test if a specific extension is... | [
"Test",
"if",
"a",
"specific",
"extension",
"is",
"available"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L1474-L1502 | [
"def",
"is_available_extension",
"(",
"name",
",",
"user",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"maintenance_db",
"=",
"None",
",",
"password",
"=",
"None",
",",
"runas",
"=",
"None",
")",
":",
"exts",
"=",
"available_e... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | is_installed_extension | Test if a specific extension is installed
CLI Example:
.. code-block:: bash
salt '*' postgres.is_installed_extension | salt/modules/postgres.py | def is_installed_extension(name,
user=None,
host=None,
port=None,
maintenance_db=None,
password=None,
runas=None):
'''
Test if a specific extension is... | def is_installed_extension(name,
user=None,
host=None,
port=None,
maintenance_db=None,
password=None,
runas=None):
'''
Test if a specific extension is... | [
"Test",
"if",
"a",
"specific",
"extension",
"is",
"installed"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L1514-L1539 | [
"def",
"is_installed_extension",
"(",
"name",
",",
"user",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"maintenance_db",
"=",
"None",
",",
"password",
"=",
"None",
",",
"runas",
"=",
"None",
")",
":",
"installed_ext",
"=",
"ge... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | create_metadata | Get lifecycle information about an extension
CLI Example:
.. code-block:: bash
salt '*' postgres.create_metadata adminpack | salt/modules/postgres.py | def create_metadata(name,
ext_version=None,
schema=None,
user=None,
host=None,
port=None,
maintenance_db=None,
password=None,
runas=None):
'''
Get lifec... | def create_metadata(name,
ext_version=None,
schema=None,
user=None,
host=None,
port=None,
maintenance_db=None,
password=None,
runas=None):
'''
Get lifec... | [
"Get",
"lifecycle",
"information",
"about",
"an",
"extension"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L1542-L1586 | [
"def",
"create_metadata",
"(",
"name",
",",
"ext_version",
"=",
"None",
",",
"schema",
"=",
"None",
",",
"user",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"maintenance_db",
"=",
"None",
",",
"password",
"=",
"None",
",",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | drop_extension | Drop an installed postgresql extension
CLI Example:
.. code-block:: bash
salt '*' postgres.drop_extension 'adminpack' | salt/modules/postgres.py | def drop_extension(name,
if_exists=None,
restrict=None,
cascade=None,
user=None,
host=None,
port=None,
maintenance_db=None,
password=None,
runas=None... | def drop_extension(name,
if_exists=None,
restrict=None,
cascade=None,
user=None,
host=None,
port=None,
maintenance_db=None,
password=None,
runas=None... | [
"Drop",
"an",
"installed",
"postgresql",
"extension"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L1589-L1645 | [
"def",
"drop_extension",
"(",
"name",
",",
"if_exists",
"=",
"None",
",",
"restrict",
"=",
"None",
",",
"cascade",
"=",
"None",
",",
"user",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"maintenance_db",
"=",
"None",
",",
"pa... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | create_extension | Install a postgresql extension
CLI Example:
.. code-block:: bash
salt '*' postgres.create_extension 'adminpack' | salt/modules/postgres.py | def create_extension(name,
if_not_exists=None,
schema=None,
ext_version=None,
from_version=None,
user=None,
host=None,
port=None,
maintenance_db=None,
... | def create_extension(name,
if_not_exists=None,
schema=None,
ext_version=None,
from_version=None,
user=None,
host=None,
port=None,
maintenance_db=None,
... | [
"Install",
"a",
"postgresql",
"extension"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L1648-L1735 | [
"def",
"create_extension",
"(",
"name",
",",
"if_not_exists",
"=",
"None",
",",
"schema",
"=",
"None",
",",
"ext_version",
"=",
"None",
",",
"from_version",
"=",
"None",
",",
"user",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | user_remove | Removes a user from the Postgres server.
CLI Example:
.. code-block:: bash
salt '*' postgres.user_remove 'username' | salt/modules/postgres.py | def user_remove(username,
user=None,
host=None,
port=None,
maintenance_db=None,
password=None,
runas=None):
'''
Removes a user from the Postgres server.
CLI Example:
.. code-block:: bash
salt '*' p... | def user_remove(username,
user=None,
host=None,
port=None,
maintenance_db=None,
password=None,
runas=None):
'''
Removes a user from the Postgres server.
CLI Example:
.. code-block:: bash
salt '*' p... | [
"Removes",
"a",
"user",
"from",
"the",
"Postgres",
"server",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L1738-L1760 | [
"def",
"user_remove",
"(",
"username",
",",
"user",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"maintenance_db",
"=",
"None",
",",
"password",
"=",
"None",
",",
"runas",
"=",
"None",
")",
":",
"return",
"_role_remove",
"(",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | group_create | Creates a Postgres group. A group is postgres is similar to a user, but
cannot login.
CLI Example:
.. code-block:: bash
salt '*' postgres.group_create 'groupname' user='user' \\
host='hostname' port='port' password='password' \\
rolepassword='rolepassword' | salt/modules/postgres.py | def group_create(groupname,
user=None,
host=None,
port=None,
maintenance_db=None,
password=None,
createdb=None,
createroles=None,
encrypted=None,
login=None,
... | def group_create(groupname,
user=None,
host=None,
port=None,
maintenance_db=None,
password=None,
createdb=None,
createroles=None,
encrypted=None,
login=None,
... | [
"Creates",
"a",
"Postgres",
"group",
".",
"A",
"group",
"is",
"postgres",
"is",
"similar",
"to",
"a",
"user",
"but",
"cannot",
"login",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L1765-L1809 | [
"def",
"group_create",
"(",
"groupname",
",",
"user",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"maintenance_db",
"=",
"None",
",",
"password",
"=",
"None",
",",
"createdb",
"=",
"None",
",",
"createroles",
"=",
"None",
",",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | group_remove | Removes a group from the Postgres server.
CLI Example:
.. code-block:: bash
salt '*' postgres.group_remove 'groupname' | salt/modules/postgres.py | def group_remove(groupname,
user=None,
host=None,
port=None,
maintenance_db=None,
password=None,
runas=None):
'''
Removes a group from the Postgres server.
CLI Example:
.. code-block:: bash
s... | def group_remove(groupname,
user=None,
host=None,
port=None,
maintenance_db=None,
password=None,
runas=None):
'''
Removes a group from the Postgres server.
CLI Example:
.. code-block:: bash
s... | [
"Removes",
"a",
"group",
"from",
"the",
"Postgres",
"server",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L1858-L1880 | [
"def",
"group_remove",
"(",
"groupname",
",",
"user",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"maintenance_db",
"=",
"None",
",",
"password",
"=",
"None",
",",
"runas",
"=",
"None",
")",
":",
"return",
"_role_remove",
"(",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | owner_to | Set the owner of all schemas, functions, tables, views and sequences to
the given username.
CLI Example:
.. code-block:: bash
salt '*' postgres.owner_to 'dbname' 'username' | salt/modules/postgres.py | def owner_to(dbname,
ownername,
user=None,
host=None,
port=None,
password=None,
runas=None):
'''
Set the owner of all schemas, functions, tables, views and sequences to
the given username.
CLI Example:
.. code-block:: ba... | def owner_to(dbname,
ownername,
user=None,
host=None,
port=None,
password=None,
runas=None):
'''
Set the owner of all schemas, functions, tables, views and sequences to
the given username.
CLI Example:
.. code-block:: ba... | [
"Set",
"the",
"owner",
"of",
"all",
"schemas",
"functions",
"tables",
"views",
"and",
"sequences",
"to",
"the",
"given",
"username",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L1883-L1955 | [
"def",
"owner_to",
"(",
"dbname",
",",
"ownername",
",",
"user",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"password",
"=",
"None",
",",
"runas",
"=",
"None",
")",
":",
"sqlfile",
"=",
"tempfile",
".",
"NamedTemporaryFile",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | schema_create | Creates a Postgres schema.
CLI Example:
.. code-block:: bash
salt '*' postgres.schema_create dbname name owner='owner' \\
user='user' \\
db_user='user' db_password='password'
db_host='hostname' db_port='port' | salt/modules/postgres.py | def schema_create(dbname, name, owner=None,
user=None,
db_user=None, db_password=None,
db_host=None, db_port=None):
'''
Creates a Postgres schema.
CLI Example:
.. code-block:: bash
salt '*' postgres.schema_create dbname name owner='owner' ... | def schema_create(dbname, name, owner=None,
user=None,
db_user=None, db_password=None,
db_host=None, db_port=None):
'''
Creates a Postgres schema.
CLI Example:
.. code-block:: bash
salt '*' postgres.schema_create dbname name owner='owner' ... | [
"Creates",
"a",
"Postgres",
"schema",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L1960-L1993 | [
"def",
"schema_create",
"(",
"dbname",
",",
"name",
",",
"owner",
"=",
"None",
",",
"user",
"=",
"None",
",",
"db_user",
"=",
"None",
",",
"db_password",
"=",
"None",
",",
"db_host",
"=",
"None",
",",
"db_port",
"=",
"None",
")",
":",
"# check if schem... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | schema_remove | Removes a schema from the Postgres server.
CLI Example:
.. code-block:: bash
salt '*' postgres.schema_remove dbname schemaname
dbname
Database name we work on
schemaname
The schema's name we'll remove
user
System user all operations should be performed on behalf... | salt/modules/postgres.py | def schema_remove(dbname, name,
user=None,
db_user=None, db_password=None,
db_host=None, db_port=None):
'''
Removes a schema from the Postgres server.
CLI Example:
.. code-block:: bash
salt '*' postgres.schema_remove dbname schemaname
... | def schema_remove(dbname, name,
user=None,
db_user=None, db_password=None,
db_host=None, db_port=None):
'''
Removes a schema from the Postgres server.
CLI Example:
.. code-block:: bash
salt '*' postgres.schema_remove dbname schemaname
... | [
"Removes",
"a",
"schema",
"from",
"the",
"Postgres",
"server",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L1996-L2053 | [
"def",
"schema_remove",
"(",
"dbname",
",",
"name",
",",
"user",
"=",
"None",
",",
"db_user",
"=",
"None",
",",
"db_password",
"=",
"None",
",",
"db_host",
"=",
"None",
",",
"db_port",
"=",
"None",
")",
":",
"# check if schema exists",
"if",
"not",
"sche... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | schema_exists | Checks if a schema exists on the Postgres server.
CLI Example:
.. code-block:: bash
salt '*' postgres.schema_exists dbname schemaname
dbname
Database name we query on
name
Schema name we look for
user
The system user the operation should be performed on behalf of... | salt/modules/postgres.py | def schema_exists(dbname, name, user=None,
db_user=None, db_password=None,
db_host=None, db_port=None):
'''
Checks if a schema exists on the Postgres server.
CLI Example:
.. code-block:: bash
salt '*' postgres.schema_exists dbname schemaname
dbname
... | def schema_exists(dbname, name, user=None,
db_user=None, db_password=None,
db_host=None, db_port=None):
'''
Checks if a schema exists on the Postgres server.
CLI Example:
.. code-block:: bash
salt '*' postgres.schema_exists dbname schemaname
dbname
... | [
"Checks",
"if",
"a",
"schema",
"exists",
"on",
"the",
"Postgres",
"server",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L2056-L2095 | [
"def",
"schema_exists",
"(",
"dbname",
",",
"name",
",",
"user",
"=",
"None",
",",
"db_user",
"=",
"None",
",",
"db_password",
"=",
"None",
",",
"db_host",
"=",
"None",
",",
"db_port",
"=",
"None",
")",
":",
"return",
"bool",
"(",
"schema_get",
"(",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | schema_get | Return a dict with information about schemas in a database.
CLI Example:
.. code-block:: bash
salt '*' postgres.schema_get dbname name
dbname
Database name we query on
name
Schema name we look for
user
The system user the operation should be performed on behalf o... | salt/modules/postgres.py | def schema_get(dbname, name, user=None,
db_user=None, db_password=None,
db_host=None, db_port=None):
'''
Return a dict with information about schemas in a database.
CLI Example:
.. code-block:: bash
salt '*' postgres.schema_get dbname name
dbname
Dat... | def schema_get(dbname, name, user=None,
db_user=None, db_password=None,
db_host=None, db_port=None):
'''
Return a dict with information about schemas in a database.
CLI Example:
.. code-block:: bash
salt '*' postgres.schema_get dbname name
dbname
Dat... | [
"Return",
"a",
"dict",
"with",
"information",
"about",
"schemas",
"in",
"a",
"database",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L2098-L2140 | [
"def",
"schema_get",
"(",
"dbname",
",",
"name",
",",
"user",
"=",
"None",
",",
"db_user",
"=",
"None",
",",
"db_password",
"=",
"None",
",",
"db_host",
"=",
"None",
",",
"db_port",
"=",
"None",
")",
":",
"all_schemas",
"=",
"schema_list",
"(",
"dbname... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | schema_list | Return a dict with information about schemas in a Postgres database.
CLI Example:
.. code-block:: bash
salt '*' postgres.schema_list dbname
dbname
Database name we query on
user
The system user the operation should be performed on behalf of
db_user
database user... | salt/modules/postgres.py | def schema_list(dbname, user=None,
db_user=None, db_password=None,
db_host=None, db_port=None):
'''
Return a dict with information about schemas in a Postgres database.
CLI Example:
.. code-block:: bash
salt '*' postgres.schema_list dbname
dbname
D... | def schema_list(dbname, user=None,
db_user=None, db_password=None,
db_host=None, db_port=None):
'''
Return a dict with information about schemas in a Postgres database.
CLI Example:
.. code-block:: bash
salt '*' postgres.schema_list dbname
dbname
D... | [
"Return",
"a",
"dict",
"with",
"information",
"about",
"schemas",
"in",
"a",
"Postgres",
"database",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L2143-L2198 | [
"def",
"schema_list",
"(",
"dbname",
",",
"user",
"=",
"None",
",",
"db_user",
"=",
"None",
",",
"db_password",
"=",
"None",
",",
"db_host",
"=",
"None",
",",
"db_port",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"}",
"query",
"=",
"(",
"''",
".",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | language_list | .. versionadded:: 2016.3.0
Return a list of languages in a database.
CLI Example:
.. code-block:: bash
salt '*' postgres.language_list dbname
maintenance_db
The database to check
user
database username if different from config or default
password
user passw... | salt/modules/postgres.py | def language_list(
maintenance_db,
user=None,
host=None,
port=None,
password=None,
runas=None):
'''
.. versionadded:: 2016.3.0
Return a list of languages in a database.
CLI Example:
.. code-block:: bash
salt '*' postgres.language_list dbnam... | def language_list(
maintenance_db,
user=None,
host=None,
port=None,
password=None,
runas=None):
'''
.. versionadded:: 2016.3.0
Return a list of languages in a database.
CLI Example:
.. code-block:: bash
salt '*' postgres.language_list dbnam... | [
"..",
"versionadded",
"::",
"2016",
".",
"3",
".",
"0"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L2201-L2253 | [
"def",
"language_list",
"(",
"maintenance_db",
",",
"user",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"password",
"=",
"None",
",",
"runas",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"}",
"query",
"=",
"'SELECT lanname AS \"Na... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | language_exists | .. versionadded:: 2016.3.0
Checks if language exists in a database.
CLI Example:
.. code-block:: bash
salt '*' postgres.language_exists plpgsql dbname
name
Language to check for
maintenance_db
The database to check in
user
database username if different from... | salt/modules/postgres.py | def language_exists(
name,
maintenance_db,
user=None,
host=None,
port=None,
password=None,
runas=None):
'''
.. versionadded:: 2016.3.0
Checks if language exists in a database.
CLI Example:
.. code-block:: bash
salt '*' postgres.lang... | def language_exists(
name,
maintenance_db,
user=None,
host=None,
port=None,
password=None,
runas=None):
'''
.. versionadded:: 2016.3.0
Checks if language exists in a database.
CLI Example:
.. code-block:: bash
salt '*' postgres.lang... | [
"..",
"versionadded",
"::",
"2016",
".",
"3",
".",
"0"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L2256-L2303 | [
"def",
"language_exists",
"(",
"name",
",",
"maintenance_db",
",",
"user",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"password",
"=",
"None",
",",
"runas",
"=",
"None",
")",
":",
"languages",
"=",
"language_list",
"(",
"main... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | language_create | .. versionadded:: 2016.3.0
Installs a language into a database
CLI Example:
.. code-block:: bash
salt '*' postgres.language_create plpgsql dbname
name
Language to install
maintenance_db
The database to install the language in
user
database username if differ... | salt/modules/postgres.py | def language_create(name,
maintenance_db,
user=None,
host=None,
port=None,
password=None,
runas=None):
'''
.. versionadded:: 2016.3.0
Installs a language into a database
CLI Example:... | def language_create(name,
maintenance_db,
user=None,
host=None,
port=None,
password=None,
runas=None):
'''
.. versionadded:: 2016.3.0
Installs a language into a database
CLI Example:... | [
"..",
"versionadded",
"::",
"2016",
".",
"3",
".",
"0"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L2306-L2360 | [
"def",
"language_create",
"(",
"name",
",",
"maintenance_db",
",",
"user",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"password",
"=",
"None",
",",
"runas",
"=",
"None",
")",
":",
"if",
"language_exists",
"(",
"name",
",",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _make_default_privileges_list_query | Generate the SQL required for specific object type | salt/modules/postgres.py | def _make_default_privileges_list_query(name, object_type, prepend):
'''
Generate the SQL required for specific object type
'''
if object_type == 'table':
query = (' '.join([
'SELECT defacl.defaclacl AS name',
'FROM pg_default_acl defacl',
'JOIN pg_authid aid'... | def _make_default_privileges_list_query(name, object_type, prepend):
'''
Generate the SQL required for specific object type
'''
if object_type == 'table':
query = (' '.join([
'SELECT defacl.defaclacl AS name',
'FROM pg_default_acl defacl',
'JOIN pg_authid aid'... | [
"Generate",
"the",
"SQL",
"required",
"for",
"specific",
"object",
"type"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L2420-L2480 | [
"def",
"_make_default_privileges_list_query",
"(",
"name",
",",
"object_type",
",",
"prepend",
")",
":",
"if",
"object_type",
"==",
"'table'",
":",
"query",
"=",
"(",
"' '",
".",
"join",
"(",
"[",
"'SELECT defacl.defaclacl AS name'",
",",
"'FROM pg_default_acl defac... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _make_privileges_list_query | Generate the SQL required for specific object type | salt/modules/postgres.py | def _make_privileges_list_query(name, object_type, prepend):
'''
Generate the SQL required for specific object type
'''
if object_type == 'table':
query = (' '.join([
'SELECT relacl AS name',
'FROM pg_catalog.pg_class c',
'JOIN pg_catalog.pg_namespace n',
... | def _make_privileges_list_query(name, object_type, prepend):
'''
Generate the SQL required for specific object type
'''
if object_type == 'table':
query = (' '.join([
'SELECT relacl AS name',
'FROM pg_catalog.pg_class c',
'JOIN pg_catalog.pg_namespace n',
... | [
"Generate",
"the",
"SQL",
"required",
"for",
"specific",
"object",
"type"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L2483-L2560 | [
"def",
"_make_privileges_list_query",
"(",
"name",
",",
"object_type",
",",
"prepend",
")",
":",
"if",
"object_type",
"==",
"'table'",
":",
"query",
"=",
"(",
"' '",
".",
"join",
"(",
"[",
"'SELECT relacl AS name'",
",",
"'FROM pg_catalog.pg_class c'",
",",
"'JO... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _get_object_owner | Return the owner of a postgres object | salt/modules/postgres.py | def _get_object_owner(name,
object_type,
prepend='public',
maintenance_db=None,
user=None,
host=None,
port=None,
password=None,
runas=None):
'''
Return the owner of a postgres object
'''
if object_type == 'table':
query = (' '.join(... | def _get_object_owner(name,
object_type,
prepend='public',
maintenance_db=None,
user=None,
host=None,
port=None,
password=None,
runas=None):
'''
Return the owner of a postgres object
'''
if object_type == 'table':
query = (' '.join(... | [
"Return",
"the",
"owner",
"of",
"a",
"postgres",
"object"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L2563-L2650 | [
"def",
"_get_object_owner",
"(",
"name",
",",
"object_type",
",",
"prepend",
"=",
"'public'",
",",
"maintenance_db",
"=",
"None",
",",
"user",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"password",
"=",
"None",
",",
"runas",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _validate_default_privileges | Validate the supplied privileges | salt/modules/postgres.py | def _validate_default_privileges(object_type, defprivs, defprivileges):
'''
Validate the supplied privileges
'''
if object_type != 'group':
_defperms = [_DEFAULT_PRIVILEGES_MAP[defperm]
for defperm in _DEFAULT_PRIVILEGE_TYPE_MAP[object_type]]
_defperms.append('ALL')
... | def _validate_default_privileges(object_type, defprivs, defprivileges):
'''
Validate the supplied privileges
'''
if object_type != 'group':
_defperms = [_DEFAULT_PRIVILEGES_MAP[defperm]
for defperm in _DEFAULT_PRIVILEGE_TYPE_MAP[object_type]]
_defperms.append('ALL')
... | [
"Validate",
"the",
"supplied",
"privileges"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L2653-L2674 | [
"def",
"_validate_default_privileges",
"(",
"object_type",
",",
"defprivs",
",",
"defprivileges",
")",
":",
"if",
"object_type",
"!=",
"'group'",
":",
"_defperms",
"=",
"[",
"_DEFAULT_PRIVILEGES_MAP",
"[",
"defperm",
"]",
"for",
"defperm",
"in",
"_DEFAULT_PRIVILEGE_... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _mod_defpriv_opts | Format options | salt/modules/postgres.py | def _mod_defpriv_opts(object_type, defprivileges):
'''
Format options
'''
object_type = object_type.lower()
defprivileges = '' if defprivileges is None else defprivileges
_defprivs = re.split(r'\s?,\s?', defprivileges.upper())
return object_type, defprivileges, _defprivs | def _mod_defpriv_opts(object_type, defprivileges):
'''
Format options
'''
object_type = object_type.lower()
defprivileges = '' if defprivileges is None else defprivileges
_defprivs = re.split(r'\s?,\s?', defprivileges.upper())
return object_type, defprivileges, _defprivs | [
"Format",
"options"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L2677-L2685 | [
"def",
"_mod_defpriv_opts",
"(",
"object_type",
",",
"defprivileges",
")",
":",
"object_type",
"=",
"object_type",
".",
"lower",
"(",
")",
"defprivileges",
"=",
"''",
"if",
"defprivileges",
"is",
"None",
"else",
"defprivileges",
"_defprivs",
"=",
"re",
".",
"s... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _process_defpriv_part | Process part | salt/modules/postgres.py | def _process_defpriv_part(defperms):
'''
Process part
'''
_tmp = {}
previous = None
for defperm in defperms:
if previous is None:
_tmp[_DEFAULT_PRIVILEGES_MAP[defperm]] = False
previous = _DEFAULT_PRIVILEGES_MAP[defperm]
else:
if defperm == '*'... | def _process_defpriv_part(defperms):
'''
Process part
'''
_tmp = {}
previous = None
for defperm in defperms:
if previous is None:
_tmp[_DEFAULT_PRIVILEGES_MAP[defperm]] = False
previous = _DEFAULT_PRIVILEGES_MAP[defperm]
else:
if defperm == '*'... | [
"Process",
"part"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L2688-L2704 | [
"def",
"_process_defpriv_part",
"(",
"defperms",
")",
":",
"_tmp",
"=",
"{",
"}",
"previous",
"=",
"None",
"for",
"defperm",
"in",
"defperms",
":",
"if",
"previous",
"is",
"None",
":",
"_tmp",
"[",
"_DEFAULT_PRIVILEGES_MAP",
"[",
"defperm",
"]",
"]",
"=",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _validate_privileges | Validate the supplied privileges | salt/modules/postgres.py | def _validate_privileges(object_type, privs, privileges):
'''
Validate the supplied privileges
'''
if object_type != 'group':
_perms = [_PRIVILEGES_MAP[perm]
for perm in _PRIVILEGE_TYPE_MAP[object_type]]
_perms.append('ALL')
if object_type not in _PRIVILEGES_OBJE... | def _validate_privileges(object_type, privs, privileges):
'''
Validate the supplied privileges
'''
if object_type != 'group':
_perms = [_PRIVILEGES_MAP[perm]
for perm in _PRIVILEGE_TYPE_MAP[object_type]]
_perms.append('ALL')
if object_type not in _PRIVILEGES_OBJE... | [
"Validate",
"the",
"supplied",
"privileges"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L2707-L2728 | [
"def",
"_validate_privileges",
"(",
"object_type",
",",
"privs",
",",
"privileges",
")",
":",
"if",
"object_type",
"!=",
"'group'",
":",
"_perms",
"=",
"[",
"_PRIVILEGES_MAP",
"[",
"perm",
"]",
"for",
"perm",
"in",
"_PRIVILEGE_TYPE_MAP",
"[",
"object_type",
"]... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _mod_priv_opts | Format options | salt/modules/postgres.py | def _mod_priv_opts(object_type, privileges):
'''
Format options
'''
object_type = object_type.lower()
privileges = '' if privileges is None else privileges
_privs = re.split(r'\s?,\s?', privileges.upper())
return object_type, privileges, _privs | def _mod_priv_opts(object_type, privileges):
'''
Format options
'''
object_type = object_type.lower()
privileges = '' if privileges is None else privileges
_privs = re.split(r'\s?,\s?', privileges.upper())
return object_type, privileges, _privs | [
"Format",
"options"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postgres.py#L2731-L2739 | [
"def",
"_mod_priv_opts",
"(",
"object_type",
",",
"privileges",
")",
":",
"object_type",
"=",
"object_type",
".",
"lower",
"(",
")",
"privileges",
"=",
"''",
"if",
"privileges",
"is",
"None",
"else",
"privileges",
"_privs",
"=",
"re",
".",
"split",
"(",
"r... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.