INSTRUCTION stringlengths 1 8.43k | RESPONSE stringlengths 75 104k |
|---|---|
Return Network Configuration | def network_info(host=None,
admin_username=None,
admin_password=None,
module=None):
'''
Return Network Configuration
CLI Example:
.. code-block:: bash
salt dell dracr.network_info
'''
inv = inventory(host=host, admin_username=admin_u... |
Configure the nameservers on the DRAC | def nameservers(ns,
host=None,
admin_username=None,
admin_password=None,
module=None):
'''
Configure the nameservers on the DRAC
CLI Example:
.. code-block:: bash
salt dell dracr.nameservers [NAMESERVERS]
salt dell dracr.... |
Configure syslog remote logging by default syslog will automatically be enabled if a server is specified. However if you want to disable syslog you will need to specify a server followed by False | def syslog(server, enable=True, host=None,
admin_username=None, admin_password=None, module=None):
'''
Configure syslog remote logging, by default syslog will automatically be
enabled if a server is specified. However, if you want to disable syslog
you will need to specify a server followed b... |
Enable/ Disable email alerts | def email_alerts(action,
host=None,
admin_username=None,
admin_password=None):
'''
Enable/Disable email alerts
CLI Example:
.. code-block:: bash
salt dell dracr.email_alerts True
salt dell dracr.email_alerts False
'''
if acti... |
List all DRAC users | def list_users(host=None,
admin_username=None,
admin_password=None,
module=None):
'''
List all DRAC users
CLI Example:
.. code-block:: bash
salt dell dracr.list_users
'''
users = {}
_username = ''
for idx in range(1, 17):
c... |
Delete a user | def delete_user(username,
uid=None,
host=None,
admin_username=None,
admin_password=None):
'''
Delete a user
CLI Example:
.. code-block:: bash
salt dell dracr.delete_user [USERNAME] [UID - optional]
salt dell dracr.delete_... |
Change user s password | def change_password(username, password, uid=None, host=None,
admin_username=None, admin_password=None,
module=None):
'''
Change user's password
CLI Example:
.. code-block:: bash
salt dell dracr.change_password [USERNAME] [PASSWORD] uid=[OPTIONAL]
... |
Change the QuickDeploy password used for switches as well | def deploy_password(username, password, host=None, admin_username=None,
admin_password=None, module=None):
'''
Change the QuickDeploy password, used for switches as well
CLI Example:
.. code-block:: bash
salt dell dracr.deploy_password [USERNAME] [PASSWORD]
hos... |
Change the QuickDeploy SNMP community string used for switches as well | def deploy_snmp(snmp, host=None, admin_username=None,
admin_password=None, module=None):
'''
Change the QuickDeploy SNMP community string, used for switches as well
CLI Example:
.. code-block:: bash
salt dell dracr.deploy_snmp SNMP_STRING
host=<remote DRAC or CMC> ... |
Configure CMC or individual iDRAC SNMP community string. Use deploy_snmp for configuring chassis switch SNMP. | def set_snmp(community, host=None,
admin_username=None, admin_password=None):
'''
Configure CMC or individual iDRAC SNMP community string.
Use ``deploy_snmp`` for configuring chassis switch SNMP.
CLI Example:
.. code-block:: bash
salt dell dracr.set_snmp [COMMUNITY]
s... |
Configure Network on the CMC or individual iDRAC. Use set_niccfg for blade and switch addresses. | def set_network(ip, netmask, gateway, host=None,
admin_username=None, admin_password=None):
'''
Configure Network on the CMC or individual iDRAC.
Use ``set_niccfg`` for blade and switch addresses.
CLI Example:
.. code-block:: bash
salt dell dracr.set_network [DRAC IP] [NET... |
status One of powerup powerdown powercycle hardreset graceshutdown | def server_power(status, host=None,
admin_username=None,
admin_password=None,
module=None):
'''
status
One of 'powerup', 'powerdown', 'powercycle', 'hardreset',
'graceshutdown'
host
The chassis host.
admin_username
T... |
Issues a power - cycle operation on the managed server. This action is similar to pressing the power button on the system s front panel to power down and then power up the system. | def server_reboot(host=None,
admin_username=None,
admin_password=None,
module=None):
'''
Issues a power-cycle operation on the managed server. This action is
similar to pressing the power button on the system's front panel to
power down and then powe... |
Powers down the managed server. | def server_poweroff(host=None,
admin_username=None,
admin_password=None,
module=None):
'''
Powers down the managed server.
host
The chassis host.
admin_username
The username used to access the chassis.
admin_password
... |
Powers up the managed server. | def server_poweron(host=None,
admin_username=None,
admin_password=None,
module=None):
'''
Powers up the managed server.
host
The chassis host.
admin_username
The username used to access the chassis.
admin_password
Th... |
Performs a reset ( reboot ) operation on the managed server. | def server_hardreset(host=None,
admin_username=None,
admin_password=None,
module=None):
'''
Performs a reset (reboot) operation on the managed server.
host
The chassis host.
admin_username
The username used to access the ch... |
return the power status for the passed module | def server_powerstatus(host=None,
admin_username=None,
admin_password=None,
module=None):
'''
return the power status for the passed module
CLI Example:
.. code-block:: bash
salt dell drac.server_powerstatus
'''
ret ... |
Configure server to PXE perform a one off PXE boot | def server_pxe(host=None,
admin_username=None,
admin_password=None):
'''
Configure server to PXE perform a one off PXE boot
CLI Example:
.. code-block:: bash
salt dell dracr.server_pxe
'''
if __execute_cmd('config -g cfgServerInfo -o cfgServerFirstBootDev... |
List the names of all slots in the chassis. | def list_slotnames(host=None,
admin_username=None,
admin_password=None):
'''
List the names of all slots in the chassis.
host
The chassis host.
admin_username
The username used to access the chassis.
admin_password
The password used to... |
Get the name of a slot number in the chassis. | def get_slotname(slot, host=None, admin_username=None, admin_password=None):
'''
Get the name of a slot number in the chassis.
slot
The number of the slot for which to obtain the name.
host
The chassis host.
admin_username
The username used to access the chassis.
admi... |
Set the name of a slot in a chassis. | def set_slotname(slot, name, host=None,
admin_username=None, admin_password=None):
'''
Set the name of a slot in a chassis.
slot
The slot number to change.
name
The name to set. Can only be 15 characters long.
host
The chassis host.
admin_username
... |
Set the name of the chassis. | def set_chassis_name(name,
host=None,
admin_username=None,
admin_password=None):
'''
Set the name of the chassis.
name
The name to be set on the chassis.
host
The chassis host.
admin_username
The username used ... |
Get the name of a chassis. | def get_chassis_name(host=None, admin_username=None, admin_password=None):
'''
Get the name of a chassis.
host
The chassis host.
admin_username
The username used to access the chassis.
admin_password
The password used to access the chassis.
CLI Example:
.. code-b... |
Set the location of the chassis. | def set_chassis_location(location,
host=None,
admin_username=None,
admin_password=None):
'''
Set the location of the chassis.
location
The name of the location to be set on the chassis.
host
The chassis host.
... |
Get the location of the chassis. | def get_chassis_location(host=None,
admin_username=None,
admin_password=None):
'''
Get the location of the chassis.
host
The chassis host.
admin_username
The username used to access the chassis.
admin_password
The password ... |
Set the location of the chassis. | def set_chassis_datacenter(location,
host=None,
admin_username=None,
admin_password=None):
'''
Set the location of the chassis.
location
The name of the datacenter to be set on the chassis.
host
The chassis host... |
Get the datacenter of the chassis. | def get_chassis_datacenter(host=None,
admin_username=None,
admin_password=None):
'''
Get the datacenter of the chassis.
host
The chassis host.
admin_username
The username used to access the chassis.
admin_password
The passw... |
Run a generic racadm command against a particular blade in a chassis. Blades are usually named things like server - 1 server - 2 etc. If the iDRAC has a different password than the CMC then you can pass it with the idrac_password kwarg. | def idrac_general(blade_name, command, idrac_password=None,
host=None,
admin_username=None, admin_password=None):
'''
Run a generic racadm command against a particular
blade in a chassis. Blades are usually named things like
'server-1', 'server-2', etc. If the iDRAC... |
Updates firmware using local firmware file | def update_firmware(filename,
host=None,
admin_username=None,
admin_password=None):
'''
Updates firmware using local firmware file
.. code-block:: bash
salt dell dracr.update_firmware firmware.exe
This executes the following command... |
Executes the following for CIFS ( using username and password stored in the pillar data ) | def update_firmware_nfs_or_cifs(filename, share,
host=None,
admin_username=None,
admin_password=None):
'''
Executes the following for CIFS
(using username and password stored in the pillar data)
.. code-bloc... |
Send a message to a Microsft Teams channel | def post_card(name,
message,
hook_url=None,
title=None,
theme_color=None):
'''
Send a message to a Microsft Teams channel
.. code-block:: yaml
send-msteams-message:
msteams.post_card:
- message: 'This state was executed ... |
Accept keys based on a dict of keys. Returns a dictionary. | def accept_dict(match, include_rejected=False, include_denied=False):
'''
Accept keys based on a dict of keys. Returns a dictionary.
match
The dictionary of keys to accept.
include_rejected
To include rejected keys in the match along with pending keys, set this
to ``True``. Def... |
Reject keys based on a glob match. Returns a dictionary. | def reject(match, include_accepted=False, include_denied=False):
'''
Reject keys based on a glob match. Returns a dictionary.
match
The glob match of keys to reject.
include_accepted
To include accepted keys in the match along with pending keys, set this
to ``True``. Defaults t... |
Return the matching key fingerprints. Returns a dictionary. | def finger(match, hash_type=None):
'''
Return the matching key fingerprints. Returns a dictionary.
match
The key for with to retrieve the fingerprint.
hash_type
The hash algorithm used to calculate the fingerprint
.. code-block:: python
>>> wheel.cmd('key.finger', ['minio... |
Return the fingerprint of the master s public key | def finger_master(hash_type=None):
'''
Return the fingerprint of the master's public key
hash_type
The hash algorithm used to calculate the fingerprint
.. code-block:: python
>>> wheel.cmd('key.finger_master')
{'local': {'master.pub': '5d:f6:79:43:5e:d4:42:3f:57:b8:45:a8:7e:a4... |
r Generate a key pair. No keys are stored on the master. A key pair is returned as a dict containing pub and priv keys. Returns a dictionary containing the the pub and priv keys with their generated values. | def gen(id_=None, keysize=2048):
r'''
Generate a key pair. No keys are stored on the master. A key pair is
returned as a dict containing pub and priv keys. Returns a dictionary
containing the the ``pub`` and ``priv`` keys with their generated values.
id\_
Set a name to generate a key pair f... |
r Generate a key pair then accept the public key. This function returns the key pair in a dict only the public key is preserved on the master. Returns a dictionary. | def gen_accept(id_, keysize=2048, force=False):
r'''
Generate a key pair then accept the public key. This function returns the
key pair in a dict, only the public key is preserved on the master. Returns
a dictionary.
id\_
The name of the minion for which to generate a key pair.
keysize... |
Generate minion RSA public keypair | def gen_keys(keydir=None, keyname=None, keysize=None, user=None):
'''
Generate minion RSA public keypair
'''
skey = get_key(__opts__)
return skey.gen_keys(keydir, keyname, keysize, user) |
Generate master public - key - signature | def gen_signature(priv, pub, signature_path, auto_create=False, keysize=None):
'''
Generate master public-key-signature
'''
skey = get_key(__opts__)
return skey.gen_keys_signature(priv, pub, signature_path, auto_create, keysize) |
Return information on a directory located on the Moose | def dirinfo(path, opts=None):
'''
Return information on a directory located on the Moose
CLI Example:
.. code-block:: bash
salt '*' moosefs.dirinfo /path/to/dir/ [-[n][h|H]]
'''
cmd = 'mfsdirinfo'
ret = {}
if opts:
cmd += ' -' + opts
cmd += ' ' + path
out = __s... |
Return information on a file located on the Moose | def fileinfo(path):
'''
Return information on a file located on the Moose
CLI Example:
.. code-block:: bash
salt '*' moosefs.fileinfo /path/to/dir/
'''
cmd = 'mfsfileinfo ' + path
ret = {}
chunknum = ''
out = __salt__['cmd.run_all'](cmd, python_shell=False)
output = o... |
Return a list of current MooseFS mounts | def mounts():
'''
Return a list of current MooseFS mounts
CLI Example:
.. code-block:: bash
salt '*' moosefs.mounts
'''
cmd = 'mount'
ret = {}
out = __salt__['cmd.run_all'](cmd)
output = out['stdout'].splitlines()
for line in output:
if not line:
c... |
Return goal ( s ) for a file or directory | def getgoal(path, opts=None):
'''
Return goal(s) for a file or directory
CLI Example:
.. code-block:: bash
salt '*' moosefs.getgoal /path/to/file [-[n][h|H]]
salt '*' moosefs.getgoal /path/to/dir/ [-[n][h|H][r]]
'''
cmd = 'mfsgetgoal'
ret = {}
if opts:
cmd += '... |
Helper function for running the auditpol command | def _auditpol_cmd(cmd):
'''
Helper function for running the auditpol command
Args:
cmd (str): the auditpol command to run
Returns:
list: A list containing each line of the return (splitlines)
Raises:
CommandExecutionError: If the command encounters an error
'''
ret... |
Get the current configuration for all audit settings specified in the category | def get_settings(category='All'):
'''
Get the current configuration for all audit settings specified in the
category
Args:
category (str):
One of the nine categories to return. Can also be ``All`` to return
the settings for all categories. Valid options are:
... |
Get the current configuration for the named audit setting | def get_setting(name):
'''
Get the current configuration for the named audit setting
Args:
name (str): The name of the setting to retrieve
Returns:
str: The current configuration for the named setting
Raises:
KeyError: On invalid setting name
CommandExecutionError:... |
Set the configuration for the named audit setting | def set_setting(name, value):
'''
Set the configuration for the named audit setting
Args:
name (str):
The name of the setting to configure
value (str):
The configuration for the named value. Valid options are:
- No Auditing
- Success
... |
Gets the contents of an auditpol/ backup. Used by the LGPO module to get fieldnames and GUIDs for Advanced Audit policies. | def get_auditpol_dump():
'''
Gets the contents of an auditpol /backup. Used by the LGPO module to get
fieldnames and GUIDs for Advanced Audit policies.
Returns:
list: A list of lines form the backup file
Usage:
.. code-block:: python
import salt.utils.win_lgpo_auditpol
... |
Check to see if given ruby is installed. | def _ruby_installed(ret, ruby, user=None):
'''
Check to see if given ruby is installed.
'''
default = __salt__['rbenv.default'](runas=user)
for version in __salt__['rbenv.versions'](user):
if version == ruby:
ret['result'] = True
ret['comment'] = 'Requested ruby exist... |
Verify that ruby is installed install if unavailable | def _check_and_install_ruby(ret, ruby, default=False, user=None):
'''
Verify that ruby is installed, install if unavailable
'''
ret = _ruby_installed(ret, ruby, user=user)
if not ret['result']:
if __salt__['rbenv.install_ruby'](ruby, runas=user):
ret['result'] = True
... |
Verify that the specified ruby is installed with rbenv. Rbenv is installed if necessary. | def installed(name, default=False, user=None):
'''
Verify that the specified ruby is installed with rbenv. Rbenv is
installed if necessary.
name
The version of ruby to install
default : False
Whether to make this ruby the default.
user: None
The user to run rbenv as.
... |
Verify that ruby is uninstalled | def _check_and_uninstall_ruby(ret, ruby, user=None):
'''
Verify that ruby is uninstalled
'''
ret = _ruby_installed(ret, ruby, user=user)
if ret['result']:
if ret['default']:
__salt__['rbenv.default']('system', runas=user)
if __salt__['rbenv.uninstall_ruby'](ruby, runas=u... |
Verify that the specified ruby is not installed with rbenv. Rbenv is installed if necessary. | def absent(name, user=None):
'''
Verify that the specified ruby is not installed with rbenv. Rbenv
is installed if necessary.
name
The version of ruby to uninstall
user: None
The user to run rbenv as.
.. versionadded:: 0.17.0
.. versionadded:: 0.16.0
'''
ret =... |
Verify that rbenv is installed install if unavailable | def _check_and_install_rbenv(ret, user=None):
'''
Verify that rbenv is installed, install if unavailable
'''
ret = _check_rbenv(ret, user)
if ret['result'] is False:
if __salt__['rbenv.install'](user):
ret['result'] = True
ret['comment'] = 'Rbenv installed'
el... |
Install rbenv if not installed. Allows you to require rbenv be installed prior to installing the plugins. Useful if you want to install rbenv plugins via the git or file modules and need them installed before installing any rubies. | def install_rbenv(name, user=None):
'''
Install rbenv if not installed. Allows you to require rbenv be installed
prior to installing the plugins. Useful if you want to install rbenv
plugins via the git or file modules and need them installed before
installing any rubies.
Use the rbenv.root conf... |
Build a well - formatted nftables rule based on kwargs. A table and chain are not required unless full is True. | def build_rule(table=None, chain=None, command=None, position='', full=None, family='ipv4',
**kwargs):
'''
Build a well-formatted nftables rule based on kwargs.
A `table` and `chain` are not required, unless `full` is True.
If `full` is `True`, then `table`, `chain` and `command` are req... |
Return a data structure of the rules in the conf file | def get_saved_rules(conf_file=None):
'''
Return a data structure of the rules in the conf file
CLI Example:
.. code-block:: bash
salt '*' nftables.get_saved_rules
'''
if _conf() and not conf_file:
conf_file = _conf()
with salt.utils.files.fopen(conf_file) as fp_:
... |
Return a data structure of the current in - memory rules | def get_rules(family='ipv4'):
'''
Return a data structure of the current, in-memory rules
CLI Example:
.. code-block:: bash
salt '*' nftables.get_rules
salt '*' nftables.get_rules family=ipv6
'''
nft_family = _NFTABLES_FAMILIES[family]
rules = []
cmd = '{0} --numeric... |
Save the current in - memory rules to disk | def save(filename=None, family='ipv4'):
'''
Save the current in-memory rules to disk
CLI Example:
.. code-block:: bash
salt '*' nftables.save /etc/nftables
'''
if _conf() and not filename:
filename = _conf()
nft_families = ['ip', 'ip6', 'arp', 'bridge']
rules = "#! nf... |
Get the handle for a particular rule | def get_rule_handle(table='filter', chain=None, rule=None, family='ipv4'):
'''
Get the handle for a particular rule
This function accepts a rule in a standard nftables command format,
starting with the chain. Trying to force users to adapt to a new
method of creating rules would be irritati... |
Check for the existence of a rule in the table and chain | def check(table='filter', chain=None, rule=None, family='ipv4'):
'''
Check for the existence of a rule in the table and chain
This function accepts a rule in a standard nftables command format,
starting with the chain. Trying to force users to adapt to a new
method of creating rules would b... |
Check for the existence of a table | def check_table(table=None, family='ipv4'):
'''
Check for the existence of a table
CLI Example::
salt '*' nftables.check_table nat
'''
ret = {'comment': '',
'result': False}
if not table:
ret['comment'] = 'Table needs to be specified'
return ret
nft_fam... |
.. versionadded:: 2014. 7. 0 | def new_chain(table='filter', chain=None, table_type=None, hook=None, priority=None, family='ipv4'):
'''
.. versionadded:: 2014.7.0
Create new chain to the specified table.
CLI Example:
.. code-block:: bash
salt '*' nftables.new_chain filter input
salt '*' nftables.new_chain fil... |
Flush the chain in the specified table flush all chains in the specified table if chain is not specified. | def flush(table='filter', chain='', family='ipv4'):
'''
Flush the chain in the specified table, flush all chains in the specified
table if chain is not specified.
CLI Example:
.. code-block:: bash
salt '*' nftables.flush filter
salt '*' nftables.flush filter input
IPv6:
... |
Rewrite all state declarations that look like this:: | def rewrite_single_shorthand_state_decl(data): # pylint: disable=C0103
'''
Rewrite all state declarations that look like this::
state_id_decl:
state.func
into::
state_id_decl:
state.func: []
'''
for sid, states in six.iteritems(data):
if isinstance(states, six... |
Convert relative sls reference into absolute relative to sls. | def _relative_to_abs_sls(relative, sls):
'''
Convert ``relative`` sls reference into absolute, relative to ``sls``.
'''
levels, suffix = re.match(r'^(\.+)(.*)$', relative).groups()
level_count = len(levels)
p_comps = sls.split('.')
if level_count > len(p_comps):
raise SaltRenderError... |
Given a list of items:: | def nvlist(thelist, names=None):
'''
Given a list of items::
- whatever
- name1: value1
- name2:
- key: value
- key: value
return a generator that yields each (item, key, value) tuple, skipping
items that are not name-value's(dictionaries) or those not in th... |
Like nvlist but applied one more time to each returned value. So given a list args of arguments to a state like this:: | def nvlist2(thelist, names=None):
'''
Like nvlist but applied one more time to each returned value.
So, given a list, args, of arguments to a state like this::
- name: echo test
- cwd: /
- require:
- file: test.sh
nvlist2(args, ['require']) would yield the tuple,
(dict_i... |
Retrieve the API params from the config file. | def _get_api_params(api_url=None,
page_id=None,
api_key=None,
api_version=None):
'''
Retrieve the API params from the config file.
'''
statuspage_cfg = __salt__['config.get']('statuspage')
if not statuspage_cfg:
statuspage_cfg = {}
... |
Validate the API params as specified in the config file. | def _validate_api_params(params):
'''
Validate the API params as specified in the config file.
'''
# page_id and API key are mandatory and they must be string/unicode
return (isinstance(params['api_page_id'], (six.string_types, six.text_type)) and
isinstance(params['api_key'], (six.strin... |
Make the HTTP request and return the body as python object. | def _http_request(url,
method='GET',
headers=None,
data=None):
'''
Make the HTTP request and return the body as python object.
'''
req = requests.request(method,
url,
headers=headers,
... |
Retrieve a specific endpoint from the Statuspage API. | def retrieve(endpoint='incidents',
api_url=None,
page_id=None,
api_key=None,
api_version=None):
'''
Retrieve a specific endpoint from the Statuspage API.
endpoint: incidents
Request a specific endpoint.
page_id
Page ID. Can also be sp... |
Update attribute ( s ) of a specific endpoint. | def update(endpoint='incidents',
id=None,
api_url=None,
page_id=None,
api_key=None,
api_version=None,
**kwargs):
'''
Update attribute(s) of a specific endpoint.
id
The unique ID of the enpoint entry.
endpoint: incidents
... |
Remove an entry from an endpoint. | def delete(endpoint='incidents',
id=None,
api_url=None,
page_id=None,
api_key=None,
api_version=None):
'''
Remove an entry from an endpoint.
endpoint: incidents
Request a specific endpoint.
page_id
Page ID. Can also be specified in... |
Return a list of tuples to seed the env list which is used to set environment variables for any pkg_add commands that are spawned. | def _get_repo_options(fromrepo=None, packagesite=None):
'''
Return a list of tuples to seed the "env" list, which is used to set
environment variables for any pkg_add commands that are spawned.
If ``fromrepo`` or ``packagesite`` are None, then their corresponding
config parameter will be looked up ... |
Since pkg_delete requires the full pkgname - version string this function will attempt to match the package name with its version. Returns a list of partial matches and package names that match the pkgname - version string required by pkg_delete and a list of errors encountered. | def _match(names):
'''
Since pkg_delete requires the full "pkgname-version" string, this function
will attempt to match the package name with its version. Returns a list of
partial matches and package names that match the "pkgname-version" string
required by pkg_delete, and a list of errors encounte... |
List the packages currently installed as a dict:: | def list_pkgs(versions_as_list=False, with_origin=False, **kwargs):
'''
List the packages currently installed as a dict::
{'<package_name>': '<version>'}
with_origin : False
Return a nested dictionary containing both the origin name and version
for each installed package.
... |
Install package ( s ) using pkg_add ( 1 ) | def install(name=None,
refresh=False,
fromrepo=None,
pkgs=None,
sources=None,
**kwargs):
'''
Install package(s) using ``pkg_add(1)``
name
The name of the package to be installed.
refresh
Whether or not to refresh the package d... |
Remove packages using pkg_delete ( 1 ) | def remove(name=None, pkgs=None, **kwargs):
'''
Remove packages using ``pkg_delete(1)``
name
The name of the package to be deleted.
Multiple Package Options:
pkgs
A list of packages to delete. Must be passed as a python list. The
``name`` parameter will be ignored if this... |
List the files that belong to a package grouped by package. Not specifying any packages will return a list of _every_ file on the system s package database ( not generally recommended ). | def file_dict(*packages, **kwargs):
'''
List the files that belong to a package, grouped by package. Not
specifying any packages will return a list of _every_ file on the
system's package database (not generally recommended).
CLI Examples:
.. code-block:: bash
salt '*' pkg.file_list h... |
Redefine ( clone ) a function under a different globals () namespace scope | def namespaced_function(function, global_dict, defaults=None, preserve_context=False):
'''
Redefine (clone) a function under a different globals() namespace scope
preserve_context:
Allow keeping the context taken from orignal namespace,
and extend it with globals() taken from
... |
Copy a function | def alias_function(fun, name, doc=None):
'''
Copy a function
'''
alias_fun = types.FunctionType(fun.__code__,
fun.__globals__,
str(name), # future lint: disable=blacklisted-function
fun.__defaults__... |
Configure the DNS server list in the specified interface | def dns_exists(name, servers=None, interface='Local Area Connection', replace=False):
'''
Configure the DNS server list in the specified interface
Example:
.. code-block:: yaml
config_dns_servers:
win_dns_client.dns_exists:
- replace: True #remove any servers not in the ... |
Configure the DNS server list from DHCP Server | def dns_dhcp(name, interface='Local Area Connection'):
'''
Configure the DNS server list from DHCP Server
'''
ret = {'name': name,
'result': True,
'changes': {},
'comment': ''}
# Check the config
config = __salt__['win_dns_client.get_dns_config'](interface)
... |
.. versionadded:: 2014. 7. 0 | def primary_suffix(name,
suffix=None,
updates=False):
'''
.. versionadded:: 2014.7.0
Configure the global primary DNS suffix of a DHCP client.
suffix : None
The suffix which is advertised for this client when acquiring a DHCP lease
When none is set, the explicitly confi... |
.. versionadded:: 2014. 1. 0 | def insert(name, table='filter', family='ipv4', **kwargs):
'''
.. versionadded:: 2014.1.0
Insert a rule into a chain
name
A user-defined name to call this rule by in another part of a state or
formula. This should not be an actual rule.
table
The table that owns the chain ... |
.. versionadded:: 2014. 1. 0 | def delete(name, table='filter', family='ipv4', **kwargs):
'''
.. versionadded:: 2014.1.0
Delete a rule to a chain
name
A user-defined name to call this rule by in another part of a state or
formula. This should not be an actual rule.
table
The table that owns the chain th... |
.. versionadded:: 2014. 1. 0 | def set_policy(name, table='filter', family='ipv4', **kwargs):
'''
.. versionadded:: 2014.1.0
Sets the default policy for iptables firewall tables
table
The table that owns the chain that should be modified
family
Networking family, either ipv4 or ipv6
policy
The requ... |
.. versionadded:: 2014. 1. 0 | def flush(name, table='filter', family='ipv4', **kwargs):
'''
.. versionadded:: 2014.1.0
Flush current iptables state
table
The table that owns the chain that should be modified
family
Networking family, either ipv4 or ipv6
'''
ret = {'name': name,
'changes': {... |
The mod_aggregate function which looks up all rules in the available low chunks and merges them into a single rules ref in the present low data | def mod_aggregate(low, chunks, running):
'''
The mod_aggregate function which looks up all rules in the available
low chunks and merges them into a single rules ref in the present low data
'''
rules = []
agg_enabled = [
'append',
'insert',
]
if low.get('fun') not ... |
Monitor the memory usage of the minion | def beacon(config):
'''
Monitor the memory usage of the minion
Specify thresholds for percent used and only emit a beacon
if it is exceeded.
.. code-block:: yaml
beacons:
memusage:
- percent: 63%
'''
ret = []
_config = {}
list(map(_config.update, con... |
Format the function name | def format_name(self):
'''
Format the function name
'''
if not hasattr(self.module, '__func_alias__'):
# Resume normal sphinx.ext.autodoc operation
return super(FunctionDocumenter, self).format_name()
if not self.objpath:
# Resume normal sphin... |
Manage NTP servers | def managed(name, servers=None):
'''
Manage NTP servers
servers
A list of NTP servers
'''
ret = {'name': name,
'changes': {},
'result': True,
'comment': 'NTP servers already configured as specified'}
if not _check_servers(servers):
ret['result']... |
Return correct command based on the family e. g. ipv4 or ipv6 | def _iptables_cmd(family='ipv4'):
'''
Return correct command based on the family, e.g. ipv4 or ipv6
'''
if family == 'ipv6':
return salt.utils.path.which('ip6tables')
else:
return salt.utils.path.which('iptables') |
Return truth of whether iptables has option. For example: | def _has_option(option, family='ipv4'):
'''
Return truth of whether iptables has `option`. For example:
.. code-block:: python
_has_option('--wait')
_has_option('--check', family='ipv6')
'''
cmd = '{0} --help'.format(_iptables_cmd(family))
if option in __salt__['cmd.run'](cmd,... |
Some distros have a specific location for config files | def _conf(family='ipv4'):
'''
Some distros have a specific location for config files
'''
if __grains__['os_family'] == 'RedHat':
if family == 'ipv6':
return '/etc/sysconfig/ip6tables'
else:
return '/etc/sysconfig/iptables'
elif __grains__['os_family'] == 'Arch... |
Return string with save_filter regex entries removed. For example: | def _regex_iptables_save(cmd_output, filters=None):
'''
Return string with `save_filter` regex entries removed. For example:
If `filters` is not provided, it will be pulled from minion config,
minion grains, minion pillar, or master config. Default return value
if no filters found is the original ... |
Return version from iptables -- version | def version(family='ipv4'):
'''
Return version from iptables --version
CLI Example:
.. code-block:: bash
salt '*' iptables.version
IPv6:
salt '*' iptables.version family=ipv6
'''
cmd = '{0} --version' . format(_iptables_cmd(family))
out = __salt__['cmd.run'](cmd).... |
Build a well - formatted iptables rule based on kwargs. A table and chain are not required unless full is True. | def build_rule(table='filter', chain=None, command=None, position='', full=None, family='ipv4',
**kwargs):
'''
Build a well-formatted iptables rule based on kwargs. A `table` and `chain`
are not required, unless `full` is True.
If `full` is `True`, then `table`, `chain` and `command` are... |
Return the current policy for the specified table/ chain | def get_saved_policy(table='filter', chain=None, conf_file=None, family='ipv4'):
'''
Return the current policy for the specified table/chain
CLI Examples:
.. code-block:: bash
salt '*' iptables.get_saved_policy filter INPUT
salt '*' iptables.get_saved_policy filter INPUT \\
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.