INSTRUCTION stringlengths 1 8.43k | RESPONSE stringlengths 75 104k |
|---|---|
Return ( extremely verbose ) map of FACLs on specified file ( s ) | def getfacl(*args, **kwargs):
'''
Return (extremely verbose) map of FACLs on specified file(s)
CLI Examples:
.. code-block:: bash
salt '*' acl.getfacl /tmp/house/kitchen
salt '*' acl.getfacl /tmp/house/kitchen /tmp/house/livingroom
salt '*' acl.getfacl /tmp/house/kitchen /tmp/... |
Parse a single ACL rule | def _parse_acl(acl, user, group):
'''
Parse a single ACL rule
'''
comps = acl.split(':')
vals = {}
# What type of rule is this?
vals['type'] = 'acl'
if comps[0] == 'default':
vals['type'] = 'default'
comps.pop(0)
# If a user is not specified, use the owner of the fi... |
Remove all FACLs from the specified file ( s ) | def wipefacls(*args, **kwargs):
'''
Remove all FACLs from the specified file(s)
CLI Examples:
.. code-block:: bash
salt '*' acl.wipefacls /tmp/house/kitchen
salt '*' acl.wipefacls /tmp/house/kitchen /tmp/house/livingroom
salt '*' acl.wipefacls /tmp/house/kitchen /tmp/house/liv... |
Add or modify a FACL for the specified file ( s ) | def modfacl(acl_type, acl_name='', perms='', *args, **kwargs):
'''
Add or modify a FACL for the specified file(s)
CLI Examples:
.. code-block:: bash
salt '*' acl.modfacl user myuser rwx /tmp/house/kitchen
salt '*' acl.modfacl default:group mygroup rx /tmp/house/kitchen
salt '*... |
Remove specific FACL from the specified file ( s ) | def delfacl(acl_type, acl_name='', *args, **kwargs):
'''
Remove specific FACL from the specified file(s)
CLI Examples:
.. code-block:: bash
salt '*' acl.delfacl user myuser /tmp/house/kitchen
salt '*' acl.delfacl default:group mygroup /tmp/house/kitchen
salt '*' acl.delfacl d:... |
Ensure that given user is present. | def present(name,
passwd,
admin=False,
grants=None,
**client_args):
'''
Ensure that given user is present.
name
Name of the user to manage
passwd
Password of the user
admin : False
Whether the user should have cluster adminis... |
Activates the firmware backup image. | def activate_backup_image(reset=False):
'''
Activates the firmware backup image.
CLI Example:
Args:
reset(bool): Reset the CIMC device on activate.
.. code-block:: bash
salt '*' cimc.activate_backup_image
salt '*' cimc.activate_backup_image reset=True
'''
dn = "... |
Create a CIMC user with username and password. | def create_user(uid=None, username=None, password=None, priv=None):
'''
Create a CIMC user with username and password.
Args:
uid(int): The user ID slot to create the user account in.
username(str): The name of the user.
password(str): The clear text password of the user.
... |
Mounts a remote file through a remote share. Currently this feature is supported in version 1. 5 or greater. The remote share can be either NFS CIFS or WWW. | def mount_share(name=None,
remote_share=None,
remote_file=None,
mount_type="nfs",
username=None,
password=None):
'''
Mounts a remote file through a remote share. Currently, this feature is supported in version 1.5 or greater.
Th... |
Sets the hostname on the server. | def set_hostname(hostname=None):
'''
Sets the hostname on the server.
.. versionadded:: 2019.2.0
Args:
hostname(str): The new hostname to set.
CLI Example:
.. code-block:: bash
salt '*' cimc.set_hostname foobar
'''
if not hostname:
raise salt.exceptions.Comm... |
Sets the logging levels of the CIMC devices. The logging levels must match the following options: emergency alert critical error warning notice informational debug. | def set_logging_levels(remote=None, local=None):
'''
Sets the logging levels of the CIMC devices. The logging levels must match
the following options: emergency, alert, critical, error, warning, notice,
informational, debug.
.. versionadded:: 2019.2.0
Args:
remote(str): The logging lev... |
Sets the NTP servers configuration. This will also enable the client NTP service. | def set_ntp_server(server1='', server2='', server3='', server4=''):
'''
Sets the NTP servers configuration. This will also enable the client NTP service.
Args:
server1(str): The first IP address or FQDN of the NTP servers.
server2(str): The second IP address or FQDN of the NTP servers.
... |
Sets the power configuration on the device. This is only available for some C - Series servers. | def set_power_configuration(policy=None, delayType=None, delayValue=None):
'''
Sets the power configuration on the device. This is only available for some
C-Series servers.
.. versionadded:: 2019.2.0
Args:
policy(str): The action to be taken when chassis power is restored after
an ... |
Set the SYSLOG server on the host. | def set_syslog_server(server=None, type="primary"):
'''
Set the SYSLOG server on the host.
Args:
server(str): The hostname or IP address of the SYSLOG server.
type(str): Specifies the type of SYSLOG server. This can either be primary (default) or secondary.
CLI Example:
.. code-b... |
Sets a CIMC user with specified configurations. | def set_user(uid=None, username=None, password=None, priv=None, status=None):
'''
Sets a CIMC user with specified configurations.
.. versionadded:: 2019.2.0
Args:
uid(int): The user ID slot to create the user account in.
username(str): The name of the user.
password(str): The... |
Update the BIOS firmware through TFTP. | def tftp_update_bios(server=None, path=None):
'''
Update the BIOS firmware through TFTP.
Args:
server(str): The IP address or hostname of the TFTP server.
path(str): The TFTP path and filename for the BIOS image.
CLI Example:
.. code-block:: bash
salt '*' cimc.tftp_updat... |
return True if the acl need to be update False if it doesn t need to be update | def _acl_changes(name, id=None, type=None, rules=None, consul_url=None, token=None):
'''
return True if the acl need to be update, False if it doesn't need to be update
'''
info = __salt__['consul.acl_info'](id=id, token=token, consul_url=consul_url)
if info['res'] and info['data'][0]['Name'] !=... |
Check the acl exists by using the name or the ID name is ignored if ID is specified if only Name is used the ID associated with it is returned | def _acl_exists(name=None, id=None, token=None, consul_url=None):
'''
Check the acl exists by using the name or the ID,
name is ignored if ID is specified,
if only Name is used the ID associated with it is returned
'''
ret = {'result': False, 'id': None}
if id:
info = __sa... |
Ensure the ACL is present | def acl_present(name, id=None, token=None, type="client", rules="", consul_url='http://localhost:8500'):
'''
Ensure the ACL is present
name
Specifies a human-friendly name for the ACL token.
id
Specifies the ID of the ACL.
type: client
Specifies the type of ACL token. Vali... |
Ensure the ACL is absent | def acl_absent(name, id=None, token=None, consul_url='http://localhost:8500'):
'''
Ensure the ACL is absent
name
Specifies a human-friendly name for the ACL token.
id
Specifies the ID of the ACL.
token
token to authenticate you Consul query
consul_url : http://locahos... |
Return NVMe NQN | def nvme_nqn():
'''
Return NVMe NQN
'''
grains = {}
grains['nvme_nqn'] = False
if salt.utils.platform.is_linux():
grains['nvme_nqn'] = _linux_nqn()
return grains |
Return NVMe NQN from a Linux host. | def _linux_nqn():
'''
Return NVMe NQN from a Linux host.
'''
ret = []
initiator = '/etc/nvme/hostnqn'
try:
with salt.utils.files.fopen(initiator, 'r') as _nvme:
for line in _nvme:
line = line.strip()
if line.startswith('nqn.'):
... |
Create or manage a java keystore. | def managed(name, passphrase, entries, force_remove=False):
'''
Create or manage a java keystore.
name
The path to the keystore file
passphrase
The password to the keystore
entries
A list containing an alias, certificate, and optional private_key.
The certificate a... |
Disable the Packet Filter. | def disable():
'''
Disable the Packet Filter.
CLI example:
.. code-block:: bash
salt '*' pf.disable
'''
ret = {}
result = __salt__['cmd.run_all']('pfctl -d',
output_loglevel='trace',
python_shell=False)
... |
Set the debug level which limits the severity of log messages printed by pf ( 4 ). | def loglevel(level):
'''
Set the debug level which limits the severity of log messages printed by ``pf(4)``.
level:
Log level. Should be one of the following: emerg, alert, crit, err, warning, notice,
info or debug (OpenBSD); or none, urgent, misc, loud (FreeBSD).
CLI example:
.. ... |
Load a ruleset from the specific file overwriting the currently loaded ruleset. | def load(file='/etc/pf.conf', noop=False):
'''
Load a ruleset from the specific file, overwriting the currently loaded ruleset.
file:
Full path to the file containing the ruleset.
noop:
Don't actually load the rules, just parse them.
CLI example:
.. code-block:: bash
... |
Flush the specified packet filter parameters. | def flush(modifier):
'''
Flush the specified packet filter parameters.
modifier:
Should be one of the following:
- all
- info
- osfp
- rules
- sources
- states
- tables
Please refer to the OpenBSD `pfctl(8) <https://man.openbsd.org/p... |
Apply a command on the specified table. | def table(command, table, **kwargs):
'''
Apply a command on the specified table.
table:
Name of the table.
command:
Command to apply to the table. Supported commands are:
- add
- delete
- expire
- flush
- kill
- replace
- show
... |
Show filter parameters. | def show(modifier):
'''
Show filter parameters.
modifier:
Modifier to apply for filtering. Only a useful subset of what pfctl supports
can be used with Salt.
- rules
- states
- tables
CLI example:
.. code-block:: bash
salt '*' pf.show rules
''... |
Create an event on the VictorOps service | def create_event(name, message_type, routing_key='everyone', **kwargs):
'''
Create an event on the VictorOps service
.. code-block:: yaml
webserver-warning-message:
victorops.create_event:
- message_type: 'CRITICAL'
- entity_id: 'webserver/diskspace'
-... |
Set up neutron credentials | def _auth(profile=None):
'''
Set up neutron credentials
'''
if profile:
credentials = __salt__['config.option'](profile)
user = credentials['keystone.user']
password = credentials['keystone.password']
tenant = credentials['keystone.tenant']
auth_url = credentials[... |
Update a tenant s quota | def update_quota(tenant_id,
subnet=None,
router=None,
network=None,
floatingip=None,
port=None,
security_group=None,
security_group_rule=None,
profile=None):
'''
Update a tenan... |
Creates a new port | def create_port(name,
network,
device_id=None,
admin_state_up=True,
profile=None):
'''
Creates a new port
CLI Example:
.. code-block:: bash
salt '*' neutron.create_port network-name port-name
:param name: Name of port to cre... |
Updates a port | def update_port(port, name, admin_state_up=True, profile=None):
'''
Updates a port
CLI Example:
.. code-block:: bash
salt '*' neutron.update_port port-name network-name new-port-name
:param port: Port name or ID
:param name: Name of this port
:param admin_state_up: Set admin stat... |
Creates a new network | def create_network(name, router_ext=None, admin_state_up=True, network_type=None, physical_network=None, segmentation_id=None, shared=None, profile=None):
'''
Creates a new network
CLI Example:
.. code-block:: bash
salt '*' neutron.create_network network-name
salt '*' neutron.create_n... |
Updates a network | def update_network(network, name, profile=None):
'''
Updates a network
CLI Example:
.. code-block:: bash
salt '*' neutron.update_network network-name new-network-name
:param network: ID or name of network to update
:param name: Name of this network
:param profile: Profile to buil... |
Creates a new subnet | def create_subnet(network, cidr, name=None,
ip_version=4, profile=None):
'''
Creates a new subnet
CLI Example:
.. code-block:: bash
salt '*' neutron.create_subnet network-name 192.168.1.0/24
:param network: Network ID or name this subnet belongs to
:param cidr: CIDR... |
Updates a subnet | def update_subnet(subnet, name, profile=None):
'''
Updates a subnet
CLI Example:
.. code-block:: bash
salt '*' neutron.update_subnet subnet-name new-subnet-name
:param subnet: ID or name of subnet to update
:param name: Name of this subnet
:param profile: Profile to build on (Opt... |
Creates a new router | def create_router(name, ext_network=None,
admin_state_up=True, profile=None):
'''
Creates a new router
CLI Example:
.. code-block:: bash
salt '*' neutron.create_router new-router-name
:param name: Name of router to create (must be first)
:param ext_network: ID or na... |
Updates a router | def update_router(router,
name=None,
admin_state_up=None,
profile=None,
**kwargs):
'''
Updates a router
CLI Example:
.. code-block:: bash
salt '*' neutron.update_router router_id name=new-router-name
admin... |
Adds an internal network interface to the specified router | def add_interface_router(router, subnet, profile=None):
'''
Adds an internal network interface to the specified router
CLI Example:
.. code-block:: bash
salt '*' neutron.add_interface_router router-name subnet-name
:param router: ID or name of the router
:param subnet: ID or name of ... |
Removes an internal network interface from the specified router | def remove_interface_router(router, subnet, profile=None):
'''
Removes an internal network interface from the specified router
CLI Example:
.. code-block:: bash
salt '*' neutron.remove_interface_router router-name subnet-name
:param router: ID or name of the router
:param subnet: ID ... |
Adds an external network gateway to the specified router | def add_gateway_router(router, ext_network, profile=None):
'''
Adds an external network gateway to the specified router
CLI Example:
.. code-block:: bash
salt '*' neutron.add_gateway_router router-name ext-network-name
:param router: ID or name of the router
:param ext_network: ID or... |
Creates a new floatingIP | def create_floatingip(floating_network, port=None, profile=None):
'''
Creates a new floatingIP
CLI Example:
.. code-block:: bash
salt '*' neutron.create_floatingip network-name port-name
:param floating_network: Network name or ID to allocate floatingIP from
:param port: Of the port ... |
Updates a floatingIP | def update_floatingip(floatingip_id, port=None, profile=None):
'''
Updates a floatingIP
CLI Example:
.. code-block:: bash
salt '*' neutron.update_floatingip network-name port-name
:param floatingip_id: ID of floatingIP
:param port: ID or name of port, to associate floatingip to `None... |
Creates a new security group | def create_security_group(name=None, description=None, profile=None):
'''
Creates a new security group
CLI Example:
.. code-block:: bash
salt '*' neutron.create_security_group security-group-name \
description='Security group for servers'
:param name: Name of security gro... |
Updates a security group | def update_security_group(security_group, name=None, description=None,
profile=None):
'''
Updates a security group
CLI Example:
.. code-block:: bash
salt '*' neutron.update_security_group security-group-name \
new-security-group-name
:param secur... |
Creates a new security group rule | def create_security_group_rule(security_group,
remote_group_id=None,
direction='ingress',
protocol=None,
port_range_min=None,
port_range_max=None,
... |
Fetches a list of all configured VPN services for a tenant | def list_vpnservices(retrieve_all=True, profile=None, **kwargs):
'''
Fetches a list of all configured VPN services for a tenant
CLI Example:
.. code-block:: bash
salt '*' neutron.list_vpnservices
:param retrieve_all: True or False, default: True (Optional)
:param profile: Profile to ... |
Fetches information of a specific VPN service | def show_vpnservice(vpnservice, profile=None, **kwargs):
'''
Fetches information of a specific VPN service
CLI Example:
.. code-block:: bash
salt '*' neutron.show_vpnservice vpnservice-name
:param vpnservice: ID or name of vpn service to look up
:param profile: Profile to build on (O... |
Creates a new VPN service | def create_vpnservice(subnet, router, name, admin_state_up=True, profile=None):
'''
Creates a new VPN service
CLI Example:
.. code-block:: bash
salt '*' neutron.create_vpnservice router-name name
:param subnet: Subnet unique identifier for the VPN service deployment
:param router: Ro... |
Updates a VPN service | def update_vpnservice(vpnservice, desc, profile=None):
'''
Updates a VPN service
CLI Example:
.. code-block:: bash
salt '*' neutron.update_vpnservice vpnservice-name desc='VPN Service1'
:param vpnservice: ID or name of vpn service to update
:param desc: Set a description for the VPN ... |
Creates a new IPsecSiteConnection | def create_ipsec_site_connection(name,
ipsecpolicy,
ikepolicy,
vpnservice,
peer_cidrs,
peer_address,
peer_id,
... |
Creates a new IKEPolicy | def create_ikepolicy(name, profile=None, **kwargs):
'''
Creates a new IKEPolicy
CLI Example:
.. code-block:: bash
salt '*' neutron.create_ikepolicy ikepolicy-name
phase1_negotiation_mode=main auth_algorithm=sha1
encryption_algorithm=aes-128 pfs=group5
:par... |
Creates a new IPsecPolicy | def create_ipsecpolicy(name, profile=None, **kwargs):
'''
Creates a new IPsecPolicy
CLI Example:
.. code-block:: bash
salt '*' neutron.create_ipsecpolicy ipsecpolicy-name
transform_protocol=esp auth_algorithm=sha1
encapsulation_mode=tunnel encryption_algorithm=... |
Creates a new firewall rule | def create_firewall_rule(protocol, action, profile=None, **kwargs):
'''
Creates a new firewall rule
CLI Example:
.. code-block:: bash
salt '*' neutron.create_firewall_rule protocol action
tenant_id=TENANT_ID name=NAME description=DESCRIPTION ip_version=IP_VERSION
... |
Update a firewall rule | def update_firewall_rule(firewall_rule,
protocol=None,
action=None,
name=None,
description=None,
ip_version=None,
source_ip_address=None,
destina... |
Return a report on all actively running jobs from a job id centric perspective | def active(display_progress=False):
'''
Return a report on all actively running jobs from a job id centric
perspective
CLI Example:
.. code-block:: bash
salt-run jobs.active
'''
ret = {}
client = salt.client.get_local_client(__opts__['conf_file'])
try:
active_ = cl... |
Return the printout from a previously executed job | def lookup_jid(jid,
ext_source=None,
returned=True,
missing=False,
display_progress=False):
'''
Return the printout from a previously executed job
jid
The jid to look up.
ext_source
The external job cache to use. Default: `Non... |
List a specific job given by its jid | def list_job(jid, ext_source=None, display_progress=False):
'''
List a specific job given by its jid
ext_source
If provided, specifies which external job cache to use.
display_progress : False
If ``True``, fire progress events.
.. versionadded:: 2015.8.8
CLI Example:
... |
List all detectable jobs and associated functions | def list_jobs(ext_source=None,
outputter=None,
search_metadata=None,
search_function=None,
search_target=None,
start_time=None,
end_time=None,
display_progress=False):
'''
List all detectable jobs and associated fu... |
List all detectable jobs and associated functions | def list_jobs_filter(count,
filter_find_job=True,
ext_source=None,
outputter=None,
display_progress=False):
'''
List all detectable jobs and associated functions
ext_source
The external job cache to use. Default: `N... |
Print a specific job s detail given by it s jid including the return data. | def print_job(jid, ext_source=None):
'''
Print a specific job's detail given by it's jid, including the return data.
CLI Example:
.. code-block:: bash
salt-run jobs.print_job 20130916125524463507
'''
ret = {}
returner = _get_returner((
__opts__['ext_job_cache'],
e... |
Check if a job has been executed and exit successfully | def exit_success(jid, ext_source=None):
'''
Check if a job has been executed and exit successfully
jid
The jid to look up.
ext_source
The external job cache to use. Default: `None`.
CLI Example:
.. code-block:: bash
salt-run jobs.exit_success 20160520145827701627
... |
.. versionadded:: 2015. 8. 0 | def last_run(ext_source=None,
outputter=None,
metadata=None,
function=None,
target=None,
display_progress=False):
'''
.. versionadded:: 2015.8.0
List all detectable jobs and associated functions
CLI Example:
.. code-block:: bash
... |
Helper to format a job instance | def _format_job_instance(job):
'''
Helper to format a job instance
'''
if not job:
ret = {'Error': 'Cannot contact returner or no job with this jid'}
return ret
ret = {'Function': job.get('fun', 'unknown-function'),
'Arguments': list(job.get('arg', [])),
# unli... |
Walk through the job dir and return jobs | def _walk_through(job_dir, display_progress=False):
'''
Walk through the job dir and return jobs
'''
serial = salt.payload.Serial(__opts__)
for top in os.listdir(job_dir):
t_path = os.path.join(job_dir, top)
for final in os.listdir(t_path):
load_path = os.path.join(t_pa... |
Trigger an event in IFTTT | def trigger_event(name,
event,
value1=None,
value2=None,
value3=None
):
'''
Trigger an event in IFTTT
.. code-block:: yaml
ifttt-event:
ifttt.trigger_event:
- event: TestEvent
... |
Ensure the CNAME with the given name or canonical name is removed | def absent(name=None, canonical=None, **api_opts):
'''
Ensure the CNAME with the given name or canonical name is removed
'''
ret = {'name': name, 'result': False, 'comment': '', 'changes': {}}
obj = __salt__['infoblox.get_cname'](name=name, canonical=canonical, **api_opts)
if not obj:
r... |
Get the redis options from salt. | def _get_options(ret=None):
'''
Get the redis options from salt.
'''
attrs = {'host': 'host',
'port': 'port',
'unix_socket_path': 'unix_socket_path',
'db': 'db',
'password': 'password',
'cluster_mode': 'cluster_mode',
'startup... |
Return a redis server object | def _get_serv(ret=None):
'''
Return a redis server object
'''
_options = _get_options(ret)
global REDIS_POOL
if REDIS_POOL:
return REDIS_POOL
elif _options.get('cluster_mode'):
REDIS_POOL = StrictRedisCluster(startup_nodes=_options.get('startup_nodes'),
... |
Return data to a redis data store | def returner(ret):
'''
Return data to a redis data store
'''
serv = _get_serv(ret)
pipeline = serv.pipeline(transaction=False)
minion, jid = ret['id'], ret['jid']
pipeline.hset('ret:{0}'.format(jid), minion, salt.utils.json.dumps(ret))
pipeline.expire('ret:{0}'.format(jid), _get_ttl())
... |
Save the load to the specified jid | def save_load(jid, load, minions=None):
'''
Save the load to the specified jid
'''
serv = _get_serv(ret=None)
serv.setex('load:{0}'.format(jid), _get_ttl(), salt.utils.json.dumps(load)) |
Return the load data that marks a specified jid | def get_load(jid):
'''
Return the load data that marks a specified jid
'''
serv = _get_serv(ret=None)
data = serv.get('load:{0}'.format(jid))
if data:
return salt.utils.json.loads(data)
return {} |
Return the information returned when the specified job id was executed | def get_jid(jid):
'''
Return the information returned when the specified job id was executed
'''
serv = _get_serv(ret=None)
ret = {}
for minion, data in six.iteritems(serv.hgetall('ret:{0}'.format(jid))):
if data:
ret[minion] = salt.utils.json.loads(data)
return ret |
Return a dict of the last function called for all minions | def get_fun(fun):
'''
Return a dict of the last function called for all minions
'''
serv = _get_serv(ret=None)
ret = {}
for minion in serv.smembers('minions'):
ind_str = '{0}:{1}'.format(minion, fun)
try:
jid = serv.get(ind_str)
except Exception:
c... |
Return a dict mapping all job ids to job information | def get_jids():
'''
Return a dict mapping all job ids to job information
'''
serv = _get_serv(ret=None)
ret = {}
for s in serv.mget(serv.keys('load:*')):
if s is None:
continue
load = salt.utils.json.loads(s)
jid = load['jid']
ret[jid] = salt.utils.jid... |
Clean out minions s return data for old jobs. | def clean_old_jobs():
'''
Clean out minions's return data for old jobs.
Normally, hset 'ret:<jid>' are saved with a TTL, and will eventually
get cleaned by redis.But for jobs with some very late minion return, the
corresponding hset's TTL will be refreshed to a too late timestamp, we'll
do manu... |
Run the preparation sequence required to start a salt - api daemon. | def prepare(self):
'''
Run the preparation sequence required to start a salt-api daemon.
If sub-classed, don't **ever** forget to run:
super(YourSubClass, self).prepare()
'''
super(SaltAPI, self).prepare()
try:
if self.config['verify_env']:
... |
Start the actual master. | def start(self):
'''
Start the actual master.
If sub-classed, don't **ever** forget to run:
super(YourSubClass, self).start()
NOTE: Run any required code before calling `super()`.
'''
super(SaltAPI, self).start()
if check_user(self.config['user']):
... |
If sub - classed run any shutdown operations on this method. | def shutdown(self, exitcode=0, exitmsg=None):
'''
If sub-classed, run any shutdown operations on this method.
'''
log.info('The salt-api is shutting down..')
msg = 'The salt-api is shutdown. '
if exitmsg is not None:
exitmsg = msg + exitmsg
else:
... |
Make sure znode is present in the correct state with the correct acls | def present(name, value, acls=None, ephemeral=False, sequence=False, makepath=False, version=-1,
profile=None, hosts=None, scheme=None, username=None, password=None, default_acl=None):
'''
Make sure znode is present in the correct state with the correct acls
name
path to znode
valu... |
Make sure znode is absent | def absent(name, version=-1, recursive=False, profile=None, hosts=None, scheme=None,
username=None, password=None, default_acl=None):
'''
Make sure znode is absent
name
path to znode
version
Specify the version which should be deleted
Default: -1 (always match)
... |
Update acls on a znode | def acls(name, acls, version=-1, profile=None, hosts=None, scheme=None,
username=None, password=None, default_acl=None):
'''
Update acls on a znode
name
path to znode
acls
list of acl dictionaries to set on znode
version
Specify the version which should be deleted... |
get the output of timedatectl | def _timedatectl():
'''
get the output of timedatectl
'''
ret = __salt__['cmd.run_all'](['timedatectl'], python_shell=False)
if ret['retcode'] != 0:
msg = 'timedatectl failed: {0}'.format(ret['stderr'])
raise CommandExecutionError(msg)
return ret |
Return the timezone in/ etc/ adjtime of the system clock | def _get_adjtime_timezone():
'''
Return the timezone in /etc/adjtime of the system clock
'''
adjtime_file = '/etc/adjtime'
if os.path.exists(adjtime_file):
cmd = ['tail', '-n', '1', adjtime_file]
return __salt__['cmd.run'](cmd, python_shell=False)
elif os.path.exists('/dev/rtc'):... |
Get current timezone ( i. e. America/ Denver ) | def get_zone():
'''
Get current timezone (i.e. America/Denver)
.. versionchanged:: 2016.11.4
.. note::
On AIX operating systems, Posix values can also be returned
'CST6CDT,M3.2.0/2:00:00,M11.1.0/2:00:00'
CLI Example:
.. code-block:: bash
salt '*' timezone.get_zone
... |
Get current numeric timezone offset from UCT ( i. e. - 0700 ) | def get_offset():
'''
Get current numeric timezone offset from UCT (i.e. -0700)
CLI Example:
.. code-block:: bash
salt '*' timezone.get_offset
'''
if 'AIX' not in __grains__['os_family']:
return __salt__['cmd.run'](['date', '+%z'], python_shell=False)
salt_path = '/opt/sa... |
Unlinks then symlinks/ etc/ localtime to the set timezone. | def set_zone(timezone):
'''
Unlinks, then symlinks /etc/localtime to the set timezone.
The timezone is crucial to several system processes, each of which SHOULD
be restarted (for instance, whatever you system uses as its cron and
syslog daemons). This will not be automagically done and must be done... |
Compares the given timezone name with the system timezone name. Checks the hash sum between the given timezone and the one set in/ etc/ localtime. Returns True if names and hash sums match and False if not. Mostly useful for running state checks. | def zone_compare(timezone):
'''
Compares the given timezone name with the system timezone name.
Checks the hash sum between the given timezone, and the one set in
/etc/localtime. Returns True if names and hash sums match, and False if not.
Mostly useful for running state checks.
.. versionchang... |
Get current hardware clock setting ( UTC or localtime ) | def get_hwclock():
'''
Get current hardware clock setting (UTC or localtime)
CLI Example:
.. code-block:: bash
salt '*' timezone.get_hwclock
'''
if salt.utils.path.which('timedatectl'):
ret = _timedatectl()
for line in (x.strip() for x in ret['stdout'].splitlines()):
... |
Sets the hardware clock to be either UTC or localtime | def set_hwclock(clock):
'''
Sets the hardware clock to be either UTC or localtime
CLI Example:
.. code-block:: bash
salt '*' timezone.set_hwclock UTC
'''
if salt.utils.path.which('timedatectl'):
cmd = ['timedatectl', 'set-local-rtc',
'true' if clock == 'localtim... |
Installs a package if not already installed | def installed(name, version=None, source=None, force=False, pre_versions=False,
install_args=None, override_args=False, force_x86=False,
package_args=None, allow_multiple=False, execution_timeout=None):
'''
Installs a package if not already installed
Args:
name (str):
... |
Uninstalls a package | def uninstalled(name, version=None, uninstall_args=None, override_args=False):
'''
Uninstalls a package
name
The name of the package to be uninstalled
version
Uninstalls a specific version of the package. Defaults to latest
version installed.
uninstall_args
A list of unins... |
Store job information using the configured master_job_cache | def store_job(opts, load, event=None, mminion=None):
'''
Store job information using the configured master_job_cache
'''
# Generate EndTime
endtime = salt.utils.jid.jid_to_time(salt.utils.jid.gen_jid(opts))
# If the return data is invalid, just ignore it
if any(key not in load for key in ('r... |
Store additional minions matched on lower - level masters using the configured master_job_cache | def store_minions(opts, jid, minions, mminion=None, syndic_id=None):
'''
Store additional minions matched on lower-level masters using the configured
master_job_cache
'''
if mminion is None:
mminion = salt.minion.MasterMinion(opts, states=False, rend=False)
job_cache = opts['master_job_c... |
Determine a retcode for a given return | def get_retcode(ret):
'''
Determine a retcode for a given return
'''
retcode = 0
# if there is a dict with retcode, use that
if isinstance(ret, dict) and ret.get('retcode', 0) != 0:
return ret['retcode']
# if its a boolean, False means 1
elif isinstance(ret, bool) and not ret:
... |
Checks for locked accounts due to too many invalid login attempts 3 or higher. | def beacon(config):
'''
Checks for locked accounts due to too many invalid login attempts, 3 or higher.
.. code-block:: yaml
beacons:
aix_account:
user: ALL
interval: 120
'''
ret = []
user = config['user']
locked_accounts = __salt__['shadow.log... |
Post data to OpsGenie. It s designed for Salt s Event Reactor. | def post_data(api_key=None, name='OpsGenie Execution Module', reason=None,
action_type=None):
'''
Post data to OpsGenie. It's designed for Salt's Event Reactor.
After configuring the sls reaction file as shown above, you can trigger the
module with your designated tag (og-tag in this case... |
Install a Mac OS Package from a pkg or dmg file if given a dmg file it will first be mounted in a temporary location | def installed(name, target="LocalSystem", dmg=False, store=False, app=False, mpkg=False, user=None, onlyif=None,
unless=None, force=False, allow_untrusted=False, version_check=None):
'''
Install a Mac OS Package from a pkg or dmg file, if given a dmg file it
will first be mounted in a temporar... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.