INSTRUCTION stringlengths 1 8.43k | RESPONSE stringlengths 75 104k |
|---|---|
To put the specified host system in maintenance mode in this VMware environment | def enter_maintenance_mode(kwargs=None, call=None):
'''
To put the specified host system in maintenance mode in this VMware environment
CLI Example:
.. code-block:: bash
salt-cloud -f enter_maintenance_mode my-vmware-config host="myHostSystemName"
'''
if call != 'function':
ra... |
Create the specified folder path in this VMware environment | def create_folder(kwargs=None, call=None):
'''
Create the specified folder path in this VMware environment
.. note::
To create a Host and Cluster Folder under a Datacenter, specify
``path="/yourDatacenterName/host/yourFolderName"``
To create a Network Folder under a Datacenter, sp... |
Create a snapshot of the specified virtual machine in this VMware environment | def create_snapshot(name, kwargs=None, call=None):
'''
Create a snapshot of the specified virtual machine in this VMware
environment
.. note::
If the VM is powered on, the internal state of the VM (memory
dump) is included in the snapshot by default which will also set
the powe... |
Revert virtual machine to it s current snapshot. If no snapshot exists the state of the virtual machine remains unchanged | def revert_to_snapshot(name, kwargs=None, call=None):
'''
Revert virtual machine to it's current snapshot. If no snapshot
exists, the state of the virtual machine remains unchanged
.. note::
The virtual machine will be powered on if the power state of
the snapshot when it was created w... |
Remove a snapshot of the specified virtual machine in this VMware environment | def remove_snapshot(name, kwargs=None, call=None):
'''
Remove a snapshot of the specified virtual machine in this VMware environment
CLI Example:
.. code-block:: bash
salt-cloud -a remove_snapshot vmname snapshot_name="mySnapshot"
salt-cloud -a remove_snapshot vmname snapshot_name="my... |
Remove all the snapshots present for the specified virtual machine. | def remove_all_snapshots(name, kwargs=None, call=None):
'''
Remove all the snapshots present for the specified virtual machine.
.. note::
All the snapshots higher up in the hierarchy of the current snapshot tree
are consolidated and their virtual disks are merged. To override this
... |
Convert the specified virtual machine to template. | def convert_to_template(name, kwargs=None, call=None):
'''
Convert the specified virtual machine to template.
CLI Example:
.. code-block:: bash
salt-cloud -a convert_to_template vmname
'''
if call != 'action':
raise SaltCloudSystemExit(
'The convert_to_template act... |
Add a host system to the specified cluster or datacenter in this VMware environment | def add_host(kwargs=None, call=None):
'''
Add a host system to the specified cluster or datacenter in this VMware environment
.. note::
To use this function, you need to specify ``esxi_host_user`` and
``esxi_host_password`` under your provider configuration set up at
``/etc/salt/cl... |
Remove the specified host system from this VMware environment | def remove_host(kwargs=None, call=None):
'''
Remove the specified host system from this VMware environment
CLI Example:
.. code-block:: bash
salt-cloud -f remove_host my-vmware-config host="myHostSystemName"
'''
if call != 'function':
raise SaltCloudSystemExit(
'Th... |
Connect the specified host system in this VMware environment | def connect_host(kwargs=None, call=None):
'''
Connect the specified host system in this VMware environment
CLI Example:
.. code-block:: bash
salt-cloud -f connect_host my-vmware-config host="myHostSystemName"
'''
if call != 'function':
raise SaltCloudSystemExit(
'T... |
Create a new datastore cluster for the specified datacenter in this VMware environment | def create_datastore_cluster(kwargs=None, call=None):
'''
Create a new datastore cluster for the specified datacenter in this VMware environment
CLI Example:
.. code-block:: bash
salt-cloud -f create_datastore_cluster my-vmware-config name="datastoreClusterName" datacenter="datacenterName"
... |
Shut down the specified host system in this VMware environment | def shutdown_host(kwargs=None, call=None):
'''
Shut down the specified host system in this VMware environment
.. note::
If the host system is not in maintenance mode, it will not be shut down. If you
want to shut down the host system regardless of whether it is in maintenance mode,
... |
Creates a new usermacro. | def present(name, value, hostid=None, **kwargs):
'''
Creates a new usermacro.
:param name: name of the usermacro
:param value: value of the usermacro
:param hostid: id's of the hosts to apply the usermacro on, if missing a global usermacro is assumed.
:param _connection_user: Optional - zabbix... |
Ensures that the mediatype does not exist eventually deletes the mediatype. | def absent(name, hostid=None, **kwargs):
'''
Ensures that the mediatype does not exist, eventually deletes the mediatype.
:param name: name of the usermacro
:param hostid: id's of the hosts to apply the usermacro on, if missing a global usermacro is assumed.
:param _connection_user: Optional - zab... |
Return the DIFFERENCE of the result sets returned by each matching minion pool | def diff(*args, **kwargs):
'''
Return the DIFFERENCE of the result sets returned by each matching minion
pool
.. versionadded:: 2014.7.0
These pools are determined from the aggregated and sorted results of
a salt command.
This command displays the "diffs" as a series of 2-way differences ... |
A helper function which returns a dictionary of minion pools along with their matching result sets. Useful for developing other survey style functions. Optionally accepts a survey_sort = up or survey_sort = down kwargs for specifying sort order. Because the kwargs namespace of the salt and survey command are shared the... | def _get_pool_results(*args, **kwargs):
'''
A helper function which returns a dictionary of minion pools along with
their matching result sets.
Useful for developing other "survey style" functions.
Optionally accepts a "survey_sort=up" or "survey_sort=down" kwargs for
specifying sort order.
... |
Ensures that the artifact from artifactory exists at given location. If it doesn t exist then it will be downloaded. If it already exists then the checksum of existing file is checked against checksum in artifactory. If it is different then the step will fail. | def downloaded(name, artifact, target_dir='/tmp', target_file=None, use_literal_group_id=False):
'''
Ensures that the artifact from artifactory exists at given location. If it doesn't exist, then
it will be downloaded. If it already exists then the checksum of existing file is checked against checksum
i... |
Performs the same task as saltutil. sync_all module See: mod: saltutil module for full list of options <salt. modules. saltutil > | def sync_all(name, **kwargs):
'''
Performs the same task as saltutil.sync_all module
See :mod:`saltutil module for full list of options <salt.modules.saltutil>`
.. code-block:: yaml
sync_everything:
saltutil.sync_all:
- refresh: True
'''
ret = {'name': name, 'chan... |
Slack object method function to construct and execute on the API URL. | def _query(api_version=None, data=None):
'''
Slack object method function to construct and execute on the API URL.
:param api_key: The Random.org api key.
:param api_version: The version of Random.org api.
:param data: The data to be sent for POST method.
:return: The json... |
Show current usages statistics | def getUsage(api_key=None, api_version=None):
'''
Show current usages statistics
:param api_key: The Random.org api key.
:param api_version: The Random.org api version.
:return: The current usage statistics.
CLI Example:
.. code-block:: bash
salt '*' random_org.getUsage
... |
Generate random integers | def generateIntegers(api_key=None,
api_version=None,
**kwargs):
'''
Generate random integers
:param api_key: The Random.org api key.
:param api_version: The Random.org api version.
:param number: The number of integers to generate
:param minimum: The lo... |
Add key as an item to this OrderedSet then return its index. | def add(self, key):
"""
Add `key` as an item to this OrderedSet, then return its index.
If `key` is already in the OrderedSet, return the index it already
had.
"""
if key not in self.map:
self.map[key] = len(self.items)
self.items.append(key)
... |
Get the index of a given entry raising an IndexError if it s not present. | def index(self, key):
"""
Get the index of a given entry, raising an IndexError if it's not
present.
`key` can be an iterable of entries that is not a string, in which case
this returns a list of indices.
"""
if is_iterable(key):
return [self.index(su... |
Remove an element. Do not raise an exception if absent. | def discard(self, key):
"""
Remove an element. Do not raise an exception if absent.
The MutableSet mixin uses this to implement the .remove() method, which
*does* raise an error when asked to remove a non-existent item.
"""
if key in self:
i = self.map[key]
... |
.. versionadded:: 2014. 1. 0 | def update(branch=None, repo=None):
'''
.. versionadded:: 2014.1.0
.. versionchanged:: 2015.8.4
This runner function now supports the :ref:`git_pillar
configuration schema <git-pillar-configuration>` introduced in
2015.8.0. Additionally, the branch and repo can now be omitted to
... |
Set package in hold state meaning it will not be upgraded. | def held(name):
'''
Set package in 'hold' state, meaning it will not be upgraded.
name
The name of the package, e.g., 'tmux'
'''
ret = {'name': name, 'changes': {}, 'result': False, 'comment': ''}
state = __salt__['pkg.get_selections'](
pattern=name,
)
if not state:
... |
Returns a dict where the key is the daemon s name and the value a boolean indicating its status ( True: enabled or False: disabled ). Check the daemons started by the system in/ etc/ rc and configured in/ etc/ rc. conf and/ etc/ rc. conf. local. Also add to the dict all the localy enabled daemons via $pkg_scripts. | def _get_rc():
'''
Returns a dict where the key is the daemon's name and
the value a boolean indicating its status (True: enabled or False: disabled).
Check the daemons started by the system in /etc/rc and
configured in /etc/rc.conf and /etc/rc.conf.local.
Also add to the dict all the localy ena... |
.. versionadded:: 2014. 7. 0 | def available(name):
'''
.. versionadded:: 2014.7.0
Returns ``True`` if the specified service is available, otherwise returns
``False``.
CLI Example:
.. code-block:: bash
salt '*' service.available sshd
'''
path = '/etc/rc.d/{0}'.format(name)
return os.path.isfile(path) a... |
.. versionadded:: 2014. 7. 0 | def get_all():
'''
.. versionadded:: 2014.7.0
Return all available boot services
CLI Example:
.. code-block:: bash
salt '*' service.get_all
'''
services = []
if not os.path.isdir('/etc/rc.d'):
return services
for service in os.listdir('/etc/rc.d'):
# this ... |
.. versionadded:: 2014. 7. 0 | def get_disabled():
'''
.. versionadded:: 2014.7.0
Return a set of services that are installed but disabled
CLI Example:
.. code-block:: bash
salt '*' service.get_disabled
'''
services = []
for daemon, is_enabled in six.iteritems(_get_rc()):
if not is_enabled:
... |
Ensure that the named user is present with the specified properties. A passwordless user can be configured by omitting password and password_hash and setting allow_passwordless to True. | def present(name,
host='localhost',
password=None,
password_hash=None,
allow_passwordless=False,
unix_socket=False,
password_column=None,
**connection_args):
'''
Ensure that the named user is present with the specified propertie... |
Edit an ini file replacing one or more sections. Returns a dictionary containing the changes made. | def set_option(file_name, sections=None, separator='='):
'''
Edit an ini file, replacing one or more sections. Returns a dictionary
containing the changes made.
file_name
path of ini_file
sections : None
A dictionary representing the sections to be edited ini file
The keys ... |
Get value of a key from a section in an ini file. Returns None if no matching key was found. | def get_option(file_name, section, option, separator='='):
'''
Get value of a key from a section in an ini file. Returns ``None`` if
no matching key was found.
API Example:
.. code-block:: python
import salt
sc = salt.client.get_local_client()
sc.cmd('target', 'ini.get_opt... |
Remove a key/ value pair from a section in an ini file. Returns the value of the removed key or None if nothing was removed. | def remove_option(file_name, section, option, separator='='):
'''
Remove a key/value pair from a section in an ini file. Returns the value of
the removed key, or ``None`` if nothing was removed.
API Example:
.. code-block:: python
import salt
sc = salt.client.get_local_client()
... |
Retrieve a section from an ini file. Returns the section as dictionary. If the section is not found an empty dictionary is returned. | def get_section(file_name, section, separator='='):
'''
Retrieve a section from an ini file. Returns the section as dictionary. If
the section is not found, an empty dictionary is returned.
API Example:
.. code-block:: python
import salt
sc = salt.client.get_local_client()
... |
Remove a section in an ini file. Returns the removed section as dictionary or None if nothing was removed. | def remove_section(file_name, section, separator='='):
'''
Remove a section in an ini file. Returns the removed section as dictionary,
or ``None`` if nothing was removed.
API Example:
.. code-block:: python
import salt
sc = salt.client.get_local_client()
sc.cmd('target', '... |
Retrieve whole structure from an ini file and return it as dictionary. | def get_ini(file_name, separator='='):
'''
Retrieve whole structure from an ini file and return it as dictionary.
API Example:
.. code-block:: python
import salt
sc = salt.client.get_local_client()
sc.cmd('target', 'ini.get_ini',
[path_to_ini_file])
CLI Exa... |
Render the python module s components | def render(template, saltenv='base', sls='', tmplpath=None, **kws):
'''
Render the python module's components
:rtype: string
'''
template = tmplpath
if not os.path.isfile(template):
raise SaltRenderError('Template {0} is not a file!'.format(template))
tmp_data = salt.utils.template... |
Ensure the RabbitMQ VHost exists. | def present(name):
'''
Ensure the RabbitMQ VHost exists.
name
VHost name
user
Initial user permission to set on the VHost, if present
.. deprecated:: 2015.8.0
owner
Initial owner permission to set on the VHost, if present
.. deprecated:: 2015.8.0
conf
... |
properties = {} | def property_present(properties, admin_username='root', admin_password='calvin', host=None, **kwargs):
'''
properties = {}
'''
ret = {'name': host,
'context': {'Host': host},
'result': True,
'changes': {},
'comment': ''}
if host is None:
output =... |
Execute svn return the output of the command | def _run_svn(cmd, cwd, user, username, password, opts, **kwargs):
'''
Execute svn
return the output of the command
cmd
The command to run.
cwd
The path to the Subversion repository
user
Run svn as a user other than what the minion runs as
username
Connect ... |
Display the Subversion information from the checkout. | def info(cwd,
targets=None,
user=None,
username=None,
password=None,
fmt='str'):
'''
Display the Subversion information from the checkout.
cwd
The path to the Subversion repository
targets : None
files, directories, and URLs to pass to the c... |
Download a working copy of the remote Subversion repository directory or file | def checkout(cwd,
remote,
target=None,
user=None,
username=None,
password=None,
*opts):
'''
Download a working copy of the remote Subversion repository
directory or file
cwd
The path to the Subversion repository
... |
Update the current directory files or directories from the remote Subversion repository | def update(cwd, targets=None, user=None, username=None, password=None, *opts):
'''
Update the current directory, files, or directories from
the remote Subversion repository
cwd
The path to the Subversion repository
targets : None
files and directories to pass to the command as argu... |
Create an unversioned copy of a tree. | def export(cwd,
remote,
target=None,
user=None,
username=None,
password=None,
revision='HEAD',
*opts):
'''
Create an unversioned copy of a tree.
cwd
The path to the Subversion repository
remote : None
URL and ... |
Given bytes bytearray str or unicode ( python 2 ) return bytes ( str for python 2 ) | def to_bytes(s, encoding=None, errors='strict'):
'''
Given bytes, bytearray, str, or unicode (python 2), return bytes (str for
python 2)
'''
if encoding is None:
# Try utf-8 first, and fall back to detected encoding
encoding = ('utf-8', __salt_system_encoding__)
if not isinstance... |
Given str bytes bytearray or unicode ( py2 ) return str | def to_str(s, encoding=None, errors='strict', normalize=False):
'''
Given str, bytes, bytearray, or unicode (py2), return str
'''
def _normalize(s):
try:
return unicodedata.normalize('NFC', s) if normalize else s
except TypeError:
return s
if encoding is None... |
Convert the string name of a boolean to that boolean value. | def to_bool(text):
'''
Convert the string name of a boolean to that boolean value.
'''
downcased_text = six.text_type(text).strip().lower()
if downcased_text == 'false':
return False
elif downcased_text == 'true':
return True
return text |
Return a single or double quote if a string is wrapped in extra quotes. Otherwise return an empty string. | def is_quoted(value):
'''
Return a single or double quote, if a string is wrapped in extra quotes.
Otherwise return an empty string.
'''
ret = ''
if isinstance(value, six.string_types) \
and value[0] == value[-1] \
and value.startswith(('\'', '"')):
ret = value[0]... |
Detects if the passed string of data is binary or text | def is_binary(data):
'''
Detects if the passed string of data is binary or text
'''
if not data or not isinstance(data, (six.string_types, six.binary_type)):
return False
if isinstance(data, six.binary_type):
if b'\0' in data:
return True
elif str('\0') in data:
... |
Given a human - readable byte string ( e. g. 2G 30M ) return the number of bytes. Will return 0 if the argument has unexpected form. | def human_to_bytes(size):
'''
Given a human-readable byte string (e.g. 2G, 30M),
return the number of bytes. Will return 0 if the argument has
unexpected form.
.. versionadded:: 2018.3.0
'''
sbytes = size[:-1]
unit = size[-1]
if sbytes.isdigit():
sbytes = int(sbytes)
... |
Create a regular expression at runtime which should match ignoring the addition or deletion of white space or line breaks unless between commas | def build_whitespace_split_regex(text):
'''
Create a regular expression at runtime which should match ignoring the
addition or deletion of white space or line breaks, unless between commas
Example:
.. code-block:: python
>>> import re
>>> import salt.utils.stringutils
>>> ... |
Checks whether or not the passed value matches the specified expression. Tries to match expr first as a glob using fnmatch. fnmatch () and then tries to match expr as a regular expression. Originally designed to match minion IDs for whitelists/ blacklists. | def expr_match(line, expr):
'''
Checks whether or not the passed value matches the specified expression.
Tries to match expr first as a glob using fnmatch.fnmatch(), and then tries
to match expr as a regular expression. Originally designed to match minion
IDs for whitelists/blacklists.
Note tha... |
Check a whitelist and/ or blacklist to see if the value matches it. | def check_whitelist_blacklist(value, whitelist=None, blacklist=None):
'''
Check a whitelist and/or blacklist to see if the value matches it.
value
The item to check the whitelist and/or blacklist against.
whitelist
The list of items that are white-listed. If ``value`` is found
... |
Check for glob or regexp patterns for include_pat and exclude_pat in the path_str string and return True/ False conditions as follows. - Default: return True if no include_pat or exclude_pat patterns are supplied - If only include_pat or exclude_pat is supplied: return True if string passes the include_pat test or fail... | def check_include_exclude(path_str, include_pat=None, exclude_pat=None):
'''
Check for glob or regexp patterns for include_pat and exclude_pat in the
'path_str' string and return True/False conditions as follows.
- Default: return 'True' if no include_pat or exclude_pat patterns are
supplied
... |
Wrapper around print () that suppresses tracebacks on broken pipes ( i. e. when salt output is piped to less and less is stopped prematurely ). | def print_cli(msg, retries=10, step=0.01):
'''
Wrapper around print() that suppresses tracebacks on broken pipes (i.e.
when salt output is piped to less and less is stopped prematurely).
'''
while retries:
try:
try:
print(msg)
except UnicodeEncodeError... |
Returns debugging context around a line in a given string | def get_context(template, line, num_lines=5, marker=None):
'''
Returns debugging context around a line in a given string
Returns:: string
'''
template_lines = template.splitlines()
num_template_lines = len(template_lines)
# In test mode, a single line template would return a crazy line num... |
Perform diff on two iterables containing lines from two files and return the diff as as string. Lines are normalized to str types to avoid issues with unicode on PY2. | def get_diff(a, b, *args, **kwargs):
'''
Perform diff on two iterables containing lines from two files, and return
the diff as as string. Lines are normalized to str types to avoid issues
with unicode on PY2.
'''
encoding = ('utf-8', 'latin-1', __salt_system_encoding__)
# Late import to avoi... |
Converts camelCase ( or CamelCase ) to snake_case. From https:// codereview. stackexchange. com/ questions/ 185966/ functions - to - convert - camelcase - strings - to - snake - case | def camel_to_snake_case(camel_input):
'''
Converts camelCase (or CamelCase) to snake_case.
From https://codereview.stackexchange.com/questions/185966/functions-to-convert-camelcase-strings-to-snake-case
:param str camel_input: The camelcase or CamelCase string to convert to snake_case
:return str
... |
Converts snake_case to camelCase ( or CamelCase if uppercamel is True ). Inspired by https:// codereview. stackexchange. com/ questions/ 85311/ transform - snake - case - to - camelcase | def snake_to_camel_case(snake_input, uppercamel=False):
'''
Converts snake_case to camelCase (or CamelCase if uppercamel is ``True``).
Inspired by https://codereview.stackexchange.com/questions/85311/transform-snake-case-to-camelcase
:param str snake_input: The input snake_case string to convert to cam... |
Queries the specified network device for rx/ tx ring parameter information | def show_ring(devname):
'''
Queries the specified network device for rx/tx ring parameter information
CLI Example:
.. code-block:: bash
salt '*' ethtool.show_ring <devname>
'''
try:
ring = ethtool.get_ringparam(devname)
except IOError:
log.error('Ring parameters n... |
Queries the specified network device for coalescing information | def show_coalesce(devname):
'''
Queries the specified network device for coalescing information
CLI Example:
.. code-block:: bash
salt '*' ethtool.show_coalesce <devname>
'''
try:
coalesce = ethtool.get_coalesce(devname)
except IOError:
log.error('Interrupt coales... |
Queries the specified network device for associated driver information | def show_driver(devname):
'''
Queries the specified network device for associated driver information
CLI Example:
.. code-block:: bash
salt '*' ethtool.show_driver <devname>
'''
try:
module = ethtool.get_module(devname)
except IOError:
log.error('Driver informatio... |
Changes the rx/ tx ring parameters of the specified network device | def set_ring(devname, **kwargs):
'''
Changes the rx/tx ring parameters of the specified network device
CLI Example:
.. code-block:: bash
salt '*' ethtool.set_ring <devname> [rx=N] [rx_mini=N] [rx_jumbo=N] [tx=N]
'''
try:
ring = ethtool.get_ringparam(devname)
except IOErro... |
Changes the coalescing settings of the specified network device | def set_coalesce(devname, **kwargs):
'''
Changes the coalescing settings of the specified network device
CLI Example:
.. code-block:: bash
salt '*' ethtool.set_coalesce <devname> [adaptive_rx=on|off] [adaptive_tx=on|off] [rx_usecs=N] [rx_frames=N]
[rx_usecs_irq=N] [rx_frames_irq=N... |
Queries the specified network device for the state of protocol offload and other features | def show_offload(devname):
'''
Queries the specified network device for the state of protocol offload and other features
CLI Example:
.. code-block:: bash
salt '*' ethtool.show_offload <devname>
'''
try:
sg = ethtool.get_sg(devname) and "on" or "off"
except IOError:
... |
Changes the offload parameters and other features of the specified network device | def set_offload(devname, **kwargs):
'''
Changes the offload parameters and other features of the specified network device
CLI Example:
.. code-block:: bash
salt '*' ethtool.set_offload <devname> tcp_segmentation_offload=on
'''
for param, value in kwargs.items():
if param == '... |
Return a Unix timestamp as a string of digits: return: | def _microtime():
'''
Return a Unix timestamp as a string of digits
:return:
'''
val1, val2 = math.modf(time.time())
val2 = int(val2)
return '{0:f}{1}'.format(val1, val2) |
Return the base path for certs from CLI or from options | def cert_base_path(cacert_path=None):
'''
Return the base path for certs from CLI or from options
cacert_path
absolute path to ca certificates root directory
CLI Example:
.. code-block:: bash
salt '*' tls.cert_base_path
'''
if not cacert_path:
cacert_path = __cont... |
Return a serial number in hex using os. urandom () and a Unix timestamp in microseconds. | def _new_serial(ca_name):
'''
Return a serial number in hex using os.urandom() and a Unix timestamp
in microseconds.
ca_name
name of the CA
CN
common name in the request
'''
hashnum = int(
binascii.hexlify(
b'_'.join((
salt.utils.stringuti... |
Get basic info to write out to the index. txt | def _get_basic_info(ca_name, cert, ca_dir=None):
'''
Get basic info to write out to the index.txt
'''
if ca_dir is None:
ca_dir = '{0}/{1}'.format(_cert_base_path(), ca_name)
index_file = "{0}/index.txt".format(ca_dir)
cert = _read_cert(cert)
expire_date = _four_digit_year_to_two_d... |
write out the index. txt database file in the appropriate directory to track certificates | def _write_cert_to_database(ca_name, cert, cacert_path=None, status='V'):
'''
write out the index.txt database file in the appropriate directory to
track certificates
ca_name
name of the CA
cert
certificate to be recorded
'''
set_ca_path(cacert_path)
ca_dir = '{0}/{1}'.f... |
Check that the X509 version is correct ( was incorrectly set in previous salt versions ). This will fix the version if needed. | def maybe_fix_ssl_version(ca_name, cacert_path=None, ca_filename=None):
'''
Check that the X509 version is correct
(was incorrectly set in previous salt versions).
This will fix the version if needed.
ca_name
ca authority name
cacert_path
absolute path to ca certificates root di... |
Verify whether a Certificate Authority ( CA ) already exists | def ca_exists(ca_name, cacert_path=None, ca_filename=None):
'''
Verify whether a Certificate Authority (CA) already exists
ca_name
name of the CA
cacert_path
absolute path to ca certificates root directory
ca_filename
alternative filename for the CA
.. versionadded:... |
Get the certificate path or content | def get_ca(ca_name, as_text=False, cacert_path=None):
'''
Get the certificate path or content
ca_name
name of the CA
as_text
if true, return the certificate content instead of the path
cacert_path
absolute path to ca certificates root directory
CLI Example:
.. code... |
Get the certificate path or content | def get_ca_signed_key(ca_name,
CN='localhost',
as_text=False,
cacert_path=None,
key_filename=None):
'''
Get the certificate path or content
ca_name
name of the CA
CN
common name of the certificate
... |
.. versionadded:: Neon | def validate(cert, ca_name, crl_file):
'''
.. versionadded:: Neon
Validate a certificate against a given CA/CRL.
cert
path to the certifiate PEM file or string
ca_name
name of the CA
crl_file
full path to the CRL file
'''
store = OpenSSL.crypto.X509Store()
... |
Returns a datetime. datetime object | def _get_expiration_date(cert):
'''
Returns a datetime.datetime object
'''
cert_obj = _read_cert(cert)
if cert_obj is None:
raise CommandExecutionError(
'Failed to read cert from {0}, see log for details'.format(cert)
)
return datetime.strptime(
salt.utils.s... |
Create a Certificate Authority ( CA ) | def create_ca(ca_name,
bits=2048,
days=365,
CN='localhost',
C='US',
ST='Utah',
L='Salt Lake City',
O='SaltStack',
OU=None,
emailAddress=None,
fixmode=False,
cacert_pa... |
Fetch X509 and CSR extension definitions from tls: extensions: ( common|server|client ) or set them to standard defaults. | def get_extensions(cert_type):
'''
Fetch X509 and CSR extension definitions from tls:extensions:
(common|server|client) or set them to standard defaults.
.. versionadded:: 2015.8.0
cert_type:
The type of certificate such as ``server`` or ``client``.
CLI Example:
.. code-block:: b... |
Create a Certificate Signing Request ( CSR ) for a particular Certificate Authority ( CA ) | def create_csr(ca_name,
bits=2048,
CN='localhost',
C='US',
ST='Utah',
L='Salt Lake City',
O='SaltStack',
OU=None,
emailAddress=None,
subjectAltName=None,
cacert_path=None... |
Create a Self - Signed Certificate ( CERT ) | def create_self_signed_cert(tls_dir='tls',
bits=2048,
days=365,
CN='localhost',
C='US',
ST='Utah',
L='Salt Lake City',
O='Sa... |
Create a Certificate ( CERT ) signed by a named Certificate Authority ( CA ) | def create_ca_signed_cert(ca_name,
CN,
days=365,
cacert_path=None,
ca_filename=None,
cert_path=None,
cert_filename=None,
digest='sha256',
... |
Create a PKCS#12 browser certificate for a particular Certificate ( CN ) | def create_pkcs12(ca_name, CN, passphrase='', cacert_path=None, replace=False):
'''
Create a PKCS#12 browser certificate for a particular Certificate (CN)
ca_name
name of the CA
CN
common name matching the certificate signing request
passphrase
used to unlock the PKCS#12 cer... |
Return information for a particular certificate | def cert_info(cert, digest='sha256'):
'''
Return information for a particular certificate
cert
path to the certifiate PEM file or string
.. versionchanged:: 2018.3.4
digest
what digest to use for fingerprinting
CLI Example:
.. code-block:: bash
salt '*' tls.... |
Create an empty Certificate Revocation List. | def create_empty_crl(
ca_name,
cacert_path=None,
ca_filename=None,
crl_file=None,
digest='sha256'):
'''
Create an empty Certificate Revocation List.
.. versionadded:: 2015.8.0
ca_name
name of the CA
cacert_path
absolute path to ca certificate... |
Revoke a certificate. | def revoke_cert(
ca_name,
CN,
cacert_path=None,
ca_filename=None,
cert_path=None,
cert_filename=None,
crl_file=None,
digest='sha256',
):
'''
Revoke a certificate.
.. versionadded:: 2015.8.0
ca_name
Name of the CA.
CN
... |
convert a seco. range range into a list target | def _convert_range_to_list(tgt, range_server):
'''
convert a seco.range range into a list target
'''
r = seco.range.Range(range_server)
try:
return r.expand(tgt)
except seco.range.RangeException as err:
log.error('Range server exception: %s', err)
return [] |
Filter minions by a generic filter. | def _ret_minions(self, filter_):
'''
Filter minions by a generic filter.
'''
minions = {}
for minion in filter_(self.raw):
data = self.get_data(minion)
if data:
minions[minion] = data.copy()
return minions |
Return minions that match via glob | def ret_glob_minions(self):
'''
Return minions that match via glob
'''
fnfilter = functools.partial(fnmatch.filter, pat=self.tgt)
return self._ret_minions(fnfilter) |
Return minions that match via pcre | def ret_pcre_minions(self):
'''
Return minions that match via pcre
'''
tgt = re.compile(self.tgt)
refilter = functools.partial(filter, tgt.match)
return self._ret_minions(refilter) |
Return minions that match via list | def ret_list_minions(self):
'''
Return minions that match via list
'''
tgt = _tgt_set(self.tgt)
return self._ret_minions(tgt.intersection) |
Return minions which match the special list - only groups defined by ssh_list_nodegroups | def ret_nodegroup_minions(self):
'''
Return minions which match the special list-only groups defined by
ssh_list_nodegroups
'''
nodegroup = __opts__.get('ssh_list_nodegroups', {}).get(self.tgt, [])
nodegroup = _tgt_set(nodegroup)
return self._ret_minions(nodegroup... |
Return minions that are returned by a range query | def ret_range_minions(self):
'''
Return minions that are returned by a range query
'''
if HAS_RANGE is False:
raise RuntimeError("Python lib 'seco.range' is not available")
minions = {}
range_hosts = _convert_range_to_list(self.tgt, __opts__['range_server'])
... |
Return the configured ip | def get_data(self, minion):
'''
Return the configured ip
'''
ret = copy.deepcopy(__opts__.get('roster_defaults', {}))
if isinstance(self.raw[minion], six.string_types):
ret.update({'host': self.raw[minion]})
return ret
elif isinstance(self.raw[mini... |
Rather basic.... | def output(data, **kwargs): # pylint: disable=unused-argument
'''
Rather basic....
'''
if not isinstance(data, six.string_types):
data = six.text_type(data)
return salt.utils.stringutils.to_unicode(data) |
Return a list of the images that are on the provider | def avail_images(call=None):
'''
Return a list of the images that are on the provider
'''
if call == 'action':
raise SaltCloudSystemExit(
'The avail_images function must be called with '
'-f or --function, or with the --list-images option'
)
items = query(act... |
Return a list of the VMs that are on the provider | def list_nodes(call=None):
'''
Return a list of the VMs that are on the provider
'''
if call == 'action':
raise SaltCloudSystemExit(
'The list_nodes function must be called with -f or --function.'
)
ret = {}
items = query(action='ve')
for item in items:
... |
Build and submit the XML to create a node | def create_node(vm_):
'''
Build and submit the XML to create a node
'''
# Start the tree
content = ET.Element('ve')
# Name of the instance
name = ET.SubElement(content, 'name')
name.text = vm_['name']
# Description, defaults to name
desc = ET.SubElement(content, 'description')
... |
Create a single VM from a data dict | def create(vm_):
'''
Create a single VM from a data dict
'''
try:
# Check for required profile parameters before sending any API calls.
if vm_['profile'] and config.is_profile_configured(__opts__,
__active_provider_name__ or 'par... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.