partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | remove | 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... | salt/modules/pkgin.py | 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):
'''
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... | [
"name",
"The",
"name",
"of",
"the",
"package",
"to",
"be",
"deleted",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pkgin.py#L529-L600 | [
"def",
"remove",
"(",
"name",
"=",
"None",
",",
"pkgs",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"pkg_params",
",",
"pkg_type",
"=",
"__salt__",
"[",
"'pkg_resource.parse_targets'",
"]",
"(",
"name",
",",
"pkgs",
")",
"except",
"Mini... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | file_list | List the files that belong to a package.
CLI Examples:
.. code-block:: bash
salt '*' pkg.file_list nginx | salt/modules/pkgin.py | 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):
'''
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'... | [
"List",
"the",
"files",
"that",
"belong",
"to",
"a",
"package",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pkgin.py#L645-L660 | [
"def",
"file_list",
"(",
"package",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"file_dict",
"(",
"package",
")",
"files",
"=",
"[",
"]",
"for",
"pkg_files",
"in",
"six",
".",
"itervalues",
"(",
"ret",
"[",
"'files'",
"]",
")",
":",
"files",
"."... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | file_dict | .. 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 | salt/modules/pkgin.py | 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):
'''
.. 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:
... | [
"..",
"versionchanged",
":",
"2016",
".",
"3",
".",
"0"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pkgin.py#L663-L696 | [
"def",
"file_dict",
"(",
"*",
"packages",
",",
"*",
"*",
"kwargs",
")",
":",
"errors",
"=",
"[",
"]",
"files",
"=",
"{",
"}",
"for",
"package",
"in",
"packages",
":",
"cmd",
"=",
"[",
"'pkg_info'",
",",
"'-qL'",
",",
"package",
"]",
"ret",
"=",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | mounted | 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... | salt/states/mount.py | 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=True,
user=None,
match_on='auto',
device_name_regex... | [
"Verify",
"that",
"a",
"device",
"is",
"mounted"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/mount.py#L61-L728 | [
"def",
"mounted",
"(",
"name",
",",
"device",
",",
"fstype",
",",
"mkmnt",
"=",
"False",
",",
"opts",
"=",
"'defaults'",
",",
"dump",
"=",
"0",
",",
"pass_num",
"=",
"0",
",",
"config",
"=",
"'/etc/fstab'",
",",
"persist",
"=",
"True",
",",
"mount",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | swap | Activates a swap device
.. code-block:: yaml
/root/swapfile:
mount.swap
.. note::
``swap`` does not currently support LABEL | salt/states/mount.py | 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'):
'''
Activates a swap device
.. code-block:: yaml
/root/swapfile:
mount.swap
.. note::
``swap`` does not currently support LABEL
'''
ret = {'name': name,
'changes': {},
'result': True,
... | [
"Activates",
"a",
"swap",
"device"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/mount.py#L731-L827 | [
"def",
"swap",
"(",
"name",
",",
"persist",
"=",
"True",
",",
"config",
"=",
"'/etc/fstab'",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"True",
",",
"'comment'",
":",
"''",
"}",
"on_",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | unmounted | .. 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
... | salt/states/mount.py | 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):
'''
.. 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... | [
"..",
"versionadded",
"::",
"0",
".",
"17",
".",
"0"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/mount.py#L830-L952 | [
"def",
"unmounted",
"(",
"name",
",",
"device",
"=",
"None",
",",
"config",
"=",
"'/etc/fstab'",
",",
"persist",
"=",
"False",
",",
"user",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | mod_watch | 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 ... | salt/states/mount.py | 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):
'''
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... | [
"The",
"mounted",
"watcher",
"called",
"to",
"invoke",
"the",
"watch",
"command",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/mount.py#L955-L983 | [
"def",
"mod_watch",
"(",
"name",
",",
"user",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"True",
",",
"'comment'",
":",
"''",
"}",
"if",
"kwargs",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _convert_to | Convert a device name, UUID or LABEL to a device name, UUID or
LABEL.
Return the fs_spec required for fstab. | salt/states/mount.py | 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):
'''
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... | [
"Convert",
"a",
"device",
"name",
"UUID",
"or",
"LABEL",
"to",
"a",
"device",
"name",
"UUID",
"or",
"LABEL",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/mount.py#L986-L1016 | [
"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... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | fstab_present | 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... | salt/states/mount.py | 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, match_on='auto'):
'''
Makes sure that a fstab mount point is pressent.
name
The name of block device. Can be any valid fs_sp... | [
"Makes",
"sure",
"that",
"a",
"fstab",
"mount",
"point",
"is",
"pressent",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/mount.py#L1019-L1185 | [
"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"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | fstab_absent | 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``,
... | salt/states/mount.py | 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'):
'''
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... | [
"Makes",
"sure",
"that",
"a",
"fstab",
"mount",
"point",
"is",
"absent",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/mount.py#L1188-L1275 | [
"def",
"fstab_absent",
"(",
"name",
",",
"fs_file",
",",
"mount_by",
"=",
"None",
",",
"config",
"=",
"'/etc/fstab'",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",
"False",
",",
"'changes'",
":",
"{",
"}",
",",
"'comment'",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | 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 | salt/modules/win_snmp.py | 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():
'''
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... | [
"Determine",
"the",
"value",
"of",
"the",
"SNMP",
"sysContact",
"sysLocation",
"and",
"sysServices",
"settings",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_snmp.py#L101-L143 | [
"def",
"get_agent_settings",
"(",
")",
":",
"ret",
"=",
"dict",
"(",
")",
"sorted_types",
"=",
"sorted",
"(",
"_SERVICE_TYPES",
".",
"items",
"(",
")",
",",
"key",
"=",
"lambda",
"x",
":",
"(",
"-",
"x",
"[",
"1",
"]",
",",
"x",
"[",
"0",
"]",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | set_agent_settings | 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... | salt/modules/win_snmp.py | 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):
'''
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... | [
"Manage",
"the",
"SNMP",
"sysContact",
"sysLocation",
"and",
"sysServices",
"settings",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_snmp.py#L146-L228 | [
"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",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | set_auth_traps_enabled | 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' | salt/modules/win_snmp.py | 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):
'''
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... | [
"Manage",
"the",
"sending",
"of",
"authentication",
"traps",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_snmp.py#L252-L284 | [
"def",
"set_auth_traps_enabled",
"(",
"status",
"=",
"True",
")",
":",
"vname",
"=",
"'EnableAuthenticationTraps'",
"current_status",
"=",
"get_auth_traps_enabled",
"(",
")",
"if",
"bool",
"(",
"status",
")",
"==",
"current_status",
":",
"_LOG",
".",
"debug",
"(... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | 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 managed normally will denote the permissi... | salt/modules/win_snmp.py | 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():
'''
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... | [
"Get",
"the",
"current",
"accepted",
"SNMP",
"community",
"names",
"and",
"their",
"permissions",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_snmp.py#L287-L382 | [
"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... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | set_community_names | 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... | salt/modules/win_snmp.py | 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):
'''
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... | [
"Manage",
"the",
"SNMP",
"accepted",
"community",
"names",
"and",
"their",
"permissions",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_snmp.py#L385-L473 | [
"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... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _merge_dicts | Shallow copy and merge dicts together, giving precedence to last in. | salt/states/win_smtp_server.py | 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):
'''
Shallow copy and merge dicts together, giving precedence to last in.
'''
ret = dict()
for arg in args:
ret.update(arg)
return ret | [
"Shallow",
"copy",
"and",
"merge",
"dicts",
"together",
"giving",
"precedence",
"to",
"last",
"in",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/win_smtp_server.py#L27-L34 | [
"def",
"_merge_dicts",
"(",
"*",
"args",
")",
":",
"ret",
"=",
"dict",
"(",
")",
"for",
"arg",
"in",
"args",
":",
"ret",
".",
"update",
"(",
"arg",
")",
"return",
"ret"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _normalize_server_settings | Convert setting values that has been improperly converted to a dict back to a string. | salt/states/win_smtp_server.py | 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):
'''
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... | [
"Convert",
"setting",
"values",
"that",
"has",
"been",
"improperly",
"converted",
"to",
"a",
"dict",
"back",
"to",
"a",
"string",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/win_smtp_server.py#L37-L51 | [
"def",
"_normalize_server_settings",
"(",
"*",
"*",
"settings",
")",
":",
"ret",
"=",
"dict",
"(",
")",
"settings",
"=",
"salt",
".",
"utils",
".",
"args",
".",
"clean_kwargs",
"(",
"*",
"*",
"settings",
")",
"for",
"setting",
"in",
"settings",
":",
"i... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | server_setting | 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:
... | salt/states/win_smtp_server.py | 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):
'''
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... | [
"Ensure",
"the",
"value",
"is",
"set",
"for",
"the",
"specified",
"setting",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/win_smtp_server.py#L54-L128 | [
"def",
"server_setting",
"(",
"name",
",",
"settings",
"=",
"None",
",",
"server",
"=",
"_DEFAULT_SERVER",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'comment'",
":",
"six",
".",
"text_type",
"(",
")",
",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | active_log_format | 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... | salt/states/win_smtp_server.py | 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):
'''
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... | [
"Manage",
"the",
"active",
"log",
"format",
"for",
"the",
"SMTP",
"server",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/win_smtp_server.py#L131-L164 | [
"def",
"active_log_format",
"(",
"name",
",",
"log_format",
",",
"server",
"=",
"_DEFAULT_SERVER",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'comment'",
":",
"six",
".",
"text_type",
"(",
")",
",",
"'resul... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | connection_ip_list | 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... | salt/states/win_smtp_server.py | 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):
'''
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: ... | [
"Manage",
"IP",
"list",
"for",
"SMTP",
"connections",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/win_smtp_server.py#L167-L230 | [
"def",
"connection_ip_list",
"(",
"name",
",",
"addresses",
"=",
"None",
",",
"grant_by_default",
"=",
"False",
",",
"server",
"=",
"_DEFAULT_SERVER",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'comment'",
":... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | relay_ip_list | 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... | salt/states/win_smtp_server.py | 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):
'''
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 ... | [
"Manage",
"IP",
"list",
"for",
"SMTP",
"relay",
"connections",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/win_smtp_server.py#L233-L328 | [
"def",
"relay_ip_list",
"(",
"name",
",",
"addresses",
"=",
"None",
",",
"server",
"=",
"_DEFAULT_SERVER",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'comment'",
":",
"six",
".",
"text_type",
"(",
")",
",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | cmd | 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... | salt/modules/onyx.py | 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):
'''
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
.. ... | [
"run",
"commands",
"from",
"__proxy__",
":",
"mod",
":",
"salt",
".",
"proxy",
".",
"onyx<salt",
".",
"proxy",
".",
"onyx",
">"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/onyx.py#L38-L66 | [
"def",
"cmd",
"(",
"command",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"proxy_prefix",
"=",
"__opts__",
"[",
"'proxy'",
"]",
"[",
"'proxytype'",
"]",
"proxy_cmd",
"=",
"'.'",
".",
"join",
"(",
"[",
"proxy_prefix",
",",
"command",
"]",
")"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _paginate | Wrapper to assist with paginated responses from Digicert's REST API. | salt/runners/digicertapi.py | 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):
'''
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'... | [
"Wrapper",
"to",
"assist",
"with",
"paginated",
"responses",
"from",
"Digicert",
"s",
"REST",
"API",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/digicertapi.py#L92-L120 | [
"def",
"_paginate",
"(",
"url",
",",
"topkey",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"salt",
".",
"utils",
".",
"http",
".",
"query",
"(",
"url",
",",
"*",
"*",
"kwargs",
")",
"if",
"'errors'",
"in",
"ret",
"[",
"'dic... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | list_domains | 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 | salt/runners/digicertapi.py | 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):
'''
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?... | [
"List",
"domains",
"that",
"CertCentral",
"knows",
"about",
".",
"You",
"can",
"filter",
"by",
"container_id",
"(",
"also",
"known",
"as",
"Division",
")",
"by",
"passing",
"a",
"container_id",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/digicertapi.py#L123-L151 | [
"def",
"list_domains",
"(",
"container_id",
"=",
"None",
")",
":",
"if",
"container_id",
":",
"url",
"=",
"'{0}/domain?{1}'",
".",
"format",
"(",
"_base_url",
"(",
")",
",",
"container_id",
")",
"else",
":",
"url",
"=",
"'{0}/domain'",
".",
"format",
"(",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | list_requests | 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 | salt/runners/digicertapi.py | 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):
'''
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... | [
"List",
"certificate",
"requests",
"made",
"to",
"CertCentral",
".",
"You",
"can",
"filter",
"by",
"status",
":",
"pending",
"approved",
"rejected"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/digicertapi.py#L154-L183 | [
"def",
"list_requests",
"(",
"status",
"=",
"None",
")",
":",
"if",
"status",
":",
"url",
"=",
"'{0}/request?status={1}'",
".",
"format",
"(",
"_base_url",
"(",
")",
",",
"status",
")",
"else",
":",
"url",
"=",
"'{0}/request'",
".",
"format",
"(",
"_base... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_certificate | 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... | salt/runners/digicertapi.py | 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):
'''
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... | [
"Retrieve",
"a",
"certificate",
"by",
"order_id",
"or",
"certificate_id",
"and",
"write",
"it",
"to",
"stdout",
"or",
"a",
"filename",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/digicertapi.py#L214-L342 | [
"def",
"get_certificate",
"(",
"order_id",
"=",
"None",
",",
"certificate_id",
"=",
"None",
",",
"minion_id",
"=",
"None",
",",
"cert_format",
"=",
"'pem_all'",
",",
"filename",
"=",
"None",
")",
":",
"if",
"order_id",
":",
"order_cert",
"=",
"salt",
".",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | list_organizations | 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... | salt/runners/digicertapi.py | 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):
'''
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 ... | [
"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... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/digicertapi.py#L345-L371 | [
"def",
"list_organizations",
"(",
"container_id",
"=",
"None",
",",
"include_validation",
"=",
"True",
")",
":",
"orgs",
"=",
"_paginate",
"(",
"'{0}/organization'",
".",
"format",
"(",
"_base_url",
"(",
")",
")",
",",
"\"organizations\"",
",",
"method",
"=",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | order_certificate | 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... | salt/runners/digicertapi.py | 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, organization_units=None, server_platform=None,
custom_expiration_date=None, comments=None, disable... | [
"Order",
"a",
"certificate",
".",
"Requires",
"that",
"an",
"Organization",
"has",
"been",
"created",
"inside",
"Digicert",
"s",
"CertCentral",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/digicertapi.py#L374-L484 | [
"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... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | gen_key | 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] | salt/runners/digicertapi.py | 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):
'''
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",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/digicertapi.py#L487-L518 | [
"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",
".",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_org_details | 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. | salt/runners/digicertapi.py | 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):
'''
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... | [
"Return",
"the",
"details",
"for",
"an",
"organization"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/digicertapi.py#L521-L544 | [
"def",
"get_org_details",
"(",
"organization_id",
")",
":",
"qdata",
"=",
"salt",
".",
"utils",
".",
"http",
".",
"query",
"(",
"'{0}/organization/{1}'",
".",
"format",
"(",
"_base_url",
"(",
")",
",",
"organization_id",
")",
",",
"method",
"=",
"'GET'",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _id_map | Maintain a relationship between a minion and a dns name | salt/runners/digicertapi.py | 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):
'''
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... | [
"Maintain",
"a",
"relationship",
"between",
"a",
"minion",
"and",
"a",
"dns",
"name"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/digicertapi.py#L624-L635 | [
"def",
"_id_map",
"(",
"minion_id",
",",
"dns_name",
")",
":",
"bank",
"=",
"'digicert/minions'",
"cache",
"=",
"salt",
".",
"cache",
".",
"Cache",
"(",
"__opts__",
",",
"syspaths",
".",
"CACHE_DIR",
")",
"dns_names",
"=",
"cache",
".",
"fetch",
"(",
"ba... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | show_csrs | Show certificate requests for this API key
CLI Example:
.. code-block:: bash
salt-run digicert.show_csrs | salt/runners/digicertapi.py | 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():
'''
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',
... | [
"Show",
"certificate",
"requests",
"for",
"this",
"API",
"key"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/digicertapi.py#L665-L689 | [
"def",
"show_csrs",
"(",
")",
":",
"data",
"=",
"salt",
".",
"utils",
".",
"http",
".",
"query",
"(",
"'{0}/certificaterequests'",
".",
"format",
"(",
"_base_url",
"(",
")",
")",
",",
"status",
"=",
"True",
",",
"decode",
"=",
"True",
",",
"decode_type... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | show_rsa | Show a private RSA key
CLI Example:
.. code-block:: bash
salt-run digicert.show_rsa myminion domain.example.com | salt/runners/digicertapi.py | 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):
'''
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... | [
"Show",
"a",
"private",
"RSA",
"key"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/digicertapi.py#L692-L707 | [
"def",
"show_rsa",
"(",
"minion_id",
",",
"dns_name",
")",
":",
"cache",
"=",
"salt",
".",
"cache",
".",
"Cache",
"(",
"__opts__",
",",
"syspaths",
".",
"CACHE_DIR",
")",
"bank",
"=",
"'digicert/domains'",
"data",
"=",
"cache",
".",
"fetch",
"(",
"bank",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | 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 | salt/modules/minion.py | 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_():
'''
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... | [
"Return",
"a",
"list",
"of",
"accepted",
"denied",
"unaccepted",
"and",
"rejected",
"keys",
".",
"This",
"is",
"the",
"same",
"output",
"as",
"salt",
"-",
"key",
"-",
"L"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/minion.py#L26-L58 | [
"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 ... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _check_minions_directories | Return the minion keys directory paths.
This function is a copy of salt.key.Key._check_minions_directories. | salt/modules/minion.py | 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):
'''
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... | [
"Return",
"the",
"minion",
"keys",
"directory",
"paths",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/minion.py#L61-L72 | [
"def",
"_check_minions_directories",
"(",
"pki_dir",
")",
":",
"minions_accepted",
"=",
"os",
".",
"path",
".",
"join",
"(",
"pki_dir",
",",
"salt",
".",
"key",
".",
"Key",
".",
"ACC",
")",
"minions_pre",
"=",
"os",
".",
"path",
".",
"join",
"(",
"pki_... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | kill | 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:
----------
... | salt/modules/minion.py | 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):
'''
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
... | [
"Kill",
"the",
"salt",
"minion",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/minion.py#L75-L142 | [
"def",
"kill",
"(",
"timeout",
"=",
"15",
")",
":",
"ret",
"=",
"{",
"'killed'",
":",
"None",
",",
"'retcode'",
":",
"1",
",",
"}",
"comment",
"=",
"[",
"]",
"pid",
"=",
"__grains__",
".",
"get",
"(",
"'pid'",
")",
"if",
"not",
"pid",
":",
"com... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | 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 value ``minion_restart_command`... | salt/modules/minion.py | 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():
'''
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... | [
"Kill",
"and",
"restart",
"the",
"salt",
"minion",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/minion.py#L145-L257 | [
"def",
"restart",
"(",
")",
":",
"should_kill",
"=",
"True",
"should_restart",
"=",
"True",
"comment",
"=",
"[",
"]",
"ret",
"=",
"{",
"'killed'",
":",
"None",
",",
"'restart'",
":",
"{",
"}",
",",
"'retcode'",
":",
"0",
",",
"}",
"restart_cmd",
"=",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | state_apply | 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... | salt/modules/saltcheck.py | 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):
'''
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 ... | [
"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... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltcheck.py#L264-L284 | [
"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... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _generate_out_list | generate test results output list | salt/modules/saltcheck.py | 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):
'''
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... | [
"generate",
"test",
"results",
"output",
"list"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltcheck.py#L356-L385 | [
"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",
"]",
".... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _is_valid_function | Determine if a function is valid for a module | salt/modules/saltcheck.py | 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):
'''
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,... | [
"Determine",
"if",
"a",
"function",
"is",
"valid",
"for",
"a",
"module"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltcheck.py#L416-L424 | [
"def",
"_is_valid_function",
"(",
"module_name",
",",
"function",
")",
":",
"try",
":",
"functions",
"=",
"__salt__",
"[",
"'sys.list_functions'",
"]",
"(",
"module_name",
")",
"except",
"salt",
".",
"exceptions",
".",
"SaltException",
":",
"functions",
"=",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _get_top_states | Equivalent to a salt cli: salt web state.show_top | salt/modules/saltcheck.py | 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'):
'''
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"... | [
"Equivalent",
"to",
"a",
"salt",
"cli",
":",
"salt",
"web",
"state",
".",
"show_top"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltcheck.py#L427-L439 | [
"def",
"_get_top_states",
"(",
"saltenv",
"=",
"'base'",
")",
":",
"alt_states",
"=",
"[",
"]",
"try",
":",
"returned",
"=",
"__salt__",
"[",
"'state.show_top'",
"]",
"(",
")",
"for",
"i",
"in",
"returned",
"[",
"saltenv",
"]",
":",
"alt_states",
".",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | SaltCheck._call_salt_command | Generic call of salt Caller command | salt/modules/saltcheck.py | 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):
'''
Generic call of salt Caller command
'''
value = False
try:
if args and kwargs:
... | [
"Generic",
"call",
"of",
"salt",
"Caller",
"command"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltcheck.py#L520-L545 | [
"def",
"_call_salt_command",
"(",
"self",
",",
"fun",
",",
"args",
",",
"kwargs",
",",
"assertion_section",
"=",
"None",
")",
":",
"value",
"=",
"False",
"try",
":",
"if",
"args",
"and",
"kwargs",
":",
"value",
"=",
"self",
".",
"salt_lc",
".",
"cmd",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | SaltCheck._cast_expected_to_returned_type | Determine the type of variable returned
Cast the expected to the type of variable returned | salt/modules/saltcheck.py | 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):
'''
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... | [
"Determine",
"the",
"type",
"of",
"variable",
"returned",
"Cast",
"the",
"expected",
"to",
"the",
"type",
"of",
"variable",
"returned"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltcheck.py#L615-L632 | [
"def",
"_cast_expected_to_returned_type",
"(",
"expected",
",",
"returned",
")",
":",
"ret_type",
"=",
"type",
"(",
"returned",
")",
"new_expected",
"=",
"expected",
"if",
"expected",
"==",
"\"False\"",
"and",
"ret_type",
"==",
"bool",
":",
"expected",
"=",
"F... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | SaltCheck.__assert_equal | Test if two objects are equal | salt/modules/saltcheck.py | 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):
'''
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:
... | [
"Test",
"if",
"two",
"objects",
"are",
"equal"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltcheck.py#L635-L648 | [
"def",
"__assert_equal",
"(",
"expected",
",",
"returned",
",",
"assert_print_result",
"=",
"True",
")",
":",
"result",
"=",
"\"Pass\"",
"try",
":",
"if",
"assert_print_result",
":",
"assert",
"(",
"expected",
"==",
"returned",
")",
",",
"\"{0} is not equal to {... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | SaltCheck.__assert_true | Test if an boolean is True | salt/modules/saltcheck.py | 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):
'''
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 | [
"Test",
"if",
"an",
"boolean",
"is",
"True"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltcheck.py#L666-L675 | [
"def",
"__assert_true",
"(",
"returned",
")",
":",
"result",
"=",
"\"Pass\"",
"try",
":",
"assert",
"(",
"returned",
"is",
"True",
")",
",",
"\"{0} not True\"",
".",
"format",
"(",
"returned",
")",
"except",
"AssertionError",
"as",
"err",
":",
"result",
"=... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | SaltCheck.__assert_false | Test if an boolean is False | salt/modules/saltcheck.py | 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):
'''
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... | [
"Test",
"if",
"an",
"boolean",
"is",
"False"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltcheck.py#L678-L692 | [
"def",
"__assert_false",
"(",
"returned",
")",
":",
"result",
"=",
"\"Pass\"",
"if",
"isinstance",
"(",
"returned",
",",
"str",
")",
":",
"try",
":",
"returned",
"=",
"bool",
"(",
"returned",
")",
"except",
"ValueError",
":",
"raise",
"try",
":",
"assert... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | SaltCheck.__assert_less | Test if a value is less than the returned value | salt/modules/saltcheck.py | 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):
'''
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)
... | [
"Test",
"if",
"a",
"value",
"is",
"less",
"than",
"the",
"returned",
"value"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltcheck.py#L749-L758 | [
"def",
"__assert_less",
"(",
"expected",
",",
"returned",
")",
":",
"result",
"=",
"\"Pass\"",
"try",
":",
"assert",
"(",
"expected",
"<",
"returned",
")",
",",
"\"{0} not False\"",
".",
"format",
"(",
"returned",
")",
"except",
"AssertionError",
"as",
"err"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | SaltCheck.__assert_empty | Test if a returned value is empty | salt/modules/saltcheck.py | 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):
'''
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 | [
"Test",
"if",
"a",
"returned",
"value",
"is",
"empty"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltcheck.py#L773-L782 | [
"def",
"__assert_empty",
"(",
"returned",
")",
":",
"result",
"=",
"\"Pass\"",
"try",
":",
"assert",
"(",
"not",
"returned",
")",
",",
"\"{0} is not empty\"",
".",
"format",
"(",
"returned",
")",
"except",
"AssertionError",
"as",
"err",
":",
"result",
"=",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | SaltCheck.__assert_not_empty | Test if a returned value is not empty | salt/modules/saltcheck.py | 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):
'''
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 | [
"Test",
"if",
"a",
"returned",
"value",
"is",
"not",
"empty"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltcheck.py#L785-L794 | [
"def",
"__assert_not_empty",
"(",
"returned",
")",
":",
"result",
"=",
"\"Pass\"",
"try",
":",
"assert",
"(",
"returned",
")",
",",
"\"value is empty\"",
"except",
"AssertionError",
"as",
"err",
":",
"result",
"=",
"\"Fail: \"",
"+",
"six",
".",
"text_type",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | SaltCheck.get_state_search_path_list | For the state file system, return a list of paths to search for states | salt/modules/saltcheck.py | 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'):
'''
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... | [
"For",
"the",
"state",
"file",
"system",
"return",
"a",
"list",
"of",
"paths",
"to",
"search",
"for",
"states"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltcheck.py#L797-L807 | [
"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"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | 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
:return: True or OSError exception | salt/modules/vbox_guest.py | 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 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
:... | [
"Mount",
"VirtualBox",
"Guest",
"Additions",
"CD",
"to",
"the",
"temp",
"directory",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/vbox_guest.py#L35-L55 | [
"def",
"additions_mount",
"(",
")",
":",
"mount_point",
"=",
"tempfile",
".",
"mkdtemp",
"(",
")",
"ret",
"=",
"__salt__",
"[",
"'mount.mount'",
"]",
"(",
"mount_point",
",",
"'/dev/cdrom'",
")",
"if",
"ret",
"is",
"True",
":",
"return",
"mount_point",
"el... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | additions_umount | 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 | salt/modules/vbox_guest.py | 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):
'''
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",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/vbox_guest.py#L58-L74 | [
"def",
"additions_umount",
"(",
"mount_point",
")",
":",
"ret",
"=",
"__salt__",
"[",
"'mount.umount'",
"]",
"(",
"mount_point",
")",
"if",
"ret",
":",
"os",
".",
"rmdir",
"(",
"mount_point",
")",
"return",
"ret"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | additions_install | 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... | salt/modules/vbox_guest.py | 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):
'''
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... | [
"Install",
"VirtualBox",
"Guest",
"Additions",
".",
"Uses",
"the",
"CD",
"connected",
"by",
"VirtualBox",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/vbox_guest.py#L156-L182 | [
"def",
"additions_install",
"(",
"*",
"*",
"kwargs",
")",
":",
"with",
"_additions_mounted",
"(",
")",
"as",
"mount_point",
":",
"kernel",
"=",
"__grains__",
".",
"get",
"(",
"'kernel'",
",",
"''",
")",
"if",
"kernel",
"==",
"'Linux'",
":",
"return",
"_a... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _additions_remove_use_cd | Remove VirtualBox Guest Additions.
It uses the CD, connected by VirtualBox. | salt/modules/vbox_guest.py | 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):
'''
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_... | [
"Remove",
"VirtualBox",
"Guest",
"Additions",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/vbox_guest.py#L217-L227 | [
"def",
"_additions_remove_use_cd",
"(",
"*",
"*",
"kwargs",
")",
":",
"with",
"_additions_mounted",
"(",
")",
"as",
"mount_point",
":",
"kernel",
"=",
"__grains__",
".",
"get",
"(",
"'kernel'",
",",
"''",
")",
"if",
"kernel",
"==",
"'Linux'",
":",
"return"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | additions_remove | 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... | salt/modules/vbox_guest.py | 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):
'''
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... | [
"Remove",
"VirtualBox",
"Guest",
"Additions",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/vbox_guest.py#L230-L255 | [
"def",
"additions_remove",
"(",
"*",
"*",
"kwargs",
")",
":",
"kernel",
"=",
"__grains__",
".",
"get",
"(",
"'kernel'",
",",
"''",
")",
"if",
"kernel",
"==",
"'Linux'",
":",
"ret",
"=",
"_additions_remove_linux",
"(",
")",
"if",
"not",
"ret",
":",
"ret... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | 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 | salt/modules/vbox_guest.py | 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():
'''
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... | [
"Check",
"VirtualBox",
"Guest",
"Additions",
"version",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/vbox_guest.py#L258-L277 | [
"def",
"additions_version",
"(",
")",
":",
"try",
":",
"d",
"=",
"_additions_dir",
"(",
")",
"except",
"EnvironmentError",
":",
"return",
"False",
"if",
"d",
"and",
"os",
".",
"listdir",
"(",
"d",
")",
":",
"return",
"re",
".",
"sub",
"(",
"r'^{0}-'",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | grant_access_to_shared_folders_to | 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... | salt/modules/vbox_guest.py | 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):
'''
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... | [
"Grant",
"access",
"to",
"auto",
"-",
"mounted",
"shared",
"folders",
"to",
"the",
"users",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/vbox_guest.py#L280-L326 | [
"def",
"grant_access_to_shared_folders_to",
"(",
"name",
",",
"users",
"=",
"None",
")",
":",
"if",
"users",
"is",
"None",
":",
"users",
"=",
"[",
"name",
"]",
"if",
"__salt__",
"[",
"'group.members'",
"]",
"(",
"_shared_folders_group",
",",
"','",
".",
"j... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | SysInfo._get_disk_size | Get a size of a disk. | salt/modules/inspectlib/query.py | 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):
'''
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... | [
"Get",
"a",
"size",
"of",
"a",
"disk",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/query.py#L49-L64 | [
"def",
"_get_disk_size",
"(",
"self",
",",
"device",
")",
":",
"out",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"\"df {0}\"",
".",
"format",
"(",
"device",
")",
")",
"if",
"out",
"[",
"'retcode'",
"]",
":",
"msg",
"=",
"\"Disk size info error: {0}\"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | SysInfo._get_fs | Get available file systems and their types. | salt/modules/inspectlib/query.py | 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):
'''
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']
... | [
"Get",
"available",
"file",
"systems",
"and",
"their",
"types",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/query.py#L66-L78 | [
"def",
"_get_fs",
"(",
"self",
")",
":",
"data",
"=",
"dict",
"(",
")",
"for",
"dev",
",",
"dev_data",
"in",
"salt",
".",
"utils",
".",
"fsutils",
".",
"_blkid",
"(",
")",
".",
"items",
"(",
")",
":",
"dev",
"=",
"self",
".",
"_get_disk_size",
"(... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | SysInfo._get_cpu | Get available CPU information. | salt/modules/inspectlib/query.py | 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):
'''
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... | [
"Get",
"available",
"CPU",
"information",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/query.py#L86-L97 | [
"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",
")",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | SysInfo._get_mem | Get memory. | salt/modules/inspectlib/query.py | 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):
'''
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... | [
"Get",
"memory",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/query.py#L99-L117 | [
"def",
"_get_mem",
"(",
"self",
")",
":",
"out",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"\"vmstat -s\"",
")",
"if",
"out",
"[",
"'retcode'",
"]",
":",
"raise",
"SIException",
"(",
"\"Memory info error: {0}\"",
".",
"format",
"(",
"out",
"[",
"'st... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | SysInfo._get_network | Get network configuration. | salt/modules/inspectlib/query.py | 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):
'''
Get network configuration.
'''
data = dict()
data['interfaces'] = salt.utils.network.interfaces()
data['subnets'] = salt.utils.network.subnets()
return data | [
"Get",
"network",
"configuration",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/query.py#L119-L127 | [
"def",
"_get_network",
"(",
"self",
")",
":",
"data",
"=",
"dict",
"(",
")",
"data",
"[",
"'interfaces'",
"]",
"=",
"salt",
".",
"utils",
".",
"network",
".",
"interfaces",
"(",
")",
"data",
"[",
"'subnets'",
"]",
"=",
"salt",
".",
"utils",
".",
"n... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | SysInfo._get_os | Get operating system summary | salt/modules/inspectlib/query.py | 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):
'''
Get operating system summary
'''
return {
'name': self._grain('os'),
'family': self._grain('os_family'),
'arch': self._grain('osarch'),
'release': self._grain('osrelease'),
} | [
"Get",
"operating",
"system",
"summary"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/query.py#L129-L138 | [
"def",
"_get_os",
"(",
"self",
")",
":",
"return",
"{",
"'name'",
":",
"self",
".",
"_grain",
"(",
"'os'",
")",
",",
"'family'",
":",
"self",
".",
"_grain",
"(",
"'os_family'",
")",
",",
"'arch'",
":",
"self",
".",
"_grain",
"(",
"'osarch'",
")",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Query._configuration | Return configuration files. | salt/modules/inspectlib/query.py | 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):
'''
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... | [
"Return",
"configuration",
"files",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/query.py#L195-L211 | [
"def",
"_configuration",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"data",
"=",
"dict",
"(",
")",
"self",
".",
"db",
".",
"open",
"(",
")",
"for",
"pkg",
"in",
"self",
".",
"db",
".",
"get",
"(",
"Package",
")",
":",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Query._get_local_users | Return all known local accounts to the system. | salt/modules/inspectlib/query.py | 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):
'''
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... | [
"Return",
"all",
"known",
"local",
"accounts",
"to",
"the",
"system",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/query.py#L213-L236 | [
"def",
"_get_local_users",
"(",
"self",
",",
"disabled",
"=",
"None",
")",
":",
"users",
"=",
"dict",
"(",
")",
"path",
"=",
"'/etc/passwd'",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"fopen",
"(",
"path",
",",
"'r'",
")",
"as",
"fp_",
":",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Query._get_local_groups | Return all known local groups to the system. | salt/modules/inspectlib/query.py | 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):
'''
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:
... | [
"Return",
"all",
"known",
"local",
"groups",
"to",
"the",
"system",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/query.py#L238-L257 | [
"def",
"_get_local_groups",
"(",
"self",
")",
":",
"groups",
"=",
"dict",
"(",
")",
"path",
"=",
"'/etc/group'",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"fopen",
"(",
"path",
",",
"'r'",
")",
"as",
"fp_",
":",
"for",
"line",
"in",
"fp_",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Query._get_external_accounts | Return all known accounts, excluding local accounts. | salt/modules/inspectlib/query.py | 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):
'''
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.
... | [
"Return",
"all",
"known",
"accounts",
"excluding",
"local",
"accounts",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/query.py#L259-L279 | [
"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... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Query._identity | 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... | salt/modules/inspectlib/query.py | 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 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
... | [
"Local",
"users",
"and",
"groups",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/query.py#L281-L301 | [
"def",
"_identity",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"LOCAL",
"=",
"'local accounts'",
"EXT",
"=",
"'external accounts'",
"data",
"=",
"dict",
"(",
")",
"data",
"[",
"LOCAL",
"]",
"=",
"self",
".",
"_get_local_users",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Query._system | This basically calls grains items and picks out only
necessary information in a certain structure.
:param args:
:param kwargs:
:return: | salt/modules/inspectlib/query.py | 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):
'''
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()
... | [
"This",
"basically",
"calls",
"grains",
"items",
"and",
"picks",
"out",
"only",
"necessary",
"information",
"in",
"a",
"certain",
"structure",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/query.py#L303-L322 | [
"def",
"_system",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"sysinfo",
"=",
"SysInfo",
"(",
"__grains__",
".",
"get",
"(",
"\"kernel\"",
")",
")",
"data",
"=",
"dict",
"(",
")",
"data",
"[",
"'cpu'",
"]",
"=",
"sysinfo",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Query._software | Return installed software. | salt/modules/inspectlib/query.py | 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):
'''
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... | [
"Return",
"installed",
"software",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/query.py#L324-L376 | [
"def",
"_software",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"data",
"=",
"dict",
"(",
")",
"if",
"'exclude'",
"in",
"kwargs",
":",
"excludes",
"=",
"kwargs",
"[",
"'exclude'",
"]",
".",
"split",
"(",
"\",\"",
")",
"else",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Query._id_resolv | Resolve local users and groups.
:param iid:
:param named:
:param uid:
:return: | salt/modules/inspectlib/query.py | 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):
'''
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_... | [
"Resolve",
"local",
"users",
"and",
"groups",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/query.py#L387-L408 | [
"def",
"_id_resolv",
"(",
"self",
",",
"iid",
",",
"named",
"=",
"True",
",",
"uid",
"=",
"True",
")",
":",
"if",
"not",
"self",
".",
"local_identity",
":",
"self",
".",
"local_identity",
"[",
"'users'",
"]",
"=",
"self",
".",
"_get_local_users",
"(",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Query._payload | 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)
* **... | salt/modules/inspectlib/query.py | 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):
'''
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)
... | [
"Find",
"all",
"unmanaged",
"files",
".",
"Returns",
"maximum",
"1000",
"values",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/query.py#L410-L493 | [
"def",
"_payload",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"def",
"_size_format",
"(",
"size",
",",
"fmt",
")",
":",
"if",
"fmt",
"is",
"None",
":",
"return",
"size",
"fmt",
"=",
"fmt",
".",
"lower",
"(",
")",
"if",
"f... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Query._all | Return all the summary of the particular system. | salt/modules/inspectlib/query.py | 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):
'''
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... | [
"Return",
"all",
"the",
"summary",
"of",
"the",
"particular",
"system",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/query.py#L495-L510 | [
"def",
"_all",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"data",
"=",
"dict",
"(",
")",
"data",
"[",
"'software'",
"]",
"=",
"self",
".",
"_software",
"(",
"*",
"*",
"kwargs",
")",
"data",
"[",
"'system'",
"]",
"=",
"sel... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _create_update_from_file | Create vm from file | salt/modules/smartos_vmadm.py | 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):
'''
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... | [
"Create",
"vm",
"from",
"file"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smartos_vmadm.py#L64-L107 | [
"def",
"_create_update_from_file",
"(",
"mode",
"=",
"'create'",
",",
"uuid",
"=",
"None",
",",
"path",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"}",
"if",
"not",
"os",
".",
"path",
".",
"isfile",
"(",
"path",
")",
"or",
"path",
"is",
"None",
":",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _create_update_from_cfg | Create vm from configuration | salt/modules/smartos_vmadm.py | 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):
'''
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... | [
"Create",
"vm",
"from",
"configuration"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smartos_vmadm.py#L110-L161 | [
"def",
"_create_update_from_cfg",
"(",
"mode",
"=",
"'create'",
",",
"uuid",
"=",
"None",
",",
"vmcfg",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"}",
"# write json file",
"vmadm_json_file",
"=",
"__salt__",
"[",
"'temp.file'",
"]",
"(",
"prefix",
"=",
"'vma... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | start | 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.... | salt/modules/smartos_vmadm.py | 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'):
'''
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... | [
"Start",
"a",
"vm"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smartos_vmadm.py#L164-L201 | [
"def",
"start",
"(",
"vm",
",",
"options",
"=",
"None",
",",
"key",
"=",
"'uuid'",
")",
":",
"ret",
"=",
"{",
"}",
"if",
"key",
"not",
"in",
"[",
"'uuid'",
",",
"'alias'",
",",
"'hostname'",
"]",
":",
"ret",
"[",
"'Error'",
"]",
"=",
"'Key must b... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | stop | Stop a vm
vm : string
vm to be stopped
force : boolean
force stop of vm if true
key : string [uuid|alias|hostname]
value type of 'vm' parameter
CLI Example:
.. code-block:: bash
salt '*' vmadm.stop 186da9ab-7392-4f55-91a5-b8f1fe770543
salt '*' vmadm.stop 1... | salt/modules/smartos_vmadm.py | def stop(vm, force=False, key='uuid'):
'''
Stop a vm
vm : string
vm to be stopped
force : boolean
force stop of vm if true
key : string [uuid|alias|hostname]
value type of 'vm' parameter
CLI Example:
.. code-block:: bash
salt '*' vmadm.stop 186da9ab-7392-4... | def stop(vm, force=False, key='uuid'):
'''
Stop a vm
vm : string
vm to be stopped
force : boolean
force stop of vm if true
key : string [uuid|alias|hostname]
value type of 'vm' parameter
CLI Example:
.. code-block:: bash
salt '*' vmadm.stop 186da9ab-7392-4... | [
"Stop",
"a",
"vm"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smartos_vmadm.py#L204-L241 | [
"def",
"stop",
"(",
"vm",
",",
"force",
"=",
"False",
",",
"key",
"=",
"'uuid'",
")",
":",
"ret",
"=",
"{",
"}",
"if",
"key",
"not",
"in",
"[",
"'uuid'",
",",
"'alias'",
",",
"'hostname'",
"]",
":",
"ret",
"[",
"'Error'",
"]",
"=",
"'Key must be ... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | list_vms | Return a list of VMs
search : string
vmadm filter property
sort : string
vmadm sort (-s) property
order : string
vmadm order (-o) property -- Default: uuid,type,ram,state,alias
keyed : boolean
specified if the output should be an array (False) or dict (True)
... | salt/modules/smartos_vmadm.py | def list_vms(search=None, sort=None, order='uuid,type,ram,state,alias', keyed=True):
'''
Return a list of VMs
search : string
vmadm filter property
sort : string
vmadm sort (-s) property
order : string
vmadm order (-o) property -- Default: uuid,type,ram,state,alias
keyed... | def list_vms(search=None, sort=None, order='uuid,type,ram,state,alias', keyed=True):
'''
Return a list of VMs
search : string
vmadm filter property
sort : string
vmadm sort (-s) property
order : string
vmadm order (-o) property -- Default: uuid,type,ram,state,alias
keyed... | [
"Return",
"a",
"list",
"of",
"VMs"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smartos_vmadm.py#L284-L339 | [
"def",
"list_vms",
"(",
"search",
"=",
"None",
",",
"sort",
"=",
"None",
",",
"order",
"=",
"'uuid,type,ram,state,alias'",
",",
"keyed",
"=",
"True",
")",
":",
"ret",
"=",
"{",
"}",
"# vmadm list [-p] [-H] [-o field,...] [-s field,...] [field=value ...]",
"cmd",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | lookup | Return a list of VMs using lookup
search : string
vmadm filter property
order : string
vmadm order (-o) property -- Default: uuid,type,ram,state,alias
one : boolean
return only one result (vmadm's -1)
CLI Example:
.. code-block:: bash
salt '*' vmadm.lookup search=... | salt/modules/smartos_vmadm.py | def lookup(search=None, order=None, one=False):
'''
Return a list of VMs using lookup
search : string
vmadm filter property
order : string
vmadm order (-o) property -- Default: uuid,type,ram,state,alias
one : boolean
return only one result (vmadm's -1)
CLI Example:
... | def lookup(search=None, order=None, one=False):
'''
Return a list of VMs using lookup
search : string
vmadm filter property
order : string
vmadm order (-o) property -- Default: uuid,type,ram,state,alias
one : boolean
return only one result (vmadm's -1)
CLI Example:
... | [
"Return",
"a",
"list",
"of",
"VMs",
"using",
"lookup"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smartos_vmadm.py#L342-L381 | [
"def",
"lookup",
"(",
"search",
"=",
"None",
",",
"order",
"=",
"None",
",",
"one",
"=",
"False",
")",
":",
"ret",
"=",
"{",
"}",
"# vmadm lookup [-j|-1] [-o field,...] [field=value ...]",
"cmd",
"=",
"'vmadm lookup {one} {order} {search}'",
".",
"format",
"(",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | sysrq | Send non-maskable interrupt to vm or capture a screenshot
vm : string
vm to be targeted
action : string
nmi or screenshot -- Default: nmi
key : string [uuid|alias|hostname]
value type of 'vm' parameter
CLI Example:
.. code-block:: bash
salt '*' vmadm.sysrq 186da9a... | salt/modules/smartos_vmadm.py | def sysrq(vm, action='nmi', key='uuid'):
'''
Send non-maskable interrupt to vm or capture a screenshot
vm : string
vm to be targeted
action : string
nmi or screenshot -- Default: nmi
key : string [uuid|alias|hostname]
value type of 'vm' parameter
CLI Example:
.. co... | def sysrq(vm, action='nmi', key='uuid'):
'''
Send non-maskable interrupt to vm or capture a screenshot
vm : string
vm to be targeted
action : string
nmi or screenshot -- Default: nmi
key : string [uuid|alias|hostname]
value type of 'vm' parameter
CLI Example:
.. co... | [
"Send",
"non",
"-",
"maskable",
"interrupt",
"to",
"vm",
"or",
"capture",
"a",
"screenshot"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smartos_vmadm.py#L384-L423 | [
"def",
"sysrq",
"(",
"vm",
",",
"action",
"=",
"'nmi'",
",",
"key",
"=",
"'uuid'",
")",
":",
"ret",
"=",
"{",
"}",
"if",
"key",
"not",
"in",
"[",
"'uuid'",
",",
"'alias'",
",",
"'hostname'",
"]",
":",
"ret",
"[",
"'Error'",
"]",
"=",
"'Key must b... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | delete | Delete a vm
vm : string
vm to be deleted
key : string [uuid|alias|hostname]
value type of 'vm' parameter
CLI Example:
.. code-block:: bash
salt '*' vmadm.delete 186da9ab-7392-4f55-91a5-b8f1fe770543
salt '*' vmadm.delete nacl key=alias | salt/modules/smartos_vmadm.py | def delete(vm, key='uuid'):
'''
Delete a vm
vm : string
vm to be deleted
key : string [uuid|alias|hostname]
value type of 'vm' parameter
CLI Example:
.. code-block:: bash
salt '*' vmadm.delete 186da9ab-7392-4f55-91a5-b8f1fe770543
salt '*' vmadm.delete nacl key... | def delete(vm, key='uuid'):
'''
Delete a vm
vm : string
vm to be deleted
key : string [uuid|alias|hostname]
value type of 'vm' parameter
CLI Example:
.. code-block:: bash
salt '*' vmadm.delete 186da9ab-7392-4f55-91a5-b8f1fe770543
salt '*' vmadm.delete nacl key... | [
"Delete",
"a",
"vm"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smartos_vmadm.py#L426-L456 | [
"def",
"delete",
"(",
"vm",
",",
"key",
"=",
"'uuid'",
")",
":",
"ret",
"=",
"{",
"}",
"if",
"key",
"not",
"in",
"[",
"'uuid'",
",",
"'alias'",
",",
"'hostname'",
"]",
":",
"ret",
"[",
"'Error'",
"]",
"=",
"'Key must be either uuid, alias or hostname'",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get | Output the JSON object describing a VM
vm : string
vm to be targeted
key : string [uuid|alias|hostname]
value type of 'vm' parameter
CLI Example:
.. code-block:: bash
salt '*' vmadm.get 186da9ab-7392-4f55-91a5-b8f1fe770543
salt '*' vmadm.get nacl key=alias | salt/modules/smartos_vmadm.py | def get(vm, key='uuid'):
'''
Output the JSON object describing a VM
vm : string
vm to be targeted
key : string [uuid|alias|hostname]
value type of 'vm' parameter
CLI Example:
.. code-block:: bash
salt '*' vmadm.get 186da9ab-7392-4f55-91a5-b8f1fe770543
salt '*'... | def get(vm, key='uuid'):
'''
Output the JSON object describing a VM
vm : string
vm to be targeted
key : string [uuid|alias|hostname]
value type of 'vm' parameter
CLI Example:
.. code-block:: bash
salt '*' vmadm.get 186da9ab-7392-4f55-91a5-b8f1fe770543
salt '*'... | [
"Output",
"the",
"JSON",
"object",
"describing",
"a",
"VM"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smartos_vmadm.py#L459-L489 | [
"def",
"get",
"(",
"vm",
",",
"key",
"=",
"'uuid'",
")",
":",
"ret",
"=",
"{",
"}",
"if",
"key",
"not",
"in",
"[",
"'uuid'",
",",
"'alias'",
",",
"'hostname'",
"]",
":",
"ret",
"[",
"'Error'",
"]",
"=",
"'Key must be either uuid, alias or hostname'",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | info | Lookup info on running kvm
vm : string
vm to be targeted
info_type : string [all|block|blockstats|chardev|cpus|kvm|pci|spice|version|vnc]
info type to return
key : string [uuid|alias|hostname]
value type of 'vm' parameter
CLI Example:
.. code-block:: bash
salt '*'... | salt/modules/smartos_vmadm.py | def info(vm, info_type='all', key='uuid'):
'''
Lookup info on running kvm
vm : string
vm to be targeted
info_type : string [all|block|blockstats|chardev|cpus|kvm|pci|spice|version|vnc]
info type to return
key : string [uuid|alias|hostname]
value type of 'vm' parameter
C... | def info(vm, info_type='all', key='uuid'):
'''
Lookup info on running kvm
vm : string
vm to be targeted
info_type : string [all|block|blockstats|chardev|cpus|kvm|pci|spice|version|vnc]
info type to return
key : string [uuid|alias|hostname]
value type of 'vm' parameter
C... | [
"Lookup",
"info",
"on",
"running",
"kvm"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smartos_vmadm.py#L492-L532 | [
"def",
"info",
"(",
"vm",
",",
"info_type",
"=",
"'all'",
",",
"key",
"=",
"'uuid'",
")",
":",
"ret",
"=",
"{",
"}",
"if",
"info_type",
"not",
"in",
"[",
"'all'",
",",
"'block'",
",",
"'blockstats'",
",",
"'chardev'",
",",
"'cpus'",
",",
"'kvm'",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | create_snapshot | Create snapshot of a vm
vm : string
vm to be targeted
name : string
snapshot name
The snapname must be 64 characters or less
and must only contain alphanumeric characters and
characters in the set [-_.:%] to comply with ZFS restrictions.
key : string [uui... | salt/modules/smartos_vmadm.py | def create_snapshot(vm, name, key='uuid'):
'''
Create snapshot of a vm
vm : string
vm to be targeted
name : string
snapshot name
The snapname must be 64 characters or less
and must only contain alphanumeric characters and
characters in the set [-_.:%]... | def create_snapshot(vm, name, key='uuid'):
'''
Create snapshot of a vm
vm : string
vm to be targeted
name : string
snapshot name
The snapname must be 64 characters or less
and must only contain alphanumeric characters and
characters in the set [-_.:%]... | [
"Create",
"snapshot",
"of",
"a",
"vm"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smartos_vmadm.py#L535-L583 | [
"def",
"create_snapshot",
"(",
"vm",
",",
"name",
",",
"key",
"=",
"'uuid'",
")",
":",
"ret",
"=",
"{",
"}",
"if",
"key",
"not",
"in",
"[",
"'uuid'",
",",
"'alias'",
",",
"'hostname'",
"]",
":",
"ret",
"[",
"'Error'",
"]",
"=",
"'Key must be either u... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | reprovision | Reprovision a vm
vm : string
vm to be reprovisioned
image : string
uuid of new image
key : string [uuid|alias|hostname]
value type of 'vm' parameter
CLI Example:
.. code-block:: bash
salt '*' vmadm.reprovision 186da9ab-7392-4f55-91a5-b8f1fe770543 c02a2044-c1bd-11e... | salt/modules/smartos_vmadm.py | def reprovision(vm, image, key='uuid'):
'''
Reprovision a vm
vm : string
vm to be reprovisioned
image : string
uuid of new image
key : string [uuid|alias|hostname]
value type of 'vm' parameter
CLI Example:
.. code-block:: bash
salt '*' vmadm.reprovision 18... | def reprovision(vm, image, key='uuid'):
'''
Reprovision a vm
vm : string
vm to be reprovisioned
image : string
uuid of new image
key : string [uuid|alias|hostname]
value type of 'vm' parameter
CLI Example:
.. code-block:: bash
salt '*' vmadm.reprovision 18... | [
"Reprovision",
"a",
"vm"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smartos_vmadm.py#L682-L720 | [
"def",
"reprovision",
"(",
"vm",
",",
"image",
",",
"key",
"=",
"'uuid'",
")",
":",
"ret",
"=",
"{",
"}",
"if",
"key",
"not",
"in",
"[",
"'uuid'",
",",
"'alias'",
",",
"'hostname'",
"]",
":",
"ret",
"[",
"'Error'",
"]",
"=",
"'Key must be either uuid... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | create | Create a new vm
from_file : string
json file to create the vm from -- if present, all other options will be ignored
kwargs : string|int|...
options to set for the vm
CLI Example:
.. code-block:: bash
salt '*' vmadm.create from_file=/tmp/new_vm.json
salt '*' vmadm.crea... | salt/modules/smartos_vmadm.py | def create(from_file=None, **kwargs):
'''
Create a new vm
from_file : string
json file to create the vm from -- if present, all other options will be ignored
kwargs : string|int|...
options to set for the vm
CLI Example:
.. code-block:: bash
salt '*' vmadm.create from... | def create(from_file=None, **kwargs):
'''
Create a new vm
from_file : string
json file to create the vm from -- if present, all other options will be ignored
kwargs : string|int|...
options to set for the vm
CLI Example:
.. code-block:: bash
salt '*' vmadm.create from... | [
"Create",
"a",
"new",
"vm"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smartos_vmadm.py#L723-L749 | [
"def",
"create",
"(",
"from_file",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"}",
"# prepare vmcfg",
"vmcfg",
"=",
"{",
"}",
"kwargs",
"=",
"salt",
".",
"utils",
".",
"args",
".",
"clean_kwargs",
"(",
"*",
"*",
"kwargs",
")",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | update | Update a new vm
vm : string
vm to be updated
from_file : string
json file to update the vm with -- if present, all other options will be ignored
key : string [uuid|alias|hostname]
value type of 'vm' parameter
kwargs : string|int|...
options to update for the vm
CLI ... | salt/modules/smartos_vmadm.py | def update(vm, from_file=None, key='uuid', **kwargs):
'''
Update a new vm
vm : string
vm to be updated
from_file : string
json file to update the vm with -- if present, all other options will be ignored
key : string [uuid|alias|hostname]
value type of 'vm' parameter
kwar... | def update(vm, from_file=None, key='uuid', **kwargs):
'''
Update a new vm
vm : string
vm to be updated
from_file : string
json file to update the vm with -- if present, all other options will be ignored
key : string [uuid|alias|hostname]
value type of 'vm' parameter
kwar... | [
"Update",
"a",
"new",
"vm"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smartos_vmadm.py#L752-L790 | [
"def",
"update",
"(",
"vm",
",",
"from_file",
"=",
"None",
",",
"key",
"=",
"'uuid'",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"}",
"# prepare vmcfg",
"vmcfg",
"=",
"{",
"}",
"kwargs",
"=",
"salt",
".",
"utils",
".",
"args",
".",
"clea... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | send | Send a vm to a directory
vm : string
vm to be sent
target : string
target directory
key : string [uuid|alias|hostname]
value type of 'vm' parameter
CLI Example:
.. code-block:: bash
salt '*' vmadm.send 186da9ab-7392-4f55-91a5-b8f1fe770543 /opt/backups
salt... | salt/modules/smartos_vmadm.py | def send(vm, target, key='uuid'):
'''
Send a vm to a directory
vm : string
vm to be sent
target : string
target directory
key : string [uuid|alias|hostname]
value type of 'vm' parameter
CLI Example:
.. code-block:: bash
salt '*' vmadm.send 186da9ab-7392-4f... | def send(vm, target, key='uuid'):
'''
Send a vm to a directory
vm : string
vm to be sent
target : string
target directory
key : string [uuid|alias|hostname]
value type of 'vm' parameter
CLI Example:
.. code-block:: bash
salt '*' vmadm.send 186da9ab-7392-4f... | [
"Send",
"a",
"vm",
"to",
"a",
"directory"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smartos_vmadm.py#L793-L848 | [
"def",
"send",
"(",
"vm",
",",
"target",
",",
"key",
"=",
"'uuid'",
")",
":",
"ret",
"=",
"{",
"}",
"if",
"key",
"not",
"in",
"[",
"'uuid'",
",",
"'alias'",
",",
"'hostname'",
"]",
":",
"ret",
"[",
"'Error'",
"]",
"=",
"'Key must be either uuid, alia... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | receive | Receive a vm from a directory
uuid : string
uuid of vm to be received
source : string
source directory
CLI Example:
.. code-block:: bash
salt '*' vmadm.receive 186da9ab-7392-4f55-91a5-b8f1fe770543 /opt/backups | salt/modules/smartos_vmadm.py | def receive(uuid, source):
'''
Receive a vm from a directory
uuid : string
uuid of vm to be received
source : string
source directory
CLI Example:
.. code-block:: bash
salt '*' vmadm.receive 186da9ab-7392-4f55-91a5-b8f1fe770543 /opt/backups
'''
ret = {}
if... | def receive(uuid, source):
'''
Receive a vm from a directory
uuid : string
uuid of vm to be received
source : string
source directory
CLI Example:
.. code-block:: bash
salt '*' vmadm.receive 186da9ab-7392-4f55-91a5-b8f1fe770543 /opt/backups
'''
ret = {}
if... | [
"Receive",
"a",
"vm",
"from",
"a",
"directory"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smartos_vmadm.py#L851-L905 | [
"def",
"receive",
"(",
"uuid",
",",
"source",
")",
":",
"ret",
"=",
"{",
"}",
"if",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
"source",
")",
":",
"ret",
"[",
"'Error'",
"]",
"=",
"'Source must be a directory or host'",
"return",
"ret",
"if",
"not",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | add_capability | Install a capability
Args:
capability (str): The capability to install
source (Optional[str]): The optional source of the capability. Default
is set by group policy and can be Windows Update.
limit_access (Optional[bool]): Prevent DISM from contacting Windows
Update ... | salt/modules/win_dism.py | def add_capability(capability,
source=None,
limit_access=False,
image=None,
restart=False):
'''
Install a capability
Args:
capability (str): The capability to install
source (Optional[str]): The optional source of t... | def add_capability(capability,
source=None,
limit_access=False,
image=None,
restart=False):
'''
Install a capability
Args:
capability (str): The capability to install
source (Optional[str]): The optional source of t... | [
"Install",
"a",
"capability"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_dism.py#L48-L98 | [
"def",
"add_capability",
"(",
"capability",
",",
"source",
"=",
"None",
",",
"limit_access",
"=",
"False",
",",
"image",
"=",
"None",
",",
"restart",
"=",
"False",
")",
":",
"if",
"salt",
".",
"utils",
".",
"versions",
".",
"version_cmp",
"(",
"__grains_... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | remove_capability | Uninstall a capability
Args:
capability(str): The capability to be removed
image (Optional[str]): The path to the root directory of an offline
Windows image. If `None` is passed, the running operating system is
targeted. Default is None.
restart (Optional[bool]): Reb... | salt/modules/win_dism.py | def remove_capability(capability, image=None, restart=False):
'''
Uninstall a capability
Args:
capability(str): The capability to be removed
image (Optional[str]): The path to the root directory of an offline
Windows image. If `None` is passed, the running operating system is
... | def remove_capability(capability, image=None, restart=False):
'''
Uninstall a capability
Args:
capability(str): The capability to be removed
image (Optional[str]): The path to the root directory of an offline
Windows image. If `None` is passed, the running operating system is
... | [
"Uninstall",
"a",
"capability"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_dism.py#L101-L139 | [
"def",
"remove_capability",
"(",
"capability",
",",
"image",
"=",
"None",
",",
"restart",
"=",
"False",
")",
":",
"if",
"salt",
".",
"utils",
".",
"versions",
".",
"version_cmp",
"(",
"__grains__",
"[",
"'osversion'",
"]",
",",
"'10'",
")",
"==",
"-",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_capabilities | List all capabilities on the system
Args:
image (Optional[str]): The path to the root directory of an offline
Windows image. If `None` is passed, the running operating system is
targeted. Default is None.
Raises:
NotImplementedError: For all versions of Windows that are... | salt/modules/win_dism.py | def get_capabilities(image=None):
'''
List all capabilities on the system
Args:
image (Optional[str]): The path to the root directory of an offline
Windows image. If `None` is passed, the running operating system is
targeted. Default is None.
Raises:
NotImplemen... | def get_capabilities(image=None):
'''
List all capabilities on the system
Args:
image (Optional[str]): The path to the root directory of an offline
Windows image. If `None` is passed, the running operating system is
targeted. Default is None.
Raises:
NotImplemen... | [
"List",
"all",
"capabilities",
"on",
"the",
"system"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_dism.py#L142-L179 | [
"def",
"get_capabilities",
"(",
"image",
"=",
"None",
")",
":",
"if",
"salt",
".",
"utils",
".",
"versions",
".",
"version_cmp",
"(",
"__grains__",
"[",
"'osversion'",
"]",
",",
"'10'",
")",
"==",
"-",
"1",
":",
"raise",
"NotImplementedError",
"(",
"'`in... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | installed_capabilities | List the capabilities installed on the system
Args:
image (Optional[str]): The path to the root directory of an offline
Windows image. If `None` is passed, the running operating system is
targeted. Default is None.
Raises:
NotImplementedError: For all versions of Window... | salt/modules/win_dism.py | def installed_capabilities(image=None):
'''
List the capabilities installed on the system
Args:
image (Optional[str]): The path to the root directory of an offline
Windows image. If `None` is passed, the running operating system is
targeted. Default is None.
Raises:
... | def installed_capabilities(image=None):
'''
List the capabilities installed on the system
Args:
image (Optional[str]): The path to the root directory of an offline
Windows image. If `None` is passed, the running operating system is
targeted. Default is None.
Raises:
... | [
"List",
"the",
"capabilities",
"installed",
"on",
"the",
"system"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_dism.py#L182-L208 | [
"def",
"installed_capabilities",
"(",
"image",
"=",
"None",
")",
":",
"if",
"salt",
".",
"utils",
".",
"versions",
".",
"version_cmp",
"(",
"__grains__",
"[",
"'osversion'",
"]",
",",
"'10'",
")",
"==",
"-",
"1",
":",
"raise",
"NotImplementedError",
"(",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | add_feature | Install a feature using DISM
Args:
feature (str): The feature to install
package (Optional[str]): The parent package for the feature. You do not
have to specify the package if it is the Windows Foundation Package.
Otherwise, use package to specify the parent package of the f... | salt/modules/win_dism.py | def add_feature(feature,
package=None,
source=None,
limit_access=False,
enable_parent=False,
image=None,
restart=False):
'''
Install a feature using DISM
Args:
feature (str): The feature to install
... | def add_feature(feature,
package=None,
source=None,
limit_access=False,
enable_parent=False,
image=None,
restart=False):
'''
Install a feature using DISM
Args:
feature (str): The feature to install
... | [
"Install",
"a",
"feature",
"using",
"DISM"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_dism.py#L240-L291 | [
"def",
"add_feature",
"(",
"feature",
",",
"package",
"=",
"None",
",",
"source",
"=",
"None",
",",
"limit_access",
"=",
"False",
",",
"enable_parent",
"=",
"False",
",",
"image",
"=",
"None",
",",
"restart",
"=",
"False",
")",
":",
"cmd",
"=",
"[",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | remove_feature | Disables the feature.
Args:
feature (str): The feature to uninstall
remove_payload (Optional[bool]): Remove the feature's payload. Must
supply source when enabling in the future.
image (Optional[str]): The path to the root directory of an offline
Windows image. If `N... | salt/modules/win_dism.py | def remove_feature(feature, remove_payload=False, image=None, restart=False):
'''
Disables the feature.
Args:
feature (str): The feature to uninstall
remove_payload (Optional[bool]): Remove the feature's payload. Must
supply source when enabling in the future.
image (Opt... | def remove_feature(feature, remove_payload=False, image=None, restart=False):
'''
Disables the feature.
Args:
feature (str): The feature to uninstall
remove_payload (Optional[bool]): Remove the feature's payload. Must
supply source when enabling in the future.
image (Opt... | [
"Disables",
"the",
"feature",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_dism.py#L294-L327 | [
"def",
"remove_feature",
"(",
"feature",
",",
"remove_payload",
"=",
"False",
",",
"image",
"=",
"None",
",",
"restart",
"=",
"False",
")",
":",
"cmd",
"=",
"[",
"'DISM'",
",",
"'/Quiet'",
",",
"'/Image:{0}'",
".",
"format",
"(",
"image",
")",
"if",
"i... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_features | List features on the system or in a package
Args:
package (Optional[str]): The full path to the package. Can be either a
.cab file or a folder. Should point to the original source of the
package, not to where the file is installed. You cannot use this
command to get pack... | salt/modules/win_dism.py | def get_features(package=None, image=None):
'''
List features on the system or in a package
Args:
package (Optional[str]): The full path to the package. Can be either a
.cab file or a folder. Should point to the original source of the
package, not to where the file is instal... | def get_features(package=None, image=None):
'''
List features on the system or in a package
Args:
package (Optional[str]): The full path to the package. Can be either a
.cab file or a folder. Should point to the original source of the
package, not to where the file is instal... | [
"List",
"features",
"on",
"the",
"system",
"or",
"in",
"a",
"package"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_dism.py#L330-L379 | [
"def",
"get_features",
"(",
"package",
"=",
"None",
",",
"image",
"=",
"None",
")",
":",
"cmd",
"=",
"[",
"'DISM'",
",",
"'/English'",
",",
"'/Image:{0}'",
".",
"format",
"(",
"image",
")",
"if",
"image",
"else",
"'/Online'",
",",
"'/Get-Features'",
"]",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | add_package | Install a package using DISM
Args:
package (str):
The package to install. Can be a .cab file, a .msu file, or a folder
.. note::
An `.msu` package is supported only when the target image is
offline, either mounted or applied.
ignore_check (O... | salt/modules/win_dism.py | def add_package(package,
ignore_check=False,
prevent_pending=False,
image=None,
restart=False):
'''
Install a package using DISM
Args:
package (str):
The package to install. Can be a .cab file, a .msu file, or a folder
... | def add_package(package,
ignore_check=False,
prevent_pending=False,
image=None,
restart=False):
'''
Install a package using DISM
Args:
package (str):
The package to install. Can be a .cab file, a .msu file, or a folder
... | [
"Install",
"a",
"package",
"using",
"DISM"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_dism.py#L424-L477 | [
"def",
"add_package",
"(",
"package",
",",
"ignore_check",
"=",
"False",
",",
"prevent_pending",
"=",
"False",
",",
"image",
"=",
"None",
",",
"restart",
"=",
"False",
")",
":",
"cmd",
"=",
"[",
"'DISM'",
",",
"'/Quiet'",
",",
"'/Image:{0}'",
".",
"forma... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | remove_package | Uninstall a package
Args:
package (str): The full path to the package. Can be either a .cab file
or a folder. Should point to the original source of the package, not
to where the file is installed. This can also be the name of a package as listed in
``dism.installed_pack... | salt/modules/win_dism.py | def remove_package(package, image=None, restart=False):
'''
Uninstall a package
Args:
package (str): The full path to the package. Can be either a .cab file
or a folder. Should point to the original source of the package, not
to where the file is installed. This can also be ... | def remove_package(package, image=None, restart=False):
'''
Uninstall a package
Args:
package (str): The full path to the package. Can be either a .cab file
or a folder. Should point to the original source of the package, not
to where the file is installed. This can also be ... | [
"Uninstall",
"a",
"package"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_dism.py#L480-L520 | [
"def",
"remove_package",
"(",
"package",
",",
"image",
"=",
"None",
",",
"restart",
"=",
"False",
")",
":",
"cmd",
"=",
"[",
"'DISM'",
",",
"'/Quiet'",
",",
"'/Image:{0}'",
".",
"format",
"(",
"image",
")",
"if",
"image",
"else",
"'/Online'",
",",
"'/R... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | package_info | Display information about a package
Args:
package (str): The full path to the package. Can be either a .cab file
or a folder. Should point to the original source of the package, not
to where the file is installed. You cannot use this command to get
package information fo... | salt/modules/win_dism.py | def package_info(package, image=None):
'''
Display information about a package
Args:
package (str): The full path to the package. Can be either a .cab file
or a folder. Should point to the original source of the package, not
to where the file is installed. You cannot use thi... | def package_info(package, image=None):
'''
Display information about a package
Args:
package (str): The full path to the package. Can be either a .cab file
or a folder. Should point to the original source of the package, not
to where the file is installed. You cannot use thi... | [
"Display",
"information",
"about",
"a",
"package"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_dism.py#L544-L589 | [
"def",
"package_info",
"(",
"package",
",",
"image",
"=",
"None",
")",
":",
"cmd",
"=",
"[",
"'DISM'",
",",
"'/English'",
",",
"'/Image:{0}'",
".",
"format",
"(",
"image",
")",
"if",
"image",
"else",
"'/Online'",
",",
"'/Get-PackageInfo'",
"]",
"if",
"'~... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | execute | Allow for the calling of execution modules via sudo.
This module is invoked by the minion if the ``sudo_user`` minion config is
present.
Example minion config:
.. code-block:: yaml
sudo_user: saltdev
Once this setting is made, any execution module call done by the minion will be
run... | salt/executors/sudo.py | def execute(opts, data, func, args, kwargs):
'''
Allow for the calling of execution modules via sudo.
This module is invoked by the minion if the ``sudo_user`` minion config is
present.
Example minion config:
.. code-block:: yaml
sudo_user: saltdev
Once this setting is made, any... | def execute(opts, data, func, args, kwargs):
'''
Allow for the calling of execution modules via sudo.
This module is invoked by the minion if the ``sudo_user`` minion config is
present.
Example minion config:
.. code-block:: yaml
sudo_user: saltdev
Once this setting is made, any... | [
"Allow",
"for",
"the",
"calling",
"of",
"execution",
"modules",
"via",
"sudo",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/executors/sudo.py#L25-L79 | [
"def",
"execute",
"(",
"opts",
",",
"data",
",",
"func",
",",
"args",
",",
"kwargs",
")",
":",
"cmd",
"=",
"[",
"'sudo'",
",",
"'-u'",
",",
"opts",
".",
"get",
"(",
"'sudo_user'",
")",
",",
"'salt-call'",
",",
"'--out'",
",",
"'json'",
",",
"'--met... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.