Code stringlengths 103 85.9k | Summary listlengths 0 94 |
|---|---|
Please provide a description of the function:def find_file(path, saltenv='base', **kwargs):
'''
Search the environment for the relative path.
'''
if 'env' in kwargs:
# "env" is not supported; Use "saltenv".
kwargs.pop('env')
path = os.path.normpath(path)
fnd = {'path': '',
... | [] |
Please provide a description of the function:def serve_file(load, fnd):
'''
Return a chunk from a file based on the data received
'''
if 'env' in load:
# "env" is not supported; Use "saltenv".
load.pop('env')
ret = {'data': '',
'dest': ''}
if 'path' not in load or 'lo... | [] |
Please provide a description of the function:def update():
'''
When we are asked to update (regular interval) lets reap the cache
'''
try:
salt.fileserver.reap_fileserver_cache_dir(
os.path.join(__opts__['cachedir'], 'roots', 'hash'),
find_file
)
except (IOErr... | [] |
Please provide a description of the function:def _file_lists(load, form):
'''
Return a dict containing the file lists for files, dirs, emtydirs and symlinks
'''
if 'env' in load:
# "env" is not supported; Use "saltenv".
load.pop('env')
saltenv = load['saltenv']
if saltenv not in... | [] |
Please provide a description of the function:def symlink_list(load):
'''
Return a dict of all symlinks based on a given path on the Master
'''
if 'env' in load:
# "env" is not supported; Use "saltenv".
load.pop('env')
ret = {}
if load['saltenv'] not in __opts__['file_roots'] and... | [] |
Please provide a description of the function:def validate(config):
'''
Validate the beacon configuration
'''
# Configuration for load beacon should be a list of dicts
if not isinstance(config, list):
return False, ('Configuration for load beacon must be a list.')
else:
_config =... | [] |
Please provide a description of the function:def beacon(config):
'''
Emit the load averages of this host.
Specify thresholds for each load average
and only emit a beacon if any of them are
exceeded.
`onchangeonly`: when `onchangeonly` is True the beacon will fire
events only when the load ... | [] |
Please provide a description of the function:def init(storage_backend='dir', trust_password=None, network_address=None,
network_port=None, storage_create_device=None,
storage_create_loop=None, storage_pool=None):
'''
Calls lxd init --auto -- opts
storage_backend :
Storage backend ... | [] |
Please provide a description of the function:def config_set(key, value):
'''
Set an LXD daemon config option
CLI Examples:
To listen on IPv4 and IPv6 port 8443,
you can omit the :8443 its the default:
.. code-block:: bash
salt '*' lxd.config_set core.https_address [::]:8443
To s... | [] |
Please provide a description of the function:def config_get(key):
'''
Get an LXD daemon config option
key :
The key of the config value to retrieve
CLI Examples:
.. code-block:: bash
salt '*' lxd.config_get core.https_address
'''
cmd = 'lxc config get "{0}"'.format(
... | [] |
Please provide a description of the function:def pylxd_client_get(remote_addr=None, cert=None, key=None, verify_cert=True):
'''
Get an pyxld client, this is not ment to be runned over the CLI.
remote_addr :
An URL to a remote Server, you also have to give cert and key if you
provide remote_... | [] |
Please provide a description of the function:def pylxd_save_object(obj):
''' Saves an object (profile/image/container) and
translate its execpetion on failure
obj :
The object to save
This is an internal method, no CLI Example.
'''
try:
obj.save()
except pylxd.exception... | [] |
Please provide a description of the function:def authenticate(remote_addr, password, cert, key, verify_cert=True):
'''
Authenticate with a remote LXDaemon.
remote_addr :
An URL to a remote Server, you also have to give cert and key if you
provide remote_addr and its a TCP Address!
... | [] |
Please provide a description of the function:def container_list(list_names=False, remote_addr=None,
cert=None, key=None, verify_cert=True):
'''
Lists containers
list_names : False
Only return a list of names when True
remote_addr :
An URL to a remote Server, you also... | [] |
Please provide a description of the function:def container_create(name, source, profiles=None,
config=None, devices=None, architecture='x86_64',
ephemeral=False, wait=True,
remote_addr=None, cert=None, key=None, verify_cert=True,
_raw=F... | [] |
Please provide a description of the function:def container_get(name=None, remote_addr=None,
cert=None, key=None, verify_cert=True, _raw=False):
''' Gets a container from the LXD
name :
The name of the container to get.
remote_addr :
An URL to a remote Serv... | [] |
Please provide a description of the function:def container_delete(name, remote_addr=None,
cert=None, key=None, verify_cert=True):
'''
Delete a container
name :
Name of the container to delete
remote_addr :
An URL to a remote Server, you also have to give cert and k... | [] |
Please provide a description of the function:def container_rename(name, newname, remote_addr=None,
cert=None, key=None, verify_cert=True):
'''
Rename a container
name :
Name of the container to Rename
newname :
The new name of the contianer
remote_addr :
... | [] |
Please provide a description of the function:def container_state(name=None, remote_addr=None,
cert=None, key=None, verify_cert=True):
'''
Get container state
remote_addr :
An URL to a remote Server, you also have to give cert and key if
you provide remote_addr and its a ... | [] |
Please provide a description of the function:def container_start(name, remote_addr=None,
cert=None, key=None, verify_cert=True):
'''
Start a container
name :
Name of the container to start
remote_addr :
An URL to a remote Server, you also have to give cert and key i... | [] |
Please provide a description of the function:def container_stop(name, timeout=30, force=True, remote_addr=None,
cert=None, key=None, verify_cert=True):
'''
Stop a container
name :
Name of the container to stop
remote_addr :
An URL to a remote Server, you also have to... | [] |
Please provide a description of the function:def container_restart(name, remote_addr=None,
cert=None, key=None, verify_cert=True):
'''
Restart a container
name :
Name of the container to restart
remote_addr :
An URL to a remote Server, you also have to give cert a... | [] |
Please provide a description of the function:def container_freeze(name, remote_addr=None,
cert=None, key=None, verify_cert=True):
'''
Freeze a container
name :
Name of the container to freeze
remote_addr :
An URL to a remote Server, you also have to give cert and k... | [] |
Please provide a description of the function:def container_unfreeze(name, remote_addr=None,
cert=None, key=None, verify_cert=True):
'''
Unfreeze a container
name :
Name of the container to unfreeze
remote_addr :
An URL to a remote Server, you also have to give ce... | [] |
Please provide a description of the function:def container_migrate(name,
stop_and_start=False,
remote_addr=None,
cert=None,
key=None,
verify_cert=True,
src_remote_addr=None,
... | [] |
Please provide a description of the function:def container_config_get(name, config_key, remote_addr=None,
cert=None, key=None, verify_cert=True):
'''
Get a container config value
name :
Name of the container
config_key :
The config key to retrieve
remote_a... | [] |
Please provide a description of the function:def container_config_set(name, config_key, config_value, remote_addr=None,
cert=None, key=None, verify_cert=True):
'''
Set a container config value
name :
Name of the container
config_key :
The config key to set
... | [] |
Please provide a description of the function:def container_config_delete(name, config_key, remote_addr=None,
cert=None, key=None, verify_cert=True):
'''
Delete a container config value
name :
Name of the container
config_key :
The config key to delete
r... | [] |
Please provide a description of the function:def container_device_get(name, device_name, remote_addr=None,
cert=None, key=None, verify_cert=True):
'''
Get a container device
name :
Name of the container
device_name :
The device name to retrieve
remote_addr... | [] |
Please provide a description of the function:def container_device_add(name, device_name, device_type='disk',
remote_addr=None,
cert=None, key=None, verify_cert=True,
**kwargs):
'''
Add a container device
name :
Name of the c... | [] |
Please provide a description of the function:def container_device_delete(name, device_name, remote_addr=None,
cert=None, key=None, verify_cert=True):
'''
Delete a container device
name :
Name of the container
device_name :
The device name to delete
remo... | [] |
Please provide a description of the function:def container_file_put(name, src, dst, recursive=False, overwrite=False,
mode=None, uid=None, gid=None, saltenv='base',
remote_addr=None,
cert=None, key=None, verify_cert=True):
'''
Put a file into ... | [] |
Please provide a description of the function:def container_file_get(name, src, dst, overwrite=False,
mode=None, uid=None, gid=None, remote_addr=None,
cert=None, key=None, verify_cert=True):
'''
Get a file from a container
name :
Name of the container
... | [] |
Please provide a description of the function:def container_execute(name, cmd, remote_addr=None,
cert=None, key=None, verify_cert=True):
'''
Execute a command list on a container.
name :
Name of the container
cmd :
Command to be executed (as a list)
Exampl... | [] |
Please provide a description of the function:def profile_list(list_names=False, remote_addr=None,
cert=None, key=None, verify_cert=True):
''' Lists all profiles from the LXD.
list_names :
Return a list of names instead of full blown dicts.
remote_addr :
An... | [] |
Please provide a description of the function:def profile_create(name, config=None, devices=None, description=None,
remote_addr=None,
cert=None, key=None, verify_cert=True):
''' Creates a profile.
name :
The name of the profile to get.
config :
... | [] |
Please provide a description of the function:def profile_get(name, remote_addr=None,
cert=None, key=None, verify_cert=True, _raw=False):
''' Gets a profile from the LXD
name :
The name of the profile to get.
remote_addr :
An URL to a remote Server, you also ... | [] |
Please provide a description of the function:def profile_delete(name, remote_addr=None,
cert=None, key=None, verify_cert=True):
''' Deletes a profile.
name :
The name of the profile to delete.
remote_addr :
An URL to a remote Server, you also have to give... | [] |
Please provide a description of the function:def profile_config_get(name, config_key, remote_addr=None,
cert=None, key=None, verify_cert=True):
''' Get a profile config item.
name :
The name of the profile to get the config item from.
config_key :
The... | [] |
Please provide a description of the function:def profile_config_set(name, config_key, config_value,
remote_addr=None,
cert=None, key=None, verify_cert=True):
''' Set a profile config item.
name :
The name of the profile to set the config item to.
... | [] |
Please provide a description of the function:def profile_config_delete(name, config_key, remote_addr=None,
cert=None, key=None, verify_cert=True):
''' Delete a profile config item.
name :
The name of the profile to delete the config item.
config_key :
... | [] |
Please provide a description of the function:def profile_device_get(name, device_name, remote_addr=None,
cert=None, key=None, verify_cert=True):
''' Get a profile device.
name :
The name of the profile to get the device from.
device_name :
The name of... | [] |
Please provide a description of the function:def profile_device_set(name, device_name, device_type='disk',
remote_addr=None,
cert=None, key=None, verify_cert=True,
**kwargs):
''' Set a profile device.
name :
The name of the pr... | [] |
Please provide a description of the function:def profile_device_delete(name, device_name, remote_addr=None,
cert=None, key=None, verify_cert=True):
''' Delete a profile device.
name :
The name of the profile to delete the device.
device_name :
The ... | [] |
Please provide a description of the function:def image_list(list_aliases=False, remote_addr=None,
cert=None, key=None, verify_cert=True):
''' Lists all images from the LXD.
list_aliases :
Return a dict with the fingerprint as key and
a list of aliases as value instea... | [] |
Please provide a description of the function:def image_get(fingerprint,
remote_addr=None,
cert=None,
key=None,
verify_cert=True,
_raw=False):
''' Get an image by its fingerprint
fingerprint :
The fingerprint of the image to r... | [] |
Please provide a description of the function:def image_get_by_alias(alias,
remote_addr=None,
cert=None,
key=None,
verify_cert=True,
_raw=False):
''' Get an image by an alias
alias :
... | [] |
Please provide a description of the function:def image_delete(image,
remote_addr=None,
cert=None,
key=None,
verify_cert=True):
''' Delete an image by an alias or fingerprint
name :
The alias or fingerprint of the image to delet... | [] |
Please provide a description of the function:def image_from_simplestreams(server,
alias,
remote_addr=None,
cert=None,
key=None,
verify_cert=True,
... | [] |
Please provide a description of the function:def image_from_file(filename,
remote_addr=None,
cert=None,
key=None,
verify_cert=True,
aliases=None,
public=False,
saltenv='base',
... | [] |
Please provide a description of the function:def image_copy_lxd(source,
src_remote_addr,
src_cert,
src_key,
src_verify_cert,
remote_addr,
cert,
key,
verify_cert=True,
... | [] |
Please provide a description of the function:def image_alias_add(image,
alias,
description='',
remote_addr=None,
cert=None,
key=None,
verify_cert=True):
''' Create an alias on the given image
... | [] |
Please provide a description of the function:def image_alias_delete(image,
alias,
remote_addr=None,
cert=None,
key=None,
verify_cert=True):
''' Delete an alias (this is currently not restricted to the ... | [] |
Please provide a description of the function:def snapshots_all(container, remote_addr=None, cert=None, key=None, verify_cert=True):
'''
Get all snapshots for a container
container :
The name of the container to get.
remote_addr :
An URL to a remote server. The 'cert' and 'key' fields m... | [] |
Please provide a description of the function:def snapshots_create(container, name=None, remote_addr=None,
cert=None, key=None, verify_cert=True):
'''
Create a snapshot for a container
container :
The name of the container to get.
name :
The name of the snapshot.
... | [] |
Please provide a description of the function:def snapshots_delete(container, name, remote_addr=None,
cert=None, key=None, verify_cert=True):
'''
Delete a snapshot for a container
container :
The name of the container to get.
name :
The name of the snapshot.
re... | [] |
Please provide a description of the function:def snapshots_get(container, name, remote_addr=None,
cert=None, key=None, verify_cert=True):
'''
Get information about snapshot for a container
container :
The name of the container to get.
name :
The name of the snapshot.
... | [] |
Please provide a description of the function:def normalize_input_values(config, devices):
'''
normalize config input so returns can be put into mongodb, which doesn't like `.`
This is not meant to be used on the commandline.
CLI Examples:
.. code-block:: bash
salt '*' lxd.normalize_input... | [] |
Please provide a description of the function:def sync_config_devices(obj, newconfig, newdevices, test=False):
''' Syncs the given config and devices with the object
(a profile or a container)
returns a changes dict with all changes made.
obj :
The object to sync with / or just t... | [] |
Please provide a description of the function:def _set_property_dict_item(obj, prop, key, value):
''' Sets the dict item key of the attr from obj.
Basicaly it does getattr(obj, prop)[key] = value.
For the disk device we added some checks to make
device changes on the CLI saver.
'''
... | [] |
Please provide a description of the function:def _pylxd_model_to_dict(obj):
'''Translates a plyxd model object to a dict'''
marshalled = {}
for key in obj.__attributes__.keys():
if hasattr(obj, key):
marshalled[key] = getattr(obj, key)
return marshalled | [] |
Please provide a description of the function:def set_ftp_proxy(server,
port,
user=None,
password=None,
network_service="Ethernet",
bypass_hosts=None):
'''
Sets the ftp proxy settings
server
The proxy server to... | [] |
Please provide a description of the function:def get_proxy_bypass(network_service="Ethernet"):
'''
Returns the current domains that can bypass the proxy
network_service
The network service to get the bypass domains from, this is only
necessary on macOS
CLI Example:
.. code-block::... | [] |
Please provide a description of the function:def set_proxy_bypass(domains, network_service="Ethernet"):
'''
Sets the domains that can bypass the proxy
domains
An array of domains allowed to bypass the proxy
network_service
The network service to apply the changes to, this only necessar... | [] |
Please provide a description of the function:def set_proxy_win(server, port, types=None, bypass_hosts=None):
'''
Sets the http proxy settings, only works with Windows.
server
The proxy server to use
password
The password to use if required by the server
types
The types of ... | [] |
Please provide a description of the function:def get_conn(host='', username=None, password=None, port=445):
'''
Get an SMB connection
'''
if HAS_IMPACKET and not HAS_SMBPROTOCOL:
salt.utils.versions.warn_until(
'Sodium',
'Support of impacket has been depricated and will b... | [] |
Please provide a description of the function:def _mkdirs_impacket(path, share='C$', conn=None, host=None, username=None, password=None):
'''
Recursively create a directory structure on an SMB share
Paths should be passed in with forward-slash delimiters, and should not
start with a forward-slash.
'... | [] |
Please provide a description of the function:def put_str(content, path, share='C$', conn=None, host=None, username=None, password=None):
'''
Wrapper around impacket.smbconnection.putFile() that allows a string to be
uploaded, without first writing it as a local file
'''
if HAS_SMBPROTOCOL:
r... | [] |
Please provide a description of the function:def _put_file_impacket(local_path, path, share='C$', conn=None, host=None, username=None, password=None):
'''
Wrapper around impacket.smbconnection.putFile() that allows a file to be
uploaded
Example usage:
import salt.utils.smb
smb_conn = s... | [] |
Please provide a description of the function:def put_file(local_path, path, share='C$', conn=None, host=None, username=None, password=None):
'''
Wrapper around impacket.smbconnection.putFile() that allows a file to be
uploaded
Example usage:
import salt.utils.smb
smb_conn = salt.utils.... | [] |
Please provide a description of the function:def string(self, writesize=None):
'''
Looks like a file handle
'''
if not self.finished:
self.finished = True
return self.content
return '' | [] |
Please provide a description of the function:def _get_template(path, option_key):
'''
Get the contents of a template file and provide it as a module type
:param path: path to the template.yml file
:type path: ``str``
:param option_key: The unique key of this template
:type option_key: ``str`... | [] |
Please provide a description of the function:def _fetch_templates(src):
'''
Fetch all of the templates in the src directory
:param src: The source path
:type src: ``str``
:rtype: ``list`` of ``tuple``
:returns: ``list`` of ('key', 'description')
'''
templates = []
log.debug('Listi... | [] |
Please provide a description of the function:def _mergetree(src, dst):
'''
Akin to shutils.copytree but over existing directories, does a recursive merge copy.
:param src: The source path
:type src: ``str``
:param dst: The destination path
:type dst: ``str``
'''
for item in os.listdi... | [] |
Please provide a description of the function:def _mergetreejinja(src, dst, context):
'''
Merge directory A to directory B, apply Jinja2 templating to both
the file/folder names AND to the contents of the files
:param src: The source path
:type src: ``str``
:param dst: The destination path
... | [] |
Please provide a description of the function:def _prompt_choice(var_name, options):
'''
Prompt the user to choose between a list of options, index each one by adding an enumerator
based on https://github.com/audreyr/cookiecutter/blob/master/cookiecutter/prompt.py#L51
:param var_name: The question to as... | [] |
Please provide a description of the function:def run(extension=None, name=None, description=None, salt_dir=None, merge=False, temp_dir=None):
'''
A template factory for extending the salt ecosystem
:param extension: The extension type, e.g. 'module', 'state', if omitted, user will be prompted
:type ex... | [] |
Please provide a description of the function:def agent_settings(name, contact, location, services=None):
'''
Manage the SNMP sysContact, sysLocation, and sysServices settings.
:param str contact: The SNMP contact.
:param str location: The SNMP location.
:param str services: A list of selected servi... | [] |
Please provide a description of the function:def auth_traps_enabled(name, status=True):
'''
Manage the sending of authentication traps.
:param bool status: The enabled status.
Example of usage:
.. code-block:: yaml
snmp-auth-traps:
win_snmp.auth_traps_enabled:
... | [] |
Please provide a description of the function:def community_names(name, communities=None):
'''
Manage the SNMP accepted community names and their permissions.
:param str communities: A dictionary of SNMP communities and permissions.
Example of usage:
.. code-block:: yaml
snmp-community-na... | [] |
Please provide a description of the function:def _check_valid_version():
'''
Check the version of npm to ensure this module will work. Currently
npm must be at least version 1.2.
'''
# Locate the full path to npm
npm_path = salt.utils.path.which('npm')
# pylint: disable=no-member
res =... | [] |
Please provide a description of the function:def install(pkg=None,
pkgs=None,
dir=None,
runas=None,
registry=None,
env=None,
dry_run=False,
silent=True):
'''
Install an NPM package.
If no directory is specified, the package... | [] |
Please provide a description of the function:def uninstall(pkg, dir=None, runas=None, env=None):
'''
Uninstall an NPM package.
If no directory is specified, the package will be uninstalled globally.
pkg
A package name in any format accepted by NPM
dir
The target directory from whi... | [] |
Please provide a description of the function:def list_(pkg=None, dir=None, runas=None, env=None, depth=None):
'''
List installed NPM packages.
If no directory is specified, this will return the list of globally-
installed packages.
pkg
Limit package listing by name
dir
The dir... | [] |
Please provide a description of the function:def cache_clean(path=None, runas=None, env=None, force=False):
'''
Clean cached NPM packages.
If no path for a specific package is provided the entire cache will be cleared.
path
The cache subpath to delete, or None to clear the entire cache
ru... | [] |
Please provide a description of the function:def cache_list(path=None, runas=None, env=None):
'''
List NPM cached packages.
If no path for a specific package is provided this will list all the cached packages.
path
The cache subpath to list, or None to list the entire cache
runas
... | [] |
Please provide a description of the function:def cache_path(runas=None, env=None):
'''
List path of the NPM cache directory.
runas
The user to run NPM with
env
Environment variables to set when invoking npm. Uses the same ``env``
format as the :py:func:`cmd.run <salt.modules.cm... | [] |
Please provide a description of the function:def raw_command(netfn, command, bridge_request=None, data=(), retry=True, delay_xmit=None, **kwargs):
'''
Send raw ipmi command
This allows arbitrary IPMI bytes to be issued. This is commonly used
for certain vendor specific commands.
:param netfn: Net... | [] |
Please provide a description of the function:def set_channel_access(channel=14, access_update_mode='non_volatile',
alerting=False, per_msg_auth=False, user_level_auth=False,
access_mode='always', privilege_update_mode='non_volatile',
privilege_level='... | [] |
Please provide a description of the function:def get_channel_access(channel=14, read_mode='non_volatile', **kwargs):
'''
:param kwargs:api_host='127.0.0.1' api_user='admin' api_pass='example' api_port=623
:param channel: number [1:7]
:param read_mode:
- non_volatile = get non-volatile Channel... | [] |
Please provide a description of the function:def set_user_access(uid, channel=14, callback=True, link_auth=True, ipmi_msg=True,
privilege_level='administrator', **kwargs):
'''
Set user access
:param uid: user number [1:16]
:param channel: number [1:7]
:param callback:
... | [] |
Please provide a description of the function:def get_user_access(uid, channel=14, **kwargs):
'''
Get user access
:param uid: user number [1:16]
:param channel: number [1:7]
:param kwargs:
- api_host=127.0.0.1
- api_user=admin
- api_pass=example
- api_port=623
... | [] |
Please provide a description of the function:def set_user_name(uid, name, **kwargs):
'''
Set user name
:param uid: user number [1:16]
:param name: username (limit of 16bytes)
:param kwargs:
- api_host=127.0.0.1
- api_user=admin
- api_pass=example
- api_port=623
... | [] |
Please provide a description of the function:def get_user_name(uid, return_none_on_error=True, **kwargs):
'''
Get user name
:param uid: user number [1:16]
:param return_none_on_error: return None on error
:param kwargs:
- api_host=127.0.0.1
- api_user=admin
- api_pass=exampl... | [] |
Please provide a description of the function:def set_user_password(uid, mode='set_password', password=None, **kwargs):
'''
Set user password and (modes)
:param uid: id number of user. see: get_names_uid()['name']
:param mode:
- disable = disable user connections
- enable ... | [] |
Please provide a description of the function:def get_sensor_data(**kwargs):
'''
Get sensor readings
Iterates sensor reading objects
:param kwargs:
- api_host=127.0.0.1
- api_user=admin
- api_pass=example
- api_port=623
- api_kg=None
CLI Example:
.. cod... | [] |
Please provide a description of the function:def set_power(state='power_on', wait=True, **kwargs):
'''
Request power state change
:param name:
* power_on -- system turn on
* power_off -- system turn off (without waiting for OS)
* shutdown -- request OS proper shutdown
* rese... | [] |
Please provide a description of the function:def set_bootdev(bootdev='default', persist=False, uefiboot=False, **kwargs):
'''
Set boot device to use on next reboot
:param bootdev:
- network: Request network boot
- hd: Boot from hard drive
- safe: Boot from hard drive, requesting 'sa... | [] |
Please provide a description of the function:def set_identify(on=True, duration=600, **kwargs):
'''
Request identify light
Request the identify light to turn off, on for a duration,
or on indefinitely. Other than error exceptions,
:param on: Set to True to force on or False to force off
:para... | [] |
Please provide a description of the function:def get_channel_max_user_count(channel=14, **kwargs):
'''
Get max users in channel
:param channel: number [1:7]
:param kwargs:
- api_host=127.0.0.1
- api_user=admin
- api_pass=example
- api_port=623
- api_kg=None
:... | [] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.