partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
_parse_udevadm_info
Parse the info returned by udevadm command.
salt/modules/udev.py
def _parse_udevadm_info(udev_info): ''' Parse the info returned by udevadm command. ''' devices = [] dev = {} for line in (line.strip() for line in udev_info.splitlines()): if line: line = line.split(':', 1) if len(line) != 2: continue ...
def _parse_udevadm_info(udev_info): ''' Parse the info returned by udevadm command. ''' devices = [] dev = {} for line in (line.strip() for line in udev_info.splitlines()): if line: line = line.split(':', 1) if len(line) != 2: continue ...
[ "Parse", "the", "info", "returned", "by", "udevadm", "command", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/udev.py#L31-L70
[ "def", "_parse_udevadm_info", "(", "udev_info", ")", ":", "devices", "=", "[", "]", "dev", "=", "{", "}", "for", "line", "in", "(", "line", ".", "strip", "(", ")", "for", "line", "in", "udev_info", ".", "splitlines", "(", ")", ")", ":", "if", "line...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_normalize_info
Replace list with only one element to the value of the element. :param dev: :return:
salt/modules/udev.py
def _normalize_info(dev): ''' Replace list with only one element to the value of the element. :param dev: :return: ''' for sect, val in dev.items(): if len(val) == 1: dev[sect] = val[0] return dev
def _normalize_info(dev): ''' Replace list with only one element to the value of the element. :param dev: :return: ''' for sect, val in dev.items(): if len(val) == 1: dev[sect] = val[0] return dev
[ "Replace", "list", "with", "only", "one", "element", "to", "the", "value", "of", "the", "element", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/udev.py#L73-L84
[ "def", "_normalize_info", "(", "dev", ")", ":", "for", "sect", ",", "val", "in", "dev", ".", "items", "(", ")", ":", "if", "len", "(", "val", ")", "==", "1", ":", "dev", "[", "sect", "]", "=", "val", "[", "0", "]", "return", "dev" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
train
info
Extract all info delivered by udevadm CLI Example: .. code-block:: bash salt '*' udev.info /dev/sda salt '*' udev.info /sys/class/net/eth0
salt/modules/udev.py
def info(dev): ''' Extract all info delivered by udevadm CLI Example: .. code-block:: bash salt '*' udev.info /dev/sda salt '*' udev.info /sys/class/net/eth0 ''' if 'sys' in dev: qtype = 'path' else: qtype = 'name' cmd = 'udevadm info --export --query=...
def info(dev): ''' Extract all info delivered by udevadm CLI Example: .. code-block:: bash salt '*' udev.info /dev/sda salt '*' udev.info /sys/class/net/eth0 ''' if 'sys' in dev: qtype = 'path' else: qtype = 'name' cmd = 'udevadm info --export --query=...
[ "Extract", "all", "info", "delivered", "by", "udevadm" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/udev.py#L87-L109
[ "def", "info", "(", "dev", ")", ":", "if", "'sys'", "in", "dev", ":", "qtype", "=", "'path'", "else", ":", "qtype", "=", "'name'", "cmd", "=", "'udevadm info --export --query=all --{0}={1}'", ".", "format", "(", "qtype", ",", "dev", ")", "udev_result", "="...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
exportdb
Return all the udev database CLI Example: .. code-block:: bash salt '*' udev.exportdb
salt/modules/udev.py
def exportdb(): ''' Return all the udev database CLI Example: .. code-block:: bash salt '*' udev.exportdb ''' cmd = 'udevadm info --export-db' udev_result = __salt__['cmd.run_all'](cmd, output_loglevel='quiet') if udev_result['retcode']: raise CommandExecutionError(u...
def exportdb(): ''' Return all the udev database CLI Example: .. code-block:: bash salt '*' udev.exportdb ''' cmd = 'udevadm info --export-db' udev_result = __salt__['cmd.run_all'](cmd, output_loglevel='quiet') if udev_result['retcode']: raise CommandExecutionError(u...
[ "Return", "all", "the", "udev", "database" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/udev.py#L168-L185
[ "def", "exportdb", "(", ")", ":", "cmd", "=", "'udevadm info --export-db'", "udev_result", "=", "__salt__", "[", "'cmd.run_all'", "]", "(", "cmd", ",", "output_loglevel", "=", "'quiet'", ")", "if", "udev_result", "[", "'retcode'", "]", ":", "raise", "CommandEx...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_get_date_time_format
Function that detects the date/time format for the string passed. :param str dt_string: A date/time string :return: The format of the passed dt_string :rtype: str :raises: SaltInvocationError on Invalid Date/Time string
salt/modules/mac_timezone.py
def _get_date_time_format(dt_string): ''' Function that detects the date/time format for the string passed. :param str dt_string: A date/time string :return: The format of the passed dt_string :rtype: str :raises: SaltInvocationError on Invalid Date/Time string ''' valid_forma...
def _get_date_time_format(dt_string): ''' Function that detects the date/time format for the string passed. :param str dt_string: A date/time string :return: The format of the passed dt_string :rtype: str :raises: SaltInvocationError on Invalid Date/Time string ''' valid_forma...
[ "Function", "that", "detects", "the", "date", "/", "time", "format", "for", "the", "string", "passed", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_timezone.py#L31-L58
[ "def", "_get_date_time_format", "(", "dt_string", ")", ":", "valid_formats", "=", "[", "'%H:%M'", ",", "'%H:%M:%S'", ",", "'%m:%d:%y'", ",", "'%m:%d:%Y'", ",", "'%m/%d/%y'", ",", "'%m/%d/%Y'", "]", "for", "dt_format", "in", "valid_formats", ":", "try", ":", "d...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
get_date
Displays the current date :return: the system date :rtype: str CLI Example: .. code-block:: bash salt '*' timezone.get_date
salt/modules/mac_timezone.py
def get_date(): ''' Displays the current date :return: the system date :rtype: str CLI Example: .. code-block:: bash salt '*' timezone.get_date ''' ret = salt.utils.mac_utils.execute_return_result('systemsetup -getdate') return salt.utils.mac_utils.parse_return(ret)
def get_date(): ''' Displays the current date :return: the system date :rtype: str CLI Example: .. code-block:: bash salt '*' timezone.get_date ''' ret = salt.utils.mac_utils.execute_return_result('systemsetup -getdate') return salt.utils.mac_utils.parse_return(ret)
[ "Displays", "the", "current", "date" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_timezone.py#L61-L75
[ "def", "get_date", "(", ")", ":", "ret", "=", "salt", ".", "utils", ".", "mac_utils", ".", "execute_return_result", "(", "'systemsetup -getdate'", ")", "return", "salt", ".", "utils", ".", "mac_utils", ".", "parse_return", "(", "ret", ")" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
train
set_date
Set the current month, day, and year :param str date: The date to set. Valid date formats are: - %m:%d:%y - %m:%d:%Y - %m/%d/%y - %m/%d/%Y :return: True if successful, False if not :rtype: bool :raises: SaltInvocationError on Invalid Date format :raises: CommandEx...
salt/modules/mac_timezone.py
def set_date(date): ''' Set the current month, day, and year :param str date: The date to set. Valid date formats are: - %m:%d:%y - %m:%d:%Y - %m/%d/%y - %m/%d/%Y :return: True if successful, False if not :rtype: bool :raises: SaltInvocationError on Invalid Da...
def set_date(date): ''' Set the current month, day, and year :param str date: The date to set. Valid date formats are: - %m:%d:%y - %m:%d:%Y - %m/%d/%y - %m/%d/%Y :return: True if successful, False if not :rtype: bool :raises: SaltInvocationError on Invalid Da...
[ "Set", "the", "current", "month", "day", "and", "year" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_timezone.py#L78-L105
[ "def", "set_date", "(", "date", ")", ":", "date_format", "=", "_get_date_time_format", "(", "date", ")", "dt_obj", "=", "datetime", ".", "strptime", "(", "date", ",", "date_format", ")", "cmd", "=", "'systemsetup -setdate {0}'", ".", "format", "(", "dt_obj", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
get_time
Get the current system time. :return: The current time in 24 hour format :rtype: str CLI Example: .. code-block:: bash salt '*' timezone.get_time
salt/modules/mac_timezone.py
def get_time(): ''' Get the current system time. :return: The current time in 24 hour format :rtype: str CLI Example: .. code-block:: bash salt '*' timezone.get_time ''' ret = salt.utils.mac_utils.execute_return_result('systemsetup -gettime') return salt.utils.mac_utils.p...
def get_time(): ''' Get the current system time. :return: The current time in 24 hour format :rtype: str CLI Example: .. code-block:: bash salt '*' timezone.get_time ''' ret = salt.utils.mac_utils.execute_return_result('systemsetup -gettime') return salt.utils.mac_utils.p...
[ "Get", "the", "current", "system", "time", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_timezone.py#L108-L122
[ "def", "get_time", "(", ")", ":", "ret", "=", "salt", ".", "utils", ".", "mac_utils", ".", "execute_return_result", "(", "'systemsetup -gettime'", ")", "return", "salt", ".", "utils", ".", "mac_utils", ".", "parse_return", "(", "ret", ")" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
train
set_time
Sets the current time. Must be in 24 hour format. :param str time: The time to set in 24 hour format. The value must be double quoted. ie: '"17:46"' :return: True if successful, False if not :rtype: bool :raises: SaltInvocationError on Invalid Time format :raises: CommandExecutionError o...
salt/modules/mac_timezone.py
def set_time(time): ''' Sets the current time. Must be in 24 hour format. :param str time: The time to set in 24 hour format. The value must be double quoted. ie: '"17:46"' :return: True if successful, False if not :rtype: bool :raises: SaltInvocationError on Invalid Time format ...
def set_time(time): ''' Sets the current time. Must be in 24 hour format. :param str time: The time to set in 24 hour format. The value must be double quoted. ie: '"17:46"' :return: True if successful, False if not :rtype: bool :raises: SaltInvocationError on Invalid Time format ...
[ "Sets", "the", "current", "time", ".", "Must", "be", "in", "24", "hour", "format", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_timezone.py#L125-L149
[ "def", "set_time", "(", "time", ")", ":", "# time must be double quoted '\"17:46\"'", "time_format", "=", "_get_date_time_format", "(", "time", ")", "dt_obj", "=", "datetime", ".", "strptime", "(", "time", ",", "time_format", ")", "cmd", "=", "'systemsetup -settime ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
get_zone
Displays the current time zone :return: The current time zone :rtype: str CLI Example: .. code-block:: bash salt '*' timezone.get_zone
salt/modules/mac_timezone.py
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(): ''' 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...
[ "Displays", "the", "current", "time", "zone" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_timezone.py#L152-L166
[ "def", "get_zone", "(", ")", ":", "ret", "=", "salt", ".", "utils", ".", "mac_utils", ".", "execute_return_result", "(", "'systemsetup -gettimezone'", ")", "return", "salt", ".", "utils", ".", "mac_utils", ".", "parse_return", "(", "ret", ")" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
train
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
salt/modules/mac_timezone.py
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(): ''' 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...
[ "Displays", "a", "list", "of", "available", "time", "zones", ".", "Use", "this", "list", "when", "setting", "a", "time", "zone", "using", "timezone", ".", "set_zone" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_timezone.py#L201-L219
[ "def", "list_zones", "(", ")", ":", "ret", "=", "salt", ".", "utils", ".", "mac_utils", ".", "execute_return_result", "(", "'systemsetup -listtimezones'", ")", "zones", "=", "salt", ".", "utils", ".", "mac_utils", ".", "parse_return", "(", "ret", ")", "retur...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
set_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: CommandExecutionError on failure CLI Exampl...
salt/modules/mac_timezone.py
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): ''' 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...
[ "Set", "the", "local", "time", "zone", ".", "Use", "timezone", ".", "list_zones", "to", "list", "valid", "time_zone", "arguments" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_timezone.py#L222-L247
[ "def", "set_zone", "(", "time_zone", ")", ":", "if", "time_zone", "not", "in", "list_zones", "(", ")", ":", "raise", "SaltInvocationError", "(", "'Invalid Timezone: {0}'", ".", "format", "(", "time_zone", ")", ")", "salt", ".", "utils", ".", "mac_utils", "."...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
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
salt/modules/mac_timezone.py
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(): ''' 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( ...
[ "Display", "whether", "network", "time", "is", "on", "or", "off" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_timezone.py#L266-L283
[ "def", "get_using_network_time", "(", ")", ":", "ret", "=", "salt", ".", "utils", ".", "mac_utils", ".", "execute_return_result", "(", "'systemsetup -getusingnetworktime'", ")", "return", "salt", ".", "utils", ".", "mac_utils", ".", "validate_enabled", "(", "salt"...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
set_using_network_time
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...
salt/modules/mac_timezone.py
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): ''' 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: ...
[ "Set", "whether", "network", "time", "is", "on", "or", "off", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_timezone.py#L286-L310
[ "def", "set_using_network_time", "(", "enable", ")", ":", "state", "=", "salt", ".", "utils", ".", "mac_utils", ".", "validate_enabled", "(", "enable", ")", "cmd", "=", "'systemsetup -setusingnetworktime {0}'", ".", "format", "(", "state", ")", "salt", ".", "u...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
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
salt/modules/mac_timezone.py
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(): ''' 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...
[ "Display", "the", "currently", "set", "network", "time", "server", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_timezone.py#L313-L328
[ "def", "get_time_server", "(", ")", ":", "ret", "=", "salt", ".", "utils", ".", "mac_utils", ".", "execute_return_result", "(", "'systemsetup -getnetworktimeserver'", ")", "return", "salt", ".", "utils", ".", "mac_utils", ".", "parse_return", "(", "ret", ")" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
train
set_time_server
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...
salt/modules/mac_timezone.py
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'): ''' 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 ...
[ "Designates", "a", "network", "time", "server", ".", "Enter", "the", "IP", "address", "or", "DNS", "name", "for", "the", "network", "time", "server", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_timezone.py#L331-L355
[ "def", "set_time_server", "(", "time_server", "=", "'time.apple.com'", ")", ":", "cmd", "=", "'systemsetup -setnetworktimeserver {0}'", ".", "format", "(", "time_server", ")", "salt", ".", "utils", ".", "mac_utils", ".", "execute_return_success", "(", "cmd", ")", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
get_snapshot
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...
salt/modules/nexus.py
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=None, username=None, password=None): ''' Gets snapshot of the desired version of the artifact nexus_url URL of nexus instance rep...
[ "Gets", "snapshot", "of", "the", "desired", "version", "of", "the", "artifact" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nexus.py#L83-L118
[ "def", "get_snapshot", "(", "nexus_url", ",", "repository", ",", "group_id", ",", "artifact_id", ",", "packaging", ",", "version", ",", "snapshot_version", "=", "None", ",", "target_dir", "=", "'/tmp'", ",", "target_file", "=", "None", ",", "classifier", "=", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
get_snapshot_version_string
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...
salt/modules/nexus.py
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): ''' Gets the specific version string of a snapshot of the desired version of the artifact nexus_url URL of nexus instance repository ...
[ "Gets", "the", "specific", "version", "string", "of", "a", "snapshot", "of", "the", "desired", "version", "of", "the", "artifact" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nexus.py#L121-L149
[ "def", "get_snapshot_version_string", "(", "nexus_url", ",", "repository", ",", "group_id", ",", "artifact_id", ",", "packaging", ",", "version", ",", "classifier", "=", "None", ",", "username", "=", "None", ",", "password", "=", "None", ")", ":", "log", "."...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
get
Get a value from the dictionary
salt/sdb/yaml.py
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 ''' 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) ...
[ "Get", "a", "value", "from", "the", "dictionary" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/sdb/yaml.py#L71-L81
[ "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...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_get_values
Retrieve all the referenced files, deserialize, then merge them together
salt/sdb/yaml.py
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): ''' 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...
[ "Retrieve", "all", "the", "referenced", "files", "deserialize", "then", "merge", "them", "together" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/sdb/yaml.py#L84-L102
[ "def", "_get_values", "(", "profile", "=", "None", ")", ":", "profile", "=", "profile", "or", "{", "}", "serializers", "=", "salt", ".", "loader", ".", "serializers", "(", "__opts__", ")", "ret", "=", "{", "}", "for", "fname", "in", "profile", ".", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
present
Ensures that the host exists, eventually creates new host. NOTE: please use argument visible_name instead of name to not mess with name from salt sls. This function accepts all standard host properties: keyword argument names differ depending on your zabbix version, see: https://www.zabbix.com/documentation...
salt/states/zabbix_host.py
def present(host, groups, interfaces, **kwargs): ''' Ensures that the host exists, eventually creates new host. NOTE: please use argument visible_name instead of name to not mess with name from salt sls. This function accepts all standard host properties: keyword argument names differ depending on your ...
def present(host, groups, interfaces, **kwargs): ''' Ensures that the host exists, eventually creates new host. NOTE: please use argument visible_name instead of name to not mess with name from salt sls. This function accepts all standard host properties: keyword argument names differ depending on your ...
[ "Ensures", "that", "the", "host", "exists", "eventually", "creates", "new", "host", ".", "NOTE", ":", "please", "use", "argument", "visible_name", "instead", "of", "name", "to", "not", "mess", "with", "name", "from", "salt", "sls", ".", "This", "function", ...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/zabbix_host.py#L22-L337
[ "def", "present", "(", "host", ",", "groups", ",", "interfaces", ",", "*", "*", "kwargs", ")", ":", "connection_args", "=", "{", "}", "if", "'_connection_user'", "in", "kwargs", ":", "connection_args", "[", "'_connection_user'", "]", "=", "kwargs", "[", "'...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
absent
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...
salt/states/zabbix_host.py
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): """ 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...
[ "Ensures", "that", "the", "host", "does", "not", "exists", "eventually", "deletes", "host", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/zabbix_host.py#L340-L407
[ "def", "absent", "(", "name", ",", "*", "*", "kwargs", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "False", ",", "'comment'", ":", "''", "}", "# Comment and change messages", "comment_host_dele...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
assign_templates
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...
salt/states/zabbix_host.py
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): ''' 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...
[ "Ensures", "that", "templates", "are", "assigned", "to", "the", "host", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/zabbix_host.py#L410-L516
[ "def", "assign_templates", "(", "host", ",", "templates", ",", "*", "*", "kwargs", ")", ":", "connection_args", "=", "{", "}", "if", "'_connection_user'", "in", "kwargs", ":", "connection_args", "[", "'_connection_user'", "]", "=", "kwargs", "[", "'_connection...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
init
This function gets called when the proxy starts up.
salt/proxy/cimc.py
def init(opts): ''' This function gets called when the proxy starts up. ''' if 'host' not in opts['proxy']: log.critical('No \'host\' key found in pillar for this proxy.') return False if 'username' not in opts['proxy']: log.critical('No \'username\' key found in pillar for t...
def init(opts): ''' This function gets called when the proxy starts up. ''' if 'host' not in opts['proxy']: log.critical('No \'host\' key found in pillar for this proxy.') return False if 'username' not in opts['proxy']: log.critical('No \'username\' key found in pillar for t...
[ "This", "function", "gets", "called", "when", "the", "proxy", "starts", "up", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/cimc.py#L110-L139
[ "def", "init", "(", "opts", ")", ":", "if", "'host'", "not", "in", "opts", "[", "'proxy'", "]", ":", "log", ".", "critical", "(", "'No \\'host\\' key found in pillar for this proxy.'", ")", "return", "False", "if", "'username'", "not", "in", "opts", "[", "'p...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
set_config_modify
The configConfMo method configures the specified managed object in a single subtree (for example, DN).
salt/proxy/cimc.py
def set_config_modify(dn=None, inconfig=None, hierarchical=False): ''' The configConfMo method configures the specified managed object in a single subtree (for example, DN). ''' ret = {} cookie = logon() # Declare if the search contains hierarchical results. h = "false" if hierarchical ...
def set_config_modify(dn=None, inconfig=None, hierarchical=False): ''' The configConfMo method configures the specified managed object in a single subtree (for example, DN). ''' ret = {} cookie = logon() # Declare if the search contains hierarchical results. h = "false" if hierarchical ...
[ "The", "configConfMo", "method", "configures", "the", "specified", "managed", "object", "in", "a", "single", "subtree", "(", "for", "example", "DN", ")", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/cimc.py#L142-L173
[ "def", "set_config_modify", "(", "dn", "=", "None", ",", "inconfig", "=", "None", ",", "hierarchical", "=", "False", ")", ":", "ret", "=", "{", "}", "cookie", "=", "logon", "(", ")", "# Declare if the search contains hierarchical results.", "h", "=", "\"false\...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
logon
Logs into the cimc device and returns the session cookie.
salt/proxy/cimc.py
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(): ''' 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, ...
[ "Logs", "into", "the", "cimc", "device", "and", "returns", "the", "session", "cookie", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/cimc.py#L210-L236
[ "def", "logon", "(", ")", ":", "content", "=", "{", "}", "payload", "=", "\"<aaaLogin inName='{0}' inPassword='{1}'></aaaLogin>\"", ".", "format", "(", "DETAILS", "[", "'username'", "]", ",", "DETAILS", "[", "'password'", "]", ")", "r", "=", "__utils__", "[", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
logout
Closes the session with the device.
salt/proxy/cimc.py
def logout(cookie=None): ''' Closes the session with the device. ''' payload = '<aaaLogout cookie="{0}" inCookie="{0}"></aaaLogout>'.format(cookie) __utils__['http.query'](DETAILS['url'], data=payload, method='POST', ...
def logout(cookie=None): ''' Closes the session with the device. ''' payload = '<aaaLogout cookie="{0}" inCookie="{0}"></aaaLogout>'.format(cookie) __utils__['http.query'](DETAILS['url'], data=payload, method='POST', ...
[ "Closes", "the", "session", "with", "the", "device", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/cimc.py#L239-L252
[ "def", "logout", "(", "cookie", "=", "None", ")", ":", "payload", "=", "'<aaaLogout cookie=\"{0}\" inCookie=\"{0}\"></aaaLogout>'", ".", "format", "(", "cookie", ")", "__utils__", "[", "'http.query'", "]", "(", "DETAILS", "[", "'url'", "]", ",", "data", "=", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
prepare_return
Converts the etree to dict
salt/proxy/cimc.py
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): ''' 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
[ "Converts", "the", "etree", "to", "dict" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/cimc.py#L255-L266
[ "def", "prepare_return", "(", "x", ")", ":", "ret", "=", "{", "}", "for", "a", "in", "list", "(", "x", ")", ":", "if", "a", ".", "tag", "not", "in", "ret", ":", "ret", "[", "a", ".", "tag", "]", "=", "[", "]", "ret", "[", "a", ".", "tag",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
grains
Get the grains from the proxied device
salt/proxy/cimc.py
def grains(): ''' Get the grains from the proxied device ''' if not DETAILS.get('grains_cache', {}): DETAILS['grains_cache'] = GRAINS_CACHE try: compute_rack = get_config_resolver_class('computeRackUnit', False) DETAILS['grains_cache'] = compute_rack['outConfigs']...
def grains(): ''' Get the grains from the proxied device ''' if not DETAILS.get('grains_cache', {}): DETAILS['grains_cache'] = GRAINS_CACHE try: compute_rack = get_config_resolver_class('computeRackUnit', False) DETAILS['grains_cache'] = compute_rack['outConfigs']...
[ "Get", "the", "grains", "from", "the", "proxied", "device" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/cimc.py#L278-L291
[ "def", "grains", "(", ")", ":", "if", "not", "DETAILS", ".", "get", "(", "'grains_cache'", ",", "{", "}", ")", ":", "DETAILS", "[", "'grains_cache'", "]", "=", "GRAINS_CACHE", "try", ":", "compute_rack", "=", "get_config_resolver_class", "(", "'computeRackUn...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
ping
Returns true if the device is reachable, else false.
salt/proxy/cimc.py
def ping(): ''' Returns true if the device is reachable, else false. ''' try: cookie = logon() logout(cookie) except salt.exceptions.CommandExecutionError: return False except Exception as err: log.debug(err) return False return True
def ping(): ''' Returns true if the device is reachable, else false. ''' try: cookie = logon() logout(cookie) except salt.exceptions.CommandExecutionError: return False except Exception as err: log.debug(err) return False return True
[ "Returns", "true", "if", "the", "device", "is", "reachable", "else", "false", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/cimc.py#L302-L314
[ "def", "ping", "(", ")", ":", "try", ":", "cookie", "=", "logon", "(", ")", "logout", "(", "cookie", ")", "except", "salt", ".", "exceptions", ".", "CommandExecutionError", ":", "return", "False", "except", "Exception", "as", "err", ":", "log", ".", "d...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
guess_archive_type
Guess an archive type (tar, zip, or rar) by its file extension
salt/utils/files.py
def guess_archive_type(name): ''' Guess an archive type (tar, zip, or rar) by its file extension ''' name = name.lower() for ending in ('tar', 'tar.gz', 'tgz', 'tar.bz2', 'tbz2', 'tbz', 'tar.xz', 'txz', 'tar.lzma', 'tlz'): if name.ends...
def guess_archive_type(name): ''' Guess an archive type (tar, zip, or rar) by its file extension ''' name = name.lower() for ending in ('tar', 'tar.gz', 'tgz', 'tar.bz2', 'tbz2', 'tbz', 'tar.xz', 'txz', 'tar.lzma', 'tlz'): if name.ends...
[ "Guess", "an", "archive", "type", "(", "tar", "zip", "or", "rar", ")", "by", "its", "file", "extension" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/files.py#L68-L82
[ "def", "guess_archive_type", "(", "name", ")", ":", "name", "=", "name", ".", "lower", "(", ")", "for", "ending", "in", "(", "'tar'", ",", "'tar.gz'", ",", "'tgz'", ",", "'tar.bz2'", ",", "'tbz2'", ",", "'tbz'", ",", "'tar.xz'", ",", "'txz'", ",", "'...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
mkstemp
Helper function which does exactly what ``tempfile.mkstemp()`` does but accepts another argument, ``close_fd``, which, by default, is true and closes the fd before returning the file path. Something commonly done throughout Salt's code.
salt/utils/files.py
def mkstemp(*args, **kwargs): ''' Helper function which does exactly what ``tempfile.mkstemp()`` does but accepts another argument, ``close_fd``, which, by default, is true and closes the fd before returning the file path. Something commonly done throughout Salt's code. ''' if 'prefix' not i...
def mkstemp(*args, **kwargs): ''' Helper function which does exactly what ``tempfile.mkstemp()`` does but accepts another argument, ``close_fd``, which, by default, is true and closes the fd before returning the file path. Something commonly done throughout Salt's code. ''' if 'prefix' not i...
[ "Helper", "function", "which", "does", "exactly", "what", "tempfile", ".", "mkstemp", "()", "does", "but", "accepts", "another", "argument", "close_fd", "which", "by", "default", "is", "true", "and", "closes", "the", "fd", "before", "returning", "the", "file",...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/files.py#L85-L100
[ "def", "mkstemp", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "'prefix'", "not", "in", "kwargs", ":", "kwargs", "[", "'prefix'", "]", "=", "'__salt.tmp.'", "close_fd", "=", "kwargs", ".", "pop", "(", "'close_fd'", ",", "True", ")", "fd...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
recursive_copy
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)
salt/utils/files.py
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): ''' 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(...
[ "Recursively", "copy", "the", "source", "directory", "to", "the", "destination", "leaving", "files", "with", "the", "source", "does", "not", "explicitly", "overwrite", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/files.py#L103-L118
[ "def", "recursive_copy", "(", "source", ",", "dest", ")", ":", "for", "root", ",", "_", ",", "files", "in", "salt", ".", "utils", ".", "path", ".", "os_walk", "(", "source", ")", ":", "path_from_source", "=", "root", ".", "replace", "(", "source", ",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
copyfile
Copy files from a source to a destination in an atomic way, and if specified cache the file.
salt/utils/files.py
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=''): ''' 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...
[ "Copy", "files", "from", "a", "source", "to", "a", "destination", "in", "an", "atomic", "way", "and", "if", "specified", "cache", "the", "file", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/files.py#L121-L181
[ "def", "copyfile", "(", "source", ",", "dest", ",", "backup_mode", "=", "''", ",", "cachedir", "=", "''", ")", ":", "if", "not", "os", ".", "path", ".", "isfile", "(", "source", ")", ":", "raise", "IOError", "(", "'[Errno 2] No such file or directory: {0}'...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
rename
On Windows, os.rename() will fail with a WindowsError exception if a file exists at the destination path. This function checks for this error and if found, it deletes the destination path first.
salt/utils/files.py
def rename(src, dst): ''' On Windows, os.rename() will fail with a WindowsError exception if a file exists at the destination path. This function checks for this error and if found, it deletes the destination path first. ''' try: os.rename(src, dst) except OSError as exc: if ...
def rename(src, dst): ''' On Windows, os.rename() will fail with a WindowsError exception if a file exists at the destination path. This function checks for this error and if found, it deletes the destination path first. ''' try: os.rename(src, dst) except OSError as exc: if ...
[ "On", "Windows", "os", ".", "rename", "()", "will", "fail", "with", "a", "WindowsError", "exception", "if", "a", "file", "exists", "at", "the", "destination", "path", ".", "This", "function", "checks", "for", "this", "error", "and", "if", "found", "it", ...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/files.py#L184-L205
[ "def", "rename", "(", "src", ",", "dst", ")", ":", "try", ":", "os", ".", "rename", "(", "src", ",", "dst", ")", "except", "OSError", "as", "exc", ":", "if", "exc", ".", "errno", "!=", "errno", ".", "EEXIST", ":", "raise", "try", ":", "os", "."...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
process_read_exception
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.
salt/utils/files.py
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): ''' 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...
[ "Common", "code", "for", "raising", "exceptions", "when", "reading", "a", "file", "fails" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/files.py#L208-L235
[ "def", "process_read_exception", "(", "exc", ",", "path", ",", "ignore", "=", "None", ")", ":", "if", "ignore", "is", "not", "None", ":", "if", "isinstance", "(", "ignore", ",", "six", ".", "integer_types", ")", ":", "ignore", "=", "(", "ignore", ",", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
wait_lock
Obtain a write lock. If one exists, wait for it to release first
salt/utils/files.py
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): ''' 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 ...
[ "Obtain", "a", "write", "lock", ".", "If", "one", "exists", "wait", "for", "it", "to", "release", "first" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/files.py#L239-L312
[ "def", "wait_lock", "(", "path", ",", "lock_fn", "=", "None", ",", "timeout", "=", "5", ",", "sleep", "=", "0.1", ",", "time_start", "=", "None", ")", ":", "if", "not", "isinstance", "(", "path", ",", "six", ".", "string_types", ")", ":", "raise", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
set_umask
Temporarily set the umask and restore once the contextmanager exits
salt/utils/files.py
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): ''' 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...
[ "Temporarily", "set", "the", "umask", "and", "restore", "once", "the", "contextmanager", "exits" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/files.py#L325-L337
[ "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", "=", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
fopen
Wrapper around open() built-in to set CLOEXEC on the fd. This flag specifies that the file descriptor should be closed when an exec function is invoked; When a file descriptor is allocated (as with open or dup), this bit is initially cleared on the new file descriptor, meaning that descriptor will ...
salt/utils/files.py
def fopen(*args, **kwargs): ''' Wrapper around open() built-in to set CLOEXEC on the fd. This flag specifies that the file descriptor should be closed when an exec function is invoked; When a file descriptor is allocated (as with open or dup), this bit is initially cleared on the new file desc...
def fopen(*args, **kwargs): ''' Wrapper around open() built-in to set CLOEXEC on the fd. This flag specifies that the file descriptor should be closed when an exec function is invoked; When a file descriptor is allocated (as with open or dup), this bit is initially cleared on the new file desc...
[ "Wrapper", "around", "open", "()", "built", "-", "in", "to", "set", "CLOEXEC", "on", "the", "fd", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/files.py#L340-L411
[ "def", "fopen", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "six", ".", "PY3", ":", "try", ":", "# Don't permit stdin/stdout/stderr to be opened. The boolean False", "# and True are treated by Python 3's open() as file descriptors 0", "# and 1, respectively.", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
flopen
Shortcut for fopen with lock and context manager.
salt/utils/files.py
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): ''' 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 ...
[ "Shortcut", "for", "fopen", "with", "lock", "and", "context", "manager", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/files.py#L415-L431
[ "def", "flopen", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "filename", ",", "args", "=", "args", "[", "0", "]", ",", "args", "[", "1", ":", "]", "writing", "=", "'wa'", "with", "fopen", "(", "filename", ",", "*", "args", ",", "*", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
fpopen
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...
salt/utils/files.py
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): ''' 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...
[ "Shortcut", "for", "fopen", "with", "extra", "uid", "gid", "and", "mode", "options", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/files.py#L435-L476
[ "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...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
safe_walk
A clone of the python os.walk function with some checks for recursive symlinks. Unlike os.walk this follows symlinks by default.
salt/utils/files.py
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): ''' 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...
[ "A", "clone", "of", "the", "python", "os", ".", "walk", "function", "with", "some", "checks", "for", "recursive", "symlinks", ".", "Unlike", "os", ".", "walk", "this", "follows", "symlinks", "by", "default", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/files.py#L479-L526
[ "def", "safe_walk", "(", "top", ",", "topdown", "=", "True", ",", "onerror", "=", "None", ",", "followlinks", "=", "True", ",", "_seen", "=", "None", ")", ":", "if", "_seen", "is", "None", ":", "_seen", "=", "set", "(", ")", "# We may not have read per...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
rm_rf
Platform-independent recursive delete. Includes code from http://stackoverflow.com/a/2656405
salt/utils/files.py
def rm_rf(path): ''' Platform-independent recursive delete. Includes code from http://stackoverflow.com/a/2656405 ''' def _onerror(func, path, exc_info): ''' Error handler for `shutil.rmtree`. If the error is due to an access error (read only file) it attempts to add...
def rm_rf(path): ''' Platform-independent recursive delete. Includes code from http://stackoverflow.com/a/2656405 ''' def _onerror(func, path, exc_info): ''' Error handler for `shutil.rmtree`. If the error is due to an access error (read only file) it attempts to add...
[ "Platform", "-", "independent", "recursive", "delete", ".", "Includes", "code", "from", "http", ":", "//", "stackoverflow", ".", "com", "/", "a", "/", "2656405" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/files.py#L539-L569
[ "def", "rm_rf", "(", "path", ")", ":", "def", "_onerror", "(", "func", ",", "path", ",", "exc_info", ")", ":", "'''\n Error handler for `shutil.rmtree`.\n\n If the error is due to an access error (read only file)\n it attempts to add write permission and then ret...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
is_fcntl_available
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
salt/utils/files.py
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): ''' 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...
[ "Simple", "function", "to", "check", "if", "the", "fcntl", "module", "is", "available", "or", "not", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/files.py#L584-L593
[ "def", "is_fcntl_available", "(", "check_sunos", "=", "False", ")", ":", "if", "check_sunos", "and", "salt", ".", "utils", ".", "platform", ".", "is_sunos", "(", ")", ":", "return", "False", "return", "HAS_FCNTL" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
train
safe_filename_leaf
Input the basename of a file, without the directory tree, and returns a safe name to use i.e. only the required characters are converted by urllib.quote If the input is a PY2 String, output a PY2 String. If input is Unicode output Unicode. For consistency all platforms are treated the same. Hard coded to ut...
salt/utils/files.py
def safe_filename_leaf(file_basename): ''' Input the basename of a file, without the directory tree, and returns a safe name to use i.e. only the required characters are converted by urllib.quote If the input is a PY2 String, output a PY2 String. If input is Unicode output Unicode. For consistency a...
def safe_filename_leaf(file_basename): ''' Input the basename of a file, without the directory tree, and returns a safe name to use i.e. only the required characters are converted by urllib.quote If the input is a PY2 String, output a PY2 String. If input is Unicode output Unicode. For consistency a...
[ "Input", "the", "basename", "of", "a", "file", "without", "the", "directory", "tree", "and", "returns", "a", "safe", "name", "to", "use", "i", ".", "e", ".", "only", "the", "required", "characters", "are", "converted", "by", "urllib", ".", "quote", "If",...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/files.py#L596-L616
[ "def", "safe_filename_leaf", "(", "file_basename", ")", ":", "def", "_replace", "(", "re_obj", ")", ":", "return", "quote", "(", "re_obj", ".", "group", "(", "0", ")", ",", "safe", "=", "''", ")", "if", "not", "isinstance", "(", "file_basename", ",", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
safe_filepath
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>
salt/utils/files.py
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): ''' 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...
[ "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",...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/files.py#L619-L639
[ "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...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
is_text
Uses heuristics to guess whether the given file is text or binary, by reading a single block of bytes from the file. If more than 30% of the chars in the block are non-text, or there are NUL ('\x00') bytes in the block, assume this is a binary file.
salt/utils/files.py
def is_text(fp_, blocksize=512): ''' Uses heuristics to guess whether the given file is text or binary, by reading a single block of bytes from the file. If more than 30% of the chars in the block are non-text, or there are NUL ('\x00') bytes in the block, assume this is a binary file. ''' i...
def is_text(fp_, blocksize=512): ''' Uses heuristics to guess whether the given file is text or binary, by reading a single block of bytes from the file. If more than 30% of the chars in the block are non-text, or there are NUL ('\x00') bytes in the block, assume this is a binary file. ''' i...
[ "Uses", "heuristics", "to", "guess", "whether", "the", "given", "file", "is", "text", "or", "binary", "by", "reading", "a", "single", "block", "of", "bytes", "from", "the", "file", ".", "If", "more", "than", "30%", "of", "the", "chars", "in", "the", "b...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/files.py#L643-L678
[ "def", "is_text", "(", "fp_", ",", "blocksize", "=", "512", ")", ":", "int2byte", "=", "(", "lambda", "x", ":", "bytes", "(", "(", "x", ",", ")", ")", ")", "if", "six", ".", "PY3", "else", "chr", "text_characters", "=", "(", "b''", ".", "join", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
is_binary
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.
salt/utils/files.py
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): ''' 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: ...
[ "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", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/files.py#L682-L699
[ "def", "is_binary", "(", "path", ")", ":", "if", "not", "os", ".", "path", ".", "isfile", "(", "path", ")", ":", "return", "False", "try", ":", "with", "fopen", "(", "path", ",", "'rb'", ")", "as", "fp_", ":", "try", ":", "data", "=", "fp_", "....
e8541fd6e744ab0df786c0f76102e41631f45d46
train
remove
Runs os.remove(path) and suppresses the OSError if the file doesn't exist
salt/utils/files.py
def remove(path): ''' Runs os.remove(path) and suppresses the OSError if the file doesn't exist ''' try: os.remove(path) except OSError as exc: if exc.errno != errno.ENOENT: raise
def remove(path): ''' Runs os.remove(path) and suppresses the OSError if the file doesn't exist ''' try: os.remove(path) except OSError as exc: if exc.errno != errno.ENOENT: raise
[ "Runs", "os", ".", "remove", "(", "path", ")", "and", "suppresses", "the", "OSError", "if", "the", "file", "doesn", "t", "exist" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/files.py#L702-L710
[ "def", "remove", "(", "path", ")", ":", "try", ":", "os", ".", "remove", "(", "path", ")", "except", "OSError", "as", "exc", ":", "if", "exc", ".", "errno", "!=", "errno", ".", "ENOENT", ":", "raise" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
train
list_files
Return a list of all files found under directory (and its subdirectories)
salt/utils/files.py
def list_files(directory): ''' Return a list of all files found under directory (and its subdirectories) ''' ret = set() ret.add(directory) for root, dirs, files in safe_walk(directory): for name in files: ret.add(os.path.join(root, name)) for name in dirs: ...
def list_files(directory): ''' Return a list of all files found under directory (and its subdirectories) ''' ret = set() ret.add(directory) for root, dirs, files in safe_walk(directory): for name in files: ret.add(os.path.join(root, name)) for name in dirs: ...
[ "Return", "a", "list", "of", "all", "files", "found", "under", "directory", "(", "and", "its", "subdirectories", ")" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/files.py#L714-L726
[ "def", "list_files", "(", "directory", ")", ":", "ret", "=", "set", "(", ")", "ret", ".", "add", "(", "directory", ")", "for", "root", ",", "dirs", ",", "files", "in", "safe_walk", "(", "directory", ")", ":", "for", "name", "in", "files", ":", "ret...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
normalize_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).
salt/utils/files.py
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): ''' 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...
[ "Return", "a", "mode", "value", "normalized", "to", "a", "string", "and", "containing", "a", "leading", "zero", "if", "it", "does", "not", "have", "one", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/files.py#L740-L756
[ "def", "normalize_mode", "(", "mode", ")", ":", "if", "mode", "is", "None", ":", "return", "None", "if", "not", "isinstance", "(", "mode", ",", "six", ".", "string_types", ")", ":", "mode", "=", "six", ".", "text_type", "(", "mode", ")", "if", "six",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
human_size_to_bytes
Convert human-readable units to bytes
salt/utils/files.py
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): ''' 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...
[ "Convert", "human", "-", "readable", "units", "to", "bytes" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/files.py#L759-L773
[ "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", "(", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
backup_minion
Backup a file on the minion
salt/utils/files.py
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): ''' 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) ...
[ "Backup", "a", "file", "on", "the", "minion" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/files.py#L776-L802
[ "def", "backup_minion", "(", "path", ",", "bkroot", ")", ":", "dname", ",", "bname", "=", "os", ".", "path", ".", "split", "(", "path", ")", "if", "salt", ".", "utils", ".", "platform", ".", "is_windows", "(", ")", ":", "src_dir", "=", "dname", "."...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
get_encoding
Detect a file's encoding using the following: - Check for Byte Order Marks (BOM) - Check for UTF-8 Markers - Check System Encoding - Check for ascii Args: path (str): The path to the file to check Returns: str: The encoding of the file Raises: CommandExecutionErro...
salt/utils/files.py
def get_encoding(path): ''' Detect a file's encoding using the following: - Check for Byte Order Marks (BOM) - Check for UTF-8 Markers - Check System Encoding - Check for ascii Args: path (str): The path to the file to check Returns: str: The encoding of the file ...
def get_encoding(path): ''' Detect a file's encoding using the following: - Check for Byte Order Marks (BOM) - Check for UTF-8 Markers - Check System Encoding - Check for ascii Args: path (str): The path to the file to check Returns: str: The encoding of the file ...
[ "Detect", "a", "file", "s", "encoding", "using", "the", "following", ":", "-", "Check", "for", "Byte", "Order", "Marks", "(", "BOM", ")", "-", "Check", "for", "UTF", "-", "8", "Markers", "-", "Check", "System", "Encoding", "-", "Check", "for", "ascii" ...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/files.py#L805-L901
[ "def", "get_encoding", "(", "path", ")", ":", "def", "check_ascii", "(", "_data", ")", ":", "# If all characters can be decoded to ASCII, then it's ASCII", "try", ":", "_data", ".", "decode", "(", "'ASCII'", ")", "log", ".", "debug", "(", "'Found ASCII'", ")", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
absent
Ensure the named grafana dashboard is absent. name Name of the grafana dashboard. orgname Name of the organization in which the dashboard should be present. profile Configuration profile used to connect to the Grafana instance. Default is 'grafana'.
salt/states/grafana4_dashboard.py
def absent(name, orgname=None, profile='grafana'): ''' Ensure the named grafana dashboard is absent. name Name of the grafana dashboard. orgname Name of the organization in which the dashboard should be present. profile Configuration profile used to connect to the Grafana ...
def absent(name, orgname=None, profile='grafana'): ''' Ensure the named grafana dashboard is absent. name Name of the grafana dashboard. orgname Name of the organization in which the dashboard should be present. profile Configuration profile used to connect to the Grafana ...
[ "Ensure", "the", "named", "grafana", "dashboard", "is", "absent", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/grafana4_dashboard.py#L212-L245
[ "def", "absent", "(", "name", ",", "orgname", "=", "None", ",", "profile", "=", "'grafana'", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'result'", ":", "True", ",", "'comment'", ":", "''", ",", "'changes'", ":", "{", "}", "}", "if", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_zfs_pool_data
Provide grains about zpools
salt/grains/zfs.py
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(): ''' 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...
[ "Provide", "grains", "about", "zpools" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/zfs.py#L54-L73
[ "def", "_zfs_pool_data", "(", ")", ":", "grains", "=", "{", "}", "# collect zpool data", "zpool_list_cmd", "=", "__utils__", "[", "'zfs.zpool_command'", "]", "(", "'list'", ",", "flags", "=", "[", "'-H'", "]", ",", "opts", "=", "{", "'-o'", ":", "'name,siz...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
zfs
Provide grains for zfs/zpool
salt/grains/zfs.py
def zfs(): ''' Provide grains for zfs/zpool ''' grains = {} grains['zfs_support'] = __utils__['zfs.is_supported']() grains['zfs_feature_flags'] = __utils__['zfs.has_feature_flags']() if grains['zfs_support']: grains = salt.utils.dictupdate.update(grains, _zfs_pool_data(), merge_lists...
def zfs(): ''' Provide grains for zfs/zpool ''' grains = {} grains['zfs_support'] = __utils__['zfs.is_supported']() grains['zfs_feature_flags'] = __utils__['zfs.has_feature_flags']() if grains['zfs_support']: grains = salt.utils.dictupdate.update(grains, _zfs_pool_data(), merge_lists...
[ "Provide", "grains", "for", "zfs", "/", "zpool" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/zfs.py#L76-L86
[ "def", "zfs", "(", ")", ":", "grains", "=", "{", "}", "grains", "[", "'zfs_support'", "]", "=", "__utils__", "[", "'zfs.is_supported'", "]", "(", ")", "grains", "[", "'zfs_feature_flags'", "]", "=", "__utils__", "[", "'zfs.has_feature_flags'", "]", "(", ")...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
wollist
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/...
salt/runners/network.py
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): ''' 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...
[ "Send", "a", "Magic", "Packet", "to", "wake", "up", "a", "list", "of", "Minions", ".", "This", "list", "must", "contain", "one", "MAC", "hardware", "address", "per", "line" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/network.py#L19-L43
[ "def", "wollist", "(", "maclist", ",", "bcast", "=", "'255.255.255.255'", ",", "destport", "=", "9", ")", ":", "ret", "=", "[", "]", "try", ":", "with", "salt", ".", "utils", ".", "files", ".", "fopen", "(", "maclist", ",", "'r'", ")", "as", "ifile...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
wol
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
salt/runners/network.py
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): ''' 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 ...
[ "Send", "a", "Magic", "Packet", "to", "wake", "up", "a", "Minion" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/network.py#L46-L62
[ "def", "wol", "(", "mac", ",", "bcast", "=", "'255.255.255.255'", ",", "destport", "=", "9", ")", ":", "dest", "=", "salt", ".", "utils", ".", "network", ".", "mac_str_to_bytes", "(", "mac", ")", "sock", "=", "socket", ".", "socket", "(", "socket", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
wolmatch
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
salt/runners/network.py
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): ''' 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...
[ "Send", "a", "Magic", "Packet", "to", "wake", "up", "Minions", "that", "are", "matched", "in", "the", "grains", "cache" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/network.py#L65-L86
[ "def", "wolmatch", "(", "tgt", ",", "tgt_type", "=", "'glob'", ",", "bcast", "=", "'255.255.255.255'", ",", "destport", "=", "9", ")", ":", "ret", "=", "[", "]", "minions", "=", "__salt__", "[", "'cache.grains'", "]", "(", "tgt", ",", "tgt_type", ")", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
get_conn
Return a conn object for accessing memcached
salt/utils/memcached.py
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): ''' 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) ...
[ "Return", "a", "conn", "object", "for", "accessing", "memcached" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/memcached.py#L77-L107
[ "def", "get_conn", "(", "opts", ",", "profile", "=", "None", ",", "host", "=", "None", ",", "port", "=", "None", ")", ":", "if", "not", "(", "host", "and", "port", ")", ":", "opts_pillar", "=", "opts", ".", "get", "(", "'pillar'", ",", "{", "}", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
set_
Set a key on the memcached server, overwriting the value if it exists.
salt/utils/memcached.py
def set_(conn, key, value, time=DEFAULT_TIME, min_compress_len=DEFAULT_MIN_COMPRESS_LEN): ''' Set a key on the memcached server, overwriting the value if it exists. ''' if not isinstance(time, integer_types): raise SaltInvocationError('\'time\' must be an inte...
def set_(conn, key, value, time=DEFAULT_TIME, min_compress_len=DEFAULT_MIN_COMPRESS_LEN): ''' Set a key on the memcached server, overwriting the value if it exists. ''' if not isinstance(time, integer_types): raise SaltInvocationError('\'time\' must be an inte...
[ "Set", "a", "key", "on", "the", "memcached", "server", "overwriting", "the", "value", "if", "it", "exists", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/memcached.py#L123-L136
[ "def", "set_", "(", "conn", ",", "key", ",", "value", ",", "time", "=", "DEFAULT_TIME", ",", "min_compress_len", "=", "DEFAULT_MIN_COMPRESS_LEN", ")", ":", "if", "not", "isinstance", "(", "time", ",", "integer_types", ")", ":", "raise", "SaltInvocationError", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_get_auth
Returns the HTTP auth header
salt/modules/glassfish.py
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): ''' Returns the HTTP auth header ''' if username and password: return requests.auth.HTTPBasicAuth(username, password) else: return None
[ "Returns", "the", "HTTP", "auth", "header" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glassfish.py#L51-L58
[ "def", "_get_auth", "(", "username", ",", "password", ")", ":", "if", "username", "and", "password", ":", "return", "requests", ".", "auth", ".", "HTTPBasicAuth", "(", "username", ",", "password", ")", "else", ":", "return", "None" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_get_url
Returns the URL of the endpoint
salt/modules/glassfish.py
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): ''' 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)
[ "Returns", "the", "URL", "of", "the", "endpoint" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glassfish.py#L61-L68
[ "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...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_clean_data
Removes SaltStack params from **kwargs
salt/modules/glassfish.py
def _clean_data(data): ''' Removes SaltStack params from **kwargs ''' for key in list(data): if key.startswith('__pub'): del data[key] return data
def _clean_data(data): ''' Removes SaltStack params from **kwargs ''' for key in list(data): if key.startswith('__pub'): del data[key] return data
[ "Removes", "SaltStack", "params", "from", "**", "kwargs" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glassfish.py#L78-L85
[ "def", "_clean_data", "(", "data", ")", ":", "for", "key", "in", "list", "(", "data", ")", ":", "if", "key", ".", "startswith", "(", "'__pub'", ")", ":", "del", "data", "[", "key", "]", "return", "data" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_api_response
Check response status code + success_code returned by glassfish
salt/modules/glassfish.py
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): ''' 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:...
[ "Check", "response", "status", "code", "+", "success_code", "returned", "by", "glassfish" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glassfish.py#L88-L109
[ "def", "_api_response", "(", "response", ")", ":", "if", "response", ".", "status_code", "==", "404", ":", "__context__", "[", "'retcode'", "]", "=", "salt", ".", "defaults", ".", "exitcodes", ".", "SALT_BUILD_FAIL", "raise", "CommandExecutionError", "(", "'El...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_api_get
Do a GET request to the API
salt/modules/glassfish.py
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): ''' 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(),...
[ "Do", "a", "GET", "request", "to", "the", "API" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glassfish.py#L112-L123
[ "def", "_api_get", "(", "path", ",", "server", "=", "None", ")", ":", "server", "=", "_get_server", "(", "server", ")", "response", "=", "requests", ".", "get", "(", "url", "=", "_get_url", "(", "server", "[", "'ssl'", "]", ",", "server", "[", "'url'...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_api_post
Do a POST request to the API
salt/modules/glassfish.py
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): ''' 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...
[ "Do", "a", "POST", "request", "to", "the", "API" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glassfish.py#L126-L138
[ "def", "_api_post", "(", "path", ",", "data", ",", "server", "=", "None", ")", ":", "server", "=", "_get_server", "(", "server", ")", "response", "=", "requests", ".", "post", "(", "url", "=", "_get_url", "(", "server", "[", "'ssl'", "]", ",", "serve...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_api_delete
Do a DELETE request to the API
salt/modules/glassfish.py
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): ''' 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=...
[ "Do", "a", "DELETE", "request", "to", "the", "API" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glassfish.py#L141-L153
[ "def", "_api_delete", "(", "path", ",", "data", ",", "server", "=", "None", ")", ":", "server", "=", "_get_server", "(", "server", ")", "response", "=", "requests", ".", "delete", "(", "url", "=", "_get_url", "(", "server", "[", "'ssl'", "]", ",", "s...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_enum_elements
Enum elements
salt/modules/glassfish.py
def _enum_elements(name, server=None): ''' Enum elements ''' elements = [] data = _api_get(name, server) if any(data['extraProperties']['childResources']): for element in data['extraProperties']['childResources']: elements.append(element) return elements return N...
def _enum_elements(name, server=None): ''' Enum elements ''' elements = [] data = _api_get(name, server) if any(data['extraProperties']['childResources']): for element in data['extraProperties']['childResources']: elements.append(element) return elements return N...
[ "Enum", "elements" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glassfish.py#L157-L168
[ "def", "_enum_elements", "(", "name", ",", "server", "=", "None", ")", ":", "elements", "=", "[", "]", "data", "=", "_api_get", "(", "name", ",", "server", ")", "if", "any", "(", "data", "[", "'extraProperties'", "]", "[", "'childResources'", "]", ")",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_get_element_properties
Get an element's properties
salt/modules/glassfish.py
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): ''' 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...
[ "Get", "an", "element", "s", "properties" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glassfish.py#L171-L183
[ "def", "_get_element_properties", "(", "name", ",", "element_type", ",", "server", "=", "None", ")", ":", "properties", "=", "{", "}", "data", "=", "_api_get", "(", "'{0}/{1}/property'", ".", "format", "(", "element_type", ",", "name", ")", ",", "server", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_get_element
Get an element with or without properties
salt/modules/glassfish.py
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): ''' 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...
[ "Get", "an", "element", "with", "or", "without", "properties" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glassfish.py#L186-L201
[ "def", "_get_element", "(", "name", ",", "element_type", ",", "server", "=", "None", ",", "with_properties", "=", "True", ")", ":", "element", "=", "{", "}", "name", "=", "quote", "(", "name", ",", "safe", "=", "''", ")", "data", "=", "_api_get", "("...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_create_element
Create a new element
salt/modules/glassfish.py
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): ''' 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...
[ "Create", "a", "new", "element" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glassfish.py#L204-L220
[ "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'", "]", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_update_element
Update an element, including it's properties
salt/modules/glassfish.py
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): ''' 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...
[ "Update", "an", "element", "including", "it", "s", "properties" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glassfish.py#L223-L252
[ "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...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_delete_element
Delete an element
salt/modules/glassfish.py
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): ''' Delete an element ''' _api_delete('{0}/{1}'.format(element_type, quote(name, safe='')), data, server) return name
[ "Delete", "an", "element" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glassfish.py#L255-L260
[ "def", "_delete_element", "(", "name", ",", "element_type", ",", "data", ",", "server", "=", "None", ")", ":", "_api_delete", "(", "'{0}/{1}'", ".", "format", "(", "element_type", ",", "quote", "(", "name", ",", "safe", "=", "''", ")", ")", ",", "data"...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
create_connector_c_pool
Create a connection pool
salt/modules/glassfish.py
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): ''' Create a connection pool ''' defaults = { 'connectionDefinitionName': 'javax.jms.ConnectionFactory', 'resourceAdapterName': 'jmsra', 'associateWithThread': False, 'connectionCreationRetryAttempts': 0, '...
[ "Create", "a", "connection", "pool" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glassfish.py#L278-L322
[ "def", "create_connector_c_pool", "(", "name", ",", "server", "=", "None", ",", "*", "*", "kwargs", ")", ":", "defaults", "=", "{", "'connectionDefinitionName'", ":", "'javax.jms.ConnectionFactory'", ",", "'resourceAdapterName'", ":", "'jmsra'", ",", "'associateWith...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
update_connector_c_pool
Update a connection pool
salt/modules/glassfish.py
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): ''' Update a connection pool ''' if 'transactionSupport' in kwargs and kwargs['transactionSupport'] not in ( 'XATransaction', 'LocalTransaction', 'NoTransaction' ): raise CommandExecutio...
[ "Update", "a", "connection", "pool" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glassfish.py#L325-L335
[ "def", "update_connector_c_pool", "(", "name", ",", "server", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "'transactionSupport'", "in", "kwargs", "and", "kwargs", "[", "'transactionSupport'", "]", "not", "in", "(", "'XATransaction'", ",", "'LocalTran...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
delete_connector_c_pool
Delete a connection pool
salt/modules/glassfish.py
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): ''' Delete a connection pool ''' data = {'target': target, 'cascade': cascade} return _delete_element(name, 'resources/connector-connection-pool', data, server)
[ "Delete", "a", "connection", "pool" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glassfish.py#L338-L343
[ "def", "delete_connector_c_pool", "(", "name", ",", "target", "=", "'server'", ",", "cascade", "=", "True", ",", "server", "=", "None", ")", ":", "data", "=", "{", "'target'", ":", "target", ",", "'cascade'", ":", "cascade", "}", "return", "_delete_element...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
create_connector_resource
Create a connection resource
salt/modules/glassfish.py
def create_connector_resource(name, server=None, **kwargs): ''' Create a connection resource ''' defaults = { 'description': '', 'enabled': True, 'id': name, 'poolName': '', 'objectType': 'user', 'target': 'server' } # Data = defaults + merge kwar...
def create_connector_resource(name, server=None, **kwargs): ''' Create a connection resource ''' defaults = { 'description': '', 'enabled': True, 'id': name, 'poolName': '', 'objectType': 'user', 'target': 'server' } # Data = defaults + merge kwar...
[ "Create", "a", "connection", "resource" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glassfish.py#L361-L386
[ "def", "create_connector_resource", "(", "name", ",", "server", "=", "None", ",", "*", "*", "kwargs", ")", ":", "defaults", "=", "{", "'description'", ":", "''", ",", "'enabled'", ":", "True", ",", "'id'", ":", "name", ",", "'poolName'", ":", "''", ","...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
update_connector_resource
Update a connection resource
salt/modules/glassfish.py
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): ''' 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...
[ "Update", "a", "connection", "resource" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glassfish.py#L389-L396
[ "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'"...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
create_admin_object_resource
Create a JMS destination
salt/modules/glassfish.py
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): ''' Create a JMS destination ''' defaults = { 'description': '', 'className': 'com.sun.messaging.Queue', 'enabled': True, 'id': name, 'resAdapter': 'jmsra', 'resType': 'javax.jms.Queue', ...
[ "Create", "a", "JMS", "destination" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glassfish.py#L421-L458
[ "def", "create_admin_object_resource", "(", "name", ",", "server", "=", "None", ",", "*", "*", "kwargs", ")", ":", "defaults", "=", "{", "'description'", ":", "''", ",", "'className'", ":", "'com.sun.messaging.Queue'", ",", "'enabled'", ":", "True", ",", "'i...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
update_admin_object_resource
Update a JMS destination
salt/modules/glassfish.py
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): ''' Update a JMS destination ''' if 'jndiName' in kwargs: del kwargs['jndiName'] return _update_element(name, 'resources/admin-object-resource', kwargs, server)
[ "Update", "a", "JMS", "destination" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glassfish.py#L461-L467
[ "def", "update_admin_object_resource", "(", "name", ",", "server", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "'jndiName'", "in", "kwargs", ":", "del", "kwargs", "[", "'jndiName'", "]", "return", "_update_element", "(", "name", ",", "'resources/ad...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
create_jdbc_connection_pool
Create a connection resource
salt/modules/glassfish.py
def create_jdbc_connection_pool(name, server=None, **kwargs): ''' Create a connection resource ''' defaults = { 'allowNonComponentCallers': False, 'associateWithThread': False, 'connectionCreationRetryAttempts': '0', 'connectionCreationRetryIntervalInSeconds': '10', ...
def create_jdbc_connection_pool(name, server=None, **kwargs): ''' Create a connection resource ''' defaults = { 'allowNonComponentCallers': False, 'associateWithThread': False, 'connectionCreationRetryAttempts': '0', 'connectionCreationRetryIntervalInSeconds': '10', ...
[ "Create", "a", "connection", "resource" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glassfish.py#L492-L579
[ "def", "create_jdbc_connection_pool", "(", "name", ",", "server", "=", "None", ",", "*", "*", "kwargs", ")", ":", "defaults", "=", "{", "'allowNonComponentCallers'", ":", "False", ",", "'associateWithThread'", ":", "False", ",", "'connectionCreationRetryAttempts'", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
delete_jdbc_connection_pool
Delete a JDBC pool
salt/modules/glassfish.py
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): ''' Delete a JDBC pool ''' data = {'target': target, 'cascade': cascade} return _delete_element(name, 'resources/jdbc-connection-pool', data, server)
[ "Delete", "a", "JDBC", "pool" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glassfish.py#L589-L594
[ "def", "delete_jdbc_connection_pool", "(", "name", ",", "target", "=", "'server'", ",", "cascade", "=", "False", ",", "server", "=", "None", ")", ":", "data", "=", "{", "'target'", ":", "target", ",", "'cascade'", ":", "cascade", "}", "return", "_delete_el...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
create_jdbc_resource
Create a JDBC resource
salt/modules/glassfish.py
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): ''' Create a JDBC resource ''' defaults = { 'description': '', 'enabled': True, 'id': name, 'poolName': '', 'target': 'server' } # Data = defaults + merge kwargs + poolname data = defaults dat...
[ "Create", "a", "JDBC", "resource" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glassfish.py#L612-L631
[ "def", "create_jdbc_resource", "(", "name", ",", "server", "=", "None", ",", "*", "*", "kwargs", ")", ":", "defaults", "=", "{", "'description'", ":", "''", ",", "'enabled'", ":", "True", ",", "'id'", ":", "name", ",", "'poolName'", ":", "''", ",", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
update_jdbc_resource
Update a JDBC resource
salt/modules/glassfish.py
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): ''' 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)
[ "Update", "a", "JDBC", "resource" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glassfish.py#L634-L641
[ "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'", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
get_system_properties
Get system properties
salt/modules/glassfish.py
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): ''' 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']: ...
[ "Get", "system", "properties" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glassfish.py#L652-L664
[ "def", "get_system_properties", "(", "server", "=", "None", ")", ":", "properties", "=", "{", "}", "data", "=", "_api_get", "(", "'system-properties'", ",", "server", ")", "# Get properties into a dict", "if", "any", "(", "data", "[", "'extraProperties'", "]", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
present
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 ...
salt/states/neutron_network.py
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): ''' 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...
[ "Ensure", "a", "network", "exists", "and", "is", "up", "-", "to", "-", "date" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/neutron_network.py#L44-L127
[ "def", "present", "(", "name", ",", "auth", "=", "None", ",", "*", "*", "kwargs", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "True", ",", "'comment'", ":", "''", "}", "kwargs", "=", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
absent
Ensure a network does not exists name Name of the network
salt/states/neutron_network.py
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): ''' 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...
[ "Ensure", "a", "network", "does", "not", "exists" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/neutron_network.py#L130-L161
[ "def", "absent", "(", "name", ",", "auth", "=", "None", ",", "*", "*", "kwargs", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "True", ",", "'comment'", ":", "''", "}", "kwargs", "=", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_split_docker_uuid
Split a smartos docker uuid into repo and tag
salt/modules/smartos_imgadm.py
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): ''' 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
[ "Split", "a", "smartos", "docker", "uuid", "into", "repo", "and", "tag" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smartos_imgadm.py#L104-L114
[ "def", "_split_docker_uuid", "(", "uuid", ")", ":", "if", "uuid", ":", "uuid", "=", "uuid", ".", "split", "(", "':'", ")", "if", "len", "(", "uuid", ")", "==", "2", ":", "tag", "=", "uuid", "[", "1", "]", "repo", "=", "uuid", "[", "0", "]", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_is_uuid
Check if uuid is a valid smartos uuid Example: e69a0918-055d-11e5-8912-e3ceb6df4cf8
salt/modules/smartos_imgadm.py
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): ''' 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
[ "Check", "if", "uuid", "is", "a", "valid", "smartos", "uuid" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smartos_imgadm.py#L117-L125
[ "def", "_is_uuid", "(", "uuid", ")", ":", "if", "uuid", "and", "list", "(", "(", "len", "(", "x", ")", "for", "x", "in", "uuid", ".", "split", "(", "'-'", ")", ")", ")", "==", "[", "8", ",", "4", ",", "4", ",", "4", ",", "12", "]", ":", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
version
Return imgadm version CLI Example: .. code-block:: bash salt '*' imgadm.version
salt/modules/smartos_imgadm.py
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(): ''' 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]
[ "Return", "imgadm", "version" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smartos_imgadm.py#L138-L152
[ "def", "version", "(", ")", ":", "ret", "=", "{", "}", "cmd", "=", "'imgadm --version'", "res", "=", "__salt__", "[", "'cmd.run'", "]", "(", "cmd", ")", ".", "splitlines", "(", ")", "ret", "=", "res", "[", "0", "]", ".", "split", "(", ")", "retur...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
docker_to_uuid
Get the image uuid from an imported docker image .. versionadded:: 2019.2.0
salt/modules/smartos_imgadm.py
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): ''' 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...
[ "Get", "the", "image", "uuid", "from", "an", "imported", "docker", "image" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smartos_imgadm.py#L155-L170
[ "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...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
avail
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
salt/modules/smartos_imgadm.py
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): ''' 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" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smartos_imgadm.py#L191-L226
[ "def", "avail", "(", "search", "=", "None", ",", "verbose", "=", "False", ")", ":", "ret", "=", "{", "}", "cmd", "=", "'imgadm avail -j'", "res", "=", "__salt__", "[", "'cmd.run_all'", "]", "(", "cmd", ")", "retcode", "=", "res", "[", "'retcode'", "]...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
show
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
salt/modules/smartos_imgadm.py
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): ''' 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...
[ "Show", "manifest", "of", "a", "given", "image" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smartos_imgadm.py#L265-L292
[ "def", "show", "(", "uuid", ")", ":", "ret", "=", "{", "}", "if", "_is_uuid", "(", "uuid", ")", "or", "_is_docker_uuid", "(", "uuid", ")", ":", "cmd", "=", "'imgadm show {0}'", ".", "format", "(", "uuid", ")", "res", "=", "__salt__", "[", "'cmd.run_a...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
import_image
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]
salt/modules/smartos_imgadm.py
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): ''' 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" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smartos_imgadm.py#L328-L353
[ "def", "import_image", "(", "uuid", ",", "verbose", "=", "False", ")", ":", "ret", "=", "{", "}", "cmd", "=", "'imgadm import {0}'", ".", "format", "(", "uuid", ")", "res", "=", "__salt__", "[", "'cmd.run_all'", "]", "(", "cmd", ",", "python_shell", "=...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
delete
Remove an installed image uuid : string Specifies uuid to import CLI Example: .. code-block:: bash salt '*' imgadm.delete e42f8c84-bbea-11e2-b920-078fab2aab1f
salt/modules/smartos_imgadm.py
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): ''' 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...
[ "Remove", "an", "installed", "image" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smartos_imgadm.py#L356-L382
[ "def", "delete", "(", "uuid", ")", ":", "ret", "=", "{", "}", "cmd", "=", "'imgadm delete {0}'", ".", "format", "(", "uuid", ")", "res", "=", "__salt__", "[", "'cmd.run_all'", "]", "(", "cmd", ",", "python_shell", "=", "False", ")", "retcode", "=", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
vacuum
Remove unused images verbose : boolean (False) toggle verbose output CLI Example: .. code-block:: bash salt '*' imgadm.vacuum [verbose=True]
salt/modules/smartos_imgadm.py
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): ''' 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['...
[ "Remove", "unused", "images" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smartos_imgadm.py#L385-L416
[ "def", "vacuum", "(", "verbose", "=", "False", ")", ":", "ret", "=", "{", "}", "cmd", "=", "'imgadm vacuum -f'", "res", "=", "__salt__", "[", "'cmd.run_all'", "]", "(", "cmd", ")", "retcode", "=", "res", "[", "'retcode'", "]", "if", "retcode", "!=", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
sources
Return a list of available sources verbose : boolean (False) toggle verbose output .. versionadded:: 2019.2.0 CLI Example: .. code-block:: bash salt '*' imgadm.sources
salt/modules/smartos_imgadm.py
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): ''' 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....
[ "Return", "a", "list", "of", "available", "sources" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smartos_imgadm.py#L419-L449
[ "def", "sources", "(", "verbose", "=", "False", ")", ":", "ret", "=", "{", "}", "cmd", "=", "'imgadm sources -j'", "res", "=", "__salt__", "[", "'cmd.run_all'", "]", "(", "cmd", ")", "retcode", "=", "res", "[", "'retcode'", "]", "if", "retcode", "!=", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
source_delete
Delete a source source : string source url to delete .. versionadded:: 2019.2.0 CLI Example: .. code-block:: bash salt '*' imgadm.source_delete https://updates.joyent.com
salt/modules/smartos_imgadm.py
def source_delete(source): ''' Delete a source source : string source url to delete .. versionadded:: 2019.2.0 CLI Example: .. code-block:: bash salt '*' imgadm.source_delete https://updates.joyent.com ''' ret = {} cmd = 'imgadm sources -d {0}'.format(source) ...
def source_delete(source): ''' Delete a source source : string source url to delete .. versionadded:: 2019.2.0 CLI Example: .. code-block:: bash salt '*' imgadm.source_delete https://updates.joyent.com ''' ret = {} cmd = 'imgadm sources -d {0}'.format(source) ...
[ "Delete", "a", "source" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smartos_imgadm.py#L452-L475
[ "def", "source_delete", "(", "source", ")", ":", "ret", "=", "{", "}", "cmd", "=", "'imgadm sources -d {0}'", ".", "format", "(", "source", ")", "res", "=", "__salt__", "[", "'cmd.run_all'", "]", "(", "cmd", ")", "retcode", "=", "res", "[", "'retcode'", ...
e8541fd6e744ab0df786c0f76102e41631f45d46