id int32 0 252k | repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
37,100 | saltstack/salt | salt/modules/mac_timezone.py | get_zone | def get_zone():
'''
Displays the current time zone
:return: The current time zone
:rtype: str
CLI Example:
.. code-block:: bash
salt '*' timezone.get_zone
'''
ret = salt.utils.mac_utils.execute_return_result('systemsetup -gettimezone')
return salt.utils.mac_utils.parse_re... | python | def get_zone():
'''
Displays the current time zone
:return: The current time zone
:rtype: str
CLI Example:
.. code-block:: bash
salt '*' timezone.get_zone
'''
ret = salt.utils.mac_utils.execute_return_result('systemsetup -gettimezone')
return salt.utils.mac_utils.parse_re... | [
"def",
"get_zone",
"(",
")",
":",
"ret",
"=",
"salt",
".",
"utils",
".",
"mac_utils",
".",
"execute_return_result",
"(",
"'systemsetup -gettimezone'",
")",
"return",
"salt",
".",
"utils",
".",
"mac_utils",
".",
"parse_return",
"(",
"ret",
")"
] | Displays the current time zone
:return: The current time zone
:rtype: str
CLI Example:
.. code-block:: bash
salt '*' timezone.get_zone | [
"Displays",
"the",
"current",
"time",
"zone"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_timezone.py#L152-L166 |
37,101 | saltstack/salt | salt/modules/mac_timezone.py | list_zones | def list_zones():
'''
Displays a list of available time zones. Use this list when setting a
time zone using ``timezone.set_zone``
:return: a list of time zones
:rtype: list
CLI Example:
.. code-block:: bash
salt '*' timezone.list_zones
'''
ret = salt.utils.mac_utils.execu... | python | def list_zones():
'''
Displays a list of available time zones. Use this list when setting a
time zone using ``timezone.set_zone``
:return: a list of time zones
:rtype: list
CLI Example:
.. code-block:: bash
salt '*' timezone.list_zones
'''
ret = salt.utils.mac_utils.execu... | [
"def",
"list_zones",
"(",
")",
":",
"ret",
"=",
"salt",
".",
"utils",
".",
"mac_utils",
".",
"execute_return_result",
"(",
"'systemsetup -listtimezones'",
")",
"zones",
"=",
"salt",
".",
"utils",
".",
"mac_utils",
".",
"parse_return",
"(",
"ret",
")",
"retur... | Displays a list of available time zones. Use this list when setting a
time zone using ``timezone.set_zone``
:return: a list of time zones
:rtype: list
CLI Example:
.. code-block:: bash
salt '*' timezone.list_zones | [
"Displays",
"a",
"list",
"of",
"available",
"time",
"zones",
".",
"Use",
"this",
"list",
"when",
"setting",
"a",
"time",
"zone",
"using",
"timezone",
".",
"set_zone"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_timezone.py#L201-L219 |
37,102 | saltstack/salt | salt/modules/mac_timezone.py | set_zone | def set_zone(time_zone):
'''
Set the local time zone. Use ``timezone.list_zones`` to list valid time_zone
arguments
:param str time_zone: The time zone to apply
:return: True if successful, False if not
:rtype: bool
:raises: SaltInvocationError on Invalid Timezone
:raises: CommandExec... | python | def set_zone(time_zone):
'''
Set the local time zone. Use ``timezone.list_zones`` to list valid time_zone
arguments
:param str time_zone: The time zone to apply
:return: True if successful, False if not
:rtype: bool
:raises: SaltInvocationError on Invalid Timezone
:raises: CommandExec... | [
"def",
"set_zone",
"(",
"time_zone",
")",
":",
"if",
"time_zone",
"not",
"in",
"list_zones",
"(",
")",
":",
"raise",
"SaltInvocationError",
"(",
"'Invalid Timezone: {0}'",
".",
"format",
"(",
"time_zone",
")",
")",
"salt",
".",
"utils",
".",
"mac_utils",
"."... | Set the local time zone. Use ``timezone.list_zones`` to list valid time_zone
arguments
:param str time_zone: The time zone to apply
:return: True if successful, False if not
:rtype: bool
:raises: SaltInvocationError on Invalid Timezone
:raises: CommandExecutionError on failure
CLI Exampl... | [
"Set",
"the",
"local",
"time",
"zone",
".",
"Use",
"timezone",
".",
"list_zones",
"to",
"list",
"valid",
"time_zone",
"arguments"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_timezone.py#L222-L247 |
37,103 | saltstack/salt | salt/modules/mac_timezone.py | get_using_network_time | def get_using_network_time():
'''
Display whether network time is on or off
:return: True if network time is on, False if off
:rtype: bool
CLI Example:
.. code-block:: bash
salt '*' timezone.get_using_network_time
'''
ret = salt.utils.mac_utils.execute_return_result(
... | python | def get_using_network_time():
'''
Display whether network time is on or off
:return: True if network time is on, False if off
:rtype: bool
CLI Example:
.. code-block:: bash
salt '*' timezone.get_using_network_time
'''
ret = salt.utils.mac_utils.execute_return_result(
... | [
"def",
"get_using_network_time",
"(",
")",
":",
"ret",
"=",
"salt",
".",
"utils",
".",
"mac_utils",
".",
"execute_return_result",
"(",
"'systemsetup -getusingnetworktime'",
")",
"return",
"salt",
".",
"utils",
".",
"mac_utils",
".",
"validate_enabled",
"(",
"salt"... | Display whether network time is on or off
:return: True if network time is on, False if off
:rtype: bool
CLI Example:
.. code-block:: bash
salt '*' timezone.get_using_network_time | [
"Display",
"whether",
"network",
"time",
"is",
"on",
"or",
"off"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_timezone.py#L266-L283 |
37,104 | saltstack/salt | salt/modules/mac_timezone.py | set_using_network_time | def set_using_network_time(enable):
'''
Set whether network time is on or off.
:param enable: True to enable, False to disable. Can also use 'on' or 'off'
:type: str bool
:return: True if successful, False if not
:rtype: bool
:raises: CommandExecutionError on failure
CLI Example:
... | python | def set_using_network_time(enable):
'''
Set whether network time is on or off.
:param enable: True to enable, False to disable. Can also use 'on' or 'off'
:type: str bool
:return: True if successful, False if not
:rtype: bool
:raises: CommandExecutionError on failure
CLI Example:
... | [
"def",
"set_using_network_time",
"(",
"enable",
")",
":",
"state",
"=",
"salt",
".",
"utils",
".",
"mac_utils",
".",
"validate_enabled",
"(",
"enable",
")",
"cmd",
"=",
"'systemsetup -setusingnetworktime {0}'",
".",
"format",
"(",
"state",
")",
"salt",
".",
"u... | Set whether network time is on or off.
:param enable: True to enable, False to disable. Can also use 'on' or 'off'
:type: str bool
:return: True if successful, False if not
:rtype: bool
:raises: CommandExecutionError on failure
CLI Example:
.. code-block:: bash
salt '*' timezon... | [
"Set",
"whether",
"network",
"time",
"is",
"on",
"or",
"off",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_timezone.py#L286-L310 |
37,105 | saltstack/salt | salt/modules/mac_timezone.py | get_time_server | def get_time_server():
'''
Display the currently set network time server.
:return: the network time server
:rtype: str
CLI Example:
.. code-block:: bash
salt '*' timezone.get_time_server
'''
ret = salt.utils.mac_utils.execute_return_result(
'systemsetup -getnetworktim... | python | def get_time_server():
'''
Display the currently set network time server.
:return: the network time server
:rtype: str
CLI Example:
.. code-block:: bash
salt '*' timezone.get_time_server
'''
ret = salt.utils.mac_utils.execute_return_result(
'systemsetup -getnetworktim... | [
"def",
"get_time_server",
"(",
")",
":",
"ret",
"=",
"salt",
".",
"utils",
".",
"mac_utils",
".",
"execute_return_result",
"(",
"'systemsetup -getnetworktimeserver'",
")",
"return",
"salt",
".",
"utils",
".",
"mac_utils",
".",
"parse_return",
"(",
"ret",
")"
] | Display the currently set network time server.
:return: the network time server
:rtype: str
CLI Example:
.. code-block:: bash
salt '*' timezone.get_time_server | [
"Display",
"the",
"currently",
"set",
"network",
"time",
"server",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_timezone.py#L313-L328 |
37,106 | saltstack/salt | salt/modules/mac_timezone.py | set_time_server | def set_time_server(time_server='time.apple.com'):
'''
Designates a network time server. Enter the IP address or DNS name for the
network time server.
:param time_server: IP or DNS name of the network time server. If nothing
is passed the time server will be set to the macOS default of
... | python | def set_time_server(time_server='time.apple.com'):
'''
Designates a network time server. Enter the IP address or DNS name for the
network time server.
:param time_server: IP or DNS name of the network time server. If nothing
is passed the time server will be set to the macOS default of
... | [
"def",
"set_time_server",
"(",
"time_server",
"=",
"'time.apple.com'",
")",
":",
"cmd",
"=",
"'systemsetup -setnetworktimeserver {0}'",
".",
"format",
"(",
"time_server",
")",
"salt",
".",
"utils",
".",
"mac_utils",
".",
"execute_return_success",
"(",
"cmd",
")",
... | Designates a network time server. Enter the IP address or DNS name for the
network time server.
:param time_server: IP or DNS name of the network time server. If nothing
is passed the time server will be set to the macOS default of
'time.apple.com'
:type: str
:return: True if successfu... | [
"Designates",
"a",
"network",
"time",
"server",
".",
"Enter",
"the",
"IP",
"address",
"or",
"DNS",
"name",
"for",
"the",
"network",
"time",
"server",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_timezone.py#L331-L355 |
37,107 | saltstack/salt | salt/modules/nexus.py | get_snapshot | def get_snapshot(nexus_url, repository, group_id, artifact_id, packaging, version, snapshot_version=None, target_dir='/tmp', target_file=None, classifier=None, username=None, password=None):
'''
Gets snapshot of the desired version of the artifact
nexus_url
URL of nexus instance
rep... | python | def get_snapshot(nexus_url, repository, group_id, artifact_id, packaging, version, snapshot_version=None, target_dir='/tmp', target_file=None, classifier=None, username=None, password=None):
'''
Gets snapshot of the desired version of the artifact
nexus_url
URL of nexus instance
rep... | [
"def",
"get_snapshot",
"(",
"nexus_url",
",",
"repository",
",",
"group_id",
",",
"artifact_id",
",",
"packaging",
",",
"version",
",",
"snapshot_version",
"=",
"None",
",",
"target_dir",
"=",
"'/tmp'",
",",
"target_file",
"=",
"None",
",",
"classifier",
"=",
... | Gets snapshot of the desired version of the artifact
nexus_url
URL of nexus instance
repository
Snapshot repository in nexus to retrieve artifact from, for example: libs-snapshots
group_id
Group Id of the artifact
artifact_id
Artifact Id of the ar... | [
"Gets",
"snapshot",
"of",
"the",
"desired",
"version",
"of",
"the",
"artifact"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nexus.py#L83-L118 |
37,108 | saltstack/salt | salt/modules/nexus.py | get_snapshot_version_string | def get_snapshot_version_string(nexus_url, repository, group_id, artifact_id, packaging, version, classifier=None, username=None, password=None):
'''
Gets the specific version string of a snapshot of the desired version of the artifact
nexus_url
URL of nexus instance
repository
... | python | def get_snapshot_version_string(nexus_url, repository, group_id, artifact_id, packaging, version, classifier=None, username=None, password=None):
'''
Gets the specific version string of a snapshot of the desired version of the artifact
nexus_url
URL of nexus instance
repository
... | [
"def",
"get_snapshot_version_string",
"(",
"nexus_url",
",",
"repository",
",",
"group_id",
",",
"artifact_id",
",",
"packaging",
",",
"version",
",",
"classifier",
"=",
"None",
",",
"username",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"log",
"."... | Gets the specific version string of a snapshot of the desired version of the artifact
nexus_url
URL of nexus instance
repository
Snapshot repository in nexus to retrieve artifact from, for example: libs-snapshots
group_id
Group Id of the artifact
artifact_id... | [
"Gets",
"the",
"specific",
"version",
"string",
"of",
"a",
"snapshot",
"of",
"the",
"desired",
"version",
"of",
"the",
"artifact"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nexus.py#L121-L149 |
37,109 | saltstack/salt | salt/sdb/yaml.py | get | def get(key, profile=None): # pylint: disable=W0613
'''
Get a value from the dictionary
'''
data = _get_values(profile)
# Decrypt SDB data if specified in the profile
if profile and profile.get('gpg', False):
return salt.utils.data.traverse_dict_and_list(_decrypt(data), key, None)
... | python | def get(key, profile=None): # pylint: disable=W0613
'''
Get a value from the dictionary
'''
data = _get_values(profile)
# Decrypt SDB data if specified in the profile
if profile and profile.get('gpg', False):
return salt.utils.data.traverse_dict_and_list(_decrypt(data), key, None)
... | [
"def",
"get",
"(",
"key",
",",
"profile",
"=",
"None",
")",
":",
"# pylint: disable=W0613",
"data",
"=",
"_get_values",
"(",
"profile",
")",
"# Decrypt SDB data if specified in the profile",
"if",
"profile",
"and",
"profile",
".",
"get",
"(",
"'gpg'",
",",
"Fals... | Get a value from the dictionary | [
"Get",
"a",
"value",
"from",
"the",
"dictionary"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/sdb/yaml.py#L71-L81 |
37,110 | saltstack/salt | salt/sdb/yaml.py | _get_values | def _get_values(profile=None):
'''
Retrieve all the referenced files, deserialize, then merge them together
'''
profile = profile or {}
serializers = salt.loader.serializers(__opts__)
ret = {}
for fname in profile.get('files', []):
try:
with salt.utils.files.flopen(fname... | python | def _get_values(profile=None):
'''
Retrieve all the referenced files, deserialize, then merge them together
'''
profile = profile or {}
serializers = salt.loader.serializers(__opts__)
ret = {}
for fname in profile.get('files', []):
try:
with salt.utils.files.flopen(fname... | [
"def",
"_get_values",
"(",
"profile",
"=",
"None",
")",
":",
"profile",
"=",
"profile",
"or",
"{",
"}",
"serializers",
"=",
"salt",
".",
"loader",
".",
"serializers",
"(",
"__opts__",
")",
"ret",
"=",
"{",
"}",
"for",
"fname",
"in",
"profile",
".",
"... | Retrieve all the referenced files, deserialize, then merge them together | [
"Retrieve",
"all",
"the",
"referenced",
"files",
"deserialize",
"then",
"merge",
"them",
"together"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/sdb/yaml.py#L84-L102 |
37,111 | saltstack/salt | salt/states/zabbix_host.py | absent | def absent(name, **kwargs):
"""
Ensures that the host does not exists, eventually deletes host.
.. versionadded:: 2016.3.0
:param: name: technical name of the host
:param _connection_user: Optional - zabbix user (can also be set in opts or pillar, see module's docstring)
:param _connection_pas... | python | def absent(name, **kwargs):
"""
Ensures that the host does not exists, eventually deletes host.
.. versionadded:: 2016.3.0
:param: name: technical name of the host
:param _connection_user: Optional - zabbix user (can also be set in opts or pillar, see module's docstring)
:param _connection_pas... | [
"def",
"absent",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"False",
",",
"'comment'",
":",
"''",
"}",
"# Comment and change messages",
"comment_host_dele... | Ensures that the host does not exists, eventually deletes host.
.. versionadded:: 2016.3.0
:param: name: technical name of the host
:param _connection_user: Optional - zabbix user (can also be set in opts or pillar, see module's docstring)
:param _connection_password: Optional - zabbix password (can a... | [
"Ensures",
"that",
"the",
"host",
"does",
"not",
"exists",
"eventually",
"deletes",
"host",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/zabbix_host.py#L340-L407 |
37,112 | saltstack/salt | salt/states/zabbix_host.py | assign_templates | def assign_templates(host, templates, **kwargs):
'''
Ensures that templates are assigned to the host.
.. versionadded:: 2017.7.0
:param host: technical name of the host
:param _connection_user: Optional - zabbix user (can also be set in opts or pillar, see module's docstring)
:param _connectio... | python | def assign_templates(host, templates, **kwargs):
'''
Ensures that templates are assigned to the host.
.. versionadded:: 2017.7.0
:param host: technical name of the host
:param _connection_user: Optional - zabbix user (can also be set in opts or pillar, see module's docstring)
:param _connectio... | [
"def",
"assign_templates",
"(",
"host",
",",
"templates",
",",
"*",
"*",
"kwargs",
")",
":",
"connection_args",
"=",
"{",
"}",
"if",
"'_connection_user'",
"in",
"kwargs",
":",
"connection_args",
"[",
"'_connection_user'",
"]",
"=",
"kwargs",
"[",
"'_connection... | Ensures that templates are assigned to the host.
.. versionadded:: 2017.7.0
:param host: technical name of the host
:param _connection_user: Optional - zabbix user (can also be set in opts or pillar, see module's docstring)
:param _connection_password: Optional - zabbix password (can also be set in op... | [
"Ensures",
"that",
"templates",
"are",
"assigned",
"to",
"the",
"host",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/zabbix_host.py#L410-L516 |
37,113 | saltstack/salt | salt/proxy/cimc.py | logon | def logon():
'''
Logs into the cimc device and returns the session cookie.
'''
content = {}
payload = "<aaaLogin inName='{0}' inPassword='{1}'></aaaLogin>".format(DETAILS['username'], DETAILS['password'])
r = __utils__['http.query'](DETAILS['url'],
data=payload,
... | python | def logon():
'''
Logs into the cimc device and returns the session cookie.
'''
content = {}
payload = "<aaaLogin inName='{0}' inPassword='{1}'></aaaLogin>".format(DETAILS['username'], DETAILS['password'])
r = __utils__['http.query'](DETAILS['url'],
data=payload,
... | [
"def",
"logon",
"(",
")",
":",
"content",
"=",
"{",
"}",
"payload",
"=",
"\"<aaaLogin inName='{0}' inPassword='{1}'></aaaLogin>\"",
".",
"format",
"(",
"DETAILS",
"[",
"'username'",
"]",
",",
"DETAILS",
"[",
"'password'",
"]",
")",
"r",
"=",
"__utils__",
"[",
... | Logs into the cimc device and returns the session cookie. | [
"Logs",
"into",
"the",
"cimc",
"device",
"and",
"returns",
"the",
"session",
"cookie",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/cimc.py#L210-L236 |
37,114 | saltstack/salt | salt/proxy/cimc.py | prepare_return | def prepare_return(x):
'''
Converts the etree to dict
'''
ret = {}
for a in list(x):
if a.tag not in ret:
ret[a.tag] = []
ret[a.tag].append(prepare_return(a))
for a in x.attrib:
ret[a] = x.attrib[a]
return ret | python | def prepare_return(x):
'''
Converts the etree to dict
'''
ret = {}
for a in list(x):
if a.tag not in ret:
ret[a.tag] = []
ret[a.tag].append(prepare_return(a))
for a in x.attrib:
ret[a] = x.attrib[a]
return ret | [
"def",
"prepare_return",
"(",
"x",
")",
":",
"ret",
"=",
"{",
"}",
"for",
"a",
"in",
"list",
"(",
"x",
")",
":",
"if",
"a",
".",
"tag",
"not",
"in",
"ret",
":",
"ret",
"[",
"a",
".",
"tag",
"]",
"=",
"[",
"]",
"ret",
"[",
"a",
".",
"tag",... | Converts the etree to dict | [
"Converts",
"the",
"etree",
"to",
"dict"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/cimc.py#L255-L266 |
37,115 | saltstack/salt | salt/utils/files.py | recursive_copy | def recursive_copy(source, dest):
'''
Recursively copy the source directory to the destination,
leaving files with the source does not explicitly overwrite.
(identical to cp -r on a unix machine)
'''
for root, _, files in salt.utils.path.os_walk(source):
path_from_source = root.replace(... | python | def recursive_copy(source, dest):
'''
Recursively copy the source directory to the destination,
leaving files with the source does not explicitly overwrite.
(identical to cp -r on a unix machine)
'''
for root, _, files in salt.utils.path.os_walk(source):
path_from_source = root.replace(... | [
"def",
"recursive_copy",
"(",
"source",
",",
"dest",
")",
":",
"for",
"root",
",",
"_",
",",
"files",
"in",
"salt",
".",
"utils",
".",
"path",
".",
"os_walk",
"(",
"source",
")",
":",
"path_from_source",
"=",
"root",
".",
"replace",
"(",
"source",
",... | Recursively copy the source directory to the destination,
leaving files with the source does not explicitly overwrite.
(identical to cp -r on a unix machine) | [
"Recursively",
"copy",
"the",
"source",
"directory",
"to",
"the",
"destination",
"leaving",
"files",
"with",
"the",
"source",
"does",
"not",
"explicitly",
"overwrite",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/files.py#L103-L118 |
37,116 | saltstack/salt | salt/utils/files.py | copyfile | def copyfile(source, dest, backup_mode='', cachedir=''):
'''
Copy files from a source to a destination in an atomic way, and if
specified cache the file.
'''
if not os.path.isfile(source):
raise IOError(
'[Errno 2] No such file or directory: {0}'.format(source)
)
if n... | python | def copyfile(source, dest, backup_mode='', cachedir=''):
'''
Copy files from a source to a destination in an atomic way, and if
specified cache the file.
'''
if not os.path.isfile(source):
raise IOError(
'[Errno 2] No such file or directory: {0}'.format(source)
)
if n... | [
"def",
"copyfile",
"(",
"source",
",",
"dest",
",",
"backup_mode",
"=",
"''",
",",
"cachedir",
"=",
"''",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"isfile",
"(",
"source",
")",
":",
"raise",
"IOError",
"(",
"'[Errno 2] No such file or directory: {0}'... | Copy files from a source to a destination in an atomic way, and if
specified cache the file. | [
"Copy",
"files",
"from",
"a",
"source",
"to",
"a",
"destination",
"in",
"an",
"atomic",
"way",
"and",
"if",
"specified",
"cache",
"the",
"file",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/files.py#L121-L181 |
37,117 | saltstack/salt | salt/utils/files.py | process_read_exception | def process_read_exception(exc, path, ignore=None):
'''
Common code for raising exceptions when reading a file fails
The ignore argument can be an iterable of integer error codes (or a single
integer error code) that should be ignored.
'''
if ignore is not None:
if isinstance(ignore, si... | python | def process_read_exception(exc, path, ignore=None):
'''
Common code for raising exceptions when reading a file fails
The ignore argument can be an iterable of integer error codes (or a single
integer error code) that should be ignored.
'''
if ignore is not None:
if isinstance(ignore, si... | [
"def",
"process_read_exception",
"(",
"exc",
",",
"path",
",",
"ignore",
"=",
"None",
")",
":",
"if",
"ignore",
"is",
"not",
"None",
":",
"if",
"isinstance",
"(",
"ignore",
",",
"six",
".",
"integer_types",
")",
":",
"ignore",
"=",
"(",
"ignore",
",",
... | Common code for raising exceptions when reading a file fails
The ignore argument can be an iterable of integer error codes (or a single
integer error code) that should be ignored. | [
"Common",
"code",
"for",
"raising",
"exceptions",
"when",
"reading",
"a",
"file",
"fails"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/files.py#L208-L235 |
37,118 | saltstack/salt | salt/utils/files.py | wait_lock | def wait_lock(path, lock_fn=None, timeout=5, sleep=0.1, time_start=None):
'''
Obtain a write lock. If one exists, wait for it to release first
'''
if not isinstance(path, six.string_types):
raise FileLockError('path must be a string')
if lock_fn is None:
lock_fn = path + '.w'
if ... | python | def wait_lock(path, lock_fn=None, timeout=5, sleep=0.1, time_start=None):
'''
Obtain a write lock. If one exists, wait for it to release first
'''
if not isinstance(path, six.string_types):
raise FileLockError('path must be a string')
if lock_fn is None:
lock_fn = path + '.w'
if ... | [
"def",
"wait_lock",
"(",
"path",
",",
"lock_fn",
"=",
"None",
",",
"timeout",
"=",
"5",
",",
"sleep",
"=",
"0.1",
",",
"time_start",
"=",
"None",
")",
":",
"if",
"not",
"isinstance",
"(",
"path",
",",
"six",
".",
"string_types",
")",
":",
"raise",
... | Obtain a write lock. If one exists, wait for it to release first | [
"Obtain",
"a",
"write",
"lock",
".",
"If",
"one",
"exists",
"wait",
"for",
"it",
"to",
"release",
"first"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/files.py#L239-L312 |
37,119 | saltstack/salt | salt/utils/files.py | set_umask | def set_umask(mask):
'''
Temporarily set the umask and restore once the contextmanager exits
'''
if mask is None or salt.utils.platform.is_windows():
# Don't attempt on Windows, or if no mask was passed
yield
else:
try:
orig_mask = os.umask(mask) # pylint: disabl... | python | def set_umask(mask):
'''
Temporarily set the umask and restore once the contextmanager exits
'''
if mask is None or salt.utils.platform.is_windows():
# Don't attempt on Windows, or if no mask was passed
yield
else:
try:
orig_mask = os.umask(mask) # pylint: disabl... | [
"def",
"set_umask",
"(",
"mask",
")",
":",
"if",
"mask",
"is",
"None",
"or",
"salt",
".",
"utils",
".",
"platform",
".",
"is_windows",
"(",
")",
":",
"# Don't attempt on Windows, or if no mask was passed",
"yield",
"else",
":",
"try",
":",
"orig_mask",
"=",
... | Temporarily set the umask and restore once the contextmanager exits | [
"Temporarily",
"set",
"the",
"umask",
"and",
"restore",
"once",
"the",
"contextmanager",
"exits"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/files.py#L325-L337 |
37,120 | saltstack/salt | salt/utils/files.py | flopen | def flopen(*args, **kwargs):
'''
Shortcut for fopen with lock and context manager.
'''
filename, args = args[0], args[1:]
writing = 'wa'
with fopen(filename, *args, **kwargs) as f_handle:
try:
if is_fcntl_available(check_sunos=True):
lock_type = fcntl.LOCK_SH
... | python | def flopen(*args, **kwargs):
'''
Shortcut for fopen with lock and context manager.
'''
filename, args = args[0], args[1:]
writing = 'wa'
with fopen(filename, *args, **kwargs) as f_handle:
try:
if is_fcntl_available(check_sunos=True):
lock_type = fcntl.LOCK_SH
... | [
"def",
"flopen",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"filename",
",",
"args",
"=",
"args",
"[",
"0",
"]",
",",
"args",
"[",
"1",
":",
"]",
"writing",
"=",
"'wa'",
"with",
"fopen",
"(",
"filename",
",",
"*",
"args",
",",
"*",
... | Shortcut for fopen with lock and context manager. | [
"Shortcut",
"for",
"fopen",
"with",
"lock",
"and",
"context",
"manager",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/files.py#L415-L431 |
37,121 | saltstack/salt | salt/utils/files.py | fpopen | def fpopen(*args, **kwargs):
'''
Shortcut for fopen with extra uid, gid, and mode options.
Supported optional Keyword Arguments:
mode
Explicit mode to set. Mode is anything os.chmod would accept
as input for mode. Works only on unix/unix-like systems.
uid
The uid to set, i... | python | def fpopen(*args, **kwargs):
'''
Shortcut for fopen with extra uid, gid, and mode options.
Supported optional Keyword Arguments:
mode
Explicit mode to set. Mode is anything os.chmod would accept
as input for mode. Works only on unix/unix-like systems.
uid
The uid to set, i... | [
"def",
"fpopen",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# Remove uid, gid and mode from kwargs if present",
"uid",
"=",
"kwargs",
".",
"pop",
"(",
"'uid'",
",",
"-",
"1",
")",
"# -1 means no change to current uid",
"gid",
"=",
"kwargs",
".",
"po... | Shortcut for fopen with extra uid, gid, and mode options.
Supported optional Keyword Arguments:
mode
Explicit mode to set. Mode is anything os.chmod would accept
as input for mode. Works only on unix/unix-like systems.
uid
The uid to set, if not set, or it is None or -1 no changes... | [
"Shortcut",
"for",
"fopen",
"with",
"extra",
"uid",
"gid",
"and",
"mode",
"options",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/files.py#L435-L476 |
37,122 | saltstack/salt | salt/utils/files.py | safe_walk | def safe_walk(top, topdown=True, onerror=None, followlinks=True, _seen=None):
'''
A clone of the python os.walk function with some checks for recursive
symlinks. Unlike os.walk this follows symlinks by default.
'''
if _seen is None:
_seen = set()
# We may not have read permission for to... | python | def safe_walk(top, topdown=True, onerror=None, followlinks=True, _seen=None):
'''
A clone of the python os.walk function with some checks for recursive
symlinks. Unlike os.walk this follows symlinks by default.
'''
if _seen is None:
_seen = set()
# We may not have read permission for to... | [
"def",
"safe_walk",
"(",
"top",
",",
"topdown",
"=",
"True",
",",
"onerror",
"=",
"None",
",",
"followlinks",
"=",
"True",
",",
"_seen",
"=",
"None",
")",
":",
"if",
"_seen",
"is",
"None",
":",
"_seen",
"=",
"set",
"(",
")",
"# We may not have read per... | A clone of the python os.walk function with some checks for recursive
symlinks. Unlike os.walk this follows symlinks by default. | [
"A",
"clone",
"of",
"the",
"python",
"os",
".",
"walk",
"function",
"with",
"some",
"checks",
"for",
"recursive",
"symlinks",
".",
"Unlike",
"os",
".",
"walk",
"this",
"follows",
"symlinks",
"by",
"default",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/files.py#L479-L526 |
37,123 | saltstack/salt | salt/utils/files.py | is_fcntl_available | def is_fcntl_available(check_sunos=False):
'''
Simple function to check if the ``fcntl`` module is available or not.
If ``check_sunos`` is passed as ``True`` an additional check to see if host is
SunOS is also made. For additional information see: http://goo.gl/159FF8
'''
if check_sunos and sal... | python | def is_fcntl_available(check_sunos=False):
'''
Simple function to check if the ``fcntl`` module is available or not.
If ``check_sunos`` is passed as ``True`` an additional check to see if host is
SunOS is also made. For additional information see: http://goo.gl/159FF8
'''
if check_sunos and sal... | [
"def",
"is_fcntl_available",
"(",
"check_sunos",
"=",
"False",
")",
":",
"if",
"check_sunos",
"and",
"salt",
".",
"utils",
".",
"platform",
".",
"is_sunos",
"(",
")",
":",
"return",
"False",
"return",
"HAS_FCNTL"
] | Simple function to check if the ``fcntl`` module is available or not.
If ``check_sunos`` is passed as ``True`` an additional check to see if host is
SunOS is also made. For additional information see: http://goo.gl/159FF8 | [
"Simple",
"function",
"to",
"check",
"if",
"the",
"fcntl",
"module",
"is",
"available",
"or",
"not",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/files.py#L584-L593 |
37,124 | saltstack/salt | salt/utils/files.py | safe_filepath | def safe_filepath(file_path_name, dir_sep=None):
'''
Input the full path and filename, splits on directory separator and calls safe_filename_leaf for
each part of the path. dir_sep allows coder to force a directory separate to a particular character
.. versionadded:: 2017.7.2
:codeauthor: Damon At... | python | def safe_filepath(file_path_name, dir_sep=None):
'''
Input the full path and filename, splits on directory separator and calls safe_filename_leaf for
each part of the path. dir_sep allows coder to force a directory separate to a particular character
.. versionadded:: 2017.7.2
:codeauthor: Damon At... | [
"def",
"safe_filepath",
"(",
"file_path_name",
",",
"dir_sep",
"=",
"None",
")",
":",
"if",
"not",
"dir_sep",
":",
"dir_sep",
"=",
"os",
".",
"sep",
"# Normally if file_path_name or dir_sep is Unicode then the output will be Unicode",
"# This code ensure the output type is th... | Input the full path and filename, splits on directory separator and calls safe_filename_leaf for
each part of the path. dir_sep allows coder to force a directory separate to a particular character
.. versionadded:: 2017.7.2
:codeauthor: Damon Atkins <https://github.com/damon-atkins> | [
"Input",
"the",
"full",
"path",
"and",
"filename",
"splits",
"on",
"directory",
"separator",
"and",
"calls",
"safe_filename_leaf",
"for",
"each",
"part",
"of",
"the",
"path",
".",
"dir_sep",
"allows",
"coder",
"to",
"force",
"a",
"directory",
"separate",
"to",... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/files.py#L619-L639 |
37,125 | saltstack/salt | salt/utils/files.py | is_binary | def is_binary(path):
'''
Detects if the file is a binary, returns bool. Returns True if the file is
a bin, False if the file is not and None if the file is not available.
'''
if not os.path.isfile(path):
return False
try:
with fopen(path, 'rb') as fp_:
try:
... | python | def is_binary(path):
'''
Detects if the file is a binary, returns bool. Returns True if the file is
a bin, False if the file is not and None if the file is not available.
'''
if not os.path.isfile(path):
return False
try:
with fopen(path, 'rb') as fp_:
try:
... | [
"def",
"is_binary",
"(",
"path",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"isfile",
"(",
"path",
")",
":",
"return",
"False",
"try",
":",
"with",
"fopen",
"(",
"path",
",",
"'rb'",
")",
"as",
"fp_",
":",
"try",
":",
"data",
"=",
"fp_",
".... | Detects if the file is a binary, returns bool. Returns True if the file is
a bin, False if the file is not and None if the file is not available. | [
"Detects",
"if",
"the",
"file",
"is",
"a",
"binary",
"returns",
"bool",
".",
"Returns",
"True",
"if",
"the",
"file",
"is",
"a",
"bin",
"False",
"if",
"the",
"file",
"is",
"not",
"and",
"None",
"if",
"the",
"file",
"is",
"not",
"available",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/files.py#L682-L699 |
37,126 | saltstack/salt | salt/utils/files.py | normalize_mode | def normalize_mode(mode):
'''
Return a mode value, normalized to a string and containing a leading zero
if it does not have one.
Allow "keep" as a valid mode (used by file state/module to preserve mode
from the Salt fileserver in file states).
'''
if mode is None:
return None
if... | python | def normalize_mode(mode):
'''
Return a mode value, normalized to a string and containing a leading zero
if it does not have one.
Allow "keep" as a valid mode (used by file state/module to preserve mode
from the Salt fileserver in file states).
'''
if mode is None:
return None
if... | [
"def",
"normalize_mode",
"(",
"mode",
")",
":",
"if",
"mode",
"is",
"None",
":",
"return",
"None",
"if",
"not",
"isinstance",
"(",
"mode",
",",
"six",
".",
"string_types",
")",
":",
"mode",
"=",
"six",
".",
"text_type",
"(",
"mode",
")",
"if",
"six",... | Return a mode value, normalized to a string and containing a leading zero
if it does not have one.
Allow "keep" as a valid mode (used by file state/module to preserve mode
from the Salt fileserver in file states). | [
"Return",
"a",
"mode",
"value",
"normalized",
"to",
"a",
"string",
"and",
"containing",
"a",
"leading",
"zero",
"if",
"it",
"does",
"not",
"have",
"one",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/files.py#L740-L756 |
37,127 | saltstack/salt | salt/utils/files.py | human_size_to_bytes | def human_size_to_bytes(human_size):
'''
Convert human-readable units to bytes
'''
size_exp_map = {'K': 1, 'M': 2, 'G': 3, 'T': 4, 'P': 5}
human_size_str = six.text_type(human_size)
match = re.match(r'^(\d+)([KMGTP])?$', human_size_str)
if not match:
raise ValueError(
'Si... | python | def human_size_to_bytes(human_size):
'''
Convert human-readable units to bytes
'''
size_exp_map = {'K': 1, 'M': 2, 'G': 3, 'T': 4, 'P': 5}
human_size_str = six.text_type(human_size)
match = re.match(r'^(\d+)([KMGTP])?$', human_size_str)
if not match:
raise ValueError(
'Si... | [
"def",
"human_size_to_bytes",
"(",
"human_size",
")",
":",
"size_exp_map",
"=",
"{",
"'K'",
":",
"1",
",",
"'M'",
":",
"2",
",",
"'G'",
":",
"3",
",",
"'T'",
":",
"4",
",",
"'P'",
":",
"5",
"}",
"human_size_str",
"=",
"six",
".",
"text_type",
"(",
... | Convert human-readable units to bytes | [
"Convert",
"human",
"-",
"readable",
"units",
"to",
"bytes"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/files.py#L759-L773 |
37,128 | saltstack/salt | salt/utils/files.py | backup_minion | def backup_minion(path, bkroot):
'''
Backup a file on the minion
'''
dname, bname = os.path.split(path)
if salt.utils.platform.is_windows():
src_dir = dname.replace(':', '_')
else:
src_dir = dname[1:]
if not salt.utils.platform.is_windows():
fstat = os.stat(path)
... | python | def backup_minion(path, bkroot):
'''
Backup a file on the minion
'''
dname, bname = os.path.split(path)
if salt.utils.platform.is_windows():
src_dir = dname.replace(':', '_')
else:
src_dir = dname[1:]
if not salt.utils.platform.is_windows():
fstat = os.stat(path)
... | [
"def",
"backup_minion",
"(",
"path",
",",
"bkroot",
")",
":",
"dname",
",",
"bname",
"=",
"os",
".",
"path",
".",
"split",
"(",
"path",
")",
"if",
"salt",
".",
"utils",
".",
"platform",
".",
"is_windows",
"(",
")",
":",
"src_dir",
"=",
"dname",
"."... | Backup a file on the minion | [
"Backup",
"a",
"file",
"on",
"the",
"minion"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/files.py#L776-L802 |
37,129 | saltstack/salt | salt/grains/zfs.py | _zfs_pool_data | def _zfs_pool_data():
'''
Provide grains about zpools
'''
grains = {}
# collect zpool data
zpool_list_cmd = __utils__['zfs.zpool_command'](
'list',
flags=['-H'],
opts={'-o': 'name,size'},
)
for zpool in __salt__['cmd.run'](zpool_list_cmd, ignore_retcode=True).spl... | python | def _zfs_pool_data():
'''
Provide grains about zpools
'''
grains = {}
# collect zpool data
zpool_list_cmd = __utils__['zfs.zpool_command'](
'list',
flags=['-H'],
opts={'-o': 'name,size'},
)
for zpool in __salt__['cmd.run'](zpool_list_cmd, ignore_retcode=True).spl... | [
"def",
"_zfs_pool_data",
"(",
")",
":",
"grains",
"=",
"{",
"}",
"# collect zpool data",
"zpool_list_cmd",
"=",
"__utils__",
"[",
"'zfs.zpool_command'",
"]",
"(",
"'list'",
",",
"flags",
"=",
"[",
"'-H'",
"]",
",",
"opts",
"=",
"{",
"'-o'",
":",
"'name,siz... | Provide grains about zpools | [
"Provide",
"grains",
"about",
"zpools"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/zfs.py#L54-L73 |
37,130 | saltstack/salt | salt/runners/network.py | wollist | def wollist(maclist, bcast='255.255.255.255', destport=9):
'''
Send a "Magic Packet" to wake up a list of Minions.
This list must contain one MAC hardware address per line
CLI Example:
.. code-block:: bash
salt-run network.wollist '/path/to/maclist'
salt-run network.wollist '/path... | python | def wollist(maclist, bcast='255.255.255.255', destport=9):
'''
Send a "Magic Packet" to wake up a list of Minions.
This list must contain one MAC hardware address per line
CLI Example:
.. code-block:: bash
salt-run network.wollist '/path/to/maclist'
salt-run network.wollist '/path... | [
"def",
"wollist",
"(",
"maclist",
",",
"bcast",
"=",
"'255.255.255.255'",
",",
"destport",
"=",
"9",
")",
":",
"ret",
"=",
"[",
"]",
"try",
":",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"fopen",
"(",
"maclist",
",",
"'r'",
")",
"as",
"ifile... | Send a "Magic Packet" to wake up a list of Minions.
This list must contain one MAC hardware address per line
CLI Example:
.. code-block:: bash
salt-run network.wollist '/path/to/maclist'
salt-run network.wollist '/path/to/maclist' 255.255.255.255 7
salt-run network.wollist '/path/... | [
"Send",
"a",
"Magic",
"Packet",
"to",
"wake",
"up",
"a",
"list",
"of",
"Minions",
".",
"This",
"list",
"must",
"contain",
"one",
"MAC",
"hardware",
"address",
"per",
"line"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/network.py#L19-L43 |
37,131 | saltstack/salt | salt/runners/network.py | wol | def wol(mac, bcast='255.255.255.255', destport=9):
'''
Send a "Magic Packet" to wake up a Minion
CLI Example:
.. code-block:: bash
salt-run network.wol 08-00-27-13-69-77
salt-run network.wol 080027136977 255.255.255.255 7
salt-run network.wol 08:00:27:13:69:77 255.255.255.255 ... | python | def wol(mac, bcast='255.255.255.255', destport=9):
'''
Send a "Magic Packet" to wake up a Minion
CLI Example:
.. code-block:: bash
salt-run network.wol 08-00-27-13-69-77
salt-run network.wol 080027136977 255.255.255.255 7
salt-run network.wol 08:00:27:13:69:77 255.255.255.255 ... | [
"def",
"wol",
"(",
"mac",
",",
"bcast",
"=",
"'255.255.255.255'",
",",
"destport",
"=",
"9",
")",
":",
"dest",
"=",
"salt",
".",
"utils",
".",
"network",
".",
"mac_str_to_bytes",
"(",
"mac",
")",
"sock",
"=",
"socket",
".",
"socket",
"(",
"socket",
"... | Send a "Magic Packet" to wake up a Minion
CLI Example:
.. code-block:: bash
salt-run network.wol 08-00-27-13-69-77
salt-run network.wol 080027136977 255.255.255.255 7
salt-run network.wol 08:00:27:13:69:77 255.255.255.255 7 | [
"Send",
"a",
"Magic",
"Packet",
"to",
"wake",
"up",
"a",
"Minion"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/network.py#L46-L62 |
37,132 | saltstack/salt | salt/runners/network.py | wolmatch | def wolmatch(tgt, tgt_type='glob', bcast='255.255.255.255', destport=9):
'''
Send a "Magic Packet" to wake up Minions that are matched in the grains cache
CLI Example:
.. code-block:: bash
salt-run network.wolmatch minion_id
salt-run network.wolmatch 192.168.0.0/16 tgt_type='ipcidr' b... | python | def wolmatch(tgt, tgt_type='glob', bcast='255.255.255.255', destport=9):
'''
Send a "Magic Packet" to wake up Minions that are matched in the grains cache
CLI Example:
.. code-block:: bash
salt-run network.wolmatch minion_id
salt-run network.wolmatch 192.168.0.0/16 tgt_type='ipcidr' b... | [
"def",
"wolmatch",
"(",
"tgt",
",",
"tgt_type",
"=",
"'glob'",
",",
"bcast",
"=",
"'255.255.255.255'",
",",
"destport",
"=",
"9",
")",
":",
"ret",
"=",
"[",
"]",
"minions",
"=",
"__salt__",
"[",
"'cache.grains'",
"]",
"(",
"tgt",
",",
"tgt_type",
")",
... | Send a "Magic Packet" to wake up Minions that are matched in the grains cache
CLI Example:
.. code-block:: bash
salt-run network.wolmatch minion_id
salt-run network.wolmatch 192.168.0.0/16 tgt_type='ipcidr' bcast=255.255.255.255 destport=7 | [
"Send",
"a",
"Magic",
"Packet",
"to",
"wake",
"up",
"Minions",
"that",
"are",
"matched",
"in",
"the",
"grains",
"cache"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/network.py#L65-L86 |
37,133 | saltstack/salt | salt/utils/memcached.py | get_conn | def get_conn(opts, profile=None, host=None, port=None):
'''
Return a conn object for accessing memcached
'''
if not (host and port):
opts_pillar = opts.get('pillar', {})
opts_master = opts_pillar.get('master', {})
opts_merged = {}
opts_merged.update(opts_master)
... | python | def get_conn(opts, profile=None, host=None, port=None):
'''
Return a conn object for accessing memcached
'''
if not (host and port):
opts_pillar = opts.get('pillar', {})
opts_master = opts_pillar.get('master', {})
opts_merged = {}
opts_merged.update(opts_master)
... | [
"def",
"get_conn",
"(",
"opts",
",",
"profile",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
")",
":",
"if",
"not",
"(",
"host",
"and",
"port",
")",
":",
"opts_pillar",
"=",
"opts",
".",
"get",
"(",
"'pillar'",
",",
"{",
"}",
... | Return a conn object for accessing memcached | [
"Return",
"a",
"conn",
"object",
"for",
"accessing",
"memcached"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/memcached.py#L77-L107 |
37,134 | saltstack/salt | salt/modules/glassfish.py | _get_auth | def _get_auth(username, password):
'''
Returns the HTTP auth header
'''
if username and password:
return requests.auth.HTTPBasicAuth(username, password)
else:
return None | python | def _get_auth(username, password):
'''
Returns the HTTP auth header
'''
if username and password:
return requests.auth.HTTPBasicAuth(username, password)
else:
return None | [
"def",
"_get_auth",
"(",
"username",
",",
"password",
")",
":",
"if",
"username",
"and",
"password",
":",
"return",
"requests",
".",
"auth",
".",
"HTTPBasicAuth",
"(",
"username",
",",
"password",
")",
"else",
":",
"return",
"None"
] | Returns the HTTP auth header | [
"Returns",
"the",
"HTTP",
"auth",
"header"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glassfish.py#L51-L58 |
37,135 | saltstack/salt | salt/modules/glassfish.py | _get_url | def _get_url(ssl, url, port, path):
'''
Returns the URL of the endpoint
'''
if ssl:
return 'https://{0}:{1}/management/domain/{2}'.format(url, port, path)
else:
return 'http://{0}:{1}/management/domain/{2}'.format(url, port, path) | python | def _get_url(ssl, url, port, path):
'''
Returns the URL of the endpoint
'''
if ssl:
return 'https://{0}:{1}/management/domain/{2}'.format(url, port, path)
else:
return 'http://{0}:{1}/management/domain/{2}'.format(url, port, path) | [
"def",
"_get_url",
"(",
"ssl",
",",
"url",
",",
"port",
",",
"path",
")",
":",
"if",
"ssl",
":",
"return",
"'https://{0}:{1}/management/domain/{2}'",
".",
"format",
"(",
"url",
",",
"port",
",",
"path",
")",
"else",
":",
"return",
"'http://{0}:{1}/management... | Returns the URL of the endpoint | [
"Returns",
"the",
"URL",
"of",
"the",
"endpoint"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glassfish.py#L61-L68 |
37,136 | saltstack/salt | salt/modules/glassfish.py | _api_response | def _api_response(response):
'''
Check response status code + success_code returned by glassfish
'''
if response.status_code == 404:
__context__['retcode'] = salt.defaults.exitcodes.SALT_BUILD_FAIL
raise CommandExecutionError('Element doesn\'t exists')
if response.status_code == 401:... | python | def _api_response(response):
'''
Check response status code + success_code returned by glassfish
'''
if response.status_code == 404:
__context__['retcode'] = salt.defaults.exitcodes.SALT_BUILD_FAIL
raise CommandExecutionError('Element doesn\'t exists')
if response.status_code == 401:... | [
"def",
"_api_response",
"(",
"response",
")",
":",
"if",
"response",
".",
"status_code",
"==",
"404",
":",
"__context__",
"[",
"'retcode'",
"]",
"=",
"salt",
".",
"defaults",
".",
"exitcodes",
".",
"SALT_BUILD_FAIL",
"raise",
"CommandExecutionError",
"(",
"'El... | Check response status code + success_code returned by glassfish | [
"Check",
"response",
"status",
"code",
"+",
"success_code",
"returned",
"by",
"glassfish"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glassfish.py#L88-L109 |
37,137 | saltstack/salt | salt/modules/glassfish.py | _api_get | def _api_get(path, server=None):
'''
Do a GET request to the API
'''
server = _get_server(server)
response = requests.get(
url=_get_url(server['ssl'], server['url'], server['port'], path),
auth=_get_auth(server['user'], server['password']),
headers=_get_headers(),... | python | def _api_get(path, server=None):
'''
Do a GET request to the API
'''
server = _get_server(server)
response = requests.get(
url=_get_url(server['ssl'], server['url'], server['port'], path),
auth=_get_auth(server['user'], server['password']),
headers=_get_headers(),... | [
"def",
"_api_get",
"(",
"path",
",",
"server",
"=",
"None",
")",
":",
"server",
"=",
"_get_server",
"(",
"server",
")",
"response",
"=",
"requests",
".",
"get",
"(",
"url",
"=",
"_get_url",
"(",
"server",
"[",
"'ssl'",
"]",
",",
"server",
"[",
"'url'... | Do a GET request to the API | [
"Do",
"a",
"GET",
"request",
"to",
"the",
"API"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glassfish.py#L112-L123 |
37,138 | saltstack/salt | salt/modules/glassfish.py | _api_post | def _api_post(path, data, server=None):
'''
Do a POST request to the API
'''
server = _get_server(server)
response = requests.post(
url=_get_url(server['ssl'], server['url'], server['port'], path),
auth=_get_auth(server['user'], server['password']),
headers=_get_h... | python | def _api_post(path, data, server=None):
'''
Do a POST request to the API
'''
server = _get_server(server)
response = requests.post(
url=_get_url(server['ssl'], server['url'], server['port'], path),
auth=_get_auth(server['user'], server['password']),
headers=_get_h... | [
"def",
"_api_post",
"(",
"path",
",",
"data",
",",
"server",
"=",
"None",
")",
":",
"server",
"=",
"_get_server",
"(",
"server",
")",
"response",
"=",
"requests",
".",
"post",
"(",
"url",
"=",
"_get_url",
"(",
"server",
"[",
"'ssl'",
"]",
",",
"serve... | Do a POST request to the API | [
"Do",
"a",
"POST",
"request",
"to",
"the",
"API"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glassfish.py#L126-L138 |
37,139 | saltstack/salt | salt/modules/glassfish.py | _api_delete | def _api_delete(path, data, server=None):
'''
Do a DELETE request to the API
'''
server = _get_server(server)
response = requests.delete(
url=_get_url(server['ssl'], server['url'], server['port'], path),
auth=_get_auth(server['user'], server['password']),
headers=... | python | def _api_delete(path, data, server=None):
'''
Do a DELETE request to the API
'''
server = _get_server(server)
response = requests.delete(
url=_get_url(server['ssl'], server['url'], server['port'], path),
auth=_get_auth(server['user'], server['password']),
headers=... | [
"def",
"_api_delete",
"(",
"path",
",",
"data",
",",
"server",
"=",
"None",
")",
":",
"server",
"=",
"_get_server",
"(",
"server",
")",
"response",
"=",
"requests",
".",
"delete",
"(",
"url",
"=",
"_get_url",
"(",
"server",
"[",
"'ssl'",
"]",
",",
"s... | Do a DELETE request to the API | [
"Do",
"a",
"DELETE",
"request",
"to",
"the",
"API"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glassfish.py#L141-L153 |
37,140 | saltstack/salt | salt/modules/glassfish.py | _get_element_properties | def _get_element_properties(name, element_type, server=None):
'''
Get an element's properties
'''
properties = {}
data = _api_get('{0}/{1}/property'.format(element_type, name), server)
# Get properties into a dict
if any(data['extraProperties']['properties']):
for element in data['e... | python | def _get_element_properties(name, element_type, server=None):
'''
Get an element's properties
'''
properties = {}
data = _api_get('{0}/{1}/property'.format(element_type, name), server)
# Get properties into a dict
if any(data['extraProperties']['properties']):
for element in data['e... | [
"def",
"_get_element_properties",
"(",
"name",
",",
"element_type",
",",
"server",
"=",
"None",
")",
":",
"properties",
"=",
"{",
"}",
"data",
"=",
"_api_get",
"(",
"'{0}/{1}/property'",
".",
"format",
"(",
"element_type",
",",
"name",
")",
",",
"server",
... | Get an element's properties | [
"Get",
"an",
"element",
"s",
"properties"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glassfish.py#L171-L183 |
37,141 | saltstack/salt | salt/modules/glassfish.py | _get_element | def _get_element(name, element_type, server=None, with_properties=True):
'''
Get an element with or without properties
'''
element = {}
name = quote(name, safe='')
data = _api_get('{0}/{1}'.format(element_type, name), server)
# Format data, get properties if asked, and return the whole thin... | python | def _get_element(name, element_type, server=None, with_properties=True):
'''
Get an element with or without properties
'''
element = {}
name = quote(name, safe='')
data = _api_get('{0}/{1}'.format(element_type, name), server)
# Format data, get properties if asked, and return the whole thin... | [
"def",
"_get_element",
"(",
"name",
",",
"element_type",
",",
"server",
"=",
"None",
",",
"with_properties",
"=",
"True",
")",
":",
"element",
"=",
"{",
"}",
"name",
"=",
"quote",
"(",
"name",
",",
"safe",
"=",
"''",
")",
"data",
"=",
"_api_get",
"("... | Get an element with or without properties | [
"Get",
"an",
"element",
"with",
"or",
"without",
"properties"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glassfish.py#L186-L201 |
37,142 | saltstack/salt | salt/modules/glassfish.py | _create_element | def _create_element(name, element_type, data, server=None):
'''
Create a new element
'''
# Define property and id from name and properties + remove SaltStack parameters
if 'properties' in data:
data['property'] = ''
for key, value in data['properties'].items():
if not dat... | python | def _create_element(name, element_type, data, server=None):
'''
Create a new element
'''
# Define property and id from name and properties + remove SaltStack parameters
if 'properties' in data:
data['property'] = ''
for key, value in data['properties'].items():
if not dat... | [
"def",
"_create_element",
"(",
"name",
",",
"element_type",
",",
"data",
",",
"server",
"=",
"None",
")",
":",
"# Define property and id from name and properties + remove SaltStack parameters",
"if",
"'properties'",
"in",
"data",
":",
"data",
"[",
"'property'",
"]",
"... | Create a new element | [
"Create",
"a",
"new",
"element"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glassfish.py#L204-L220 |
37,143 | saltstack/salt | salt/modules/glassfish.py | _update_element | def _update_element(name, element_type, data, server=None):
'''
Update an element, including it's properties
'''
# Urlencode the name (names may have slashes)
name = quote(name, safe='')
# Update properties first
if 'properties' in data:
properties = []
for key, value in dat... | python | def _update_element(name, element_type, data, server=None):
'''
Update an element, including it's properties
'''
# Urlencode the name (names may have slashes)
name = quote(name, safe='')
# Update properties first
if 'properties' in data:
properties = []
for key, value in dat... | [
"def",
"_update_element",
"(",
"name",
",",
"element_type",
",",
"data",
",",
"server",
"=",
"None",
")",
":",
"# Urlencode the name (names may have slashes)",
"name",
"=",
"quote",
"(",
"name",
",",
"safe",
"=",
"''",
")",
"# Update properties first",
"if",
"'p... | Update an element, including it's properties | [
"Update",
"an",
"element",
"including",
"it",
"s",
"properties"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glassfish.py#L223-L252 |
37,144 | saltstack/salt | salt/modules/glassfish.py | _delete_element | def _delete_element(name, element_type, data, server=None):
'''
Delete an element
'''
_api_delete('{0}/{1}'.format(element_type, quote(name, safe='')), data, server)
return name | python | def _delete_element(name, element_type, data, server=None):
'''
Delete an element
'''
_api_delete('{0}/{1}'.format(element_type, quote(name, safe='')), data, server)
return name | [
"def",
"_delete_element",
"(",
"name",
",",
"element_type",
",",
"data",
",",
"server",
"=",
"None",
")",
":",
"_api_delete",
"(",
"'{0}/{1}'",
".",
"format",
"(",
"element_type",
",",
"quote",
"(",
"name",
",",
"safe",
"=",
"''",
")",
")",
",",
"data"... | Delete an element | [
"Delete",
"an",
"element"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glassfish.py#L255-L260 |
37,145 | saltstack/salt | salt/modules/glassfish.py | create_connector_c_pool | def create_connector_c_pool(name, server=None, **kwargs):
'''
Create a connection pool
'''
defaults = {
'connectionDefinitionName': 'javax.jms.ConnectionFactory',
'resourceAdapterName': 'jmsra',
'associateWithThread': False,
'connectionCreationRetryAttempts': 0,
'... | python | def create_connector_c_pool(name, server=None, **kwargs):
'''
Create a connection pool
'''
defaults = {
'connectionDefinitionName': 'javax.jms.ConnectionFactory',
'resourceAdapterName': 'jmsra',
'associateWithThread': False,
'connectionCreationRetryAttempts': 0,
'... | [
"def",
"create_connector_c_pool",
"(",
"name",
",",
"server",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"defaults",
"=",
"{",
"'connectionDefinitionName'",
":",
"'javax.jms.ConnectionFactory'",
",",
"'resourceAdapterName'",
":",
"'jmsra'",
",",
"'associateWith... | Create a connection pool | [
"Create",
"a",
"connection",
"pool"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glassfish.py#L278-L322 |
37,146 | saltstack/salt | salt/modules/glassfish.py | update_connector_c_pool | def update_connector_c_pool(name, server=None, **kwargs):
'''
Update a connection pool
'''
if 'transactionSupport' in kwargs and kwargs['transactionSupport'] not in (
'XATransaction',
'LocalTransaction',
'NoTransaction'
):
raise CommandExecutio... | python | def update_connector_c_pool(name, server=None, **kwargs):
'''
Update a connection pool
'''
if 'transactionSupport' in kwargs and kwargs['transactionSupport'] not in (
'XATransaction',
'LocalTransaction',
'NoTransaction'
):
raise CommandExecutio... | [
"def",
"update_connector_c_pool",
"(",
"name",
",",
"server",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"'transactionSupport'",
"in",
"kwargs",
"and",
"kwargs",
"[",
"'transactionSupport'",
"]",
"not",
"in",
"(",
"'XATransaction'",
",",
"'LocalTran... | Update a connection pool | [
"Update",
"a",
"connection",
"pool"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glassfish.py#L325-L335 |
37,147 | saltstack/salt | salt/modules/glassfish.py | delete_connector_c_pool | def delete_connector_c_pool(name, target='server', cascade=True, server=None):
'''
Delete a connection pool
'''
data = {'target': target, 'cascade': cascade}
return _delete_element(name, 'resources/connector-connection-pool', data, server) | python | def delete_connector_c_pool(name, target='server', cascade=True, server=None):
'''
Delete a connection pool
'''
data = {'target': target, 'cascade': cascade}
return _delete_element(name, 'resources/connector-connection-pool', data, server) | [
"def",
"delete_connector_c_pool",
"(",
"name",
",",
"target",
"=",
"'server'",
",",
"cascade",
"=",
"True",
",",
"server",
"=",
"None",
")",
":",
"data",
"=",
"{",
"'target'",
":",
"target",
",",
"'cascade'",
":",
"cascade",
"}",
"return",
"_delete_element... | Delete a connection pool | [
"Delete",
"a",
"connection",
"pool"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glassfish.py#L338-L343 |
37,148 | saltstack/salt | salt/modules/glassfish.py | update_connector_resource | def update_connector_resource(name, server=None, **kwargs):
'''
Update a connection resource
'''
# You're not supposed to update jndiName, if you do so, it will crash, silently
if 'jndiName' in kwargs:
del kwargs['jndiName']
return _update_element(name, 'resources/connector-resource', kw... | python | def update_connector_resource(name, server=None, **kwargs):
'''
Update a connection resource
'''
# You're not supposed to update jndiName, if you do so, it will crash, silently
if 'jndiName' in kwargs:
del kwargs['jndiName']
return _update_element(name, 'resources/connector-resource', kw... | [
"def",
"update_connector_resource",
"(",
"name",
",",
"server",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"# You're not supposed to update jndiName, if you do so, it will crash, silently",
"if",
"'jndiName'",
"in",
"kwargs",
":",
"del",
"kwargs",
"[",
"'jndiName'"... | Update a connection resource | [
"Update",
"a",
"connection",
"resource"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glassfish.py#L389-L396 |
37,149 | saltstack/salt | salt/modules/glassfish.py | create_admin_object_resource | def create_admin_object_resource(name, server=None, **kwargs):
'''
Create a JMS destination
'''
defaults = {
'description': '',
'className': 'com.sun.messaging.Queue',
'enabled': True,
'id': name,
'resAdapter': 'jmsra',
'resType': 'javax.jms.Queue',
... | python | def create_admin_object_resource(name, server=None, **kwargs):
'''
Create a JMS destination
'''
defaults = {
'description': '',
'className': 'com.sun.messaging.Queue',
'enabled': True,
'id': name,
'resAdapter': 'jmsra',
'resType': 'javax.jms.Queue',
... | [
"def",
"create_admin_object_resource",
"(",
"name",
",",
"server",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"defaults",
"=",
"{",
"'description'",
":",
"''",
",",
"'className'",
":",
"'com.sun.messaging.Queue'",
",",
"'enabled'",
":",
"True",
",",
"'i... | Create a JMS destination | [
"Create",
"a",
"JMS",
"destination"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glassfish.py#L421-L458 |
37,150 | saltstack/salt | salt/modules/glassfish.py | update_admin_object_resource | def update_admin_object_resource(name, server=None, **kwargs):
'''
Update a JMS destination
'''
if 'jndiName' in kwargs:
del kwargs['jndiName']
return _update_element(name, 'resources/admin-object-resource', kwargs, server) | python | def update_admin_object_resource(name, server=None, **kwargs):
'''
Update a JMS destination
'''
if 'jndiName' in kwargs:
del kwargs['jndiName']
return _update_element(name, 'resources/admin-object-resource', kwargs, server) | [
"def",
"update_admin_object_resource",
"(",
"name",
",",
"server",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"'jndiName'",
"in",
"kwargs",
":",
"del",
"kwargs",
"[",
"'jndiName'",
"]",
"return",
"_update_element",
"(",
"name",
",",
"'resources/ad... | Update a JMS destination | [
"Update",
"a",
"JMS",
"destination"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glassfish.py#L461-L467 |
37,151 | saltstack/salt | salt/modules/glassfish.py | delete_jdbc_connection_pool | def delete_jdbc_connection_pool(name, target='server', cascade=False, server=None):
'''
Delete a JDBC pool
'''
data = {'target': target, 'cascade': cascade}
return _delete_element(name, 'resources/jdbc-connection-pool', data, server) | python | def delete_jdbc_connection_pool(name, target='server', cascade=False, server=None):
'''
Delete a JDBC pool
'''
data = {'target': target, 'cascade': cascade}
return _delete_element(name, 'resources/jdbc-connection-pool', data, server) | [
"def",
"delete_jdbc_connection_pool",
"(",
"name",
",",
"target",
"=",
"'server'",
",",
"cascade",
"=",
"False",
",",
"server",
"=",
"None",
")",
":",
"data",
"=",
"{",
"'target'",
":",
"target",
",",
"'cascade'",
":",
"cascade",
"}",
"return",
"_delete_el... | Delete a JDBC pool | [
"Delete",
"a",
"JDBC",
"pool"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glassfish.py#L589-L594 |
37,152 | saltstack/salt | salt/modules/glassfish.py | create_jdbc_resource | def create_jdbc_resource(name, server=None, **kwargs):
'''
Create a JDBC resource
'''
defaults = {
'description': '',
'enabled': True,
'id': name,
'poolName': '',
'target': 'server'
}
# Data = defaults + merge kwargs + poolname
data = defaults
dat... | python | def create_jdbc_resource(name, server=None, **kwargs):
'''
Create a JDBC resource
'''
defaults = {
'description': '',
'enabled': True,
'id': name,
'poolName': '',
'target': 'server'
}
# Data = defaults + merge kwargs + poolname
data = defaults
dat... | [
"def",
"create_jdbc_resource",
"(",
"name",
",",
"server",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"defaults",
"=",
"{",
"'description'",
":",
"''",
",",
"'enabled'",
":",
"True",
",",
"'id'",
":",
"name",
",",
"'poolName'",
":",
"''",
",",
"... | Create a JDBC resource | [
"Create",
"a",
"JDBC",
"resource"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glassfish.py#L612-L631 |
37,153 | saltstack/salt | salt/modules/glassfish.py | update_jdbc_resource | def update_jdbc_resource(name, server=None, **kwargs):
'''
Update a JDBC resource
'''
# You're not supposed to update jndiName, if you do so, it will crash, silently
if 'jndiName' in kwargs:
del kwargs['jndiName']
return _update_element(name, 'resources/jdbc-resource', kwargs, server) | python | def update_jdbc_resource(name, server=None, **kwargs):
'''
Update a JDBC resource
'''
# You're not supposed to update jndiName, if you do so, it will crash, silently
if 'jndiName' in kwargs:
del kwargs['jndiName']
return _update_element(name, 'resources/jdbc-resource', kwargs, server) | [
"def",
"update_jdbc_resource",
"(",
"name",
",",
"server",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"# You're not supposed to update jndiName, if you do so, it will crash, silently",
"if",
"'jndiName'",
"in",
"kwargs",
":",
"del",
"kwargs",
"[",
"'jndiName'",
"... | Update a JDBC resource | [
"Update",
"a",
"JDBC",
"resource"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glassfish.py#L634-L641 |
37,154 | saltstack/salt | salt/modules/glassfish.py | get_system_properties | def get_system_properties(server=None):
'''
Get system properties
'''
properties = {}
data = _api_get('system-properties', server)
# Get properties into a dict
if any(data['extraProperties']['systemProperties']):
for element in data['extraProperties']['systemProperties']:
... | python | def get_system_properties(server=None):
'''
Get system properties
'''
properties = {}
data = _api_get('system-properties', server)
# Get properties into a dict
if any(data['extraProperties']['systemProperties']):
for element in data['extraProperties']['systemProperties']:
... | [
"def",
"get_system_properties",
"(",
"server",
"=",
"None",
")",
":",
"properties",
"=",
"{",
"}",
"data",
"=",
"_api_get",
"(",
"'system-properties'",
",",
"server",
")",
"# Get properties into a dict",
"if",
"any",
"(",
"data",
"[",
"'extraProperties'",
"]",
... | Get system properties | [
"Get",
"system",
"properties"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glassfish.py#L652-L664 |
37,155 | saltstack/salt | salt/states/neutron_network.py | present | def present(name, auth=None, **kwargs):
'''
Ensure a network exists and is up-to-date
name
Name of the network
provider
A dict of network provider options.
shared
Set the network as shared.
external
Whether this network is externally accessible.
admin_sta... | python | def present(name, auth=None, **kwargs):
'''
Ensure a network exists and is up-to-date
name
Name of the network
provider
A dict of network provider options.
shared
Set the network as shared.
external
Whether this network is externally accessible.
admin_sta... | [
"def",
"present",
"(",
"name",
",",
"auth",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"True",
",",
"'comment'",
":",
"''",
"}",
"kwargs",
"=",
... | Ensure a network exists and is up-to-date
name
Name of the network
provider
A dict of network provider options.
shared
Set the network as shared.
external
Whether this network is externally accessible.
admin_state_up
Set the network administrative state ... | [
"Ensure",
"a",
"network",
"exists",
"and",
"is",
"up",
"-",
"to",
"-",
"date"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/neutron_network.py#L44-L127 |
37,156 | saltstack/salt | salt/states/neutron_network.py | absent | def absent(name, auth=None, **kwargs):
'''
Ensure a network does not exists
name
Name of the network
'''
ret = {'name': name,
'changes': {},
'result': True,
'comment': ''}
kwargs = __utils__['args.clean_kwargs'](**kwargs)
__salt__['neutronng.setup... | python | def absent(name, auth=None, **kwargs):
'''
Ensure a network does not exists
name
Name of the network
'''
ret = {'name': name,
'changes': {},
'result': True,
'comment': ''}
kwargs = __utils__['args.clean_kwargs'](**kwargs)
__salt__['neutronng.setup... | [
"def",
"absent",
"(",
"name",
",",
"auth",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"True",
",",
"'comment'",
":",
"''",
"}",
"kwargs",
"=",
"... | Ensure a network does not exists
name
Name of the network | [
"Ensure",
"a",
"network",
"does",
"not",
"exists"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/neutron_network.py#L130-L161 |
37,157 | saltstack/salt | salt/modules/smartos_imgadm.py | _split_docker_uuid | def _split_docker_uuid(uuid):
'''
Split a smartos docker uuid into repo and tag
'''
if uuid:
uuid = uuid.split(':')
if len(uuid) == 2:
tag = uuid[1]
repo = uuid[0]
return repo, tag
return None, None | python | def _split_docker_uuid(uuid):
'''
Split a smartos docker uuid into repo and tag
'''
if uuid:
uuid = uuid.split(':')
if len(uuid) == 2:
tag = uuid[1]
repo = uuid[0]
return repo, tag
return None, None | [
"def",
"_split_docker_uuid",
"(",
"uuid",
")",
":",
"if",
"uuid",
":",
"uuid",
"=",
"uuid",
".",
"split",
"(",
"':'",
")",
"if",
"len",
"(",
"uuid",
")",
"==",
"2",
":",
"tag",
"=",
"uuid",
"[",
"1",
"]",
"repo",
"=",
"uuid",
"[",
"0",
"]",
"... | Split a smartos docker uuid into repo and tag | [
"Split",
"a",
"smartos",
"docker",
"uuid",
"into",
"repo",
"and",
"tag"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smartos_imgadm.py#L104-L114 |
37,158 | saltstack/salt | salt/modules/smartos_imgadm.py | _is_uuid | def _is_uuid(uuid):
'''
Check if uuid is a valid smartos uuid
Example: e69a0918-055d-11e5-8912-e3ceb6df4cf8
'''
if uuid and list((len(x) for x in uuid.split('-'))) == [8, 4, 4, 4, 12]:
return True
return False | python | def _is_uuid(uuid):
'''
Check if uuid is a valid smartos uuid
Example: e69a0918-055d-11e5-8912-e3ceb6df4cf8
'''
if uuid and list((len(x) for x in uuid.split('-'))) == [8, 4, 4, 4, 12]:
return True
return False | [
"def",
"_is_uuid",
"(",
"uuid",
")",
":",
"if",
"uuid",
"and",
"list",
"(",
"(",
"len",
"(",
"x",
")",
"for",
"x",
"in",
"uuid",
".",
"split",
"(",
"'-'",
")",
")",
")",
"==",
"[",
"8",
",",
"4",
",",
"4",
",",
"4",
",",
"12",
"]",
":",
... | Check if uuid is a valid smartos uuid
Example: e69a0918-055d-11e5-8912-e3ceb6df4cf8 | [
"Check",
"if",
"uuid",
"is",
"a",
"valid",
"smartos",
"uuid"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smartos_imgadm.py#L117-L125 |
37,159 | saltstack/salt | salt/modules/smartos_imgadm.py | version | def version():
'''
Return imgadm version
CLI Example:
.. code-block:: bash
salt '*' imgadm.version
'''
ret = {}
cmd = 'imgadm --version'
res = __salt__['cmd.run'](cmd).splitlines()
ret = res[0].split()
return ret[-1] | python | def version():
'''
Return imgadm version
CLI Example:
.. code-block:: bash
salt '*' imgadm.version
'''
ret = {}
cmd = 'imgadm --version'
res = __salt__['cmd.run'](cmd).splitlines()
ret = res[0].split()
return ret[-1] | [
"def",
"version",
"(",
")",
":",
"ret",
"=",
"{",
"}",
"cmd",
"=",
"'imgadm --version'",
"res",
"=",
"__salt__",
"[",
"'cmd.run'",
"]",
"(",
"cmd",
")",
".",
"splitlines",
"(",
")",
"ret",
"=",
"res",
"[",
"0",
"]",
".",
"split",
"(",
")",
"retur... | Return imgadm version
CLI Example:
.. code-block:: bash
salt '*' imgadm.version | [
"Return",
"imgadm",
"version"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smartos_imgadm.py#L138-L152 |
37,160 | saltstack/salt | salt/modules/smartos_imgadm.py | docker_to_uuid | def docker_to_uuid(uuid):
'''
Get the image uuid from an imported docker image
.. versionadded:: 2019.2.0
'''
if _is_uuid(uuid):
return uuid
if _is_docker_uuid(uuid):
images = list_installed(verbose=True)
for image_uuid in images:
if 'name' not in images[imag... | python | def docker_to_uuid(uuid):
'''
Get the image uuid from an imported docker image
.. versionadded:: 2019.2.0
'''
if _is_uuid(uuid):
return uuid
if _is_docker_uuid(uuid):
images = list_installed(verbose=True)
for image_uuid in images:
if 'name' not in images[imag... | [
"def",
"docker_to_uuid",
"(",
"uuid",
")",
":",
"if",
"_is_uuid",
"(",
"uuid",
")",
":",
"return",
"uuid",
"if",
"_is_docker_uuid",
"(",
"uuid",
")",
":",
"images",
"=",
"list_installed",
"(",
"verbose",
"=",
"True",
")",
"for",
"image_uuid",
"in",
"imag... | Get the image uuid from an imported docker image
.. versionadded:: 2019.2.0 | [
"Get",
"the",
"image",
"uuid",
"from",
"an",
"imported",
"docker",
"image"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smartos_imgadm.py#L155-L170 |
37,161 | saltstack/salt | salt/modules/smartos_imgadm.py | avail | def avail(search=None, verbose=False):
'''
Return a list of available images
search : string
search keyword
verbose : boolean (False)
toggle verbose output
CLI Example:
.. code-block:: bash
salt '*' imgadm.avail [percona]
salt '*' imgadm.avail verbose=True
... | python | def avail(search=None, verbose=False):
'''
Return a list of available images
search : string
search keyword
verbose : boolean (False)
toggle verbose output
CLI Example:
.. code-block:: bash
salt '*' imgadm.avail [percona]
salt '*' imgadm.avail verbose=True
... | [
"def",
"avail",
"(",
"search",
"=",
"None",
",",
"verbose",
"=",
"False",
")",
":",
"ret",
"=",
"{",
"}",
"cmd",
"=",
"'imgadm avail -j'",
"res",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"cmd",
")",
"retcode",
"=",
"res",
"[",
"'retcode'",
"]... | Return a list of available images
search : string
search keyword
verbose : boolean (False)
toggle verbose output
CLI Example:
.. code-block:: bash
salt '*' imgadm.avail [percona]
salt '*' imgadm.avail verbose=True | [
"Return",
"a",
"list",
"of",
"available",
"images"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smartos_imgadm.py#L191-L226 |
37,162 | saltstack/salt | salt/modules/smartos_imgadm.py | show | def show(uuid):
'''
Show manifest of a given image
uuid : string
uuid of image
CLI Example:
.. code-block:: bash
salt '*' imgadm.show e42f8c84-bbea-11e2-b920-078fab2aab1f
salt '*' imgadm.show plexinc/pms-docker:plexpass
'''
ret = {}
if _is_uuid(uuid) or _is_d... | python | def show(uuid):
'''
Show manifest of a given image
uuid : string
uuid of image
CLI Example:
.. code-block:: bash
salt '*' imgadm.show e42f8c84-bbea-11e2-b920-078fab2aab1f
salt '*' imgadm.show plexinc/pms-docker:plexpass
'''
ret = {}
if _is_uuid(uuid) or _is_d... | [
"def",
"show",
"(",
"uuid",
")",
":",
"ret",
"=",
"{",
"}",
"if",
"_is_uuid",
"(",
"uuid",
")",
"or",
"_is_docker_uuid",
"(",
"uuid",
")",
":",
"cmd",
"=",
"'imgadm show {0}'",
".",
"format",
"(",
"uuid",
")",
"res",
"=",
"__salt__",
"[",
"'cmd.run_a... | Show manifest of a given image
uuid : string
uuid of image
CLI Example:
.. code-block:: bash
salt '*' imgadm.show e42f8c84-bbea-11e2-b920-078fab2aab1f
salt '*' imgadm.show plexinc/pms-docker:plexpass | [
"Show",
"manifest",
"of",
"a",
"given",
"image"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smartos_imgadm.py#L265-L292 |
37,163 | saltstack/salt | salt/modules/smartos_imgadm.py | import_image | def import_image(uuid, verbose=False):
'''
Import an image from the repository
uuid : string
uuid to import
verbose : boolean (False)
toggle verbose output
CLI Example:
.. code-block:: bash
salt '*' imgadm.import e42f8c84-bbea-11e2-b920-078fab2aab1f [verbose=True]
... | python | def import_image(uuid, verbose=False):
'''
Import an image from the repository
uuid : string
uuid to import
verbose : boolean (False)
toggle verbose output
CLI Example:
.. code-block:: bash
salt '*' imgadm.import e42f8c84-bbea-11e2-b920-078fab2aab1f [verbose=True]
... | [
"def",
"import_image",
"(",
"uuid",
",",
"verbose",
"=",
"False",
")",
":",
"ret",
"=",
"{",
"}",
"cmd",
"=",
"'imgadm import {0}'",
".",
"format",
"(",
"uuid",
")",
"res",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"cmd",
",",
"python_shell",
"=... | Import an image from the repository
uuid : string
uuid to import
verbose : boolean (False)
toggle verbose output
CLI Example:
.. code-block:: bash
salt '*' imgadm.import e42f8c84-bbea-11e2-b920-078fab2aab1f [verbose=True] | [
"Import",
"an",
"image",
"from",
"the",
"repository"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smartos_imgadm.py#L328-L353 |
37,164 | saltstack/salt | salt/modules/smartos_imgadm.py | delete | def delete(uuid):
'''
Remove an installed image
uuid : string
Specifies uuid to import
CLI Example:
.. code-block:: bash
salt '*' imgadm.delete e42f8c84-bbea-11e2-b920-078fab2aab1f
'''
ret = {}
cmd = 'imgadm delete {0}'.format(uuid)
res = __salt__['cmd.run_all'](c... | python | def delete(uuid):
'''
Remove an installed image
uuid : string
Specifies uuid to import
CLI Example:
.. code-block:: bash
salt '*' imgadm.delete e42f8c84-bbea-11e2-b920-078fab2aab1f
'''
ret = {}
cmd = 'imgadm delete {0}'.format(uuid)
res = __salt__['cmd.run_all'](c... | [
"def",
"delete",
"(",
"uuid",
")",
":",
"ret",
"=",
"{",
"}",
"cmd",
"=",
"'imgadm delete {0}'",
".",
"format",
"(",
"uuid",
")",
"res",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"cmd",
",",
"python_shell",
"=",
"False",
")",
"retcode",
"=",
"... | Remove an installed image
uuid : string
Specifies uuid to import
CLI Example:
.. code-block:: bash
salt '*' imgadm.delete e42f8c84-bbea-11e2-b920-078fab2aab1f | [
"Remove",
"an",
"installed",
"image"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smartos_imgadm.py#L356-L382 |
37,165 | saltstack/salt | salt/modules/smartos_imgadm.py | vacuum | def vacuum(verbose=False):
'''
Remove unused images
verbose : boolean (False)
toggle verbose output
CLI Example:
.. code-block:: bash
salt '*' imgadm.vacuum [verbose=True]
'''
ret = {}
cmd = 'imgadm vacuum -f'
res = __salt__['cmd.run_all'](cmd)
retcode = res['... | python | def vacuum(verbose=False):
'''
Remove unused images
verbose : boolean (False)
toggle verbose output
CLI Example:
.. code-block:: bash
salt '*' imgadm.vacuum [verbose=True]
'''
ret = {}
cmd = 'imgadm vacuum -f'
res = __salt__['cmd.run_all'](cmd)
retcode = res['... | [
"def",
"vacuum",
"(",
"verbose",
"=",
"False",
")",
":",
"ret",
"=",
"{",
"}",
"cmd",
"=",
"'imgadm vacuum -f'",
"res",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"cmd",
")",
"retcode",
"=",
"res",
"[",
"'retcode'",
"]",
"if",
"retcode",
"!=",
... | Remove unused images
verbose : boolean (False)
toggle verbose output
CLI Example:
.. code-block:: bash
salt '*' imgadm.vacuum [verbose=True] | [
"Remove",
"unused",
"images"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smartos_imgadm.py#L385-L416 |
37,166 | saltstack/salt | salt/modules/smartos_imgadm.py | sources | def sources(verbose=False):
'''
Return a list of available sources
verbose : boolean (False)
toggle verbose output
.. versionadded:: 2019.2.0
CLI Example:
.. code-block:: bash
salt '*' imgadm.sources
'''
ret = {}
cmd = 'imgadm sources -j'
res = __salt__['cmd.... | python | def sources(verbose=False):
'''
Return a list of available sources
verbose : boolean (False)
toggle verbose output
.. versionadded:: 2019.2.0
CLI Example:
.. code-block:: bash
salt '*' imgadm.sources
'''
ret = {}
cmd = 'imgadm sources -j'
res = __salt__['cmd.... | [
"def",
"sources",
"(",
"verbose",
"=",
"False",
")",
":",
"ret",
"=",
"{",
"}",
"cmd",
"=",
"'imgadm sources -j'",
"res",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"cmd",
")",
"retcode",
"=",
"res",
"[",
"'retcode'",
"]",
"if",
"retcode",
"!=",
... | Return a list of available sources
verbose : boolean (False)
toggle verbose output
.. versionadded:: 2019.2.0
CLI Example:
.. code-block:: bash
salt '*' imgadm.sources | [
"Return",
"a",
"list",
"of",
"available",
"sources"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smartos_imgadm.py#L419-L449 |
37,167 | saltstack/salt | salt/modules/smartos_imgadm.py | source_add | def source_add(source, source_type='imgapi'):
'''
Add a new source
source : string
source url to add
source_trype : string (imgapi)
source type, either imgapi or docker
.. versionadded:: 2019.2.0
CLI Example:
.. code-block:: bash
salt '*' imgadm.source_add https:... | python | def source_add(source, source_type='imgapi'):
'''
Add a new source
source : string
source url to add
source_trype : string (imgapi)
source type, either imgapi or docker
.. versionadded:: 2019.2.0
CLI Example:
.. code-block:: bash
salt '*' imgadm.source_add https:... | [
"def",
"source_add",
"(",
"source",
",",
"source_type",
"=",
"'imgapi'",
")",
":",
"ret",
"=",
"{",
"}",
"# NOTE: there are some undocumented deprecated source types",
"# so we just warn instead of error on those",
"if",
"source_type",
"not",
"in",
"[",
"'imgapi'",
... | Add a new source
source : string
source url to add
source_trype : string (imgapi)
source type, either imgapi or docker
.. versionadded:: 2019.2.0
CLI Example:
.. code-block:: bash
salt '*' imgadm.source_add https://updates.joyent.com
salt '*' imgadm.source_add ht... | [
"Add",
"a",
"new",
"source"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smartos_imgadm.py#L478-L510 |
37,168 | saltstack/salt | salt/utils/win_dacl.py | get_sid | def get_sid(principal):
'''
Converts a username to a sid, or verifies a sid. Required for working with
the DACL.
Args:
principal(str):
The principal to lookup the sid. Can be a sid or a username.
Returns:
PySID Object: A sid
Usage:
.. code-block:: python
... | python | def get_sid(principal):
'''
Converts a username to a sid, or verifies a sid. Required for working with
the DACL.
Args:
principal(str):
The principal to lookup the sid. Can be a sid or a username.
Returns:
PySID Object: A sid
Usage:
.. code-block:: python
... | [
"def",
"get_sid",
"(",
"principal",
")",
":",
"# If None is passed, use the Universal Well-known SID \"Null SID\"",
"if",
"principal",
"is",
"None",
":",
"principal",
"=",
"'NULL SID'",
"# Test if the user passed a sid or a name",
"try",
":",
"sid",
"=",
"salt",
".",
"uti... | Converts a username to a sid, or verifies a sid. Required for working with
the DACL.
Args:
principal(str):
The principal to lookup the sid. Can be a sid or a username.
Returns:
PySID Object: A sid
Usage:
.. code-block:: python
# Get a user's sid
salt... | [
"Converts",
"a",
"username",
"to",
"a",
"sid",
"or",
"verifies",
"a",
"sid",
".",
"Required",
"for",
"working",
"with",
"the",
"DACL",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_dacl.py#L1047-L1090 |
37,169 | saltstack/salt | salt/utils/win_dacl.py | get_sid_string | def get_sid_string(principal):
'''
Converts a PySID object to a string SID.
Args:
principal(str):
The principal to lookup the sid. Must be a PySID object.
Returns:
str: A string sid
Usage:
.. code-block:: python
# Get a PySID object
py_sid = salt... | python | def get_sid_string(principal):
'''
Converts a PySID object to a string SID.
Args:
principal(str):
The principal to lookup the sid. Must be a PySID object.
Returns:
str: A string sid
Usage:
.. code-block:: python
# Get a PySID object
py_sid = salt... | [
"def",
"get_sid_string",
"(",
"principal",
")",
":",
"# If None is passed, use the Universal Well-known SID \"Null SID\"",
"if",
"principal",
"is",
"None",
":",
"principal",
"=",
"'NULL SID'",
"try",
":",
"return",
"win32security",
".",
"ConvertSidToStringSid",
"(",
"prin... | Converts a PySID object to a string SID.
Args:
principal(str):
The principal to lookup the sid. Must be a PySID object.
Returns:
str: A string sid
Usage:
.. code-block:: python
# Get a PySID object
py_sid = salt.utils.win_dacl.get_sid('jsnuffy')
... | [
"Converts",
"a",
"PySID",
"object",
"to",
"a",
"string",
"SID",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_dacl.py#L1093-L1129 |
37,170 | saltstack/salt | salt/utils/win_dacl.py | get_name | def get_name(principal):
'''
Gets the name from the specified principal.
Args:
principal (str):
Find the Normalized name based on this. Can be a PySID object, a SID
string, or a user name in any capitalization.
.. note::
Searching based on the u... | python | def get_name(principal):
'''
Gets the name from the specified principal.
Args:
principal (str):
Find the Normalized name based on this. Can be a PySID object, a SID
string, or a user name in any capitalization.
.. note::
Searching based on the u... | [
"def",
"get_name",
"(",
"principal",
")",
":",
"# If this is a PySID object, use it",
"if",
"isinstance",
"(",
"principal",
",",
"pywintypes",
".",
"SIDType",
")",
":",
"sid_obj",
"=",
"principal",
"else",
":",
"# If None is passed, use the Universal Well-known SID for \"... | Gets the name from the specified principal.
Args:
principal (str):
Find the Normalized name based on this. Can be a PySID object, a SID
string, or a user name in any capitalization.
.. note::
Searching based on the user name can be slow on hosts connect... | [
"Gets",
"the",
"name",
"from",
"the",
"specified",
"principal",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_dacl.py#L1132-L1186 |
37,171 | saltstack/salt | salt/utils/win_dacl.py | get_owner | def get_owner(obj_name, obj_type='file'):
r'''
Gets the owner of the passed object
Args:
obj_name (str):
The path for which to obtain owner information. The format of this
parameter is different depending on the ``obj_type``
obj_type (str):
The type of ... | python | def get_owner(obj_name, obj_type='file'):
r'''
Gets the owner of the passed object
Args:
obj_name (str):
The path for which to obtain owner information. The format of this
parameter is different depending on the ``obj_type``
obj_type (str):
The type of ... | [
"def",
"get_owner",
"(",
"obj_name",
",",
"obj_type",
"=",
"'file'",
")",
":",
"# Not all filesystems mountable within windows have SecurityDescriptors.",
"# For instance, some mounted SAMBA shares, or VirtualBox shared folders. If",
"# we can't load a file descriptor for the file, we defaul... | r'''
Gets the owner of the passed object
Args:
obj_name (str):
The path for which to obtain owner information. The format of this
parameter is different depending on the ``obj_type``
obj_type (str):
The type of object to query. This value changes the format... | [
"r",
"Gets",
"the",
"owner",
"of",
"the",
"passed",
"object"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_dacl.py#L1189-L1270 |
37,172 | saltstack/salt | salt/utils/win_dacl.py | get_primary_group | def get_primary_group(obj_name, obj_type='file'):
r'''
Gets the primary group of the passed object
Args:
obj_name (str):
The path for which to obtain primary group information
obj_type (str):
The type of object to query. This value changes the format of the
... | python | def get_primary_group(obj_name, obj_type='file'):
r'''
Gets the primary group of the passed object
Args:
obj_name (str):
The path for which to obtain primary group information
obj_type (str):
The type of object to query. This value changes the format of the
... | [
"def",
"get_primary_group",
"(",
"obj_name",
",",
"obj_type",
"=",
"'file'",
")",
":",
"# Not all filesystems mountable within windows have SecurityDescriptors.",
"# For instance, some mounted SAMBA shares, or VirtualBox shared folders. If",
"# we can't load a file descriptor for the file, w... | r'''
Gets the primary group of the passed object
Args:
obj_name (str):
The path for which to obtain primary group information
obj_type (str):
The type of object to query. This value changes the format of the
``obj_name`` parameter as follows:
-... | [
"r",
"Gets",
"the",
"primary",
"group",
"of",
"the",
"passed",
"object"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_dacl.py#L1273-L1356 |
37,173 | saltstack/salt | salt/utils/win_dacl.py | set_owner | def set_owner(obj_name, principal, obj_type='file'):
'''
Set the owner of an object. This can be a file, folder, registry key,
printer, service, etc...
Args:
obj_name (str):
The object for which to set owner. This can be the path to a file or
folder, a registry key, pri... | python | def set_owner(obj_name, principal, obj_type='file'):
'''
Set the owner of an object. This can be a file, folder, registry key,
printer, service, etc...
Args:
obj_name (str):
The object for which to set owner. This can be the path to a file or
folder, a registry key, pri... | [
"def",
"set_owner",
"(",
"obj_name",
",",
"principal",
",",
"obj_type",
"=",
"'file'",
")",
":",
"sid",
"=",
"get_sid",
"(",
"principal",
")",
"obj_flags",
"=",
"flags",
"(",
")",
"# Validate obj_type",
"if",
"obj_type",
".",
"lower",
"(",
")",
"not",
"i... | Set the owner of an object. This can be a file, folder, registry key,
printer, service, etc...
Args:
obj_name (str):
The object for which to set owner. This can be the path to a file or
folder, a registry key, printer, etc. For more information about how
to format t... | [
"Set",
"the",
"owner",
"of",
"an",
"object",
".",
"This",
"can",
"be",
"a",
"file",
"folder",
"registry",
"key",
"printer",
"service",
"etc",
"..."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_dacl.py#L1359-L1433 |
37,174 | saltstack/salt | salt/utils/win_dacl.py | set_permissions | def set_permissions(obj_name,
principal,
permissions,
access_mode='grant',
applies_to=None,
obj_type='file',
reset_perms=False,
protected=None):
'''
Set the permissions of ... | python | def set_permissions(obj_name,
principal,
permissions,
access_mode='grant',
applies_to=None,
obj_type='file',
reset_perms=False,
protected=None):
'''
Set the permissions of ... | [
"def",
"set_permissions",
"(",
"obj_name",
",",
"principal",
",",
"permissions",
",",
"access_mode",
"=",
"'grant'",
",",
"applies_to",
"=",
"None",
",",
"obj_type",
"=",
"'file'",
",",
"reset_perms",
"=",
"False",
",",
"protected",
"=",
"None",
")",
":",
... | Set the permissions of an object. This can be a file, folder, registry key,
printer, service, etc...
Args:
obj_name (str):
The object for which to set permissions. This can be the path to a
file or folder, a registry key, printer, etc. For more information
about how... | [
"Set",
"the",
"permissions",
"of",
"an",
"object",
".",
"This",
"can",
"be",
"a",
"file",
"folder",
"registry",
"key",
"printer",
"service",
"etc",
"..."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_dacl.py#L1517-L1599 |
37,175 | saltstack/salt | salt/utils/win_dacl.py | rm_permissions | def rm_permissions(obj_name,
principal,
ace_type='all',
obj_type='file'):
r'''
Remove a user's ACE from an object. This can be a file, folder, registry
key, printer, service, etc...
Args:
obj_name (str):
The object from which... | python | def rm_permissions(obj_name,
principal,
ace_type='all',
obj_type='file'):
r'''
Remove a user's ACE from an object. This can be a file, folder, registry
key, printer, service, etc...
Args:
obj_name (str):
The object from which... | [
"def",
"rm_permissions",
"(",
"obj_name",
",",
"principal",
",",
"ace_type",
"=",
"'all'",
",",
"obj_type",
"=",
"'file'",
")",
":",
"obj_dacl",
"=",
"dacl",
"(",
"obj_name",
",",
"obj_type",
")",
"obj_dacl",
".",
"rm_ace",
"(",
"principal",
",",
"ace_type... | r'''
Remove a user's ACE from an object. This can be a file, folder, registry
key, printer, service, etc...
Args:
obj_name (str):
The object from which to remove the ace. This can be the
path to a file or folder, a registry key, printer, etc. For more
informatio... | [
"r",
"Remove",
"a",
"user",
"s",
"ACE",
"from",
"an",
"object",
".",
"This",
"can",
"be",
"a",
"file",
"folder",
"registry",
"key",
"printer",
"service",
"etc",
"..."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_dacl.py#L1602-L1648 |
37,176 | saltstack/salt | salt/utils/win_dacl.py | get_permissions | def get_permissions(obj_name, principal=None, obj_type='file'):
'''
Get the permissions for the passed object
Args:
obj_name (str):
The name of or path to the object.
principal (Optional[str]):
The name of the user or group for which to get permissions. Can also
... | python | def get_permissions(obj_name, principal=None, obj_type='file'):
'''
Get the permissions for the passed object
Args:
obj_name (str):
The name of or path to the object.
principal (Optional[str]):
The name of the user or group for which to get permissions. Can also
... | [
"def",
"get_permissions",
"(",
"obj_name",
",",
"principal",
"=",
"None",
",",
"obj_type",
"=",
"'file'",
")",
":",
"obj_dacl",
"=",
"dacl",
"(",
"obj_name",
",",
"obj_type",
")",
"if",
"principal",
"is",
"None",
":",
"return",
"obj_dacl",
".",
"list_aces"... | Get the permissions for the passed object
Args:
obj_name (str):
The name of or path to the object.
principal (Optional[str]):
The name of the user or group for which to get permissions. Can also
pass a SID. If None, all ACEs defined on the object will be
... | [
"Get",
"the",
"permissions",
"for",
"the",
"passed",
"object"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_dacl.py#L1651-L1682 |
37,177 | saltstack/salt | salt/utils/win_dacl.py | has_permission | def has_permission(obj_name,
principal,
permission,
access_mode='grant',
obj_type='file',
exact=True):
r'''
Check if the object has a permission
Args:
obj_name (str):
The name of or path to t... | python | def has_permission(obj_name,
principal,
permission,
access_mode='grant',
obj_type='file',
exact=True):
r'''
Check if the object has a permission
Args:
obj_name (str):
The name of or path to t... | [
"def",
"has_permission",
"(",
"obj_name",
",",
"principal",
",",
"permission",
",",
"access_mode",
"=",
"'grant'",
",",
"obj_type",
"=",
"'file'",
",",
"exact",
"=",
"True",
")",
":",
"# Validate access_mode",
"if",
"access_mode",
".",
"lower",
"(",
")",
"no... | r'''
Check if the object has a permission
Args:
obj_name (str):
The name of or path to the object.
principal (str):
The name of the user or group for which to get permissions. Can also
pass a SID.
permission (str):
The permission to ver... | [
"r",
"Check",
"if",
"the",
"object",
"has",
"a",
"permission"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_dacl.py#L1685-L1773 |
37,178 | saltstack/salt | salt/utils/win_dacl.py | set_inheritance | def set_inheritance(obj_name, enabled, obj_type='file', clear=False):
'''
Enable or disable an objects inheritance.
Args:
obj_name (str):
The name of the object
enabled (bool):
True to enable inheritance, False to disable
obj_type (Optional[str]):
... | python | def set_inheritance(obj_name, enabled, obj_type='file', clear=False):
'''
Enable or disable an objects inheritance.
Args:
obj_name (str):
The name of the object
enabled (bool):
True to enable inheritance, False to disable
obj_type (Optional[str]):
... | [
"def",
"set_inheritance",
"(",
"obj_name",
",",
"enabled",
",",
"obj_type",
"=",
"'file'",
",",
"clear",
"=",
"False",
")",
":",
"if",
"obj_type",
"not",
"in",
"[",
"'file'",
",",
"'registry'",
",",
"'registry32'",
"]",
":",
"raise",
"SaltInvocationError",
... | Enable or disable an objects inheritance.
Args:
obj_name (str):
The name of the object
enabled (bool):
True to enable inheritance, False to disable
obj_type (Optional[str]):
The type of object. Only three objects allow inheritance. Valid
ob... | [
"Enable",
"or",
"disable",
"an",
"objects",
"inheritance",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_dacl.py#L1776-L1818 |
37,179 | saltstack/salt | salt/utils/win_dacl.py | get_inheritance | def get_inheritance(obj_name, obj_type='file'):
'''
Get an object's inheritance.
Args:
obj_name (str):
The name of the object
obj_type (Optional[str]):
The type of object. Only three object types allow inheritance. Valid
objects are:
- file... | python | def get_inheritance(obj_name, obj_type='file'):
'''
Get an object's inheritance.
Args:
obj_name (str):
The name of the object
obj_type (Optional[str]):
The type of object. Only three object types allow inheritance. Valid
objects are:
- file... | [
"def",
"get_inheritance",
"(",
"obj_name",
",",
"obj_type",
"=",
"'file'",
")",
":",
"obj_dacl",
"=",
"dacl",
"(",
"obj_name",
"=",
"obj_name",
",",
"obj_type",
"=",
"obj_type",
")",
"inherited",
"=",
"win32security",
".",
"INHERITED_ACE",
"for",
"i",
"in",
... | Get an object's inheritance.
Args:
obj_name (str):
The name of the object
obj_type (Optional[str]):
The type of object. Only three object types allow inheritance. Valid
objects are:
- file (default): This is a file or directory
- regist... | [
"Get",
"an",
"object",
"s",
"inheritance",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_dacl.py#L1821-L1861 |
37,180 | saltstack/salt | salt/utils/github.py | get_user_pubkeys | def get_user_pubkeys(users):
'''
Retrieve a set of public keys from GitHub for the specified list of users.
Expects input in list format. Optionally, a value in the list may be a dict
whose value is a list of key IDs to be returned. If this is not done, then
all keys will be returned.
Some exam... | python | def get_user_pubkeys(users):
'''
Retrieve a set of public keys from GitHub for the specified list of users.
Expects input in list format. Optionally, a value in the list may be a dict
whose value is a list of key IDs to be returned. If this is not done, then
all keys will be returned.
Some exam... | [
"def",
"get_user_pubkeys",
"(",
"users",
")",
":",
"if",
"not",
"isinstance",
"(",
"users",
",",
"list",
")",
":",
"return",
"{",
"'Error'",
":",
"'A list of users is expected'",
"}",
"ret",
"=",
"{",
"}",
"for",
"user",
"in",
"users",
":",
"key_ids",
"=... | Retrieve a set of public keys from GitHub for the specified list of users.
Expects input in list format. Optionally, a value in the list may be a dict
whose value is a list of key IDs to be returned. If this is not done, then
all keys will be returned.
Some example data structures that coupld be passed... | [
"Retrieve",
"a",
"set",
"of",
"public",
"keys",
"from",
"GitHub",
"for",
"the",
"specified",
"list",
"of",
"users",
".",
"Expects",
"input",
"in",
"list",
"format",
".",
"Optionally",
"a",
"value",
"in",
"the",
"list",
"may",
"be",
"a",
"dict",
"whose",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/github.py#L20-L71 |
37,181 | saltstack/salt | salt/modules/namecheap_domains_dns.py | get_hosts | def get_hosts(sld, tld):
'''
Retrieves DNS host record settings for the requested domain.
returns a dictionary of information about the requested domain
sld
SLD of the domain name
tld
TLD of the domain name
CLI Example:
.. code-block:: bash
salt 'my-minion' name... | python | def get_hosts(sld, tld):
'''
Retrieves DNS host record settings for the requested domain.
returns a dictionary of information about the requested domain
sld
SLD of the domain name
tld
TLD of the domain name
CLI Example:
.. code-block:: bash
salt 'my-minion' name... | [
"def",
"get_hosts",
"(",
"sld",
",",
"tld",
")",
":",
"opts",
"=",
"salt",
".",
"utils",
".",
"namecheap",
".",
"get_opts",
"(",
"'namecheap.domains.dns.gethosts'",
")",
"opts",
"[",
"'TLD'",
"]",
"=",
"tld",
"opts",
"[",
"'SLD'",
"]",
"=",
"sld",
"res... | Retrieves DNS host record settings for the requested domain.
returns a dictionary of information about the requested domain
sld
SLD of the domain name
tld
TLD of the domain name
CLI Example:
.. code-block:: bash
salt 'my-minion' namecheap_domains_dns.get_hosts sld tld | [
"Retrieves",
"DNS",
"host",
"record",
"settings",
"for",
"the",
"requested",
"domain",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/namecheap_domains_dns.py#L56-L84 |
37,182 | saltstack/salt | salt/modules/namecheap_domains_dns.py | get_list | def get_list(sld, tld):
'''
Gets a list of DNS servers associated with the requested domain.
returns a dictionary of information about requested domain
sld
SLD of the domain name
tld
TLD of the domain name
CLI Example:
.. code-block:: bash
salt 'my-minion' namec... | python | def get_list(sld, tld):
'''
Gets a list of DNS servers associated with the requested domain.
returns a dictionary of information about requested domain
sld
SLD of the domain name
tld
TLD of the domain name
CLI Example:
.. code-block:: bash
salt 'my-minion' namec... | [
"def",
"get_list",
"(",
"sld",
",",
"tld",
")",
":",
"opts",
"=",
"salt",
".",
"utils",
".",
"namecheap",
".",
"get_opts",
"(",
"'namecheap.domains.dns.getlist'",
")",
"opts",
"[",
"'TLD'",
"]",
"=",
"tld",
"opts",
"[",
"'SLD'",
"]",
"=",
"sld",
"respo... | Gets a list of DNS servers associated with the requested domain.
returns a dictionary of information about requested domain
sld
SLD of the domain name
tld
TLD of the domain name
CLI Example:
.. code-block:: bash
salt 'my-minion' namecheap_domains_dns.get_list sld tld | [
"Gets",
"a",
"list",
"of",
"DNS",
"servers",
"associated",
"with",
"the",
"requested",
"domain",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/namecheap_domains_dns.py#L87-L115 |
37,183 | saltstack/salt | salt/modules/namecheap_domains_dns.py | set_hosts | def set_hosts(sld, tld, hosts):
'''
Sets DNS host records settings for the requested domain.
returns True if the host records were set successfully
sld
SLD of the domain name
tld
TLD of the domain name
hosts
Must be passed as a list of Python dictionaries, with each d... | python | def set_hosts(sld, tld, hosts):
'''
Sets DNS host records settings for the requested domain.
returns True if the host records were set successfully
sld
SLD of the domain name
tld
TLD of the domain name
hosts
Must be passed as a list of Python dictionaries, with each d... | [
"def",
"set_hosts",
"(",
"sld",
",",
"tld",
",",
"hosts",
")",
":",
"opts",
"=",
"salt",
".",
"utils",
".",
"namecheap",
".",
"get_opts",
"(",
"'namecheap.domains.dns.setHosts'",
")",
"opts",
"[",
"'SLD'",
"]",
"=",
"sld",
"opts",
"[",
"'TLD'",
"]",
"=... | Sets DNS host records settings for the requested domain.
returns True if the host records were set successfully
sld
SLD of the domain name
tld
TLD of the domain name
hosts
Must be passed as a list of Python dictionaries, with each dictionary
containing the following k... | [
"Sets",
"DNS",
"host",
"records",
"settings",
"for",
"the",
"requested",
"domain",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/namecheap_domains_dns.py#L118-L170 |
37,184 | saltstack/salt | salt/modules/namecheap_domains_dns.py | set_custom | def set_custom(sld, tld, nameservers):
'''
Sets domain to use custom DNS servers.
returns True if the custom nameservers were set successfully
sld
SLD of the domain name
tld
TLD of the domain name
nameservers
array of strings List of nameservers to be associated with... | python | def set_custom(sld, tld, nameservers):
'''
Sets domain to use custom DNS servers.
returns True if the custom nameservers were set successfully
sld
SLD of the domain name
tld
TLD of the domain name
nameservers
array of strings List of nameservers to be associated with... | [
"def",
"set_custom",
"(",
"sld",
",",
"tld",
",",
"nameservers",
")",
":",
"opts",
"=",
"salt",
".",
"utils",
".",
"namecheap",
".",
"get_opts",
"(",
"'namecheap.domains.dns.setCustom'",
")",
"opts",
"[",
"'SLD'",
"]",
"=",
"sld",
"opts",
"[",
"'TLD'",
"... | Sets domain to use custom DNS servers.
returns True if the custom nameservers were set successfully
sld
SLD of the domain name
tld
TLD of the domain name
nameservers
array of strings List of nameservers to be associated with this domain
CLI Example:
.. code-block::... | [
"Sets",
"domain",
"to",
"use",
"custom",
"DNS",
"servers",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/namecheap_domains_dns.py#L173-L203 |
37,185 | saltstack/salt | salt/modules/namecheap_domains_dns.py | set_default | def set_default(sld, tld):
'''
Sets domain to use namecheap default DNS servers. Required for free
services like Host record management, URL forwarding, email forwarding,
dynamic DNS and other value added services.
sld
SLD of the domain name
tld
TLD of the domain name
Retu... | python | def set_default(sld, tld):
'''
Sets domain to use namecheap default DNS servers. Required for free
services like Host record management, URL forwarding, email forwarding,
dynamic DNS and other value added services.
sld
SLD of the domain name
tld
TLD of the domain name
Retu... | [
"def",
"set_default",
"(",
"sld",
",",
"tld",
")",
":",
"opts",
"=",
"salt",
".",
"utils",
".",
"namecheap",
".",
"get_opts",
"(",
"'namecheap.domains.dns.setDefault'",
")",
"opts",
"[",
"'SLD'",
"]",
"=",
"sld",
"opts",
"[",
"'TLD'",
"]",
"=",
"tld",
... | Sets domain to use namecheap default DNS servers. Required for free
services like Host record management, URL forwarding, email forwarding,
dynamic DNS and other value added services.
sld
SLD of the domain name
tld
TLD of the domain name
Returns ``True`` if the domain was successf... | [
"Sets",
"domain",
"to",
"use",
"namecheap",
"default",
"DNS",
"servers",
".",
"Required",
"for",
"free",
"services",
"like",
"Host",
"record",
"management",
"URL",
"forwarding",
"email",
"forwarding",
"dynamic",
"DNS",
"and",
"other",
"value",
"added",
"services... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/namecheap_domains_dns.py#L206-L235 |
37,186 | saltstack/salt | salt/output/profile.py | output | def output(data, **kwargs):
'''
Display the profiling data in a table format.
'''
rows = _find_durations(data)
kwargs['opts'] = __opts__
kwargs['rows_key'] = 'rows'
kwargs['labels_key'] = 'labels'
to_show = {'labels': ['name', 'mod.fun', 'duration (ms)'],
'rows': rows... | python | def output(data, **kwargs):
'''
Display the profiling data in a table format.
'''
rows = _find_durations(data)
kwargs['opts'] = __opts__
kwargs['rows_key'] = 'rows'
kwargs['labels_key'] = 'labels'
to_show = {'labels': ['name', 'mod.fun', 'duration (ms)'],
'rows': rows... | [
"def",
"output",
"(",
"data",
",",
"*",
"*",
"kwargs",
")",
":",
"rows",
"=",
"_find_durations",
"(",
"data",
")",
"kwargs",
"[",
"'opts'",
"]",
"=",
"__opts__",
"kwargs",
"[",
"'rows_key'",
"]",
"=",
"'rows'",
"kwargs",
"[",
"'labels_key'",
"]",
"=",
... | Display the profiling data in a table format. | [
"Display",
"the",
"profiling",
"data",
"in",
"a",
"table",
"format",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/output/profile.py#L67-L81 |
37,187 | saltstack/salt | salt/utils/environment.py | get_module_environment | def get_module_environment(env=None, function=None):
'''
Get module optional environment.
To setup an environment option for a particular module,
add either pillar or config at the minion as follows:
system-environment:
modules:
pkg:
_:
LC_ALL: en_GB.UTF-8
... | python | def get_module_environment(env=None, function=None):
'''
Get module optional environment.
To setup an environment option for a particular module,
add either pillar or config at the minion as follows:
system-environment:
modules:
pkg:
_:
LC_ALL: en_GB.UTF-8
... | [
"def",
"get_module_environment",
"(",
"env",
"=",
"None",
",",
"function",
"=",
"None",
")",
":",
"result",
"=",
"{",
"}",
"if",
"not",
"env",
":",
"env",
"=",
"{",
"}",
"for",
"env_src",
"in",
"[",
"env",
".",
"get",
"(",
"'__opts__'",
",",
"{",
... | Get module optional environment.
To setup an environment option for a particular module,
add either pillar or config at the minion as follows:
system-environment:
modules:
pkg:
_:
LC_ALL: en_GB.UTF-8
FOO: bar
install:
HELLO: world
... | [
"Get",
"module",
"optional",
"environment",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/environment.py#L9-L65 |
37,188 | saltstack/salt | salt/modules/aptly.py | _cmd_run | def _cmd_run(cmd):
'''
Run the aptly command.
:return: The string output of the command.
:rtype: str
'''
cmd.insert(0, 'aptly')
cmd_ret = __salt__['cmd.run_all'](cmd, ignore_retcode=True)
if cmd_ret['retcode'] != 0:
log.debug('Unable to execute command: %s\nError: %s', cmd,
... | python | def _cmd_run(cmd):
'''
Run the aptly command.
:return: The string output of the command.
:rtype: str
'''
cmd.insert(0, 'aptly')
cmd_ret = __salt__['cmd.run_all'](cmd, ignore_retcode=True)
if cmd_ret['retcode'] != 0:
log.debug('Unable to execute command: %s\nError: %s', cmd,
... | [
"def",
"_cmd_run",
"(",
"cmd",
")",
":",
"cmd",
".",
"insert",
"(",
"0",
",",
"'aptly'",
")",
"cmd_ret",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"cmd",
",",
"ignore_retcode",
"=",
"True",
")",
"if",
"cmd_ret",
"[",
"'retcode'",
"]",
"!=",
"0... | Run the aptly command.
:return: The string output of the command.
:rtype: str | [
"Run",
"the",
"aptly",
"command",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptly.py#L36-L50 |
37,189 | saltstack/salt | salt/modules/aptly.py | _convert_to_closest_type | def _convert_to_closest_type(value):
'''
Convert string value to it's closest non-string analog, if possible.
:param dict value: The string value to attempt conversion on.
:return: The converted value.
:rtype: Union[bool, int, None, str]
'''
value = salt.utils.stringutils.to_bool(value.str... | python | def _convert_to_closest_type(value):
'''
Convert string value to it's closest non-string analog, if possible.
:param dict value: The string value to attempt conversion on.
:return: The converted value.
:rtype: Union[bool, int, None, str]
'''
value = salt.utils.stringutils.to_bool(value.str... | [
"def",
"_convert_to_closest_type",
"(",
"value",
")",
":",
"value",
"=",
"salt",
".",
"utils",
".",
"stringutils",
".",
"to_bool",
"(",
"value",
".",
"strip",
"(",
")",
")",
"if",
"isinstance",
"(",
"value",
",",
"bool",
")",
":",
"return",
"value",
"r... | Convert string value to it's closest non-string analog, if possible.
:param dict value: The string value to attempt conversion on.
:return: The converted value.
:rtype: Union[bool, int, None, str] | [
"Convert",
"string",
"value",
"to",
"it",
"s",
"closest",
"non",
"-",
"string",
"analog",
"if",
"possible",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptly.py#L53-L67 |
37,190 | saltstack/salt | salt/modules/aptly.py | _format_repo_args | def _format_repo_args(comment=None, component=None, distribution=None,
uploaders_file=None, saltenv='base'):
'''
Format the common arguments for creating or editing a repository.
:param str comment: The description of the repository.
:param str component: The default component to ... | python | def _format_repo_args(comment=None, component=None, distribution=None,
uploaders_file=None, saltenv='base'):
'''
Format the common arguments for creating or editing a repository.
:param str comment: The description of the repository.
:param str component: The default component to ... | [
"def",
"_format_repo_args",
"(",
"comment",
"=",
"None",
",",
"component",
"=",
"None",
",",
"distribution",
"=",
"None",
",",
"uploaders_file",
"=",
"None",
",",
"saltenv",
"=",
"'base'",
")",
":",
"ret",
"=",
"list",
"(",
")",
"cached_uploaders_path",
"=... | Format the common arguments for creating or editing a repository.
:param str comment: The description of the repository.
:param str component: The default component to use when publishing.
:param str distribution: The default distribution to use when publishing.
:param str uploaders_file: The repositor... | [
"Format",
"the",
"common",
"arguments",
"for",
"creating",
"or",
"editing",
"a",
"repository",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptly.py#L70-L103 |
37,191 | saltstack/salt | salt/modules/aptly.py | _parse_show_output | def _parse_show_output(cmd_ret):
'''
Parse the output of an aptly show command.
:param str cmd_ret: The text of the command output that needs to be parsed.
:return: A dictionary containing the configuration data.
:rtype: dict
'''
parsed_data = dict()
list_key = None
for line in cm... | python | def _parse_show_output(cmd_ret):
'''
Parse the output of an aptly show command.
:param str cmd_ret: The text of the command output that needs to be parsed.
:return: A dictionary containing the configuration data.
:rtype: dict
'''
parsed_data = dict()
list_key = None
for line in cm... | [
"def",
"_parse_show_output",
"(",
"cmd_ret",
")",
":",
"parsed_data",
"=",
"dict",
"(",
")",
"list_key",
"=",
"None",
"for",
"line",
"in",
"cmd_ret",
".",
"splitlines",
"(",
")",
":",
"# Skip empty lines.",
"if",
"not",
"line",
".",
"strip",
"(",
")",
":... | Parse the output of an aptly show command.
:param str cmd_ret: The text of the command output that needs to be parsed.
:return: A dictionary containing the configuration data.
:rtype: dict | [
"Parse",
"the",
"output",
"of",
"an",
"aptly",
"show",
"command",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptly.py#L106-L152 |
37,192 | saltstack/salt | salt/modules/aptly.py | _validate_config | def _validate_config(config_path):
'''
Validate that the configuration file exists and is readable.
:param str config_path: The path to the configuration file for the aptly instance.
:return: None
:rtype: None
'''
log.debug('Checking configuration file: %s', config_path)
if not os.pat... | python | def _validate_config(config_path):
'''
Validate that the configuration file exists and is readable.
:param str config_path: The path to the configuration file for the aptly instance.
:return: None
:rtype: None
'''
log.debug('Checking configuration file: %s', config_path)
if not os.pat... | [
"def",
"_validate_config",
"(",
"config_path",
")",
":",
"log",
".",
"debug",
"(",
"'Checking configuration file: %s'",
",",
"config_path",
")",
"if",
"not",
"os",
".",
"path",
".",
"isfile",
"(",
"config_path",
")",
":",
"message",
"=",
"'Unable to get configur... | Validate that the configuration file exists and is readable.
:param str config_path: The path to the configuration file for the aptly instance.
:return: None
:rtype: None | [
"Validate",
"that",
"the",
"configuration",
"file",
"exists",
"and",
"is",
"readable",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptly.py#L185-L200 |
37,193 | saltstack/salt | salt/modules/aptly.py | get_config | def get_config(config_path=_DEFAULT_CONFIG_PATH):
'''
Get the configuration data.
:param str config_path: The path to the configuration file for the aptly instance.
:return: A dictionary containing the configuration data.
:rtype: dict
CLI Example:
.. code-block:: bash
salt '*' a... | python | def get_config(config_path=_DEFAULT_CONFIG_PATH):
'''
Get the configuration data.
:param str config_path: The path to the configuration file for the aptly instance.
:return: A dictionary containing the configuration data.
:rtype: dict
CLI Example:
.. code-block:: bash
salt '*' a... | [
"def",
"get_config",
"(",
"config_path",
"=",
"_DEFAULT_CONFIG_PATH",
")",
":",
"_validate_config",
"(",
"config_path",
")",
"cmd",
"=",
"[",
"'config'",
",",
"'show'",
",",
"'-config={}'",
".",
"format",
"(",
"config_path",
")",
"]",
"cmd_ret",
"=",
"_cmd_run... | Get the configuration data.
:param str config_path: The path to the configuration file for the aptly instance.
:return: A dictionary containing the configuration data.
:rtype: dict
CLI Example:
.. code-block:: bash
salt '*' aptly.get_config | [
"Get",
"the",
"configuration",
"data",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptly.py#L203-L224 |
37,194 | saltstack/salt | salt/modules/aptly.py | list_repos | def list_repos(config_path=_DEFAULT_CONFIG_PATH, with_packages=False):
'''
List all of the local package repositories.
:param str config_path: The path to the configuration file for the aptly instance.
:param bool with_packages: Return a list of packages in the repo.
:return: A dictionary of the r... | python | def list_repos(config_path=_DEFAULT_CONFIG_PATH, with_packages=False):
'''
List all of the local package repositories.
:param str config_path: The path to the configuration file for the aptly instance.
:param bool with_packages: Return a list of packages in the repo.
:return: A dictionary of the r... | [
"def",
"list_repos",
"(",
"config_path",
"=",
"_DEFAULT_CONFIG_PATH",
",",
"with_packages",
"=",
"False",
")",
":",
"_validate_config",
"(",
"config_path",
")",
"ret",
"=",
"dict",
"(",
")",
"cmd",
"=",
"[",
"'repo'",
",",
"'list'",
",",
"'-config={}'",
".",... | List all of the local package repositories.
:param str config_path: The path to the configuration file for the aptly instance.
:param bool with_packages: Return a list of packages in the repo.
:return: A dictionary of the repositories.
:rtype: dict
CLI Example:
.. code-block:: bash
... | [
"List",
"all",
"of",
"the",
"local",
"package",
"repositories",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptly.py#L227-L256 |
37,195 | saltstack/salt | salt/modules/aptly.py | get_repo | def get_repo(name, config_path=_DEFAULT_CONFIG_PATH, with_packages=False):
'''
Get detailed information about a local package repository.
:param str name: The name of the local repository.
:param str config_path: The path to the configuration file for the aptly instance.
:param bool with_packages: ... | python | def get_repo(name, config_path=_DEFAULT_CONFIG_PATH, with_packages=False):
'''
Get detailed information about a local package repository.
:param str name: The name of the local repository.
:param str config_path: The path to the configuration file for the aptly instance.
:param bool with_packages: ... | [
"def",
"get_repo",
"(",
"name",
",",
"config_path",
"=",
"_DEFAULT_CONFIG_PATH",
",",
"with_packages",
"=",
"False",
")",
":",
"_validate_config",
"(",
"config_path",
")",
"with_packages",
"=",
"six",
".",
"text_type",
"(",
"bool",
"(",
"with_packages",
")",
"... | Get detailed information about a local package repository.
:param str name: The name of the local repository.
:param str config_path: The path to the configuration file for the aptly instance.
:param bool with_packages: Return a list of packages in the repo.
:return: A dictionary containing informatio... | [
"Get",
"detailed",
"information",
"about",
"a",
"local",
"package",
"repository",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptly.py#L259-L292 |
37,196 | saltstack/salt | salt/modules/aptly.py | new_repo | def new_repo(name, config_path=_DEFAULT_CONFIG_PATH, comment=None, component=None,
distribution=None, uploaders_file=None, from_snapshot=None,
saltenv='base'):
'''
Create a new local package repository.
:param str name: The name of the local repository.
:param str config_path:... | python | def new_repo(name, config_path=_DEFAULT_CONFIG_PATH, comment=None, component=None,
distribution=None, uploaders_file=None, from_snapshot=None,
saltenv='base'):
'''
Create a new local package repository.
:param str name: The name of the local repository.
:param str config_path:... | [
"def",
"new_repo",
"(",
"name",
",",
"config_path",
"=",
"_DEFAULT_CONFIG_PATH",
",",
"comment",
"=",
"None",
",",
"component",
"=",
"None",
",",
"distribution",
"=",
"None",
",",
"uploaders_file",
"=",
"None",
",",
"from_snapshot",
"=",
"None",
",",
"salten... | Create a new local package repository.
:param str name: The name of the local repository.
:param str config_path: The path to the configuration file for the aptly instance.
:param str comment: The description of the repository.
:param str component: The default component to use when publishing.
:pa... | [
"Create",
"a",
"new",
"local",
"package",
"repository",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptly.py#L295-L344 |
37,197 | saltstack/salt | salt/modules/aptly.py | set_repo | def set_repo(name, config_path=_DEFAULT_CONFIG_PATH, comment=None, component=None,
distribution=None, uploaders_file=None, saltenv='base'):
'''
Configure the settings for a local package repository.
:param str name: The name of the local repository.
:param str config_path: The path to the ... | python | def set_repo(name, config_path=_DEFAULT_CONFIG_PATH, comment=None, component=None,
distribution=None, uploaders_file=None, saltenv='base'):
'''
Configure the settings for a local package repository.
:param str name: The name of the local repository.
:param str config_path: The path to the ... | [
"def",
"set_repo",
"(",
"name",
",",
"config_path",
"=",
"_DEFAULT_CONFIG_PATH",
",",
"comment",
"=",
"None",
",",
"component",
"=",
"None",
",",
"distribution",
"=",
"None",
",",
"uploaders_file",
"=",
"None",
",",
"saltenv",
"=",
"'base'",
")",
":",
"_va... | Configure the settings for a local package repository.
:param str name: The name of the local repository.
:param str config_path: The path to the configuration file for the aptly instance.
:param str comment: The description of the repository.
:param str component: The default component to use when pub... | [
"Configure",
"the",
"settings",
"for",
"a",
"local",
"package",
"repository",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptly.py#L347-L419 |
37,198 | saltstack/salt | salt/modules/aptly.py | delete_repo | def delete_repo(name, config_path=_DEFAULT_CONFIG_PATH, force=False):
'''
Remove a local package repository.
:param str name: The name of the local repository.
:param str config_path: The path to the configuration file for the aptly instance.
:param bool force: Whether to remove the repository even... | python | def delete_repo(name, config_path=_DEFAULT_CONFIG_PATH, force=False):
'''
Remove a local package repository.
:param str name: The name of the local repository.
:param str config_path: The path to the configuration file for the aptly instance.
:param bool force: Whether to remove the repository even... | [
"def",
"delete_repo",
"(",
"name",
",",
"config_path",
"=",
"_DEFAULT_CONFIG_PATH",
",",
"force",
"=",
"False",
")",
":",
"_validate_config",
"(",
"config_path",
")",
"force",
"=",
"six",
".",
"text_type",
"(",
"bool",
"(",
"force",
")",
")",
".",
"lower",... | Remove a local package repository.
:param str name: The name of the local repository.
:param str config_path: The path to the configuration file for the aptly instance.
:param bool force: Whether to remove the repository even if it is used as the source
of an existing snapshot.
:return: A bool... | [
"Remove",
"a",
"local",
"package",
"repository",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptly.py#L422-L459 |
37,199 | saltstack/salt | salt/modules/aptly.py | list_mirrors | def list_mirrors(config_path=_DEFAULT_CONFIG_PATH):
'''
Get a list of all the mirrored remote repositories.
:param str config_path: The path to the configuration file for the aptly instance.
:return: A list of the mirror names.
:rtype: list
CLI Example:
.. code-block:: bash
salt... | python | def list_mirrors(config_path=_DEFAULT_CONFIG_PATH):
'''
Get a list of all the mirrored remote repositories.
:param str config_path: The path to the configuration file for the aptly instance.
:return: A list of the mirror names.
:rtype: list
CLI Example:
.. code-block:: bash
salt... | [
"def",
"list_mirrors",
"(",
"config_path",
"=",
"_DEFAULT_CONFIG_PATH",
")",
":",
"_validate_config",
"(",
"config_path",
")",
"cmd",
"=",
"[",
"'mirror'",
",",
"'list'",
",",
"'-config={}'",
".",
"format",
"(",
"config_path",
")",
",",
"'-raw=true'",
"]",
"cm... | Get a list of all the mirrored remote repositories.
:param str config_path: The path to the configuration file for the aptly instance.
:return: A list of the mirror names.
:rtype: list
CLI Example:
.. code-block:: bash
salt '*' aptly.list_mirrors | [
"Get",
"a",
"list",
"of",
"all",
"the",
"mirrored",
"remote",
"repositories",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptly.py#L462-L485 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.