INSTRUCTION stringlengths 1 8.43k | RESPONSE stringlengths 75 104k |
|---|---|
Return a list of kubernetes deployments defined in the namespace | def deployments(namespace='default', **kwargs):
'''
Return a list of kubernetes deployments defined in the namespace
CLI Examples::
salt '*' kubernetes.deployments
salt '*' kubernetes.deployments namespace=default
'''
cfg = _setup_conn(**kwargs)
try:
api_instance = kube... |
Return a list of kubernetes services defined in the namespace | def services(namespace='default', **kwargs):
'''
Return a list of kubernetes services defined in the namespace
CLI Examples::
salt '*' kubernetes.services
salt '*' kubernetes.services namespace=default
'''
cfg = _setup_conn(**kwargs)
try:
api_instance = kubernetes.clien... |
Return a list of kubernetes pods defined in the namespace | def pods(namespace='default', **kwargs):
'''
Return a list of kubernetes pods defined in the namespace
CLI Examples::
salt '*' kubernetes.pods
salt '*' kubernetes.pods namespace=default
'''
cfg = _setup_conn(**kwargs)
try:
api_instance = kubernetes.client.CoreV1Api()
... |
Return a list of kubernetes configmaps defined in the namespace | def configmaps(namespace='default', **kwargs):
'''
Return a list of kubernetes configmaps defined in the namespace
CLI Examples::
salt '*' kubernetes.configmaps
salt '*' kubernetes.configmaps namespace=default
'''
cfg = _setup_conn(**kwargs)
try:
api_instance = kubernet... |
Return the kubernetes deployment defined by name and namespace | def show_deployment(name, namespace='default', **kwargs):
'''
Return the kubernetes deployment defined by name and namespace
CLI Examples::
salt '*' kubernetes.show_deployment my-nginx default
salt '*' kubernetes.show_deployment name=my-nginx namespace=default
'''
cfg = _setup_conn... |
Return information for a given namespace defined by the specified name | def show_namespace(name, **kwargs):
'''
Return information for a given namespace defined by the specified name
CLI Examples::
salt '*' kubernetes.show_namespace kube-system
'''
cfg = _setup_conn(**kwargs)
try:
api_instance = kubernetes.client.CoreV1Api()
api_response = ... |
Return the kubernetes secret defined by name and namespace. The secrets can be decoded if specified by the user. Warning: this has security implications. | def show_secret(name, namespace='default', decode=False, **kwargs):
'''
Return the kubernetes secret defined by name and namespace.
The secrets can be decoded if specified by the user. Warning: this has
security implications.
CLI Examples::
salt '*' kubernetes.show_secret confidential defa... |
Deletes the kubernetes deployment defined by name and namespace | def delete_deployment(name, namespace='default', **kwargs):
'''
Deletes the kubernetes deployment defined by name and namespace
CLI Examples::
salt '*' kubernetes.delete_deployment my-nginx
salt '*' kubernetes.delete_deployment name=my-nginx namespace=default
'''
cfg = _setup_conn(... |
Deletes the kubernetes service defined by name and namespace | def delete_service(name, namespace='default', **kwargs):
'''
Deletes the kubernetes service defined by name and namespace
CLI Examples::
salt '*' kubernetes.delete_service my-nginx default
salt '*' kubernetes.delete_service name=my-nginx namespace=default
'''
cfg = _setup_conn(**kw... |
Deletes the kubernetes pod defined by name and namespace | def delete_pod(name, namespace='default', **kwargs):
'''
Deletes the kubernetes pod defined by name and namespace
CLI Examples::
salt '*' kubernetes.delete_pod guestbook-708336848-5nl8c default
salt '*' kubernetes.delete_pod name=guestbook-708336848-5nl8c namespace=default
'''
cfg ... |
Creates the kubernetes deployment as defined by the user. | def create_pod(
name,
namespace,
metadata,
spec,
source,
template,
saltenv,
**kwargs):
'''
Creates the kubernetes deployment as defined by the user.
'''
body = __create_object_body(
kind='Pod',
obj_class=kubernetes.client.V1... |
Creates the kubernetes secret as defined by the user. | def create_secret(
name,
namespace='default',
data=None,
source=None,
template=None,
saltenv='base',
**kwargs):
'''
Creates the kubernetes secret as defined by the user.
CLI Examples::
salt 'minion1' kubernetes.create_secret \
pas... |
Creates the kubernetes configmap as defined by the user. | def create_configmap(
name,
namespace,
data,
source=None,
template=None,
saltenv='base',
**kwargs):
'''
Creates the kubernetes configmap as defined by the user.
CLI Examples::
salt 'minion1' kubernetes.create_configmap \
settings ... |
Creates a namespace with the specified name. | def create_namespace(
name,
**kwargs):
'''
Creates a namespace with the specified name.
CLI Example:
salt '*' kubernetes.create_namespace salt
salt '*' kubernetes.create_namespace name=salt
'''
meta_obj = kubernetes.client.V1ObjectMeta(name=name)
body = kubernet... |
Replaces an existing deployment with a new one defined by name and namespace having the specificed metadata and spec. | def replace_deployment(name,
metadata,
spec,
source,
template,
saltenv,
namespace='default',
**kwargs):
'''
Replaces an existing deployment with a new ... |
Replaces an existing service with a new one defined by name and namespace having the specificed metadata and spec. | def replace_service(name,
metadata,
spec,
source,
template,
old_service,
saltenv,
namespace='default',
**kwargs):
'''
Replaces an existing service with ... |
Create a Kubernetes Object body instance. | def __create_object_body(kind,
obj_class,
spec_creator,
name,
namespace,
metadata,
spec,
source,
template,
... |
Read a yaml file and if needed renders that using the specifieds templating. Returns the python objects defined inside of the file. | def __read_and_render_yaml_file(source,
template,
saltenv):
'''
Read a yaml file and, if needed, renders that using the specifieds
templating. Returns the python objects defined inside of the file.
'''
sfn = __salt__['cp.cache_file'](so... |
Converts a dictionary into kubernetes ObjectMetaV1 instance. | def __dict_to_object_meta(name, namespace, metadata):
'''
Converts a dictionary into kubernetes ObjectMetaV1 instance.
'''
meta_obj = kubernetes.client.V1ObjectMeta()
meta_obj.namespace = namespace
# Replicate `kubectl [create|replace|apply] --record`
if 'annotations' not in metadata:
... |
Converts a dictionary into kubernetes AppsV1beta1DeploymentSpec instance. | def __dict_to_deployment_spec(spec):
'''
Converts a dictionary into kubernetes AppsV1beta1DeploymentSpec instance.
'''
spec_obj = AppsV1beta1DeploymentSpec(template=spec.get('template', ''))
for key, value in iteritems(spec):
if hasattr(spec_obj, key):
setattr(spec_obj, key, valu... |
Converts a dictionary into kubernetes V1PodSpec instance. | def __dict_to_pod_spec(spec):
'''
Converts a dictionary into kubernetes V1PodSpec instance.
'''
spec_obj = kubernetes.client.V1PodSpec()
for key, value in iteritems(spec):
if hasattr(spec_obj, key):
setattr(spec_obj, key, value)
return spec_obj |
Converts a dictionary into kubernetes V1ServiceSpec instance. | def __dict_to_service_spec(spec):
'''
Converts a dictionary into kubernetes V1ServiceSpec instance.
'''
spec_obj = kubernetes.client.V1ServiceSpec()
for key, value in iteritems(spec): # pylint: disable=too-many-nested-blocks
if key == 'ports':
spec_obj.ports = []
for... |
Returns a dictionary that has string keys and values. | def __enforce_only_strings_dict(dictionary):
'''
Returns a dictionary that has string keys and values.
'''
ret = {}
for key, value in iteritems(dictionary):
ret[six.text_type(key)] = six.text_type(value)
return ret |
Accept the provided key | def accept(self, pub):
'''
Accept the provided key
'''
try:
with salt.utils.files.fopen(self.path, 'r') as fp_:
expiry = int(fp_.read())
except (OSError, IOError):
log.error(
'Request to sign key for minion \'%s\' on hyper \... |
Prepare the master to expect a signing request | def authorize(self):
'''
Prepare the master to expect a signing request
'''
with salt.utils.files.fopen(self.path, 'w+') as fp_:
fp_.write(str(int(time.time()))) # future lint: disable=blacklisted-function
return True |
Main entry point for patching the collections. abc and inspect standard library modules. | def patch(patch_inspect=True):
"""
Main entry point for patching the ``collections.abc`` and ``inspect``
standard library modules.
"""
PATCHED['collections.abc.Generator'] = _collections_abc.Generator = Generator
PATCHED['collections.abc.Coroutine'] = _collections_abc.Coroutine = Coroutine
P... |
Parses the auth/ authconfig line | def parse_auth(rule):
'''
Parses the auth/authconfig line
'''
parser = argparse.ArgumentParser()
rules = shlex.split(rule)
rules.pop(0)
noargs = ('back', 'test', 'nostart', 'kickstart', 'probe', 'enablecache',
'disablecache', 'disablenis', 'enableshadow', 'disableshadow',
... |
Parse the iscsiname line | def parse_iscsiname(rule):
'''
Parse the iscsiname line
'''
parser = argparse.ArgumentParser()
rules = shlex.split(rule)
rules.pop(0)
#parser.add_argument('iqn')
args = clean_args(vars(parser.parse_args(rules)))
parser = None
return args |
Parse the partition line | def parse_partition(rule):
'''
Parse the partition line
'''
parser = argparse.ArgumentParser()
rules = shlex.split(rule)
rules.pop(0)
parser.add_argument('mntpoint')
parser.add_argument('--size', dest='size', action='store')
parser.add_argument('--grow', dest='grow', action='store_tr... |
Parse the raid line | def parse_raid(rule):
'''
Parse the raid line
'''
parser = argparse.ArgumentParser()
rules = shlex.split(rule)
rules.pop(0)
partitions = []
newrules = []
for count in range(0, len(rules)):
if count == 0:
newrules.append(rules[count])
continue
... |
Parse the services line | def parse_services(rule):
'''
Parse the services line
'''
parser = argparse.ArgumentParser()
rules = shlex.split(rule)
rules.pop(0)
parser.add_argument('--disabled', dest='disabled', action='store')
parser.add_argument('--enabled', dest='enabled', action='store')
args = clean_args(v... |
Parse the updates line | def parse_updates(rule):
'''
Parse the updates line
'''
rules = shlex.split(rule)
rules.pop(0)
return {'url': rules[0]} if rules else True |
Parse the volgroup line | def parse_volgroup(rule):
'''
Parse the volgroup line
'''
parser = argparse.ArgumentParser()
rules = shlex.split(rule)
rules.pop(0)
partitions = []
newrules = []
for count in range(0, len(rules)):
if count == 0:
newrules.append(rules[count])
continue
... |
Convert a kickstart file to an SLS file | def mksls(src, dst=None):
'''
Convert a kickstart file to an SLS file
'''
mode = 'command'
sls = {}
ks_opts = {}
with salt.utils.files.fopen(src, 'r') as fh_:
for line in fh_:
if line.startswith('#'):
continue
if mode == 'command':
... |
Helper function that validates the minutes parameter. Can be any number between 1 and 180. Can also be the string values Never and Off. | def _validate_sleep(minutes):
'''
Helper function that validates the minutes parameter. Can be any number
between 1 and 180. Can also be the string values "Never" and "Off".
Because "On" and "Off" get converted to boolean values on the command line
it will error if "On" is passed
Returns: The ... |
Sets the amount of idle time until the machine sleeps. Sets the same value for Computer Display and Hard Disk. Pass Never or Off for computers that should never sleep. | def set_sleep(minutes):
'''
Sets the amount of idle time until the machine sleeps. Sets the same value
for Computer, Display, and Hard Disk. Pass "Never" or "Off" for computers
that should never sleep.
:param minutes: Can be an integer between 1 and 180 or "Never" or "Off"
:ptype: int, str
... |
Display the amount of idle time until the computer sleeps. | def get_computer_sleep():
'''
Display the amount of idle time until the computer sleeps.
:return: A string representing the sleep settings for the computer
:rtype: str
CLI Example:
..code-block:: bash
salt '*' power.get_computer_sleep
'''
ret = salt.utils.mac_utils.execute_re... |
Set the amount of idle time until the computer sleeps. Pass Never of Off to never sleep. | def set_computer_sleep(minutes):
'''
Set the amount of idle time until the computer sleeps. Pass "Never" of "Off"
to never sleep.
:param minutes: Can be an integer between 1 and 180 or "Never" or "Off"
:ptype: int, str
:return: True if successful, False if not
:rtype: bool
CLI Example... |
Display the amount of idle time until the display sleeps. | def get_display_sleep():
'''
Display the amount of idle time until the display sleeps.
:return: A string representing the sleep settings for the displey
:rtype: str
CLI Example:
..code-block:: bash
salt '*' power.get_display_sleep
'''
ret = salt.utils.mac_utils.execute_return... |
Set the amount of idle time until the display sleeps. Pass Never of Off to never sleep. | def set_display_sleep(minutes):
'''
Set the amount of idle time until the display sleeps. Pass "Never" of "Off"
to never sleep.
:param minutes: Can be an integer between 1 and 180 or "Never" or "Off"
:ptype: int, str
:return: True if successful, False if not
:rtype: bool
CLI Example:
... |
Display the amount of idle time until the hard disk sleeps. | def get_harddisk_sleep():
'''
Display the amount of idle time until the hard disk sleeps.
:return: A string representing the sleep settings for the hard disk
:rtype: str
CLI Example:
..code-block:: bash
salt '*' power.get_harddisk_sleep
'''
ret = salt.utils.mac_utils.execute_... |
Set the amount of idle time until the harddisk sleeps. Pass Never of Off to never sleep. | def set_harddisk_sleep(minutes):
'''
Set the amount of idle time until the harddisk sleeps. Pass "Never" of "Off"
to never sleep.
:param minutes: Can be an integer between 1 and 180 or "Never" or "Off"
:ptype: int, str
:return: True if successful, False if not
:rtype: bool
CLI Example... |
Displays whether wake on modem is on or off if supported | def get_wake_on_modem():
'''
Displays whether 'wake on modem' is on or off if supported
:return: A string value representing the "wake on modem" settings
:rtype: str
CLI Example:
.. code-block:: bash
salt '*' power.get_wake_on_modem
'''
ret = salt.utils.mac_utils.execute_retu... |
Set whether or not the computer will wake from sleep when modem activity is detected. | def set_wake_on_modem(enabled):
'''
Set whether or not the computer will wake from sleep when modem activity is
detected.
:param bool enabled: True to enable, False to disable. "On" and "Off" are
also acceptable values. Additionally you can pass 1 and 0 to represent
True and False respe... |
Displays whether wake on network is on or off if supported | def get_wake_on_network():
'''
Displays whether 'wake on network' is on or off if supported
:return: A string value representing the "wake on network" settings
:rtype: string
CLI Example:
.. code-block:: bash
salt '*' power.get_wake_on_network
'''
ret = salt.utils.mac_utils.e... |
Set whether or not the computer will wake from sleep when network activity is detected. | def set_wake_on_network(enabled):
'''
Set whether or not the computer will wake from sleep when network activity
is detected.
:param bool enabled: True to enable, False to disable. "On" and "Off" are
also acceptable values. Additionally you can pass 1 and 0 to represent
True and False r... |
Displays whether restart on power failure is on or off if supported | def get_restart_power_failure():
'''
Displays whether 'restart on power failure' is on or off if supported
:return: A string value representing the "restart on power failure" settings
:rtype: string
CLI Example:
.. code-block:: bash
salt '*' power.get_restart_power_failure
'''
... |
Set whether or not the computer will automatically restart after a power failure. | def set_restart_power_failure(enabled):
'''
Set whether or not the computer will automatically restart after a power
failure.
:param bool enabled: True to enable, False to disable. "On" and "Off" are
also acceptable values. Additionally you can pass 1 and 0 to represent
True and False r... |
Displays whether restart on freeze is on or off if supported | def get_restart_freeze():
'''
Displays whether 'restart on freeze' is on or off if supported
:return: A string value representing the "restart on freeze" settings
:rtype: string
CLI Example:
.. code-block:: bash
salt '*' power.get_restart_freeze
'''
ret = salt.utils.mac_utils... |
Specifies whether the server restarts automatically after a system freeze. This setting doesn t seem to be editable. The command completes successfully but the setting isn t actually updated. This is probably a macOS. The functions remains in case they ever fix the bug. | def set_restart_freeze(enabled):
'''
Specifies whether the server restarts automatically after a system freeze.
This setting doesn't seem to be editable. The command completes successfully
but the setting isn't actually updated. This is probably a macOS. The
functions remains in case they ever fix t... |
Displays whether allow power button to sleep computer is on or off if supported | def get_sleep_on_power_button():
'''
Displays whether 'allow power button to sleep computer' is on or off if
supported
:return: A string value representing the "allow power button to sleep
computer" settings
:rtype: string
CLI Example:
.. code-block:: bash
salt '*' power... |
Set whether or not the power button can sleep the computer. | def set_sleep_on_power_button(enabled):
'''
Set whether or not the power button can sleep the computer.
:param bool enabled: True to enable, False to disable. "On" and "Off" are
also acceptable values. Additionally you can pass 1 and 0 to represent
True and False respectively
:return: ... |
Return a conn object for the passed VM data | def get_conn(conn_type):
'''
Return a conn object for the passed VM data
'''
vm_ = get_configured_provider()
kwargs = vm_.copy() # pylint: disable=E1103
kwargs['username'] = vm_['username']
kwargs['auth_endpoint'] = vm_.get('identity_url', None)
kwargs['region'] = vm_['compute_region'... |
Initalize Docker on Minion as a Swarm Manager | def swarm_init(advertise_addr=str,
listen_addr=int,
force_new_cluster=bool):
'''
Initalize Docker on Minion as a Swarm Manager
advertise_addr
The ip of the manager
listen_addr
Listen address used for inter-manager communication,
as well as determin... |
Join a Swarm Worker to the cluster | def joinswarm(remote_addr=int,
listen_addr=int,
token=str):
'''
Join a Swarm Worker to the cluster
remote_addr
The manager node you want to connect to for the swarm
listen_addr
Listen address used for inter-manager communication if the node gets promoted to ... |
Force the minion to leave the swarm | def leave_swarm(force=bool):
'''
Force the minion to leave the swarm
force
Will force the minion/worker/manager to leave the swarm
CLI Example:
.. code-block:: bash
salt '*' swarm.leave_swarm force=False
'''
salt_return = {}
__context__['client'].swarm.leave(force=for... |
Create Docker Swarm Service Create | def service_create(image=str,
name=str,
command=str,
hostname=str,
replicas=int,
target_port=int,
published_port=int):
'''
Create Docker Swarm Service Create
image
The docker image
... |
Swarm Service Information | def swarm_service_info(service_name=str):
'''
Swarm Service Information
service_name
The name of the service that you want information on about the service
CLI Example:
.. code-block:: bash
salt '*' swarm.swarm_service_info service_name=Test_Service
'''
try:
salt_... |
Remove Swarm Service | def remove_service(service=str):
'''
Remove Swarm Service
service
The name of the service
CLI Example:
.. code-block:: bash
salt '*' swarm.remove_service service=Test_Service
'''
try:
salt_return = {}
client = docker.APIClient(base_url='unix://var/run/dock... |
Displays Information about Swarm Nodes with passing in the server | def node_ls(server=str):
'''
Displays Information about Swarm Nodes with passing in the server
server
The minion/server name
CLI Example:
.. code-block:: bash
salt '*' swarm.node_ls server=minion1
'''
try:
salt_return = {}
client = docker.APIClient(base_ur... |
Remove a node from a swarm and the target needs to be a swarm manager | def remove_node(node_id=str, force=bool):
'''
Remove a node from a swarm and the target needs to be a swarm manager
node_id
The node id from the return of swarm.node_ls
force
Forcefully remove the node/minion from the service
CLI Example:
.. code-block:: bash
salt '*... |
Updates docker swarm nodes/ needs to target a manager node/ minion | def update_node(availability=str,
node_name=str,
role=str,
node_id=str,
version=int):
'''
Updates docker swarm nodes/needs to target a manager node/minion
availability
Drain or Active
node_name
minion/node
role
... |
Ensure the IAM role exists. | def present(
name,
policy_document=None,
policy_document_from_pillars=None,
path=None,
policies=None,
policies_from_pillars=None,
managed_policies=None,
create_instance_profile=True,
region=None,
key=None,
keyid=None,
profil... |
List - type sub - items in policies don t happen to be order - sensitive but compare operations will render them unequal leading to non - idempotent state runs. We ll sort any list - type subitems before comparison to reduce the likelihood of false negatives. | def _sort_policy(doc):
'''
List-type sub-items in policies don't happen to be order-sensitive, but
compare operations will render them unequal, leading to non-idempotent
state runs. We'll sort any list-type subitems before comparison to reduce
the likelihood of false negatives.
'''
if isins... |
Ensure the IAM role is deleted. | def absent(
name,
region=None,
key=None,
keyid=None,
profile=None):
'''
Ensure the IAM role is deleted.
name
Name of the IAM role.
region
Region to connect to.
key
Secret key to be used.
keyid
Access key to be used.
... |
r Monitor the disk usage of the minion | def beacon(config):
r'''
Monitor the disk usage of the minion
Specify thresholds for each disk and only emit a beacon if any of them are
exceeded.
.. code-block:: yaml
beacons:
diskusage:
- /: 63%
- /mnt/nfs: 50%
Windows drives must be quoted to avoi... |
Compile tops | def top(**kwargs):
'''
Compile tops
'''
# Node definitions path will be retrieved from args (or set to default),
# then added to 'salt_data' dict that is passed to the 'get_pillars'
# function. The dictionary contains:
# - __opts__
# - __salt__
# - __grains__
# - ... |
Check to see if the host is responding. Returns False if the host didn t respond True otherwise. | def ping():
'''
Check to see if the host is responding. Returns False if the host didn't
respond, True otherwise.
CLI Example:
.. code-block:: bash
salt cisco-nso test.ping
'''
try:
client = _get_client()
client.info()
except SaltSystemExit as err:
log.... |
Get a data entry in a datastore | def set_data_value(datastore, path, data):
'''
Get a data entry in a datastore
:param datastore: The datastore, e.g. running, operational.
One of the NETCONF store IETF types
:type datastore: :class:`DatastoreType` (``str`` enum).
:param path: The device path to set the value at,
... |
Helper function to the grains from the proxied devices. | def _grains():
'''
Helper function to the grains from the proxied devices.
'''
client = _get_client()
# This is a collection of the configuration of all running devices under NSO
ret = client.get_datastore(DatastoreType.RUNNING)
GRAINS_CACHE.update(ret)
return GRAINS_CACHE |
Utility function to get all available update packages. | def _get_available(recommended=False, restart=False):
'''
Utility function to get all available update packages.
Sample return date:
{ 'updatename': '1.2.3-45', ... }
'''
cmd = ['softwareupdate', '--list']
out = salt.utils.mac_utils.execute_return_result(cmd)
# rexp parses lines that l... |
Ignore a specific program update. When an update is ignored the - and version number at the end will be omitted so SecUpd2014 - 001 - 1. 0 becomes SecUpd2014 - 001. It will be removed automatically if present. An update is successfully ignored when it no longer shows up after list_updates. | def ignore(name):
'''
Ignore a specific program update. When an update is ignored the '-' and
version number at the end will be omitted, so "SecUpd2014-001-1.0" becomes
"SecUpd2014-001". It will be removed automatically if present. An update
is successfully ignored when it no longer shows up after l... |
List all updates that have been ignored. Ignored updates are shown without the - and version number at the end this is how the softwareupdate command works. | def list_ignored():
'''
List all updates that have been ignored. Ignored updates are shown
without the '-' and version number at the end, this is how the
softwareupdate command works.
:return: The list of ignored updates
:rtype: list
CLI Example:
.. code-block:: bash
salt '*' ... |
Check the status of automatic update scheduling. | def schedule_enabled():
'''
Check the status of automatic update scheduling.
:return: True if scheduling is enabled, False if disabled
:rtype: bool
CLI Example:
.. code-block:: bash
salt '*' softwareupdate.schedule_enabled
'''
cmd = ['softwareupdate', '--schedule']
ret = ... |
Enable/ disable automatic update scheduling. | def schedule_enable(enable):
'''
Enable/disable automatic update scheduling.
:param enable: True/On/Yes/1 to turn on automatic updates. False/No/Off/0
to turn off automatic updates. If this value is empty, the current
status will be returned.
:type: bool str
:return: True if sched... |
Install all available updates. Returns a dictionary containing the name of the update and the status of its installation. | def update_all(recommended=False, restart=True):
'''
Install all available updates. Returns a dictionary containing the name
of the update and the status of its installation.
:param bool recommended: If set to True, only install the recommended
updates. If set to False (default) all updates are... |
Install a named update. | def update(name):
'''
Install a named update.
:param str name: The name of the of the update to install.
:return: True if successfully updated, otherwise False
:rtype: bool
CLI Example:
.. code-block:: bash
salt '*' softwareupdate.update <update-name>
'''
if not update_av... |
Return a list of all updates that have been downloaded locally. | def list_downloads():
'''
Return a list of all updates that have been downloaded locally.
:return: A list of updates that have been downloaded
:rtype: list
CLI Example:
.. code-block:: bash
salt '*' softwareupdate.list_downloads
'''
outfiles = []
for root, subFolder, files... |
Download a named update so that it can be installed later with the update or update_all functions | def download(name):
'''
Download a named update so that it can be installed later with the
``update`` or ``update_all`` functions
:param str name: The update to download.
:return: True if successful, otherwise False
:rtype: bool
CLI Example:
.. code-block:: bash
salt '*' soft... |
Download all available updates so that they can be installed later with the update or update_all functions. It returns a list of updates that are now downloaded. | def download_all(recommended=False, restart=True):
'''
Download all available updates so that they can be installed later with the
``update`` or ``update_all`` functions. It returns a list of updates that
are now downloaded.
:param bool recommended: If set to True, only install the recommended
... |
.. versionadded:: 2016. 3. 0 | def get_catalog():
'''
.. versionadded:: 2016.3.0
Get the current catalog being used for update lookups. Will return a url if
a custom catalog has been specified. Otherwise the word 'Default' will be
returned
:return: The catalog being used for update lookups
:rtype: str
CLI Example:
... |
.. versionadded:: 2016. 3. 0 | def set_catalog(url):
'''
.. versionadded:: 2016.3.0
Set the Software Update Catalog to the URL specified
:param str url: The url to the update catalog
:return: True if successful, False if not
:rtype: bool
CLI Example:
.. code-block:: bash
salt '*' softwareupdates.set_cata... |
.. versionadded:: 2016. 3. 0 | def reset_catalog():
'''
.. versionadded:: 2016.3.0
Reset the Software Update Catalog to the default.
:return: True if successful, False if not
:rtype: bool
CLI Example:
.. code-block:: bash
salt '*' softwareupdates.reset_catalog
'''
# This command always returns an erro... |
.. versionadded:: 2014. 7. 0 | def get_(key, recurse=False, profile=None, **kwargs):
'''
.. versionadded:: 2014.7.0
Get a value from etcd, by direct path. Returns None on failure.
CLI Examples:
.. code-block:: bash
salt myminion etcd.get /path/to/key
salt myminion etcd.get /path/to/key profile=my_etcd_config
... |
.. versionadded:: 2014. 7. 0 | def set_(key, value, profile=None, ttl=None, directory=False, **kwargs):
'''
.. versionadded:: 2014.7.0
Set a key in etcd by direct path. Optionally, create a directory
or set a TTL on the key. Returns None on failure.
CLI Example:
.. code-block:: bash
salt myminion etcd.set /path/t... |
.. versionadded:: 2016. 3. 0 | def update(fields, path='', profile=None, **kwargs):
'''
.. versionadded:: 2016.3.0
Sets a dictionary of values in one call. Useful for large updates
in syndic environments. The dictionary can contain a mix of formats
such as:
.. code-block:: python
{
'/some/example/key': ... |
.. versionadded:: 2016. 3. 0 | def watch(key, recurse=False, profile=None, timeout=0, index=None, **kwargs):
'''
.. versionadded:: 2016.3.0
Makes a best effort to watch for a key or tree change in etcd.
Returns a dict containing the new key value ( or None if the key was
deleted ), the modifiedIndex of the key, whether the key c... |
.. versionadded:: 2014. 7. 0 | def ls_(path='/', profile=None, **kwargs):
'''
.. versionadded:: 2014.7.0
Return all keys and dirs inside a specific path. Returns an empty dict on
failure.
CLI Example:
.. code-block:: bash
salt myminion etcd.ls /path/to/dir/
salt myminion etcd.ls /path/to/dir/ profile=my_e... |
.. versionadded:: 2014. 7. 0 | def rm_(key, recurse=False, profile=None, **kwargs):
'''
.. versionadded:: 2014.7.0
Delete a key from etcd. Returns True if the key was deleted, False if it was
not and None if there was a failure.
CLI Example:
.. code-block:: bash
salt myminion etcd.rm /path/to/key
salt my... |
.. versionadded:: 2014. 7. 0 | def tree(path='/', profile=None, **kwargs):
'''
.. versionadded:: 2014.7.0
Recurse through etcd and return all values. Returns None on failure.
CLI Example:
.. code-block:: bash
salt myminion etcd.tree
salt myminion etcd.tree profile=my_etcd_config
salt myminion etcd.tr... |
Return the credentials for AWS signing. This could be just the id and key specified in the provider configuration or if the id or key is set to the literal string use - instance - role - credentials creds will pull the instance role credentials from the meta data cache them and provide them instead. | def creds(provider):
'''
Return the credentials for AWS signing. This could be just the id and key
specified in the provider configuration, or if the id or key is set to the
literal string 'use-instance-role-credentials' creds will pull the instance
role credentials from the meta data, cache them, ... |
Sign a query against AWS services using Signature Version 2 Signing Process. This is documented at: | def sig2(method, endpoint, params, provider, aws_api_version):
'''
Sign a query against AWS services using Signature Version 2 Signing
Process. This is documented at:
http://docs.aws.amazon.com/general/latest/gr/signature-version-2.html
'''
timenow = datetime.utcnow()
timestamp = timenow.st... |
Sign a query against AWS services using Signature Version 4 Signing Process. This is documented at: | def sig4(method, endpoint, params, prov_dict,
aws_api_version=DEFAULT_AWS_API_VERSION, location=None,
product='ec2', uri='/', requesturl=None, data='', headers=None,
role_arn=None, payload_hash=None):
'''
Sign a query against AWS services using Signature Version 4 Signing
Process.... |
Get a signature key. See: | def _sig_key(key, date_stamp, regionName, serviceName):
'''
Get a signature key. See:
http://docs.aws.amazon.com/general/latest/gr/signature-v4-examples.html#signature-v4-examples-python
'''
kDate = _sign(('AWS4' + key).encode('utf-8'), date_stamp)
if regionName:
kRegion = _sign(kDate, ... |
Perform a query against AWS services using Signature Version 2 Signing Process. This is documented at: | def query(params=None, setname=None, requesturl=None, location=None,
return_url=False, return_root=False, opts=None, provider=None,
endpoint=None, product='ec2', sigver='2'):
'''
Perform a query against AWS services using Signature Version 2 Signing
Process. This is documented at:
h... |
Try to get region from instance identity document and cache it | def get_region_from_metadata():
'''
Try to get region from instance identity document and cache it
.. versionadded:: 2015.5.6
'''
global __Location__
if __Location__ == 'do-not-get-from-metadata':
log.debug('Previously failed to get AWS region from metadata. Not trying again.')
... |
Return the region to use in this order: opts [ location ] provider [ location ] get_region_from_metadata () DEFAULT_LOCATION | def get_location(opts=None, provider=None):
'''
Return the region to use, in this order:
opts['location']
provider['location']
get_region_from_metadata()
DEFAULT_LOCATION
'''
if opts is None:
opts = {}
ret = opts.get('location')
if ret is None and provider... |
Parses opts and generates a list of master ( host port ) addresses. By default looks for list of masters in opts [ master ] and uses opts [ master_port ] as the default port when otherwise not provided. | def extract_masters(opts, masters='master', port=None, raise_if_empty=True):
'''
Parses opts and generates a list of master (host,port) addresses.
By default looks for list of masters in opts['master'] and uses
opts['master_port'] as the default port when otherwise not provided.
Use the opts key gi... |
Parse hostname string and return a tuple of ( host port ) If port missing in hostname string then use default_port If anything is not a valid then return None | def parse_hostname(hostname, default_port):
'''
Parse hostname string and return a tuple of (host, port)
If port missing in hostname string then use default_port
If anything is not a valid then return None
hostname should contain a host and an option space delimited port
host port
As an at... |
Return all the line objects that match the expression in the regex argument. | def find_objects(config=None, config_path=None, regex=None, saltenv='base'):
'''
Return all the line objects that match the expression in the ``regex``
argument.
.. warning::
This function is mostly valuable when invoked from other Salt
components (i.e., execution modules, states, templ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.