repo
stringclasses
85 values
path
stringlengths
8
121
func_name
stringlengths
1
82
original_string
stringlengths
112
65.5k
language
stringclasses
1 value
code
stringlengths
112
65.5k
code_tokens
listlengths
20
4.09k
docstring
stringlengths
3
46.3k
docstring_tokens
listlengths
1
564
sha
stringclasses
85 values
url
stringlengths
93
218
partition
stringclasses
1 value
saltstack/salt
salt/modules/nspawn.py
exists
def exists(name): ''' Returns true if the named container exists CLI Example: .. code-block:: bash salt myminion nspawn.exists <name> ''' contextkey = 'nspawn.exists.{0}'.format(name) if contextkey in __context__: return __context__[contextkey] __context__[contextkey] ...
python
def exists(name): ''' Returns true if the named container exists CLI Example: .. code-block:: bash salt myminion nspawn.exists <name> ''' contextkey = 'nspawn.exists.{0}'.format(name) if contextkey in __context__: return __context__[contextkey] __context__[contextkey] ...
[ "def", "exists", "(", "name", ")", ":", "contextkey", "=", "'nspawn.exists.{0}'", ".", "format", "(", "name", ")", "if", "contextkey", "in", "__context__", ":", "return", "__context__", "[", "contextkey", "]", "__context__", "[", "contextkey", "]", "=", "nam...
Returns true if the named container exists CLI Example: .. code-block:: bash salt myminion nspawn.exists <name>
[ "Returns", "true", "if", "the", "named", "container", "exists" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nspawn.py#L904-L918
train
saltstack/salt
salt/modules/nspawn.py
state
def state(name): ''' Return state of container (running or stopped) CLI Example: .. code-block:: bash salt myminion nspawn.state <name> ''' try: cmd = 'show {0} --property=State'.format(name) return _machinectl(cmd, ignore_retcode=True)['stdout'].split('=')[-1] exc...
python
def state(name): ''' Return state of container (running or stopped) CLI Example: .. code-block:: bash salt myminion nspawn.state <name> ''' try: cmd = 'show {0} --property=State'.format(name) return _machinectl(cmd, ignore_retcode=True)['stdout'].split('=')[-1] exc...
[ "def", "state", "(", "name", ")", ":", "try", ":", "cmd", "=", "'show {0} --property=State'", ".", "format", "(", "name", ")", "return", "_machinectl", "(", "cmd", ",", "ignore_retcode", "=", "True", ")", "[", "'stdout'", "]", ".", "split", "(", "'='", ...
Return state of container (running or stopped) CLI Example: .. code-block:: bash salt myminion nspawn.state <name>
[ "Return", "state", "of", "container", "(", "running", "or", "stopped", ")" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nspawn.py#L922-L936
train
saltstack/salt
salt/modules/nspawn.py
info
def info(name, **kwargs): ''' Return info about a container .. note:: The container must be running for ``machinectl`` to gather information about it. If the container is stopped, then this function will start it. start : False If ``True``, then the container will be s...
python
def info(name, **kwargs): ''' Return info about a container .. note:: The container must be running for ``machinectl`` to gather information about it. If the container is stopped, then this function will start it. start : False If ``True``, then the container will be s...
[ "def", "info", "(", "name", ",", "*", "*", "kwargs", ")", ":", "kwargs", "=", "salt", ".", "utils", ".", "args", ".", "clean_kwargs", "(", "*", "*", "kwargs", ")", "start_", "=", "kwargs", ".", "pop", "(", "'start'", ",", "False", ")", "if", "kwa...
Return info about a container .. note:: The container must be running for ``machinectl`` to gather information about it. If the container is stopped, then this function will start it. start : False If ``True``, then the container will be started to retrieve the info. A ...
[ "Return", "info", "about", "a", "container" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nspawn.py#L939-L1019
train
saltstack/salt
salt/modules/nspawn.py
enable
def enable(name): ''' Set the named container to be launched at boot CLI Example: .. code-block:: bash salt myminion nspawn.enable <name> ''' cmd = 'systemctl enable systemd-nspawn@{0}'.format(name) if __salt__['cmd.retcode'](cmd, python_shell=False) != 0: __context__['ret...
python
def enable(name): ''' Set the named container to be launched at boot CLI Example: .. code-block:: bash salt myminion nspawn.enable <name> ''' cmd = 'systemctl enable systemd-nspawn@{0}'.format(name) if __salt__['cmd.retcode'](cmd, python_shell=False) != 0: __context__['ret...
[ "def", "enable", "(", "name", ")", ":", "cmd", "=", "'systemctl enable systemd-nspawn@{0}'", ".", "format", "(", "name", ")", "if", "__salt__", "[", "'cmd.retcode'", "]", "(", "cmd", ",", "python_shell", "=", "False", ")", "!=", "0", ":", "__context__", "[...
Set the named container to be launched at boot CLI Example: .. code-block:: bash salt myminion nspawn.enable <name>
[ "Set", "the", "named", "container", "to", "be", "launched", "at", "boot" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nspawn.py#L1023-L1037
train
saltstack/salt
salt/modules/nspawn.py
start
def start(name): ''' Start the named container CLI Example: .. code-block:: bash salt myminion nspawn.start <name> ''' if _sd_version() >= 219: ret = _machinectl('start {0}'.format(name)) else: cmd = 'systemctl start systemd-nspawn@{0}'.format(name) ret = _...
python
def start(name): ''' Start the named container CLI Example: .. code-block:: bash salt myminion nspawn.start <name> ''' if _sd_version() >= 219: ret = _machinectl('start {0}'.format(name)) else: cmd = 'systemctl start systemd-nspawn@{0}'.format(name) ret = _...
[ "def", "start", "(", "name", ")", ":", "if", "_sd_version", "(", ")", ">=", "219", ":", "ret", "=", "_machinectl", "(", "'start {0}'", ".", "format", "(", "name", ")", ")", "else", ":", "cmd", "=", "'systemctl start systemd-nspawn@{0}'", ".", "format", "...
Start the named container CLI Example: .. code-block:: bash salt myminion nspawn.start <name>
[ "Start", "the", "named", "container" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nspawn.py#L1059-L1078
train
saltstack/salt
salt/modules/nspawn.py
stop
def stop(name, kill=False): ''' This is a compatibility function which provides the logic for nspawn.poweroff and nspawn.terminate. ''' if _sd_version() >= 219: if kill: action = 'terminate' else: action = 'poweroff' ret = _machinectl('{0} {1}'.format(...
python
def stop(name, kill=False): ''' This is a compatibility function which provides the logic for nspawn.poweroff and nspawn.terminate. ''' if _sd_version() >= 219: if kill: action = 'terminate' else: action = 'poweroff' ret = _machinectl('{0} {1}'.format(...
[ "def", "stop", "(", "name", ",", "kill", "=", "False", ")", ":", "if", "_sd_version", "(", ")", ">=", "219", ":", "if", "kill", ":", "action", "=", "'terminate'", "else", ":", "action", "=", "'poweroff'", "ret", "=", "_machinectl", "(", "'{0} {1}'", ...
This is a compatibility function which provides the logic for nspawn.poweroff and nspawn.terminate.
[ "This", "is", "a", "compatibility", "function", "which", "provides", "the", "logic", "for", "nspawn", ".", "poweroff", "and", "nspawn", ".", "terminate", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nspawn.py#L1083-L1101
train
saltstack/salt
salt/modules/nspawn.py
reboot
def reboot(name, kill=False): ''' Reboot the container by sending a SIGINT to its init process. Equivalent to running ``machinectl reboot`` on the named container. For convenience, running ``nspawn.restart`` (as shown in the CLI examples below) is equivalent to running ``nspawn.reboot``. .. no...
python
def reboot(name, kill=False): ''' Reboot the container by sending a SIGINT to its init process. Equivalent to running ``machinectl reboot`` on the named container. For convenience, running ``nspawn.restart`` (as shown in the CLI examples below) is equivalent to running ``nspawn.reboot``. .. no...
[ "def", "reboot", "(", "name", ",", "kill", "=", "False", ")", ":", "if", "_sd_version", "(", ")", ">=", "219", ":", "if", "state", "(", "name", ")", "==", "'running'", ":", "ret", "=", "_machinectl", "(", "'reboot {0}'", ".", "format", "(", "name", ...
Reboot the container by sending a SIGINT to its init process. Equivalent to running ``machinectl reboot`` on the named container. For convenience, running ``nspawn.restart`` (as shown in the CLI examples below) is equivalent to running ``nspawn.reboot``. .. note:: ``machinectl reboot`` is onl...
[ "Reboot", "the", "container", "by", "sending", "a", "SIGINT", "to", "its", "init", "process", ".", "Equivalent", "to", "running", "machinectl", "reboot", "on", "the", "named", "container", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nspawn.py#L1162-L1209
train
saltstack/salt
salt/modules/nspawn.py
remove
def remove(name, stop=False): ''' Remove the named container .. warning:: This function will remove all data associated with the container. It will not, however, remove the btrfs subvolumes created by pulling container images (:mod:`nspawn.pull_raw <salt.modules.nspawn.pull...
python
def remove(name, stop=False): ''' Remove the named container .. warning:: This function will remove all data associated with the container. It will not, however, remove the btrfs subvolumes created by pulling container images (:mod:`nspawn.pull_raw <salt.modules.nspawn.pull...
[ "def", "remove", "(", "name", ",", "stop", "=", "False", ")", ":", "if", "not", "stop", "and", "state", "(", "name", ")", "!=", "'stopped'", ":", "raise", "CommandExecutionError", "(", "'Container \\'{0}\\' is not stopped'", ".", "format", "(", "name", ")", ...
Remove the named container .. warning:: This function will remove all data associated with the container. It will not, however, remove the btrfs subvolumes created by pulling container images (:mod:`nspawn.pull_raw <salt.modules.nspawn.pull_raw>`, :mod:`nspawn.pull_tar <sal...
[ "Remove", "the", "named", "container" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nspawn.py#L1213-L1257
train
saltstack/salt
salt/modules/nspawn.py
copy_to
def copy_to(name, source, dest, overwrite=False, makedirs=False): ''' Copy a file from the host into a container name Container name source File to be copied to the container dest Destination on the container. Must be an absolute path. overwrite : False Unless...
python
def copy_to(name, source, dest, overwrite=False, makedirs=False): ''' Copy a file from the host into a container name Container name source File to be copied to the container dest Destination on the container. Must be an absolute path. overwrite : False Unless...
[ "def", "copy_to", "(", "name", ",", "source", ",", "dest", ",", "overwrite", "=", "False", ",", "makedirs", "=", "False", ")", ":", "path", "=", "source", "try", ":", "if", "source", ".", "startswith", "(", "'salt://'", ")", ":", "cached_source", "=", ...
Copy a file from the host into a container name Container name source File to be copied to the container dest Destination on the container. Must be an absolute path. overwrite : False Unless this option is set to ``True``, then if a file exists at the location...
[ "Copy", "a", "file", "from", "the", "host", "into", "a", "container" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nspawn.py#L1265-L1315
train
saltstack/salt
salt/modules/nspawn.py
_pull_image
def _pull_image(pull_type, image, name, **kwargs): ''' Common logic for machinectl pull-* commands ''' _ensure_systemd(219) if exists(name): raise SaltInvocationError( 'Container \'{0}\' already exists'.format(name) ) if pull_type in ('raw', 'tar'): valid_kwar...
python
def _pull_image(pull_type, image, name, **kwargs): ''' Common logic for machinectl pull-* commands ''' _ensure_systemd(219) if exists(name): raise SaltInvocationError( 'Container \'{0}\' already exists'.format(name) ) if pull_type in ('raw', 'tar'): valid_kwar...
[ "def", "_pull_image", "(", "pull_type", ",", "image", ",", "name", ",", "*", "*", "kwargs", ")", ":", "_ensure_systemd", "(", "219", ")", "if", "exists", "(", "name", ")", ":", "raise", "SaltInvocationError", "(", "'Container \\'{0}\\' already exists'", ".", ...
Common logic for machinectl pull-* commands
[ "Common", "logic", "for", "machinectl", "pull", "-", "*", "commands" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nspawn.py#L1324-L1388
train
saltstack/salt
salt/modules/nspawn.py
pull_raw
def pull_raw(url, name, verify=False): ''' Execute a ``machinectl pull-raw`` to download a .qcow2 or raw disk image, and add it to /var/lib/machines as a new container. .. note:: **Requires systemd >= 219** url URL from which to download the container name Name for th...
python
def pull_raw(url, name, verify=False): ''' Execute a ``machinectl pull-raw`` to download a .qcow2 or raw disk image, and add it to /var/lib/machines as a new container. .. note:: **Requires systemd >= 219** url URL from which to download the container name Name for th...
[ "def", "pull_raw", "(", "url", ",", "name", ",", "verify", "=", "False", ")", ":", "return", "_pull_image", "(", "'raw'", ",", "url", ",", "name", ",", "verify", "=", "verify", ")" ]
Execute a ``machinectl pull-raw`` to download a .qcow2 or raw disk image, and add it to /var/lib/machines as a new container. .. note:: **Requires systemd >= 219** url URL from which to download the container name Name for the new container verify : False Perform...
[ "Execute", "a", "machinectl", "pull", "-", "raw", "to", "download", "a", ".", "qcow2", "or", "raw", "disk", "image", "and", "add", "it", "to", "/", "var", "/", "lib", "/", "machines", "as", "a", "new", "container", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nspawn.py#L1391-L1420
train
saltstack/salt
salt/modules/nspawn.py
pull_tar
def pull_tar(url, name, verify=False): ''' Execute a ``machinectl pull-raw`` to download a .tar container image, and add it to /var/lib/machines as a new container. .. note:: **Requires systemd >= 219** url URL from which to download the container name Name for the ne...
python
def pull_tar(url, name, verify=False): ''' Execute a ``machinectl pull-raw`` to download a .tar container image, and add it to /var/lib/machines as a new container. .. note:: **Requires systemd >= 219** url URL from which to download the container name Name for the ne...
[ "def", "pull_tar", "(", "url", ",", "name", ",", "verify", "=", "False", ")", ":", "return", "_pull_image", "(", "'tar'", ",", "url", ",", "name", ",", "verify", "=", "verify", ")" ]
Execute a ``machinectl pull-raw`` to download a .tar container image, and add it to /var/lib/machines as a new container. .. note:: **Requires systemd >= 219** url URL from which to download the container name Name for the new container verify : False Perform sig...
[ "Execute", "a", "machinectl", "pull", "-", "raw", "to", "download", "a", ".", "tar", "container", "image", "and", "add", "it", "to", "/", "var", "/", "lib", "/", "machines", "as", "a", "new", "container", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nspawn.py#L1423-L1452
train
saltstack/salt
salt/states/boto_s3_bucket.py
_prep_acl_for_compare
def _prep_acl_for_compare(ACL): ''' Prepares the ACL returned from the AWS API for comparison with a given one. ''' ret = copy.deepcopy(ACL) ret['Owner'] = _normalize_user(ret['Owner']) for item in ret.get('Grants', ()): item['Grantee'] = _normalize_user(item.get('Grantee')) return r...
python
def _prep_acl_for_compare(ACL): ''' Prepares the ACL returned from the AWS API for comparison with a given one. ''' ret = copy.deepcopy(ACL) ret['Owner'] = _normalize_user(ret['Owner']) for item in ret.get('Grants', ()): item['Grantee'] = _normalize_user(item.get('Grantee')) return r...
[ "def", "_prep_acl_for_compare", "(", "ACL", ")", ":", "ret", "=", "copy", ".", "deepcopy", "(", "ACL", ")", "ret", "[", "'Owner'", "]", "=", "_normalize_user", "(", "ret", "[", "'Owner'", "]", ")", "for", "item", "in", "ret", ".", "get", "(", "'Grant...
Prepares the ACL returned from the AWS API for comparison with a given one.
[ "Prepares", "the", "ACL", "returned", "from", "the", "AWS", "API", "for", "comparison", "with", "a", "given", "one", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_s3_bucket.py#L178-L186
train
saltstack/salt
salt/states/boto_s3_bucket.py
_compare_acl
def _compare_acl(current, desired, region, key, keyid, profile): ''' ACLs can be specified using macro-style names that get expanded to something more complex. There's no predictable way to reverse it. So expand all syntactic sugar in our input, and compare against that rather than the input itself....
python
def _compare_acl(current, desired, region, key, keyid, profile): ''' ACLs can be specified using macro-style names that get expanded to something more complex. There's no predictable way to reverse it. So expand all syntactic sugar in our input, and compare against that rather than the input itself....
[ "def", "_compare_acl", "(", "current", ",", "desired", ",", "region", ",", "key", ",", "keyid", ",", "profile", ")", ":", "ocid", "=", "_get_canonical_id", "(", "region", ",", "key", ",", "keyid", ",", "profile", ")", "return", "__utils__", "[", "'boto3....
ACLs can be specified using macro-style names that get expanded to something more complex. There's no predictable way to reverse it. So expand all syntactic sugar in our input, and compare against that rather than the input itself.
[ "ACLs", "can", "be", "specified", "using", "macro", "-", "style", "names", "that", "get", "expanded", "to", "something", "more", "complex", ".", "There", "s", "no", "predictable", "way", "to", "reverse", "it", ".", "So", "expand", "all", "syntactic", "suga...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_s3_bucket.py#L311-L319
train
saltstack/salt
salt/states/boto_s3_bucket.py
_compare_replication
def _compare_replication(current, desired, region, key, keyid, profile): ''' Replication accepts a non-ARN role name, but always returns an ARN ''' if desired is not None and desired.get('Role'): desired = copy.deepcopy(desired) desired['Role'] = _get_role_arn(desired['Role'], ...
python
def _compare_replication(current, desired, region, key, keyid, profile): ''' Replication accepts a non-ARN role name, but always returns an ARN ''' if desired is not None and desired.get('Role'): desired = copy.deepcopy(desired) desired['Role'] = _get_role_arn(desired['Role'], ...
[ "def", "_compare_replication", "(", "current", ",", "desired", ",", "region", ",", "key", ",", "keyid", ",", "profile", ")", ":", "if", "desired", "is", "not", "None", "and", "desired", ".", "get", "(", "'Role'", ")", ":", "desired", "=", "copy", ".", ...
Replication accepts a non-ARN role name, but always returns an ARN
[ "Replication", "accepts", "a", "non", "-", "ARN", "role", "name", "but", "always", "returns", "an", "ARN" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_s3_bucket.py#L326-L334
train
saltstack/salt
salt/states/boto_s3_bucket.py
present
def present(name, Bucket, LocationConstraint=None, ACL=None, CORSRules=None, LifecycleConfiguration=None, Logging=None, NotificationConfiguration=None, Policy=None, Replication=None, RequestPayment=None, ...
python
def present(name, Bucket, LocationConstraint=None, ACL=None, CORSRules=None, LifecycleConfiguration=None, Logging=None, NotificationConfiguration=None, Policy=None, Replication=None, RequestPayment=None, ...
[ "def", "present", "(", "name", ",", "Bucket", ",", "LocationConstraint", "=", "None", ",", "ACL", "=", "None", ",", "CORSRules", "=", "None", ",", "LifecycleConfiguration", "=", "None", ",", "Logging", "=", "None", ",", "NotificationConfiguration", "=", "Non...
Ensure bucket exists. name The name of the state definition Bucket Name of the bucket. LocationConstraint 'EU'|'eu-west-1'|'us-west-1'|'us-west-2'|'ap-southeast-1'|'ap-southeast-2'|'ap-northeast-1'|'sa-east-1'|'cn-north-1'|'eu-central-1' ACL The permissions on a bucke...
[ "Ensure", "bucket", "exists", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_s3_bucket.py#L337-L611
train
saltstack/salt
salt/modules/pkgin.py
_check_pkgin
def _check_pkgin(): ''' Looks to see if pkgin is present on the system, return full path ''' ppath = salt.utils.path.which('pkgin') if ppath is None: # pkgin was not found in $PATH, try to find it via LOCALBASE try: localbase = __salt__['cmd.run']( 'pkg_inf...
python
def _check_pkgin(): ''' Looks to see if pkgin is present on the system, return full path ''' ppath = salt.utils.path.which('pkgin') if ppath is None: # pkgin was not found in $PATH, try to find it via LOCALBASE try: localbase = __salt__['cmd.run']( 'pkg_inf...
[ "def", "_check_pkgin", "(", ")", ":", "ppath", "=", "salt", ".", "utils", ".", "path", ".", "which", "(", "'pkgin'", ")", "if", "ppath", "is", "None", ":", "# pkgin was not found in $PATH, try to find it via LOCALBASE", "try", ":", "localbase", "=", "__salt__", ...
Looks to see if pkgin is present on the system, return full path
[ "Looks", "to", "see", "if", "pkgin", "is", "present", "on", "the", "system", "return", "full", "path" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pkgin.py#L38-L56
train
saltstack/salt
salt/modules/pkgin.py
_get_version
def _get_version(): ''' Get the pkgin version ''' version_string = __salt__['cmd.run']( [_check_pkgin(), '-v'], output_loglevel='trace') if version_string is None: # Dunno why it would, but... return False version_match = VERSION_MATCH.search(version_string) ...
python
def _get_version(): ''' Get the pkgin version ''' version_string = __salt__['cmd.run']( [_check_pkgin(), '-v'], output_loglevel='trace') if version_string is None: # Dunno why it would, but... return False version_match = VERSION_MATCH.search(version_string) ...
[ "def", "_get_version", "(", ")", ":", "version_string", "=", "__salt__", "[", "'cmd.run'", "]", "(", "[", "_check_pkgin", "(", ")", ",", "'-v'", "]", ",", "output_loglevel", "=", "'trace'", ")", "if", "version_string", "is", "None", ":", "# Dunno why it woul...
Get the pkgin version
[ "Get", "the", "pkgin", "version" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pkgin.py#L60-L75
train
saltstack/salt
salt/modules/pkgin.py
search
def search(pkg_name, **kwargs): ''' Searches for an exact match using pkgin ^package$ CLI Example: .. code-block:: bash salt '*' pkg.search 'mysql-server' ''' pkglist = {} pkgin = _check_pkgin() if not pkgin: return pkglist if _supports_regex(): pkg_name ...
python
def search(pkg_name, **kwargs): ''' Searches for an exact match using pkgin ^package$ CLI Example: .. code-block:: bash salt '*' pkg.search 'mysql-server' ''' pkglist = {} pkgin = _check_pkgin() if not pkgin: return pkglist if _supports_regex(): pkg_name ...
[ "def", "search", "(", "pkg_name", ",", "*", "*", "kwargs", ")", ":", "pkglist", "=", "{", "}", "pkgin", "=", "_check_pkgin", "(", ")", "if", "not", "pkgin", ":", "return", "pkglist", "if", "_supports_regex", "(", ")", ":", "pkg_name", "=", "'^{0}$'", ...
Searches for an exact match using pkgin ^package$ CLI Example: .. code-block:: bash salt '*' pkg.search 'mysql-server'
[ "Searches", "for", "an", "exact", "match", "using", "pkgin", "^package$" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pkgin.py#L120-L149
train
saltstack/salt
salt/modules/pkgin.py
refresh_db
def refresh_db(force=False, **kwargs): ''' Use pkg update to get latest pkg_summary force Pass -f so that the cache is always refreshed. .. versionadded:: 2018.3.0 CLI Example: .. code-block:: bash salt '*' pkg.refresh_db ''' # Remove rtag file to keep multiple ...
python
def refresh_db(force=False, **kwargs): ''' Use pkg update to get latest pkg_summary force Pass -f so that the cache is always refreshed. .. versionadded:: 2018.3.0 CLI Example: .. code-block:: bash salt '*' pkg.refresh_db ''' # Remove rtag file to keep multiple ...
[ "def", "refresh_db", "(", "force", "=", "False", ",", "*", "*", "kwargs", ")", ":", "# Remove rtag file to keep multiple refreshes from happening in pkg states", "salt", ".", "utils", ".", "pkg", ".", "clear_rtag", "(", "__opts__", ")", "pkgin", "=", "_check_pkgin",...
Use pkg update to get latest pkg_summary force Pass -f so that the cache is always refreshed. .. versionadded:: 2018.3.0 CLI Example: .. code-block:: bash salt '*' pkg.refresh_db
[ "Use", "pkg", "update", "to", "get", "latest", "pkg_summary" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pkgin.py#L233-L266
train
saltstack/salt
salt/modules/pkgin.py
list_pkgs
def list_pkgs(versions_as_list=False, **kwargs): ''' .. versionchanged: 2016.3.0 List the packages currently installed as a dict:: {'<package_name>': '<version>'} CLI Example: .. code-block:: bash salt '*' pkg.list_pkgs ''' versions_as_list = salt.utils.data.is_true(vers...
python
def list_pkgs(versions_as_list=False, **kwargs): ''' .. versionchanged: 2016.3.0 List the packages currently installed as a dict:: {'<package_name>': '<version>'} CLI Example: .. code-block:: bash salt '*' pkg.list_pkgs ''' versions_as_list = salt.utils.data.is_true(vers...
[ "def", "list_pkgs", "(", "versions_as_list", "=", "False", ",", "*", "*", "kwargs", ")", ":", "versions_as_list", "=", "salt", ".", "utils", ".", "data", ".", "is_true", "(", "versions_as_list", ")", "# not yet implemented or not applicable", "if", "any", "(", ...
.. versionchanged: 2016.3.0 List the packages currently installed as a dict:: {'<package_name>': '<version>'} CLI Example: .. code-block:: bash salt '*' pkg.list_pkgs
[ "..", "versionchanged", ":", "2016", ".", "3", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pkgin.py#L269-L317
train
saltstack/salt
salt/modules/pkgin.py
list_upgrades
def list_upgrades(refresh=True, **kwargs): ''' List all available package upgrades. .. versionadded:: 2018.3.0 refresh Whether or not to refresh the package database before installing. CLI Example: .. code-block:: bash salt '*' pkg.list_upgrades ''' pkgs = {} for...
python
def list_upgrades(refresh=True, **kwargs): ''' List all available package upgrades. .. versionadded:: 2018.3.0 refresh Whether or not to refresh the package database before installing. CLI Example: .. code-block:: bash salt '*' pkg.list_upgrades ''' pkgs = {} for...
[ "def", "list_upgrades", "(", "refresh", "=", "True", ",", "*", "*", "kwargs", ")", ":", "pkgs", "=", "{", "}", "for", "pkg", "in", "sorted", "(", "list_pkgs", "(", "refresh", "=", "refresh", ")", ".", "keys", "(", ")", ")", ":", "# NOTE: we already o...
List all available package upgrades. .. versionadded:: 2018.3.0 refresh Whether or not to refresh the package database before installing. CLI Example: .. code-block:: bash salt '*' pkg.list_upgrades
[ "List", "all", "available", "package", "upgrades", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pkgin.py#L320-L341
train
saltstack/salt
salt/modules/pkgin.py
install
def install(name=None, refresh=False, fromrepo=None, pkgs=None, sources=None, **kwargs): ''' Install the passed package name The name of the package to be installed. refresh Whether or not to refresh the package database before installing. fromrepo Specify a pa...
python
def install(name=None, refresh=False, fromrepo=None, pkgs=None, sources=None, **kwargs): ''' Install the passed package name The name of the package to be installed. refresh Whether or not to refresh the package database before installing. fromrepo Specify a pa...
[ "def", "install", "(", "name", "=", "None", ",", "refresh", "=", "False", ",", "fromrepo", "=", "None", ",", "pkgs", "=", "None", ",", "sources", "=", "None", ",", "*", "*", "kwargs", ")", ":", "try", ":", "pkg_params", ",", "pkg_type", "=", "__sal...
Install the passed package name The name of the package to be installed. refresh Whether or not to refresh the package database before installing. fromrepo Specify a package repository to install from. Multiple Package Installation Options: pkgs A list of packag...
[ "Install", "the", "passed", "package" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pkgin.py#L344-L453
train
saltstack/salt
salt/modules/pkgin.py
upgrade
def upgrade(refresh=True, pkgs=None, **kwargs): ''' Run pkg upgrade, if pkgin used. Otherwise do nothing refresh Whether or not to refresh the package database before installing. Multiple Package Upgrade Options: pkgs A list of packages to upgrade from a software repository. Must ...
python
def upgrade(refresh=True, pkgs=None, **kwargs): ''' Run pkg upgrade, if pkgin used. Otherwise do nothing refresh Whether or not to refresh the package database before installing. Multiple Package Upgrade Options: pkgs A list of packages to upgrade from a software repository. Must ...
[ "def", "upgrade", "(", "refresh", "=", "True", ",", "pkgs", "=", "None", ",", "*", "*", "kwargs", ")", ":", "pkgin", "=", "_check_pkgin", "(", ")", "if", "not", "pkgin", ":", "# There is not easy way to upgrade packages with old package system", "return", "{", ...
Run pkg upgrade, if pkgin used. Otherwise do nothing refresh Whether or not to refresh the package database before installing. Multiple Package Upgrade Options: pkgs A list of packages to upgrade from a software repository. Must be passed as a python list. CLI Example: ...
[ "Run", "pkg", "upgrade", "if", "pkgin", "used", ".", "Otherwise", "do", "nothing" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pkgin.py#L456-L526
train
saltstack/salt
salt/modules/pkgin.py
remove
def remove(name=None, pkgs=None, **kwargs): ''' name The name of the package to be deleted. Multiple Package Options: pkgs A list of packages to delete. Must be passed as a python list. The ``name`` parameter will be ignored if this option is passed. .. versionadded:: 0.1...
python
def remove(name=None, pkgs=None, **kwargs): ''' name The name of the package to be deleted. Multiple Package Options: pkgs A list of packages to delete. Must be passed as a python list. The ``name`` parameter will be ignored if this option is passed. .. versionadded:: 0.1...
[ "def", "remove", "(", "name", "=", "None", ",", "pkgs", "=", "None", ",", "*", "*", "kwargs", ")", ":", "try", ":", "pkg_params", ",", "pkg_type", "=", "__salt__", "[", "'pkg_resource.parse_targets'", "]", "(", "name", ",", "pkgs", ")", "except", "Mini...
name The name of the package to be deleted. Multiple Package Options: pkgs A list of packages to delete. Must be passed as a python list. The ``name`` parameter will be ignored if this option is passed. .. versionadded:: 0.16.0 Returns a list containing the removed packages...
[ "name", "The", "name", "of", "the", "package", "to", "be", "deleted", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pkgin.py#L529-L600
train
saltstack/salt
salt/modules/pkgin.py
file_list
def file_list(package, **kwargs): ''' List the files that belong to a package. CLI Examples: .. code-block:: bash salt '*' pkg.file_list nginx ''' ret = file_dict(package) files = [] for pkg_files in six.itervalues(ret['files']): files.extend(pkg_files) ret['files'...
python
def file_list(package, **kwargs): ''' List the files that belong to a package. CLI Examples: .. code-block:: bash salt '*' pkg.file_list nginx ''' ret = file_dict(package) files = [] for pkg_files in six.itervalues(ret['files']): files.extend(pkg_files) ret['files'...
[ "def", "file_list", "(", "package", ",", "*", "*", "kwargs", ")", ":", "ret", "=", "file_dict", "(", "package", ")", "files", "=", "[", "]", "for", "pkg_files", "in", "six", ".", "itervalues", "(", "ret", "[", "'files'", "]", ")", ":", "files", "."...
List the files that belong to a package. CLI Examples: .. code-block:: bash salt '*' pkg.file_list nginx
[ "List", "the", "files", "that", "belong", "to", "a", "package", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pkgin.py#L645-L660
train
saltstack/salt
salt/modules/pkgin.py
file_dict
def file_dict(*packages, **kwargs): ''' .. versionchanged: 2016.3.0 List the files that belong to a package. CLI Examples: .. code-block:: bash salt '*' pkg.file_dict nginx salt '*' pkg.file_dict nginx varnish ''' errors = [] files = {} for package in packages: ...
python
def file_dict(*packages, **kwargs): ''' .. versionchanged: 2016.3.0 List the files that belong to a package. CLI Examples: .. code-block:: bash salt '*' pkg.file_dict nginx salt '*' pkg.file_dict nginx varnish ''' errors = [] files = {} for package in packages: ...
[ "def", "file_dict", "(", "*", "packages", ",", "*", "*", "kwargs", ")", ":", "errors", "=", "[", "]", "files", "=", "{", "}", "for", "package", "in", "packages", ":", "cmd", "=", "[", "'pkg_info'", ",", "'-qL'", ",", "package", "]", "ret", "=", "...
.. versionchanged: 2016.3.0 List the files that belong to a package. CLI Examples: .. code-block:: bash salt '*' pkg.file_dict nginx salt '*' pkg.file_dict nginx varnish
[ "..", "versionchanged", ":", "2016", ".", "3", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pkgin.py#L663-L696
train
saltstack/salt
salt/states/mount.py
mounted
def mounted(name, device, fstype, mkmnt=False, opts='defaults', dump=0, pass_num=0, config='/etc/fstab', persist=True, mount=True, user=None, match_on='auto', device_name_regex...
python
def mounted(name, device, fstype, mkmnt=False, opts='defaults', dump=0, pass_num=0, config='/etc/fstab', persist=True, mount=True, user=None, match_on='auto', device_name_regex...
[ "def", "mounted", "(", "name", ",", "device", ",", "fstype", ",", "mkmnt", "=", "False", ",", "opts", "=", "'defaults'", ",", "dump", "=", "0", ",", "pass_num", "=", "0", ",", "config", "=", "'/etc/fstab'", ",", "persist", "=", "True", ",", "mount", ...
Verify that a device is mounted name The path to the location where the device is to be mounted device The device name, typically the device node, such as ``/dev/sdb1`` or ``UUID=066e0200-2867-4ebe-b9e6-f30026ca2314`` or ``LABEL=DATA`` fstype The filesystem type, this will...
[ "Verify", "that", "a", "device", "is", "mounted" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/mount.py#L61-L728
train
saltstack/salt
salt/states/mount.py
swap
def swap(name, persist=True, config='/etc/fstab'): ''' Activates a swap device .. code-block:: yaml /root/swapfile: mount.swap .. note:: ``swap`` does not currently support LABEL ''' ret = {'name': name, 'changes': {}, 'result': True, ...
python
def swap(name, persist=True, config='/etc/fstab'): ''' Activates a swap device .. code-block:: yaml /root/swapfile: mount.swap .. note:: ``swap`` does not currently support LABEL ''' ret = {'name': name, 'changes': {}, 'result': True, ...
[ "def", "swap", "(", "name", ",", "persist", "=", "True", ",", "config", "=", "'/etc/fstab'", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "True", ",", "'comment'", ":", "''", "}", "on_", ...
Activates a swap device .. code-block:: yaml /root/swapfile: mount.swap .. note:: ``swap`` does not currently support LABEL
[ "Activates", "a", "swap", "device" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/mount.py#L731-L827
train
saltstack/salt
salt/states/mount.py
unmounted
def unmounted(name, device=None, config='/etc/fstab', persist=False, user=None, **kwargs): ''' .. versionadded:: 0.17.0 Verify that a device is not mounted name The path to the location where the device is to be unmounted fr...
python
def unmounted(name, device=None, config='/etc/fstab', persist=False, user=None, **kwargs): ''' .. versionadded:: 0.17.0 Verify that a device is not mounted name The path to the location where the device is to be unmounted fr...
[ "def", "unmounted", "(", "name", ",", "device", "=", "None", ",", "config", "=", "'/etc/fstab'", ",", "persist", "=", "False", ",", "user", "=", "None", ",", "*", "*", "kwargs", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":...
.. versionadded:: 0.17.0 Verify that a device is not mounted name The path to the location where the device is to be unmounted from device The device to be unmounted. This is optional because the device could be mounted in multiple places. .. versionadded:: 2015.5.0 ...
[ "..", "versionadded", "::", "0", ".", "17", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/mount.py#L830-L952
train
saltstack/salt
salt/states/mount.py
mod_watch
def mod_watch(name, user=None, **kwargs): ''' The mounted watcher, called to invoke the watch command. .. note:: This state exists to support special handling of the ``watch`` :ref:`requisite <requisites>`. It should not be called directly. Parameters for this function should be se...
python
def mod_watch(name, user=None, **kwargs): ''' The mounted watcher, called to invoke the watch command. .. note:: This state exists to support special handling of the ``watch`` :ref:`requisite <requisites>`. It should not be called directly. Parameters for this function should be se...
[ "def", "mod_watch", "(", "name", ",", "user", "=", "None", ",", "*", "*", "kwargs", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "True", ",", "'comment'", ":", "''", "}", "if", "kwargs",...
The mounted watcher, called to invoke the watch command. .. note:: This state exists to support special handling of the ``watch`` :ref:`requisite <requisites>`. It should not be called directly. Parameters for this function should be set by the state being triggered. name The ...
[ "The", "mounted", "watcher", "called", "to", "invoke", "the", "watch", "command", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/mount.py#L955-L983
train
saltstack/salt
salt/states/mount.py
_convert_to
def _convert_to(maybe_device, convert_to): ''' Convert a device name, UUID or LABEL to a device name, UUID or LABEL. Return the fs_spec required for fstab. ''' # Fast path. If we already have the information required, we can # save one blkid call if not convert_to or \ (convert...
python
def _convert_to(maybe_device, convert_to): ''' Convert a device name, UUID or LABEL to a device name, UUID or LABEL. Return the fs_spec required for fstab. ''' # Fast path. If we already have the information required, we can # save one blkid call if not convert_to or \ (convert...
[ "def", "_convert_to", "(", "maybe_device", ",", "convert_to", ")", ":", "# Fast path. If we already have the information required, we can", "# save one blkid call", "if", "not", "convert_to", "or", "(", "convert_to", "==", "'device'", "and", "maybe_device", ".", "startswith...
Convert a device name, UUID or LABEL to a device name, UUID or LABEL. Return the fs_spec required for fstab.
[ "Convert", "a", "device", "name", "UUID", "or", "LABEL", "to", "a", "device", "name", "UUID", "or", "LABEL", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/mount.py#L986-L1016
train
saltstack/salt
salt/states/mount.py
fstab_present
def fstab_present(name, fs_file, fs_vfstype, fs_mntops='defaults', fs_freq=0, fs_passno=0, mount_by=None, config='/etc/fstab', mount=True, match_on='auto'): ''' Makes sure that a fstab mount point is pressent. name The name of block device. Can be any valid fs_sp...
python
def fstab_present(name, fs_file, fs_vfstype, fs_mntops='defaults', fs_freq=0, fs_passno=0, mount_by=None, config='/etc/fstab', mount=True, match_on='auto'): ''' Makes sure that a fstab mount point is pressent. name The name of block device. Can be any valid fs_sp...
[ "def", "fstab_present", "(", "name", ",", "fs_file", ",", "fs_vfstype", ",", "fs_mntops", "=", "'defaults'", ",", "fs_freq", "=", "0", ",", "fs_passno", "=", "0", ",", "mount_by", "=", "None", ",", "config", "=", "'/etc/fstab'", ",", "mount", "=", "True"...
Makes sure that a fstab mount point is pressent. name The name of block device. Can be any valid fs_spec value. fs_file Mount point (target) for the filesystem. fs_vfstype The type of the filesystem (e.g. ext4, xfs, btrfs, ...) fs_mntops The mount options associated w...
[ "Makes", "sure", "that", "a", "fstab", "mount", "point", "is", "pressent", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/mount.py#L1019-L1185
train
saltstack/salt
salt/states/mount.py
fstab_absent
def fstab_absent(name, fs_file, mount_by=None, config='/etc/fstab'): ''' Makes sure that a fstab mount point is absent. name The name of block device. Can be any valid fs_spec value. fs_file Mount point (target) for the filesystem. mount_by Select the final value for fs_sp...
python
def fstab_absent(name, fs_file, mount_by=None, config='/etc/fstab'): ''' Makes sure that a fstab mount point is absent. name The name of block device. Can be any valid fs_spec value. fs_file Mount point (target) for the filesystem. mount_by Select the final value for fs_sp...
[ "def", "fstab_absent", "(", "name", ",", "fs_file", ",", "mount_by", "=", "None", ",", "config", "=", "'/etc/fstab'", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'result'", ":", "False", ",", "'changes'", ":", "{", "}", ",", "'comment'", ...
Makes sure that a fstab mount point is absent. name The name of block device. Can be any valid fs_spec value. fs_file Mount point (target) for the filesystem. mount_by Select the final value for fs_spec. Can be [``None``, ``device``, ``label``, ``uuid``, ``partlabel``, ...
[ "Makes", "sure", "that", "a", "fstab", "mount", "point", "is", "absent", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/mount.py#L1188-L1275
train
saltstack/salt
salt/modules/win_snmp.py
get_agent_settings
def get_agent_settings(): ''' Determine the value of the SNMP sysContact, sysLocation, and sysServices settings. Returns: dict: A dictionary of the agent settings. CLI Example: .. code-block:: bash salt '*' win_snmp.get_agent_settings ''' ret = dict() sorted_types...
python
def get_agent_settings(): ''' Determine the value of the SNMP sysContact, sysLocation, and sysServices settings. Returns: dict: A dictionary of the agent settings. CLI Example: .. code-block:: bash salt '*' win_snmp.get_agent_settings ''' ret = dict() sorted_types...
[ "def", "get_agent_settings", "(", ")", ":", "ret", "=", "dict", "(", ")", "sorted_types", "=", "sorted", "(", "_SERVICE_TYPES", ".", "items", "(", ")", ",", "key", "=", "lambda", "x", ":", "(", "-", "x", "[", "1", "]", ",", "x", "[", "0", "]", ...
Determine the value of the SNMP sysContact, sysLocation, and sysServices settings. Returns: dict: A dictionary of the agent settings. CLI Example: .. code-block:: bash salt '*' win_snmp.get_agent_settings
[ "Determine", "the", "value", "of", "the", "SNMP", "sysContact", "sysLocation", "and", "sysServices", "settings", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_snmp.py#L101-L143
train
saltstack/salt
salt/modules/win_snmp.py
set_agent_settings
def set_agent_settings(contact=None, location=None, services=None): ''' Manage the SNMP sysContact, sysLocation, and sysServices settings. Args: contact (str, optional): The SNMP contact. location (str, optional): The SNMP location. services (list, optional): A list of selected se...
python
def set_agent_settings(contact=None, location=None, services=None): ''' Manage the SNMP sysContact, sysLocation, and sysServices settings. Args: contact (str, optional): The SNMP contact. location (str, optional): The SNMP location. services (list, optional): A list of selected se...
[ "def", "set_agent_settings", "(", "contact", "=", "None", ",", "location", "=", "None", ",", "services", "=", "None", ")", ":", "if", "services", "is", "not", "None", ":", "# Filter services for unique items, and sort them for comparison", "# purposes.", "services", ...
Manage the SNMP sysContact, sysLocation, and sysServices settings. Args: contact (str, optional): The SNMP contact. location (str, optional): The SNMP location. services (list, optional): A list of selected services. The possible service names can be found via ``win_snmp.get_a...
[ "Manage", "the", "SNMP", "sysContact", "sysLocation", "and", "sysServices", "settings", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_snmp.py#L146-L228
train
saltstack/salt
salt/modules/win_snmp.py
set_auth_traps_enabled
def set_auth_traps_enabled(status=True): ''' Manage the sending of authentication traps. Args: status (bool): True to enable traps. False to disable. Returns: bool: True if successful, otherwise False CLI Example: .. code-block:: bash salt '*' win_snmp.set_auth_traps...
python
def set_auth_traps_enabled(status=True): ''' Manage the sending of authentication traps. Args: status (bool): True to enable traps. False to disable. Returns: bool: True if successful, otherwise False CLI Example: .. code-block:: bash salt '*' win_snmp.set_auth_traps...
[ "def", "set_auth_traps_enabled", "(", "status", "=", "True", ")", ":", "vname", "=", "'EnableAuthenticationTraps'", "current_status", "=", "get_auth_traps_enabled", "(", ")", "if", "bool", "(", "status", ")", "==", "current_status", ":", "_LOG", ".", "debug", "(...
Manage the sending of authentication traps. Args: status (bool): True to enable traps. False to disable. Returns: bool: True if successful, otherwise False CLI Example: .. code-block:: bash salt '*' win_snmp.set_auth_traps_enabled status='True'
[ "Manage", "the", "sending", "of", "authentication", "traps", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_snmp.py#L252-L284
train
saltstack/salt
salt/modules/win_snmp.py
get_community_names
def get_community_names(): ''' Get the current accepted SNMP community names and their permissions. If community names are being managed by Group Policy, those values will be returned instead like this: .. code-block:: bash TestCommunity: Managed by GPO Community names ma...
python
def get_community_names(): ''' Get the current accepted SNMP community names and their permissions. If community names are being managed by Group Policy, those values will be returned instead like this: .. code-block:: bash TestCommunity: Managed by GPO Community names ma...
[ "def", "get_community_names", "(", ")", ":", "ret", "=", "dict", "(", ")", "# Look in GPO settings first", "if", "__utils__", "[", "'reg.key_exists'", "]", "(", "_HKEY", ",", "_COMMUNITIES_GPO_KEY", ")", ":", "_LOG", ".", "debug", "(", "'Loading communities from G...
Get the current accepted SNMP community names and their permissions. If community names are being managed by Group Policy, those values will be returned instead like this: .. code-block:: bash TestCommunity: Managed by GPO Community names managed normally will denote the permissi...
[ "Get", "the", "current", "accepted", "SNMP", "community", "names", "and", "their", "permissions", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_snmp.py#L287-L382
train
saltstack/salt
salt/modules/win_snmp.py
set_community_names
def set_community_names(communities): ''' Manage the SNMP accepted community names and their permissions. .. note:: Settings managed by Group Policy will always take precedence over those set using the SNMP interface. Therefore if this function finds Group Policy settings it will ra...
python
def set_community_names(communities): ''' Manage the SNMP accepted community names and their permissions. .. note:: Settings managed by Group Policy will always take precedence over those set using the SNMP interface. Therefore if this function finds Group Policy settings it will ra...
[ "def", "set_community_names", "(", "communities", ")", ":", "values", "=", "dict", "(", ")", "if", "__utils__", "[", "'reg.key_exists'", "]", "(", "_HKEY", ",", "_COMMUNITIES_GPO_KEY", ")", ":", "_LOG", ".", "debug", "(", "'Communities on this system are managed b...
Manage the SNMP accepted community names and their permissions. .. note:: Settings managed by Group Policy will always take precedence over those set using the SNMP interface. Therefore if this function finds Group Policy settings it will raise a CommandExecutionError Args: com...
[ "Manage", "the", "SNMP", "accepted", "community", "names", "and", "their", "permissions", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_snmp.py#L385-L473
train
saltstack/salt
salt/states/win_smtp_server.py
_merge_dicts
def _merge_dicts(*args): ''' Shallow copy and merge dicts together, giving precedence to last in. ''' ret = dict() for arg in args: ret.update(arg) return ret
python
def _merge_dicts(*args): ''' Shallow copy and merge dicts together, giving precedence to last in. ''' ret = dict() for arg in args: ret.update(arg) return ret
[ "def", "_merge_dicts", "(", "*", "args", ")", ":", "ret", "=", "dict", "(", ")", "for", "arg", "in", "args", ":", "ret", ".", "update", "(", "arg", ")", "return", "ret" ]
Shallow copy and merge dicts together, giving precedence to last in.
[ "Shallow", "copy", "and", "merge", "dicts", "together", "giving", "precedence", "to", "last", "in", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/win_smtp_server.py#L27-L34
train
saltstack/salt
salt/states/win_smtp_server.py
_normalize_server_settings
def _normalize_server_settings(**settings): ''' Convert setting values that has been improperly converted to a dict back to a string. ''' ret = dict() settings = salt.utils.args.clean_kwargs(**settings) for setting in settings: if isinstance(settings[setting], dict): value_f...
python
def _normalize_server_settings(**settings): ''' Convert setting values that has been improperly converted to a dict back to a string. ''' ret = dict() settings = salt.utils.args.clean_kwargs(**settings) for setting in settings: if isinstance(settings[setting], dict): value_f...
[ "def", "_normalize_server_settings", "(", "*", "*", "settings", ")", ":", "ret", "=", "dict", "(", ")", "settings", "=", "salt", ".", "utils", ".", "args", ".", "clean_kwargs", "(", "*", "*", "settings", ")", "for", "setting", "in", "settings", ":", "i...
Convert setting values that has been improperly converted to a dict back to a string.
[ "Convert", "setting", "values", "that", "has", "been", "improperly", "converted", "to", "a", "dict", "back", "to", "a", "string", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/win_smtp_server.py#L37-L51
train
saltstack/salt
salt/states/win_smtp_server.py
server_setting
def server_setting(name, settings=None, server=_DEFAULT_SERVER): ''' Ensure the value is set for the specified setting. .. note:: The setting names are case-sensitive. :param str settings: A dictionary of the setting names and their values. :param str server: The SMTP server name. Ex...
python
def server_setting(name, settings=None, server=_DEFAULT_SERVER): ''' Ensure the value is set for the specified setting. .. note:: The setting names are case-sensitive. :param str settings: A dictionary of the setting names and their values. :param str server: The SMTP server name. Ex...
[ "def", "server_setting", "(", "name", ",", "settings", "=", "None", ",", "server", "=", "_DEFAULT_SERVER", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'comment'", ":", "six", ".", "text_type", "(", ")", ",...
Ensure the value is set for the specified setting. .. note:: The setting names are case-sensitive. :param str settings: A dictionary of the setting names and their values. :param str server: The SMTP server name. Example of usage: .. code-block:: yaml smtp-settings: ...
[ "Ensure", "the", "value", "is", "set", "for", "the", "specified", "setting", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/win_smtp_server.py#L54-L128
train
saltstack/salt
salt/states/win_smtp_server.py
active_log_format
def active_log_format(name, log_format, server=_DEFAULT_SERVER): ''' Manage the active log format for the SMTP server. :param str log_format: The log format name. :param str server: The SMTP server name. Example of usage: .. code-block:: yaml smtp-log-format: win_smtp_ser...
python
def active_log_format(name, log_format, server=_DEFAULT_SERVER): ''' Manage the active log format for the SMTP server. :param str log_format: The log format name. :param str server: The SMTP server name. Example of usage: .. code-block:: yaml smtp-log-format: win_smtp_ser...
[ "def", "active_log_format", "(", "name", ",", "log_format", ",", "server", "=", "_DEFAULT_SERVER", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'comment'", ":", "six", ".", "text_type", "(", ")", ",", "'resul...
Manage the active log format for the SMTP server. :param str log_format: The log format name. :param str server: The SMTP server name. Example of usage: .. code-block:: yaml smtp-log-format: win_smtp_server.active_log_format: - log_format: Microsoft IIS Log File F...
[ "Manage", "the", "active", "log", "format", "for", "the", "SMTP", "server", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/win_smtp_server.py#L131-L164
train
saltstack/salt
salt/states/win_smtp_server.py
connection_ip_list
def connection_ip_list(name, addresses=None, grant_by_default=False, server=_DEFAULT_SERVER): ''' Manage IP list for SMTP connections. :param str addresses: A dictionary of IP + subnet pairs. :param bool grant_by_default: Whether the addresses should be a blacklist or whitelist. :param str server: ...
python
def connection_ip_list(name, addresses=None, grant_by_default=False, server=_DEFAULT_SERVER): ''' Manage IP list for SMTP connections. :param str addresses: A dictionary of IP + subnet pairs. :param bool grant_by_default: Whether the addresses should be a blacklist or whitelist. :param str server: ...
[ "def", "connection_ip_list", "(", "name", ",", "addresses", "=", "None", ",", "grant_by_default", "=", "False", ",", "server", "=", "_DEFAULT_SERVER", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'comment'", ":...
Manage IP list for SMTP connections. :param str addresses: A dictionary of IP + subnet pairs. :param bool grant_by_default: Whether the addresses should be a blacklist or whitelist. :param str server: The SMTP server name. Example of usage for creating a whitelist: .. code-block:: yaml s...
[ "Manage", "IP", "list", "for", "SMTP", "connections", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/win_smtp_server.py#L167-L230
train
saltstack/salt
salt/states/win_smtp_server.py
relay_ip_list
def relay_ip_list(name, addresses=None, server=_DEFAULT_SERVER): ''' Manage IP list for SMTP relay connections. Due to the unusual way that Windows stores the relay IPs, it is advisable to retrieve the existing list you wish to set from a pre-configured server. For example, setting '127.0.0.1' as ...
python
def relay_ip_list(name, addresses=None, server=_DEFAULT_SERVER): ''' Manage IP list for SMTP relay connections. Due to the unusual way that Windows stores the relay IPs, it is advisable to retrieve the existing list you wish to set from a pre-configured server. For example, setting '127.0.0.1' as ...
[ "def", "relay_ip_list", "(", "name", ",", "addresses", "=", "None", ",", "server", "=", "_DEFAULT_SERVER", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'comment'", ":", "six", ".", "text_type", "(", ")", ",...
Manage IP list for SMTP relay connections. Due to the unusual way that Windows stores the relay IPs, it is advisable to retrieve the existing list you wish to set from a pre-configured server. For example, setting '127.0.0.1' as an allowed relay IP through the GUI would generate an actual relay IP lis...
[ "Manage", "IP", "list", "for", "SMTP", "relay", "connections", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/win_smtp_server.py#L233-L328
train
saltstack/salt
salt/modules/onyx.py
cmd
def cmd(command, *args, **kwargs): ''' run commands from __proxy__ :mod:`salt.proxy.onyx<salt.proxy.onyx>` command function from `salt.proxy.onyx` to run args positional args to pass to `command` function kwargs key word arguments to pass to `command` function .. ...
python
def cmd(command, *args, **kwargs): ''' run commands from __proxy__ :mod:`salt.proxy.onyx<salt.proxy.onyx>` command function from `salt.proxy.onyx` to run args positional args to pass to `command` function kwargs key word arguments to pass to `command` function .. ...
[ "def", "cmd", "(", "command", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "proxy_prefix", "=", "__opts__", "[", "'proxy'", "]", "[", "'proxytype'", "]", "proxy_cmd", "=", "'.'", ".", "join", "(", "[", "proxy_prefix", ",", "command", "]", ")"...
run commands from __proxy__ :mod:`salt.proxy.onyx<salt.proxy.onyx>` command function from `salt.proxy.onyx` to run args positional args to pass to `command` function kwargs key word arguments to pass to `command` function .. code-block:: bash salt '*' onyx.cmd se...
[ "run", "commands", "from", "__proxy__", ":", "mod", ":", "salt", ".", "proxy", ".", "onyx<salt", ".", "proxy", ".", "onyx", ">" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/onyx.py#L38-L66
train
saltstack/salt
salt/runners/digicertapi.py
_paginate
def _paginate(url, topkey, *args, **kwargs): ''' Wrapper to assist with paginated responses from Digicert's REST API. ''' ret = salt.utils.http.query(url, **kwargs) if 'errors' in ret['dict']: return ret['dict'] lim = int(ret['dict']['page']['limit']) total = int(ret['dict']['page'...
python
def _paginate(url, topkey, *args, **kwargs): ''' Wrapper to assist with paginated responses from Digicert's REST API. ''' ret = salt.utils.http.query(url, **kwargs) if 'errors' in ret['dict']: return ret['dict'] lim = int(ret['dict']['page']['limit']) total = int(ret['dict']['page'...
[ "def", "_paginate", "(", "url", ",", "topkey", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "ret", "=", "salt", ".", "utils", ".", "http", ".", "query", "(", "url", ",", "*", "*", "kwargs", ")", "if", "'errors'", "in", "ret", "[", "'dic...
Wrapper to assist with paginated responses from Digicert's REST API.
[ "Wrapper", "to", "assist", "with", "paginated", "responses", "from", "Digicert", "s", "REST", "API", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/digicertapi.py#L92-L120
train
saltstack/salt
salt/runners/digicertapi.py
list_domains
def list_domains(container_id=None): ''' List domains that CertCentral knows about. You can filter by container_id (also known as "Division") by passing a container_id. CLI Example: .. code-block:: bash salt-run digicert.list_domains ''' if container_id: url = '{0}/domain?...
python
def list_domains(container_id=None): ''' List domains that CertCentral knows about. You can filter by container_id (also known as "Division") by passing a container_id. CLI Example: .. code-block:: bash salt-run digicert.list_domains ''' if container_id: url = '{0}/domain?...
[ "def", "list_domains", "(", "container_id", "=", "None", ")", ":", "if", "container_id", ":", "url", "=", "'{0}/domain?{1}'", ".", "format", "(", "_base_url", "(", ")", ",", "container_id", ")", "else", ":", "url", "=", "'{0}/domain'", ".", "format", "(", ...
List domains that CertCentral knows about. You can filter by container_id (also known as "Division") by passing a container_id. CLI Example: .. code-block:: bash salt-run digicert.list_domains
[ "List", "domains", "that", "CertCentral", "knows", "about", ".", "You", "can", "filter", "by", "container_id", "(", "also", "known", "as", "Division", ")", "by", "passing", "a", "container_id", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/digicertapi.py#L123-L151
train
saltstack/salt
salt/runners/digicertapi.py
list_requests
def list_requests(status=None): ''' List certificate requests made to CertCentral. You can filter by status: ``pending``, ``approved``, ``rejected`` CLI Example: .. code-block:: bash salt-run digicert.list_requests pending ''' if status: url = '{0}/request?status={1}'.form...
python
def list_requests(status=None): ''' List certificate requests made to CertCentral. You can filter by status: ``pending``, ``approved``, ``rejected`` CLI Example: .. code-block:: bash salt-run digicert.list_requests pending ''' if status: url = '{0}/request?status={1}'.form...
[ "def", "list_requests", "(", "status", "=", "None", ")", ":", "if", "status", ":", "url", "=", "'{0}/request?status={1}'", ".", "format", "(", "_base_url", "(", ")", ",", "status", ")", "else", ":", "url", "=", "'{0}/request'", ".", "format", "(", "_base...
List certificate requests made to CertCentral. You can filter by status: ``pending``, ``approved``, ``rejected`` CLI Example: .. code-block:: bash salt-run digicert.list_requests pending
[ "List", "certificate", "requests", "made", "to", "CertCentral", ".", "You", "can", "filter", "by", "status", ":", "pending", "approved", "rejected" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/digicertapi.py#L154-L183
train
saltstack/salt
salt/runners/digicertapi.py
get_certificate
def get_certificate(order_id=None, certificate_id=None, minion_id=None, cert_format='pem_all', filename=None): ''' Retrieve a certificate by order_id or certificate_id and write it to stdout or a filename. A list of permissible cert_formats is here: https://www.digicert.com/services/v2/documentatio...
python
def get_certificate(order_id=None, certificate_id=None, minion_id=None, cert_format='pem_all', filename=None): ''' Retrieve a certificate by order_id or certificate_id and write it to stdout or a filename. A list of permissible cert_formats is here: https://www.digicert.com/services/v2/documentatio...
[ "def", "get_certificate", "(", "order_id", "=", "None", ",", "certificate_id", "=", "None", ",", "minion_id", "=", "None", ",", "cert_format", "=", "'pem_all'", ",", "filename", "=", "None", ")", ":", "if", "order_id", ":", "order_cert", "=", "salt", ".", ...
Retrieve a certificate by order_id or certificate_id and write it to stdout or a filename. A list of permissible cert_formats is here: https://www.digicert.com/services/v2/documentation/appendix-certificate-formats CLI Example: .. code-block:: bash salt-run digicert.get_certificate order...
[ "Retrieve", "a", "certificate", "by", "order_id", "or", "certificate_id", "and", "write", "it", "to", "stdout", "or", "a", "filename", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/digicertapi.py#L214-L342
train
saltstack/salt
salt/runners/digicertapi.py
list_organizations
def list_organizations(container_id=None, include_validation=True): ''' List organizations that CertCentral knows about. You can filter by container_id (also known as "Division") by passing a container_id. This function returns validation information by default; pass ``include_validation=False`` to ...
python
def list_organizations(container_id=None, include_validation=True): ''' List organizations that CertCentral knows about. You can filter by container_id (also known as "Division") by passing a container_id. This function returns validation information by default; pass ``include_validation=False`` to ...
[ "def", "list_organizations", "(", "container_id", "=", "None", ",", "include_validation", "=", "True", ")", ":", "orgs", "=", "_paginate", "(", "'{0}/organization'", ".", "format", "(", "_base_url", "(", ")", ")", ",", "\"organizations\"", ",", "method", "=", ...
List organizations that CertCentral knows about. You can filter by container_id (also known as "Division") by passing a container_id. This function returns validation information by default; pass ``include_validation=False`` to turn it off. CLI Example: .. code-block:: bash salt-run digic...
[ "List", "organizations", "that", "CertCentral", "knows", "about", ".", "You", "can", "filter", "by", "container_id", "(", "also", "known", "as", "Division", ")", "by", "passing", "a", "container_id", ".", "This", "function", "returns", "validation", "information...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/digicertapi.py#L345-L371
train
saltstack/salt
salt/runners/digicertapi.py
order_certificate
def order_certificate(minion_id, common_name, organization_id, validity_years, cert_key_passphrase=None, signature_hash=None, key_len=2048, dns_names=None, organization_units=None, server_platform=None, custom_expiration_date=None, comments=None, disable...
python
def order_certificate(minion_id, common_name, organization_id, validity_years, cert_key_passphrase=None, signature_hash=None, key_len=2048, dns_names=None, organization_units=None, server_platform=None, custom_expiration_date=None, comments=None, disable...
[ "def", "order_certificate", "(", "minion_id", ",", "common_name", ",", "organization_id", ",", "validity_years", ",", "cert_key_passphrase", "=", "None", ",", "signature_hash", "=", "None", ",", "key_len", "=", "2048", ",", "dns_names", "=", "None", ",", "organi...
Order a certificate. Requires that an Organization has been created inside Digicert's CertCentral. See here for API documentation: https://www.digicert.com/services/v2/documentation/order/order-ssl-determinator CLI Example: .. code-block:: bash salt-run digicert.order_certificate my_minioni...
[ "Order", "a", "certificate", ".", "Requires", "that", "an", "Organization", "has", "been", "created", "inside", "Digicert", "s", "CertCentral", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/digicertapi.py#L374-L484
train
saltstack/salt
salt/runners/digicertapi.py
gen_key
def gen_key(minion_id, dns_name=None, password=None, key_len=2048): ''' Generate and return a private_key. If a ``dns_name`` is passed in, the private_key will be cached under that name. CLI Example: .. code-block:: bash salt-run digicert.gen_key <minion_id> [dns_name] [password] ''' ...
python
def gen_key(minion_id, dns_name=None, password=None, key_len=2048): ''' Generate and return a private_key. If a ``dns_name`` is passed in, the private_key will be cached under that name. CLI Example: .. code-block:: bash salt-run digicert.gen_key <minion_id> [dns_name] [password] ''' ...
[ "def", "gen_key", "(", "minion_id", ",", "dns_name", "=", "None", ",", "password", "=", "None", ",", "key_len", "=", "2048", ")", ":", "keygen_type", "=", "'RSA'", "if", "keygen_type", "==", "\"RSA\"", ":", "if", "HAS_M2", ":", "gen", "=", "RSA", ".", ...
Generate and return a private_key. If a ``dns_name`` is passed in, the private_key will be cached under that name. CLI Example: .. code-block:: bash salt-run digicert.gen_key <minion_id> [dns_name] [password]
[ "Generate", "and", "return", "a", "private_key", ".", "If", "a", "dns_name", "is", "passed", "in", "the", "private_key", "will", "be", "cached", "under", "that", "name", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/digicertapi.py#L487-L518
train
saltstack/salt
salt/runners/digicertapi.py
get_org_details
def get_org_details(organization_id): ''' Return the details for an organization CLI Example: .. code-block:: bash salt-run digicert.get_org_details 34 Returns a dictionary with the org details, or with 'error' and 'status' keys. ''' qdata = salt.utils.http.query( '{0}/o...
python
def get_org_details(organization_id): ''' Return the details for an organization CLI Example: .. code-block:: bash salt-run digicert.get_org_details 34 Returns a dictionary with the org details, or with 'error' and 'status' keys. ''' qdata = salt.utils.http.query( '{0}/o...
[ "def", "get_org_details", "(", "organization_id", ")", ":", "qdata", "=", "salt", ".", "utils", ".", "http", ".", "query", "(", "'{0}/organization/{1}'", ".", "format", "(", "_base_url", "(", ")", ",", "organization_id", ")", ",", "method", "=", "'GET'", "...
Return the details for an organization CLI Example: .. code-block:: bash salt-run digicert.get_org_details 34 Returns a dictionary with the org details, or with 'error' and 'status' keys.
[ "Return", "the", "details", "for", "an", "organization" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/digicertapi.py#L521-L544
train
saltstack/salt
salt/runners/digicertapi.py
_id_map
def _id_map(minion_id, dns_name): ''' Maintain a relationship between a minion and a dns name ''' bank = 'digicert/minions' cache = salt.cache.Cache(__opts__, syspaths.CACHE_DIR) dns_names = cache.fetch(bank, minion_id) if not isinstance(dns_names, list): dns_names = [] if dns_na...
python
def _id_map(minion_id, dns_name): ''' Maintain a relationship between a minion and a dns name ''' bank = 'digicert/minions' cache = salt.cache.Cache(__opts__, syspaths.CACHE_DIR) dns_names = cache.fetch(bank, minion_id) if not isinstance(dns_names, list): dns_names = [] if dns_na...
[ "def", "_id_map", "(", "minion_id", ",", "dns_name", ")", ":", "bank", "=", "'digicert/minions'", "cache", "=", "salt", ".", "cache", ".", "Cache", "(", "__opts__", ",", "syspaths", ".", "CACHE_DIR", ")", "dns_names", "=", "cache", ".", "fetch", "(", "ba...
Maintain a relationship between a minion and a dns name
[ "Maintain", "a", "relationship", "between", "a", "minion", "and", "a", "dns", "name" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/digicertapi.py#L624-L635
train
saltstack/salt
salt/runners/digicertapi.py
show_csrs
def show_csrs(): ''' Show certificate requests for this API key CLI Example: .. code-block:: bash salt-run digicert.show_csrs ''' data = salt.utils.http.query( '{0}/certificaterequests'.format(_base_url()), status=True, decode=True, decode_type='json', ...
python
def show_csrs(): ''' Show certificate requests for this API key CLI Example: .. code-block:: bash salt-run digicert.show_csrs ''' data = salt.utils.http.query( '{0}/certificaterequests'.format(_base_url()), status=True, decode=True, decode_type='json', ...
[ "def", "show_csrs", "(", ")", ":", "data", "=", "salt", ".", "utils", ".", "http", ".", "query", "(", "'{0}/certificaterequests'", ".", "format", "(", "_base_url", "(", ")", ")", ",", "status", "=", "True", ",", "decode", "=", "True", ",", "decode_type...
Show certificate requests for this API key CLI Example: .. code-block:: bash salt-run digicert.show_csrs
[ "Show", "certificate", "requests", "for", "this", "API", "key" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/digicertapi.py#L665-L689
train
saltstack/salt
salt/runners/digicertapi.py
show_rsa
def show_rsa(minion_id, dns_name): ''' Show a private RSA key CLI Example: .. code-block:: bash salt-run digicert.show_rsa myminion domain.example.com ''' cache = salt.cache.Cache(__opts__, syspaths.CACHE_DIR) bank = 'digicert/domains' data = cache.fetch( bank, dns_nam...
python
def show_rsa(minion_id, dns_name): ''' Show a private RSA key CLI Example: .. code-block:: bash salt-run digicert.show_rsa myminion domain.example.com ''' cache = salt.cache.Cache(__opts__, syspaths.CACHE_DIR) bank = 'digicert/domains' data = cache.fetch( bank, dns_nam...
[ "def", "show_rsa", "(", "minion_id", ",", "dns_name", ")", ":", "cache", "=", "salt", ".", "cache", ".", "Cache", "(", "__opts__", ",", "syspaths", ".", "CACHE_DIR", ")", "bank", "=", "'digicert/domains'", "data", "=", "cache", ".", "fetch", "(", "bank",...
Show a private RSA key CLI Example: .. code-block:: bash salt-run digicert.show_rsa myminion domain.example.com
[ "Show", "a", "private", "RSA", "key" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/digicertapi.py#L692-L707
train
saltstack/salt
salt/modules/minion.py
list_
def list_(): ''' Return a list of accepted, denied, unaccepted and rejected keys. This is the same output as `salt-key -L` CLI Example: .. code-block:: bash salt 'master' minion.list ''' pki_dir = __salt__['config.get']('pki_dir', '') # We have to replace the minion/master di...
python
def list_(): ''' Return a list of accepted, denied, unaccepted and rejected keys. This is the same output as `salt-key -L` CLI Example: .. code-block:: bash salt 'master' minion.list ''' pki_dir = __salt__['config.get']('pki_dir', '') # We have to replace the minion/master di...
[ "def", "list_", "(", ")", ":", "pki_dir", "=", "__salt__", "[", "'config.get'", "]", "(", "'pki_dir'", ",", "''", ")", "# We have to replace the minion/master directories", "pki_dir", "=", "pki_dir", ".", "replace", "(", "'minion'", ",", "'master'", ")", "# The ...
Return a list of accepted, denied, unaccepted and rejected keys. This is the same output as `salt-key -L` CLI Example: .. code-block:: bash salt 'master' minion.list
[ "Return", "a", "list", "of", "accepted", "denied", "unaccepted", "and", "rejected", "keys", ".", "This", "is", "the", "same", "output", "as", "salt", "-", "key", "-", "L" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/minion.py#L26-L58
train
saltstack/salt
salt/modules/minion.py
_check_minions_directories
def _check_minions_directories(pki_dir): ''' Return the minion keys directory paths. This function is a copy of salt.key.Key._check_minions_directories. ''' minions_accepted = os.path.join(pki_dir, salt.key.Key.ACC) minions_pre = os.path.join(pki_dir, salt.key.Key.PEND) minions_rejected = o...
python
def _check_minions_directories(pki_dir): ''' Return the minion keys directory paths. This function is a copy of salt.key.Key._check_minions_directories. ''' minions_accepted = os.path.join(pki_dir, salt.key.Key.ACC) minions_pre = os.path.join(pki_dir, salt.key.Key.PEND) minions_rejected = o...
[ "def", "_check_minions_directories", "(", "pki_dir", ")", ":", "minions_accepted", "=", "os", ".", "path", ".", "join", "(", "pki_dir", ",", "salt", ".", "key", ".", "Key", ".", "ACC", ")", "minions_pre", "=", "os", ".", "path", ".", "join", "(", "pki_...
Return the minion keys directory paths. This function is a copy of salt.key.Key._check_minions_directories.
[ "Return", "the", "minion", "keys", "directory", "paths", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/minion.py#L61-L72
train
saltstack/salt
salt/modules/minion.py
kill
def kill(timeout=15): ''' Kill the salt minion. timeout int seconds to wait for the minion to die. If you have a monitor that restarts ``salt-minion`` when it dies then this is a great way to restart after a minion upgrade. CLI example:: >$ salt minion[12] minion.kill ...
python
def kill(timeout=15): ''' Kill the salt minion. timeout int seconds to wait for the minion to die. If you have a monitor that restarts ``salt-minion`` when it dies then this is a great way to restart after a minion upgrade. CLI example:: >$ salt minion[12] minion.kill ...
[ "def", "kill", "(", "timeout", "=", "15", ")", ":", "ret", "=", "{", "'killed'", ":", "None", ",", "'retcode'", ":", "1", ",", "}", "comment", "=", "[", "]", "pid", "=", "__grains__", ".", "get", "(", "'pid'", ")", "if", "not", "pid", ":", "com...
Kill the salt minion. timeout int seconds to wait for the minion to die. If you have a monitor that restarts ``salt-minion`` when it dies then this is a great way to restart after a minion upgrade. CLI example:: >$ salt minion[12] minion.kill minion1: ---------- ...
[ "Kill", "the", "salt", "minion", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/minion.py#L75-L142
train
saltstack/salt
salt/modules/minion.py
restart
def restart(): ''' Kill and restart the salt minion. The configuration key ``minion_restart_command`` is an argv list for the command to restart the minion. If ``minion_restart_command`` is not specified or empty then the ``argv`` of the current process will be used. if the configuration valu...
python
def restart(): ''' Kill and restart the salt minion. The configuration key ``minion_restart_command`` is an argv list for the command to restart the minion. If ``minion_restart_command`` is not specified or empty then the ``argv`` of the current process will be used. if the configuration valu...
[ "def", "restart", "(", ")", ":", "should_kill", "=", "True", "should_restart", "=", "True", "comment", "=", "[", "]", "ret", "=", "{", "'killed'", ":", "None", ",", "'restart'", ":", "{", "}", ",", "'retcode'", ":", "0", ",", "}", "restart_cmd", "=",...
Kill and restart the salt minion. The configuration key ``minion_restart_command`` is an argv list for the command to restart the minion. If ``minion_restart_command`` is not specified or empty then the ``argv`` of the current process will be used. if the configuration value ``minion_restart_command`...
[ "Kill", "and", "restart", "the", "salt", "minion", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/minion.py#L145-L257
train
saltstack/salt
salt/modules/saltcheck.py
state_apply
def state_apply(state_name, **kwargs): ''' Runs :py:func:`state.apply <salt.modules.state.apply>` with given options to set up test data. Intended to be used for optional test setup or teardown Reference the :py:func:`state.apply <salt.modules.state.apply>` module documentation for arguments and usage ...
python
def state_apply(state_name, **kwargs): ''' Runs :py:func:`state.apply <salt.modules.state.apply>` with given options to set up test data. Intended to be used for optional test setup or teardown Reference the :py:func:`state.apply <salt.modules.state.apply>` module documentation for arguments and usage ...
[ "def", "state_apply", "(", "state_name", ",", "*", "*", "kwargs", ")", ":", "# A new salt client is instantiated with the default configuration because the main module's", "# client is hardcoded to local", "# If the minion is running with a master, a non-local client is needed to lookup stat...
Runs :py:func:`state.apply <salt.modules.state.apply>` with given options to set up test data. Intended to be used for optional test setup or teardown Reference the :py:func:`state.apply <salt.modules.state.apply>` module documentation for arguments and usage options CLI Example: .. code-block:: bash...
[ "Runs", ":", "py", ":", "func", ":", "state", ".", "apply", "<salt", ".", "modules", ".", "state", ".", "apply", ">", "with", "given", "options", "to", "set", "up", "test", "data", ".", "Intended", "to", "be", "used", "for", "optional", "test", "setu...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltcheck.py#L264-L284
train
saltstack/salt
salt/modules/saltcheck.py
_generate_out_list
def _generate_out_list(results): ''' generate test results output list ''' passed = 0 failed = 0 skipped = 0 missing_tests = 0 total_time = 0.0 for state in results: if not results[state].items(): missing_tests = missing_tests + 1 else: for dum...
python
def _generate_out_list(results): ''' generate test results output list ''' passed = 0 failed = 0 skipped = 0 missing_tests = 0 total_time = 0.0 for state in results: if not results[state].items(): missing_tests = missing_tests + 1 else: for dum...
[ "def", "_generate_out_list", "(", "results", ")", ":", "passed", "=", "0", "failed", "=", "0", "skipped", "=", "0", "missing_tests", "=", "0", "total_time", "=", "0.0", "for", "state", "in", "results", ":", "if", "not", "results", "[", "state", "]", "....
generate test results output list
[ "generate", "test", "results", "output", "list" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltcheck.py#L356-L385
train
saltstack/salt
salt/modules/saltcheck.py
_is_valid_function
def _is_valid_function(module_name, function): ''' Determine if a function is valid for a module ''' try: functions = __salt__['sys.list_functions'](module_name) except salt.exceptions.SaltException: functions = ["unable to look up functions"] return "{0}.{1}".format(module_name,...
python
def _is_valid_function(module_name, function): ''' Determine if a function is valid for a module ''' try: functions = __salt__['sys.list_functions'](module_name) except salt.exceptions.SaltException: functions = ["unable to look up functions"] return "{0}.{1}".format(module_name,...
[ "def", "_is_valid_function", "(", "module_name", ",", "function", ")", ":", "try", ":", "functions", "=", "__salt__", "[", "'sys.list_functions'", "]", "(", "module_name", ")", "except", "salt", ".", "exceptions", ".", "SaltException", ":", "functions", "=", "...
Determine if a function is valid for a module
[ "Determine", "if", "a", "function", "is", "valid", "for", "a", "module" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltcheck.py#L416-L424
train
saltstack/salt
salt/modules/saltcheck.py
_get_top_states
def _get_top_states(saltenv='base'): ''' Equivalent to a salt cli: salt web state.show_top ''' alt_states = [] try: returned = __salt__['state.show_top']() for i in returned[saltenv]: alt_states.append(i) except Exception: raise # log.info("top states: %s"...
python
def _get_top_states(saltenv='base'): ''' Equivalent to a salt cli: salt web state.show_top ''' alt_states = [] try: returned = __salt__['state.show_top']() for i in returned[saltenv]: alt_states.append(i) except Exception: raise # log.info("top states: %s"...
[ "def", "_get_top_states", "(", "saltenv", "=", "'base'", ")", ":", "alt_states", "=", "[", "]", "try", ":", "returned", "=", "__salt__", "[", "'state.show_top'", "]", "(", ")", "for", "i", "in", "returned", "[", "saltenv", "]", ":", "alt_states", ".", ...
Equivalent to a salt cli: salt web state.show_top
[ "Equivalent", "to", "a", "salt", "cli", ":", "salt", "web", "state", ".", "show_top" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltcheck.py#L427-L439
train
saltstack/salt
salt/modules/saltcheck.py
SaltCheck._call_salt_command
def _call_salt_command(self, fun, args, kwargs, assertion_section=None): ''' Generic call of salt Caller command ''' value = False try: if args and kwargs: ...
python
def _call_salt_command(self, fun, args, kwargs, assertion_section=None): ''' Generic call of salt Caller command ''' value = False try: if args and kwargs: ...
[ "def", "_call_salt_command", "(", "self", ",", "fun", ",", "args", ",", "kwargs", ",", "assertion_section", "=", "None", ")", ":", "value", "=", "False", "try", ":", "if", "args", "and", "kwargs", ":", "value", "=", "self", ".", "salt_lc", ".", "cmd", ...
Generic call of salt Caller command
[ "Generic", "call", "of", "salt", "Caller", "command" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltcheck.py#L520-L545
train
saltstack/salt
salt/modules/saltcheck.py
SaltCheck._cast_expected_to_returned_type
def _cast_expected_to_returned_type(expected, returned): ''' Determine the type of variable returned Cast the expected to the type of variable returned ''' ret_type = type(returned) new_expected = expected if expected == "False" and ret_type == bool: e...
python
def _cast_expected_to_returned_type(expected, returned): ''' Determine the type of variable returned Cast the expected to the type of variable returned ''' ret_type = type(returned) new_expected = expected if expected == "False" and ret_type == bool: e...
[ "def", "_cast_expected_to_returned_type", "(", "expected", ",", "returned", ")", ":", "ret_type", "=", "type", "(", "returned", ")", "new_expected", "=", "expected", "if", "expected", "==", "\"False\"", "and", "ret_type", "==", "bool", ":", "expected", "=", "F...
Determine the type of variable returned Cast the expected to the type of variable returned
[ "Determine", "the", "type", "of", "variable", "returned", "Cast", "the", "expected", "to", "the", "type", "of", "variable", "returned" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltcheck.py#L615-L632
train
saltstack/salt
salt/modules/saltcheck.py
SaltCheck.__assert_equal
def __assert_equal(expected, returned, assert_print_result=True): ''' Test if two objects are equal ''' result = "Pass" try: if assert_print_result: assert (expected == returned), "{0} is not equal to {1}".format(expected, returned) else: ...
python
def __assert_equal(expected, returned, assert_print_result=True): ''' Test if two objects are equal ''' result = "Pass" try: if assert_print_result: assert (expected == returned), "{0} is not equal to {1}".format(expected, returned) else: ...
[ "def", "__assert_equal", "(", "expected", ",", "returned", ",", "assert_print_result", "=", "True", ")", ":", "result", "=", "\"Pass\"", "try", ":", "if", "assert_print_result", ":", "assert", "(", "expected", "==", "returned", ")", ",", "\"{0} is not equal to {...
Test if two objects are equal
[ "Test", "if", "two", "objects", "are", "equal" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltcheck.py#L635-L648
train
saltstack/salt
salt/modules/saltcheck.py
SaltCheck.__assert_true
def __assert_true(returned): ''' Test if an boolean is True ''' result = "Pass" try: assert (returned is True), "{0} not True".format(returned) except AssertionError as err: result = "Fail: " + six.text_type(err) return result
python
def __assert_true(returned): ''' Test if an boolean is True ''' result = "Pass" try: assert (returned is True), "{0} not True".format(returned) except AssertionError as err: result = "Fail: " + six.text_type(err) return result
[ "def", "__assert_true", "(", "returned", ")", ":", "result", "=", "\"Pass\"", "try", ":", "assert", "(", "returned", "is", "True", ")", ",", "\"{0} not True\"", ".", "format", "(", "returned", ")", "except", "AssertionError", "as", "err", ":", "result", "=...
Test if an boolean is True
[ "Test", "if", "an", "boolean", "is", "True" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltcheck.py#L666-L675
train
saltstack/salt
salt/modules/saltcheck.py
SaltCheck.__assert_false
def __assert_false(returned): ''' Test if an boolean is False ''' result = "Pass" if isinstance(returned, str): try: returned = bool(returned) except ValueError: raise try: assert (returned is False), "{0...
python
def __assert_false(returned): ''' Test if an boolean is False ''' result = "Pass" if isinstance(returned, str): try: returned = bool(returned) except ValueError: raise try: assert (returned is False), "{0...
[ "def", "__assert_false", "(", "returned", ")", ":", "result", "=", "\"Pass\"", "if", "isinstance", "(", "returned", ",", "str", ")", ":", "try", ":", "returned", "=", "bool", "(", "returned", ")", "except", "ValueError", ":", "raise", "try", ":", "assert...
Test if an boolean is False
[ "Test", "if", "an", "boolean", "is", "False" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltcheck.py#L678-L692
train
saltstack/salt
salt/modules/saltcheck.py
SaltCheck.__assert_less
def __assert_less(expected, returned): ''' Test if a value is less than the returned value ''' result = "Pass" try: assert (expected < returned), "{0} not False".format(returned) except AssertionError as err: result = "Fail: " + six.text_type(err) ...
python
def __assert_less(expected, returned): ''' Test if a value is less than the returned value ''' result = "Pass" try: assert (expected < returned), "{0} not False".format(returned) except AssertionError as err: result = "Fail: " + six.text_type(err) ...
[ "def", "__assert_less", "(", "expected", ",", "returned", ")", ":", "result", "=", "\"Pass\"", "try", ":", "assert", "(", "expected", "<", "returned", ")", ",", "\"{0} not False\"", ".", "format", "(", "returned", ")", "except", "AssertionError", "as", "err"...
Test if a value is less than the returned value
[ "Test", "if", "a", "value", "is", "less", "than", "the", "returned", "value" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltcheck.py#L749-L758
train
saltstack/salt
salt/modules/saltcheck.py
SaltCheck.__assert_empty
def __assert_empty(returned): ''' Test if a returned value is empty ''' result = "Pass" try: assert (not returned), "{0} is not empty".format(returned) except AssertionError as err: result = "Fail: " + six.text_type(err) return result
python
def __assert_empty(returned): ''' Test if a returned value is empty ''' result = "Pass" try: assert (not returned), "{0} is not empty".format(returned) except AssertionError as err: result = "Fail: " + six.text_type(err) return result
[ "def", "__assert_empty", "(", "returned", ")", ":", "result", "=", "\"Pass\"", "try", ":", "assert", "(", "not", "returned", ")", ",", "\"{0} is not empty\"", ".", "format", "(", "returned", ")", "except", "AssertionError", "as", "err", ":", "result", "=", ...
Test if a returned value is empty
[ "Test", "if", "a", "returned", "value", "is", "empty" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltcheck.py#L773-L782
train
saltstack/salt
salt/modules/saltcheck.py
SaltCheck.__assert_not_empty
def __assert_not_empty(returned): ''' Test if a returned value is not empty ''' result = "Pass" try: assert (returned), "value is empty" except AssertionError as err: result = "Fail: " + six.text_type(err) return result
python
def __assert_not_empty(returned): ''' Test if a returned value is not empty ''' result = "Pass" try: assert (returned), "value is empty" except AssertionError as err: result = "Fail: " + six.text_type(err) return result
[ "def", "__assert_not_empty", "(", "returned", ")", ":", "result", "=", "\"Pass\"", "try", ":", "assert", "(", "returned", ")", ",", "\"value is empty\"", "except", "AssertionError", "as", "err", ":", "result", "=", "\"Fail: \"", "+", "six", ".", "text_type", ...
Test if a returned value is not empty
[ "Test", "if", "a", "returned", "value", "is", "not", "empty" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltcheck.py#L785-L794
train
saltstack/salt
salt/modules/saltcheck.py
SaltCheck.get_state_search_path_list
def get_state_search_path_list(saltenv='base'): ''' For the state file system, return a list of paths to search for states ''' # state cache should be updated before running this method search_list = [] cachedir = __opts__.get('cachedir', None) log.info("Searching...
python
def get_state_search_path_list(saltenv='base'): ''' For the state file system, return a list of paths to search for states ''' # state cache should be updated before running this method search_list = [] cachedir = __opts__.get('cachedir', None) log.info("Searching...
[ "def", "get_state_search_path_list", "(", "saltenv", "=", "'base'", ")", ":", "# state cache should be updated before running this method", "search_list", "=", "[", "]", "cachedir", "=", "__opts__", ".", "get", "(", "'cachedir'", ",", "None", ")", "log", ".", "info"...
For the state file system, return a list of paths to search for states
[ "For", "the", "state", "file", "system", "return", "a", "list", "of", "paths", "to", "search", "for", "states" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltcheck.py#L797-L807
train
saltstack/salt
salt/modules/vbox_guest.py
additions_mount
def additions_mount(): ''' Mount VirtualBox Guest Additions CD to the temp directory. To connect VirtualBox Guest Additions via VirtualBox graphical interface press 'Host+D' ('Host' is usually 'Right Ctrl'). CLI Example: .. code-block:: bash salt '*' vbox_guest.additions_mount :...
python
def additions_mount(): ''' Mount VirtualBox Guest Additions CD to the temp directory. To connect VirtualBox Guest Additions via VirtualBox graphical interface press 'Host+D' ('Host' is usually 'Right Ctrl'). CLI Example: .. code-block:: bash salt '*' vbox_guest.additions_mount :...
[ "def", "additions_mount", "(", ")", ":", "mount_point", "=", "tempfile", ".", "mkdtemp", "(", ")", "ret", "=", "__salt__", "[", "'mount.mount'", "]", "(", "mount_point", ",", "'/dev/cdrom'", ")", "if", "ret", "is", "True", ":", "return", "mount_point", "el...
Mount VirtualBox Guest Additions CD to the temp directory. To connect VirtualBox Guest Additions via VirtualBox graphical interface press 'Host+D' ('Host' is usually 'Right Ctrl'). CLI Example: .. code-block:: bash salt '*' vbox_guest.additions_mount :return: True or OSError exception
[ "Mount", "VirtualBox", "Guest", "Additions", "CD", "to", "the", "temp", "directory", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/vbox_guest.py#L35-L55
train
saltstack/salt
salt/modules/vbox_guest.py
additions_umount
def additions_umount(mount_point): ''' Unmount VirtualBox Guest Additions CD from the temp directory. CLI Example: .. code-block:: bash salt '*' vbox_guest.additions_umount :param mount_point: directory VirtualBox Guest Additions is mounted to :return: True or an string with error ...
python
def additions_umount(mount_point): ''' Unmount VirtualBox Guest Additions CD from the temp directory. CLI Example: .. code-block:: bash salt '*' vbox_guest.additions_umount :param mount_point: directory VirtualBox Guest Additions is mounted to :return: True or an string with error ...
[ "def", "additions_umount", "(", "mount_point", ")", ":", "ret", "=", "__salt__", "[", "'mount.umount'", "]", "(", "mount_point", ")", "if", "ret", ":", "os", ".", "rmdir", "(", "mount_point", ")", "return", "ret" ]
Unmount VirtualBox Guest Additions CD from the temp directory. CLI Example: .. code-block:: bash salt '*' vbox_guest.additions_umount :param mount_point: directory VirtualBox Guest Additions is mounted to :return: True or an string with error
[ "Unmount", "VirtualBox", "Guest", "Additions", "CD", "from", "the", "temp", "directory", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/vbox_guest.py#L58-L74
train
saltstack/salt
salt/modules/vbox_guest.py
additions_install
def additions_install(**kwargs): ''' Install VirtualBox Guest Additions. Uses the CD, connected by VirtualBox. To connect VirtualBox Guest Additions via VirtualBox graphical interface press 'Host+D' ('Host' is usually 'Right Ctrl'). See https://www.virtualbox.org/manual/ch04.html#idp52733088 for m...
python
def additions_install(**kwargs): ''' Install VirtualBox Guest Additions. Uses the CD, connected by VirtualBox. To connect VirtualBox Guest Additions via VirtualBox graphical interface press 'Host+D' ('Host' is usually 'Right Ctrl'). See https://www.virtualbox.org/manual/ch04.html#idp52733088 for m...
[ "def", "additions_install", "(", "*", "*", "kwargs", ")", ":", "with", "_additions_mounted", "(", ")", "as", "mount_point", ":", "kernel", "=", "__grains__", ".", "get", "(", "'kernel'", ",", "''", ")", "if", "kernel", "==", "'Linux'", ":", "return", "_a...
Install VirtualBox Guest Additions. Uses the CD, connected by VirtualBox. To connect VirtualBox Guest Additions via VirtualBox graphical interface press 'Host+D' ('Host' is usually 'Right Ctrl'). See https://www.virtualbox.org/manual/ch04.html#idp52733088 for more details. CLI Example: .. code-b...
[ "Install", "VirtualBox", "Guest", "Additions", ".", "Uses", "the", "CD", "connected", "by", "VirtualBox", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/vbox_guest.py#L156-L182
train
saltstack/salt
salt/modules/vbox_guest.py
_additions_remove_use_cd
def _additions_remove_use_cd(**kwargs): ''' Remove VirtualBox Guest Additions. It uses the CD, connected by VirtualBox. ''' with _additions_mounted() as mount_point: kernel = __grains__.get('kernel', '') if kernel == 'Linux': return _additions_remove_linux_use_cd(mount_...
python
def _additions_remove_use_cd(**kwargs): ''' Remove VirtualBox Guest Additions. It uses the CD, connected by VirtualBox. ''' with _additions_mounted() as mount_point: kernel = __grains__.get('kernel', '') if kernel == 'Linux': return _additions_remove_linux_use_cd(mount_...
[ "def", "_additions_remove_use_cd", "(", "*", "*", "kwargs", ")", ":", "with", "_additions_mounted", "(", ")", "as", "mount_point", ":", "kernel", "=", "__grains__", ".", "get", "(", "'kernel'", ",", "''", ")", "if", "kernel", "==", "'Linux'", ":", "return"...
Remove VirtualBox Guest Additions. It uses the CD, connected by VirtualBox.
[ "Remove", "VirtualBox", "Guest", "Additions", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/vbox_guest.py#L217-L227
train
saltstack/salt
salt/modules/vbox_guest.py
additions_remove
def additions_remove(**kwargs): ''' Remove VirtualBox Guest Additions. Firstly it tries to uninstall itself by executing '/opt/VBoxGuestAdditions-VERSION/uninstall.run uninstall'. It uses the CD, connected by VirtualBox if it failes. CLI Example: .. code-block:: bash salt '*' vbo...
python
def additions_remove(**kwargs): ''' Remove VirtualBox Guest Additions. Firstly it tries to uninstall itself by executing '/opt/VBoxGuestAdditions-VERSION/uninstall.run uninstall'. It uses the CD, connected by VirtualBox if it failes. CLI Example: .. code-block:: bash salt '*' vbo...
[ "def", "additions_remove", "(", "*", "*", "kwargs", ")", ":", "kernel", "=", "__grains__", ".", "get", "(", "'kernel'", ",", "''", ")", "if", "kernel", "==", "'Linux'", ":", "ret", "=", "_additions_remove_linux", "(", ")", "if", "not", "ret", ":", "ret...
Remove VirtualBox Guest Additions. Firstly it tries to uninstall itself by executing '/opt/VBoxGuestAdditions-VERSION/uninstall.run uninstall'. It uses the CD, connected by VirtualBox if it failes. CLI Example: .. code-block:: bash salt '*' vbox_guest.additions_remove salt '*' vb...
[ "Remove", "VirtualBox", "Guest", "Additions", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/vbox_guest.py#L230-L255
train
saltstack/salt
salt/modules/vbox_guest.py
additions_version
def additions_version(): ''' Check VirtualBox Guest Additions version. CLI Example: .. code-block:: bash salt '*' vbox_guest.additions_version :return: version of VirtualBox Guest Additions or False if they are not installed ''' try: d = _additions_dir() except Enviro...
python
def additions_version(): ''' Check VirtualBox Guest Additions version. CLI Example: .. code-block:: bash salt '*' vbox_guest.additions_version :return: version of VirtualBox Guest Additions or False if they are not installed ''' try: d = _additions_dir() except Enviro...
[ "def", "additions_version", "(", ")", ":", "try", ":", "d", "=", "_additions_dir", "(", ")", "except", "EnvironmentError", ":", "return", "False", "if", "d", "and", "os", ".", "listdir", "(", "d", ")", ":", "return", "re", ".", "sub", "(", "r'^{0}-'", ...
Check VirtualBox Guest Additions version. CLI Example: .. code-block:: bash salt '*' vbox_guest.additions_version :return: version of VirtualBox Guest Additions or False if they are not installed
[ "Check", "VirtualBox", "Guest", "Additions", "version", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/vbox_guest.py#L258-L277
train
saltstack/salt
salt/modules/vbox_guest.py
grant_access_to_shared_folders_to
def grant_access_to_shared_folders_to(name, users=None): ''' Grant access to auto-mounted shared folders to the users. User is specified by it's name. To grant access for several users use argument `users`. Access will be denied to the users not listed in `users` argument. See https://www.virtualb...
python
def grant_access_to_shared_folders_to(name, users=None): ''' Grant access to auto-mounted shared folders to the users. User is specified by it's name. To grant access for several users use argument `users`. Access will be denied to the users not listed in `users` argument. See https://www.virtualb...
[ "def", "grant_access_to_shared_folders_to", "(", "name", ",", "users", "=", "None", ")", ":", "if", "users", "is", "None", ":", "users", "=", "[", "name", "]", "if", "__salt__", "[", "'group.members'", "]", "(", "_shared_folders_group", ",", "','", ".", "j...
Grant access to auto-mounted shared folders to the users. User is specified by it's name. To grant access for several users use argument `users`. Access will be denied to the users not listed in `users` argument. See https://www.virtualbox.org/manual/ch04.html#sf_mount_auto for more details. CLI Exam...
[ "Grant", "access", "to", "auto", "-", "mounted", "shared", "folders", "to", "the", "users", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/vbox_guest.py#L280-L326
train
saltstack/salt
salt/modules/inspectlib/query.py
SysInfo._get_disk_size
def _get_disk_size(self, device): ''' Get a size of a disk. ''' out = __salt__['cmd.run_all']("df {0}".format(device)) if out['retcode']: msg = "Disk size info error: {0}".format(out['stderr']) log.error(msg) raise SIException(msg) dev...
python
def _get_disk_size(self, device): ''' Get a size of a disk. ''' out = __salt__['cmd.run_all']("df {0}".format(device)) if out['retcode']: msg = "Disk size info error: {0}".format(out['stderr']) log.error(msg) raise SIException(msg) dev...
[ "def", "_get_disk_size", "(", "self", ",", "device", ")", ":", "out", "=", "__salt__", "[", "'cmd.run_all'", "]", "(", "\"df {0}\"", ".", "format", "(", "device", ")", ")", "if", "out", "[", "'retcode'", "]", ":", "msg", "=", "\"Disk size info error: {0}\"...
Get a size of a disk.
[ "Get", "a", "size", "of", "a", "disk", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/query.py#L49-L64
train
saltstack/salt
salt/modules/inspectlib/query.py
SysInfo._get_fs
def _get_fs(self): ''' Get available file systems and their types. ''' data = dict() for dev, dev_data in salt.utils.fsutils._blkid().items(): dev = self._get_disk_size(dev) device = dev.pop('device') dev['type'] = dev_data['type'] ...
python
def _get_fs(self): ''' Get available file systems and their types. ''' data = dict() for dev, dev_data in salt.utils.fsutils._blkid().items(): dev = self._get_disk_size(dev) device = dev.pop('device') dev['type'] = dev_data['type'] ...
[ "def", "_get_fs", "(", "self", ")", ":", "data", "=", "dict", "(", ")", "for", "dev", ",", "dev_data", "in", "salt", ".", "utils", ".", "fsutils", ".", "_blkid", "(", ")", ".", "items", "(", ")", ":", "dev", "=", "self", ".", "_get_disk_size", "(...
Get available file systems and their types.
[ "Get", "available", "file", "systems", "and", "their", "types", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/query.py#L66-L78
train
saltstack/salt
salt/modules/inspectlib/query.py
SysInfo._get_cpu
def _get_cpu(self): ''' Get available CPU information. ''' # CPU data in grains is OK-ish, but lscpu is still better in this case out = __salt__['cmd.run_all']("lscpu") salt.utils.fsutils._verify_run(out) data = dict() for descr, value in [elm.split(":", 1...
python
def _get_cpu(self): ''' Get available CPU information. ''' # CPU data in grains is OK-ish, but lscpu is still better in this case out = __salt__['cmd.run_all']("lscpu") salt.utils.fsutils._verify_run(out) data = dict() for descr, value in [elm.split(":", 1...
[ "def", "_get_cpu", "(", "self", ")", ":", "# CPU data in grains is OK-ish, but lscpu is still better in this case", "out", "=", "__salt__", "[", "'cmd.run_all'", "]", "(", "\"lscpu\"", ")", "salt", ".", "utils", ".", "fsutils", ".", "_verify_run", "(", "out", ")", ...
Get available CPU information.
[ "Get", "available", "CPU", "information", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/query.py#L86-L97
train
saltstack/salt
salt/modules/inspectlib/query.py
SysInfo._get_mem
def _get_mem(self): ''' Get memory. ''' out = __salt__['cmd.run_all']("vmstat -s") if out['retcode']: raise SIException("Memory info error: {0}".format(out['stderr'])) ret = dict() for line in out['stdout'].split(os.linesep): line = line.s...
python
def _get_mem(self): ''' Get memory. ''' out = __salt__['cmd.run_all']("vmstat -s") if out['retcode']: raise SIException("Memory info error: {0}".format(out['stderr'])) ret = dict() for line in out['stdout'].split(os.linesep): line = line.s...
[ "def", "_get_mem", "(", "self", ")", ":", "out", "=", "__salt__", "[", "'cmd.run_all'", "]", "(", "\"vmstat -s\"", ")", "if", "out", "[", "'retcode'", "]", ":", "raise", "SIException", "(", "\"Memory info error: {0}\"", ".", "format", "(", "out", "[", "'st...
Get memory.
[ "Get", "memory", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/query.py#L99-L117
train
saltstack/salt
salt/modules/inspectlib/query.py
SysInfo._get_network
def _get_network(self): ''' Get network configuration. ''' data = dict() data['interfaces'] = salt.utils.network.interfaces() data['subnets'] = salt.utils.network.subnets() return data
python
def _get_network(self): ''' Get network configuration. ''' data = dict() data['interfaces'] = salt.utils.network.interfaces() data['subnets'] = salt.utils.network.subnets() return data
[ "def", "_get_network", "(", "self", ")", ":", "data", "=", "dict", "(", ")", "data", "[", "'interfaces'", "]", "=", "salt", ".", "utils", ".", "network", ".", "interfaces", "(", ")", "data", "[", "'subnets'", "]", "=", "salt", ".", "utils", ".", "n...
Get network configuration.
[ "Get", "network", "configuration", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/query.py#L119-L127
train
saltstack/salt
salt/modules/inspectlib/query.py
SysInfo._get_os
def _get_os(self): ''' Get operating system summary ''' return { 'name': self._grain('os'), 'family': self._grain('os_family'), 'arch': self._grain('osarch'), 'release': self._grain('osrelease'), }
python
def _get_os(self): ''' Get operating system summary ''' return { 'name': self._grain('os'), 'family': self._grain('os_family'), 'arch': self._grain('osarch'), 'release': self._grain('osrelease'), }
[ "def", "_get_os", "(", "self", ")", ":", "return", "{", "'name'", ":", "self", ".", "_grain", "(", "'os'", ")", ",", "'family'", ":", "self", ".", "_grain", "(", "'os_family'", ")", ",", "'arch'", ":", "self", ".", "_grain", "(", "'osarch'", ")", "...
Get operating system summary
[ "Get", "operating", "system", "summary" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/query.py#L129-L138
train
saltstack/salt
salt/modules/inspectlib/query.py
Query._configuration
def _configuration(self, *args, **kwargs): ''' Return configuration files. ''' data = dict() self.db.open() for pkg in self.db.get(Package): configs = list() for pkg_cfg in self.db.get(PackageCfgFile, eq={'pkgid': pkg.id}): configs...
python
def _configuration(self, *args, **kwargs): ''' Return configuration files. ''' data = dict() self.db.open() for pkg in self.db.get(Package): configs = list() for pkg_cfg in self.db.get(PackageCfgFile, eq={'pkgid': pkg.id}): configs...
[ "def", "_configuration", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "data", "=", "dict", "(", ")", "self", ".", "db", ".", "open", "(", ")", "for", "pkg", "in", "self", ".", "db", ".", "get", "(", "Package", ")", ":", "...
Return configuration files.
[ "Return", "configuration", "files", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/query.py#L195-L211
train
saltstack/salt
salt/modules/inspectlib/query.py
Query._get_local_users
def _get_local_users(self, disabled=None): ''' Return all known local accounts to the system. ''' users = dict() path = '/etc/passwd' with salt.utils.files.fopen(path, 'r') as fp_: for line in fp_: line = line.strip() if ':' not...
python
def _get_local_users(self, disabled=None): ''' Return all known local accounts to the system. ''' users = dict() path = '/etc/passwd' with salt.utils.files.fopen(path, 'r') as fp_: for line in fp_: line = line.strip() if ':' not...
[ "def", "_get_local_users", "(", "self", ",", "disabled", "=", "None", ")", ":", "users", "=", "dict", "(", ")", "path", "=", "'/etc/passwd'", "with", "salt", ".", "utils", ".", "files", ".", "fopen", "(", "path", ",", "'r'", ")", "as", "fp_", ":", ...
Return all known local accounts to the system.
[ "Return", "all", "known", "local", "accounts", "to", "the", "system", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/query.py#L213-L236
train
saltstack/salt
salt/modules/inspectlib/query.py
Query._get_local_groups
def _get_local_groups(self): ''' Return all known local groups to the system. ''' groups = dict() path = '/etc/group' with salt.utils.files.fopen(path, 'r') as fp_: for line in fp_: line = line.strip() if ':' not in line: ...
python
def _get_local_groups(self): ''' Return all known local groups to the system. ''' groups = dict() path = '/etc/group' with salt.utils.files.fopen(path, 'r') as fp_: for line in fp_: line = line.strip() if ':' not in line: ...
[ "def", "_get_local_groups", "(", "self", ")", ":", "groups", "=", "dict", "(", ")", "path", "=", "'/etc/group'", "with", "salt", ".", "utils", ".", "files", ".", "fopen", "(", "path", ",", "'r'", ")", "as", "fp_", ":", "for", "line", "in", "fp_", "...
Return all known local groups to the system.
[ "Return", "all", "known", "local", "groups", "to", "the", "system", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/query.py#L238-L257
train
saltstack/salt
salt/modules/inspectlib/query.py
Query._get_external_accounts
def _get_external_accounts(self, locals): ''' Return all known accounts, excluding local accounts. ''' users = dict() out = __salt__['cmd.run_all']("passwd -S -a") if out['retcode']: # System does not supports all accounts descriptions, just skipping. ...
python
def _get_external_accounts(self, locals): ''' Return all known accounts, excluding local accounts. ''' users = dict() out = __salt__['cmd.run_all']("passwd -S -a") if out['retcode']: # System does not supports all accounts descriptions, just skipping. ...
[ "def", "_get_external_accounts", "(", "self", ",", "locals", ")", ":", "users", "=", "dict", "(", ")", "out", "=", "__salt__", "[", "'cmd.run_all'", "]", "(", "\"passwd -S -a\"", ")", "if", "out", "[", "'retcode'", "]", ":", "# System does not supports all acc...
Return all known accounts, excluding local accounts.
[ "Return", "all", "known", "accounts", "excluding", "local", "accounts", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/query.py#L259-L279
train
saltstack/salt
salt/modules/inspectlib/query.py
Query._identity
def _identity(self, *args, **kwargs): ''' Local users and groups. accounts Can be either 'local', 'remote' or 'all' (equal to "local,remote"). Remote accounts cannot be resolved on all systems, but only those, which supports 'passwd -S -a'. disabled ...
python
def _identity(self, *args, **kwargs): ''' Local users and groups. accounts Can be either 'local', 'remote' or 'all' (equal to "local,remote"). Remote accounts cannot be resolved on all systems, but only those, which supports 'passwd -S -a'. disabled ...
[ "def", "_identity", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "LOCAL", "=", "'local accounts'", "EXT", "=", "'external accounts'", "data", "=", "dict", "(", ")", "data", "[", "LOCAL", "]", "=", "self", ".", "_get_local_users", "...
Local users and groups. accounts Can be either 'local', 'remote' or 'all' (equal to "local,remote"). Remote accounts cannot be resolved on all systems, but only those, which supports 'passwd -S -a'. disabled True (or False, default) to return only disabl...
[ "Local", "users", "and", "groups", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/query.py#L281-L301
train
saltstack/salt
salt/modules/inspectlib/query.py
Query._system
def _system(self, *args, **kwargs): ''' This basically calls grains items and picks out only necessary information in a certain structure. :param args: :param kwargs: :return: ''' sysinfo = SysInfo(__grains__.get("kernel")) data = dict() ...
python
def _system(self, *args, **kwargs): ''' This basically calls grains items and picks out only necessary information in a certain structure. :param args: :param kwargs: :return: ''' sysinfo = SysInfo(__grains__.get("kernel")) data = dict() ...
[ "def", "_system", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "sysinfo", "=", "SysInfo", "(", "__grains__", ".", "get", "(", "\"kernel\"", ")", ")", "data", "=", "dict", "(", ")", "data", "[", "'cpu'", "]", "=", "sysinfo", "...
This basically calls grains items and picks out only necessary information in a certain structure. :param args: :param kwargs: :return:
[ "This", "basically", "calls", "grains", "items", "and", "picks", "out", "only", "necessary", "information", "in", "a", "certain", "structure", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/query.py#L303-L322
train
saltstack/salt
salt/modules/inspectlib/query.py
Query._software
def _software(self, *args, **kwargs): ''' Return installed software. ''' data = dict() if 'exclude' in kwargs: excludes = kwargs['exclude'].split(",") else: excludes = list() os_family = __grains__.get("os_family").lower() # Get l...
python
def _software(self, *args, **kwargs): ''' Return installed software. ''' data = dict() if 'exclude' in kwargs: excludes = kwargs['exclude'].split(",") else: excludes = list() os_family = __grains__.get("os_family").lower() # Get l...
[ "def", "_software", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "data", "=", "dict", "(", ")", "if", "'exclude'", "in", "kwargs", ":", "excludes", "=", "kwargs", "[", "'exclude'", "]", ".", "split", "(", "\",\"", ")", "else", ...
Return installed software.
[ "Return", "installed", "software", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/query.py#L324-L376
train
saltstack/salt
salt/modules/inspectlib/query.py
Query._id_resolv
def _id_resolv(self, iid, named=True, uid=True): ''' Resolve local users and groups. :param iid: :param named: :param uid: :return: ''' if not self.local_identity: self.local_identity['users'] = self._get_local_users() self.local_...
python
def _id_resolv(self, iid, named=True, uid=True): ''' Resolve local users and groups. :param iid: :param named: :param uid: :return: ''' if not self.local_identity: self.local_identity['users'] = self._get_local_users() self.local_...
[ "def", "_id_resolv", "(", "self", ",", "iid", ",", "named", "=", "True", ",", "uid", "=", "True", ")", ":", "if", "not", "self", ".", "local_identity", ":", "self", ".", "local_identity", "[", "'users'", "]", "=", "self", ".", "_get_local_users", "(", ...
Resolve local users and groups. :param iid: :param named: :param uid: :return:
[ "Resolve", "local", "users", "and", "groups", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/query.py#L387-L408
train
saltstack/salt
salt/modules/inspectlib/query.py
Query._payload
def _payload(self, *args, **kwargs): ''' Find all unmanaged files. Returns maximum 1000 values. Parameters: * **filter**: Include only results which path starts from the filter string. * **time**: Display time in Unix ticks or format according to the configured TZ (default) ...
python
def _payload(self, *args, **kwargs): ''' Find all unmanaged files. Returns maximum 1000 values. Parameters: * **filter**: Include only results which path starts from the filter string. * **time**: Display time in Unix ticks or format according to the configured TZ (default) ...
[ "def", "_payload", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "def", "_size_format", "(", "size", ",", "fmt", ")", ":", "if", "fmt", "is", "None", ":", "return", "size", "fmt", "=", "fmt", ".", "lower", "(", ")", "if", "f...
Find all unmanaged files. Returns maximum 1000 values. Parameters: * **filter**: Include only results which path starts from the filter string. * **time**: Display time in Unix ticks or format according to the configured TZ (default) Values: ticks, tz (default) * **...
[ "Find", "all", "unmanaged", "files", ".", "Returns", "maximum", "1000", "values", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/query.py#L410-L493
train
saltstack/salt
salt/modules/inspectlib/query.py
Query._all
def _all(self, *args, **kwargs): ''' Return all the summary of the particular system. ''' data = dict() data['software'] = self._software(**kwargs) data['system'] = self._system(**kwargs) data['services'] = self._services(**kwargs) try: data['c...
python
def _all(self, *args, **kwargs): ''' Return all the summary of the particular system. ''' data = dict() data['software'] = self._software(**kwargs) data['system'] = self._system(**kwargs) data['services'] = self._services(**kwargs) try: data['c...
[ "def", "_all", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "data", "=", "dict", "(", ")", "data", "[", "'software'", "]", "=", "self", ".", "_software", "(", "*", "*", "kwargs", ")", "data", "[", "'system'", "]", "=", "sel...
Return all the summary of the particular system.
[ "Return", "all", "the", "summary", "of", "the", "particular", "system", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/query.py#L495-L510
train
saltstack/salt
salt/modules/smartos_vmadm.py
_create_update_from_file
def _create_update_from_file(mode='create', uuid=None, path=None): ''' Create vm from file ''' ret = {} if not os.path.isfile(path) or path is None: ret['Error'] = 'File ({0}) does not exists!'.format(path) return ret # vmadm validate create|update [-f <filename>] cmd = 'vmad...
python
def _create_update_from_file(mode='create', uuid=None, path=None): ''' Create vm from file ''' ret = {} if not os.path.isfile(path) or path is None: ret['Error'] = 'File ({0}) does not exists!'.format(path) return ret # vmadm validate create|update [-f <filename>] cmd = 'vmad...
[ "def", "_create_update_from_file", "(", "mode", "=", "'create'", ",", "uuid", "=", "None", ",", "path", "=", "None", ")", ":", "ret", "=", "{", "}", "if", "not", "os", ".", "path", ".", "isfile", "(", "path", ")", "or", "path", "is", "None", ":", ...
Create vm from file
[ "Create", "vm", "from", "file" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smartos_vmadm.py#L64-L107
train
saltstack/salt
salt/modules/smartos_vmadm.py
_create_update_from_cfg
def _create_update_from_cfg(mode='create', uuid=None, vmcfg=None): ''' Create vm from configuration ''' ret = {} # write json file vmadm_json_file = __salt__['temp.file'](prefix='vmadm-') with salt.utils.files.fopen(vmadm_json_file, 'w') as vmadm_json: salt.utils.json.dump(vmcfg, vm...
python
def _create_update_from_cfg(mode='create', uuid=None, vmcfg=None): ''' Create vm from configuration ''' ret = {} # write json file vmadm_json_file = __salt__['temp.file'](prefix='vmadm-') with salt.utils.files.fopen(vmadm_json_file, 'w') as vmadm_json: salt.utils.json.dump(vmcfg, vm...
[ "def", "_create_update_from_cfg", "(", "mode", "=", "'create'", ",", "uuid", "=", "None", ",", "vmcfg", "=", "None", ")", ":", "ret", "=", "{", "}", "# write json file", "vmadm_json_file", "=", "__salt__", "[", "'temp.file'", "]", "(", "prefix", "=", "'vma...
Create vm from configuration
[ "Create", "vm", "from", "configuration" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smartos_vmadm.py#L110-L161
train
saltstack/salt
salt/modules/smartos_vmadm.py
start
def start(vm, options=None, key='uuid'): ''' Start a vm vm : string vm to be started options : string optional additional options key : string [uuid|alias|hostname] value type of 'vm' parameter CLI Example: .. code-block:: bash salt '*' vmadm.start 186da9a...
python
def start(vm, options=None, key='uuid'): ''' Start a vm vm : string vm to be started options : string optional additional options key : string [uuid|alias|hostname] value type of 'vm' parameter CLI Example: .. code-block:: bash salt '*' vmadm.start 186da9a...
[ "def", "start", "(", "vm", ",", "options", "=", "None", ",", "key", "=", "'uuid'", ")", ":", "ret", "=", "{", "}", "if", "key", "not", "in", "[", "'uuid'", ",", "'alias'", ",", "'hostname'", "]", ":", "ret", "[", "'Error'", "]", "=", "'Key must b...
Start a vm vm : string vm to be started options : string optional additional options key : string [uuid|alias|hostname] value type of 'vm' parameter CLI Example: .. code-block:: bash salt '*' vmadm.start 186da9ab-7392-4f55-91a5-b8f1fe770543 salt '*' vmadm....
[ "Start", "a", "vm" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smartos_vmadm.py#L164-L201
train