INSTRUCTION
stringlengths
1
8.43k
RESPONSE
stringlengths
75
104k
Name of the last installed kernel for Red Hat based systems.
def _kernel_versions_redhat(): ''' Name of the last installed kernel, for Red Hat based systems. Returns: List with name of last installed kernel as it is interpreted in output of `uname -a` command. ''' kernel_get_last = __salt__['cmd.run']('rpm -q --last kernel') kernels = [] ...
Last installed kernel name for Debian based systems.
def _kernel_versions_nilrt(): ''' Last installed kernel name, for Debian based systems. Returns: List with possible names of last installed kernel as they are probably interpreted in output of `uname -a` command. ''' kver = None def _get_kver_from_bin(kbin): '''...
Name of the last installed kernel for Red Hat based systems.
def _check_timeout(start_time, timeout): ''' Name of the last installed kernel, for Red Hat based systems. Returns: List with name of last installed kernel as it is interpreted in output of `uname -a` command. ''' timeout_milisec = timeout * 60000 if timeout_milisec < (int(round(tim...
Detect whether a file changed in an NILinuxRT system using md5sum and timestamp files from a state directory.
def _file_changed_nilrt(full_filepath): ''' Detect whether a file changed in an NILinuxRT system using md5sum and timestamp files from a state directory. Returns: - False if md5sum/timestamp state files don't exist - True/False depending if ``base_filename`` got modified/touch...
Besides the normal Linux kernel driver interfaces NILinuxRT - supported hardware features an extensible plugin - based device enumeration and configuration interface named System API. When an installed package is extending the API it is very hard to know all repercurssions and actions to be taken so reboot making sure ...
def _sysapi_changed_nilrt(): ''' Besides the normal Linux kernel driver interfaces, NILinuxRT-supported hardware features an extensible, plugin-based device enumeration and configuration interface named "System API". When an installed package is extending the API it is very hard to know all repercurssio...
Analyzes files openeded by running processes and seeks for packages which need to be restarted.
def restartcheck(ignorelist=None, blacklist=None, excludepid=None, **kwargs): ''' Analyzes files openeded by running processes and seeks for packages which need to be restarted. Args: ignorelist: string or list of packages to be ignored blacklist: string or list of file paths to be ignored ...
Configures the default VSAN policy on a vCenter. The state assumes there is only one default VSAN policy on a vCenter.
def default_vsan_policy_configured(name, policy): ''' Configures the default VSAN policy on a vCenter. The state assumes there is only one default VSAN policy on a vCenter. policy Dict representation of a policy ''' # TODO Refactor when recurse_differ supports list_differ # It's goi...
Assigns a default storage policy to a datastore
def default_storage_policy_assigned(name, policy, datastore): ''' Assigns a default storage policy to a datastore policy Name of storage policy datastore Name of datastore ''' log.info('Running state %s for policy \'%s\', datastore \'%s\'.', name, policy, datastore...
Return a cloud client
def _get_client(): ''' Return a cloud client ''' client = salt.cloud.CloudClient( os.path.join(os.path.dirname(__opts__['conf_file']), 'cloud'), pillars=copy.deepcopy(__pillar__.get('cloud', {})) ) return client
Return true if the instance is found on a provider
def has_instance(name, provider=None): ''' Return true if the instance is found on a provider CLI Example: .. code-block:: bash salt minionname cloud.has_instance myinstance ''' data = get_instance(name, provider) if data is None: return False return True
Return details on an instance.
def get_instance(name, provider=None): ''' Return details on an instance. Similar to the cloud action show_instance but returns only the instance details. CLI Example: .. code-block:: bash salt minionname cloud.get_instance myinstance SLS Example: .. code-block:: bash ...
Spin up an instance using Salt Cloud
def profile_(profile, names, vm_overrides=None, opts=None, **kwargs): ''' Spin up an instance using Salt Cloud CLI Example: .. code-block:: bash salt minionname cloud.profile my-gce-config myinstance ''' client = _get_client() if isinstance(opts, dict): client.opts.update(...
Execute a salt cloud map file
def map_run(path=None, **kwargs): ''' Execute a salt cloud map file Cloud Map data can be retrieved from several sources: - a local file (provide the path to the file to the 'path' argument) - a JSON-formatted map directly (provide the appropriately formatted to using the 'map_data' argument) ...
Execute a single action on the given provider/ instance
def action( fun=None, cloudmap=None, names=None, provider=None, instance=None, **kwargs): ''' Execute a single action on the given provider/instance CLI Example: .. code-block:: bash salt minionname cloud.action start instance=myinstance ...
Create an instance using Salt Cloud
def create(provider, names, opts=None, **kwargs): ''' Create an instance using Salt Cloud CLI Example: .. code-block:: bash salt minionname cloud.create my-ec2-config myinstance image=ami-1624987f size='t1.micro' ssh_username=ec2-user securitygroup=default delvol_on_destroy=True ''' c...
List block storage volumes
def volume_list(provider): ''' List block storage volumes CLI Example: .. code-block:: bash salt minionname cloud.volume_list my-nova ''' client = _get_client() info = client.extra_action(action='volume_list', provider=provider, names='name') return info['name']
Attach volume to a server
def volume_attach(provider, names, **kwargs): ''' Attach volume to a server CLI Example: .. code-block:: bash salt minionname cloud.volume_attach my-nova myblock server_name=myserver device='/dev/xvdf' ''' client = _get_client() info = client.extra_action(provider=provider, names...
List private networks
def network_list(provider): ''' List private networks CLI Example: .. code-block:: bash salt minionname cloud.network_list my-nova ''' client = _get_client() return client.extra_action(action='network_list', provider=provider, names='names')
Create private network
def network_create(provider, names, **kwargs): ''' Create private network CLI Example: .. code-block:: bash salt minionname cloud.network_create my-nova names=['salt'] cidr='192.168.100.0/24' ''' client = _get_client() return client.extra_action(provider=provider, names=names, ac...
List virtual interfaces on a server
def virtual_interface_list(provider, names, **kwargs): ''' List virtual interfaces on a server CLI Example: .. code-block:: bash salt minionname cloud.virtual_interface_list my-nova names=['salt-master'] ''' client = _get_client() return client.extra_action(provider=provider, nam...
Attach private interfaces to a server
def virtual_interface_create(provider, names, **kwargs): ''' Attach private interfaces to a server CLI Example: .. code-block:: bash salt minionname cloud.virtual_interface_create my-nova names=['salt-master'] net_name='salt' ''' client = _get_client() return client.extra_action(...
Return a list of sysctl parameters for this minion
def show(config_file=False): ''' Return a list of sysctl parameters for this minion CLI Example: .. code-block:: bash salt '*' sysctl.show ''' roots = ( 'kern', 'vm', 'vfs', 'net', 'hw', 'machdep', 'user', 'ddb', ...
Return a single sysctl parameter for this minion
def get(name): ''' Return a single sysctl parameter for this minion CLI Example: .. code-block:: bash salt '*' sysctl.get hw.physmem ''' cmd = 'sysctl -n {0}'.format(name) out = __salt__['cmd.run'](cmd, python_shell=False) return out
Assign and persist a simple sysctl parameter for this minion
def persist(name, value, config='/etc/sysctl.conf'): ''' Assign and persist a simple sysctl parameter for this minion CLI Example: .. code-block:: bash salt '*' sysctl.persist net.inet.icmp.icmplim 50 ''' nlines = [] edited = False value = six.text_type(value) # create /e...
Send a message to a PushOver channel.
def post_message(name, user=None, device=None, message=None, title=None, priority=None, expire=None, retry=None, sound=None, api_version=1, token=None...
Check if address is a valid IP. returns True if valid otherwise False.
def check_ip(addr): ''' Check if address is a valid IP. returns True if valid, otherwise False. CLI Example: .. code-block:: bash salt ns1 dig.check_ip 127.0.0.1 salt ns1 dig.check_ip 1111:2222:3333:4444:5555:6666:7777:8888 ''' try: addr = addr.rsplit('/', 1) exce...
Return the AAAA record for host.
def AAAA(host, nameserver=None): ''' Return the AAAA record for ``host``. Always returns a list. CLI Example: .. code-block:: bash salt ns1 dig.AAAA www.google.com ''' dig = ['dig', '+short', six.text_type(host), 'AAAA'] if nameserver is not None: dig.append('@{0}'.f...
Return a list of IPs of the nameservers for domain
def NS(domain, resolve=True, nameserver=None): ''' Return a list of IPs of the nameservers for ``domain`` If ``resolve`` is False, don't resolve names. CLI Example: .. code-block:: bash salt ns1 dig.NS google.com ''' dig = ['dig', '+short', six.text_type(domain), 'NS'] if na...
Return the allowed IPv4 ranges in the SPF record for domain.
def SPF(domain, record='SPF', nameserver=None): ''' Return the allowed IPv4 ranges in the SPF record for ``domain``. If record is ``SPF`` and the SPF record is empty, the TXT record will be searched automatically. If you know the domain uses TXT and not SPF, specifying that will save a lookup. ...
Return a list of lists for the MX of domain.
def MX(domain, resolve=False, nameserver=None): ''' Return a list of lists for the MX of ``domain``. If the ``resolve`` argument is True, resolve IPs for the servers. It's limited to one IP, because although in practice it's very rarely a round robin, it is an acceptable configuration and pulling ...
Return the TXT record for host.
def TXT(host, nameserver=None): ''' Return the TXT record for ``host``. Always returns a list. CLI Example: .. code-block:: bash salt ns1 dig.TXT google.com ''' dig = ['dig', '+short', six.text_type(host), 'TXT'] if nameserver is not None: dig.append('@{0}'.format(na...
Return a list of sysctl parameters for this minion
def show(config_file=False): ''' Return a list of sysctl parameters for this minion CLI Example: .. code-block:: bash salt '*' sysctl.show ''' roots = ( 'compat', 'debug', 'dev', 'hptmv', 'hw', 'kern', 'machdep', 'net', ...
Assign a single sysctl parameter for this minion
def assign(name, value): ''' Assign a single sysctl parameter for this minion CLI Example: .. code-block:: bash salt '*' sysctl.assign net.inet.icmp.icmplim 50 ''' ret = {} cmd = 'sysctl {0}="{1}"'.format(name, value) data = __salt__['cmd.run_all'](cmd, python_shell=False) ...
Assign and persist a simple sysctl parameter for this minion
def persist(name, value, config='/etc/sysctl.conf'): ''' Assign and persist a simple sysctl parameter for this minion CLI Example: .. code-block:: bash salt '*' sysctl.persist net.inet.icmp.icmplim 50 salt '*' sysctl.persist coretemp_load NO config=/boot/loader.conf ''' nlines...
Recursively workout the file name from an augeas change
def _workout_filename(filename): ''' Recursively workout the file name from an augeas change ''' if os.path.isfile(filename) or filename == '/': if filename == '/': filename = None return filename else: return _workout_filename(os.path.dirname(filename))
Ensure all changes are fully qualified and affect only one file. This ensures that the diff output works and a state change is not incorrectly reported.
def _check_filepath(changes): ''' Ensure all changes are fully qualified and affect only one file. This ensures that the diff output works and a state change is not incorrectly reported. ''' filename = None for change_ in changes: try: cmd, arg = change_.split(' ', 1) ...
.. versionadded:: 2014. 7. 0
def change(name, context=None, changes=None, lens=None, load_path=None, **kwargs): ''' .. versionadded:: 2014.7.0 This state replaces :py:func:`~salt.states.augeas.setvalue`. Issue changes to Augeas, optionally for a specific context, with a specific lens. name State name ...
Returns an instance of the redis client
def _connect(host=None, port=None, db=None, password=None): ''' Returns an instance of the redis client ''' if not host: host = __salt__['config.option']('redis.host') if not port: port = __salt__['config.option']('redis.port') if not db: db = __salt__['config.option']('r...
Returns an instance of the redis client
def _sconnect(host=None, port=None, password=None): ''' Returns an instance of the redis client ''' if host is None: host = __salt__['config.option']('redis_sentinel.host', 'localhost') if port is None: port = __salt__['config.option']('redis_sentinel.port', 26379) if password is...
Asynchronously rewrite the append - only file
def bgrewriteaof(host=None, port=None, db=None, password=None): ''' Asynchronously rewrite the append-only file CLI Example: .. code-block:: bash salt '*' redis.bgrewriteaof ''' server = _connect(host, port, db, password) return server.bgrewriteaof()
Asynchronously save the dataset to disk
def bgsave(host=None, port=None, db=None, password=None): ''' Asynchronously save the dataset to disk CLI Example: .. code-block:: bash salt '*' redis.bgsave ''' server = _connect(host, port, db, password) return server.bgsave()
Get redis server configuration values
def config_get(pattern='*', host=None, port=None, db=None, password=None): ''' Get redis server configuration values CLI Example: .. code-block:: bash salt '*' redis.config_get salt '*' redis.config_get port ''' server = _connect(host, port, db, password) return server.con...
Set redis server configuration values
def config_set(name, value, host=None, port=None, db=None, password=None): ''' Set redis server configuration values CLI Example: .. code-block:: bash salt '*' redis.config_set masterauth luv_kittens ''' server = _connect(host, port, db, password) return server.config_set(name, va...
Return the number of keys in the selected database
def dbsize(host=None, port=None, db=None, password=None): ''' Return the number of keys in the selected database CLI Example: .. code-block:: bash salt '*' redis.dbsize ''' server = _connect(host, port, db, password) return server.dbsize()
Deletes the keys from redis returns number of keys deleted
def delete(*keys, **connection_args): ''' Deletes the keys from redis, returns number of keys deleted CLI Example: .. code-block:: bash salt '*' redis.delete foo ''' # Get connection args from keywords if set conn_args = {} for arg in ['host', 'port', 'db', 'password']: ...
Return true if the key exists in redis
def exists(key, host=None, port=None, db=None, password=None): ''' Return true if the key exists in redis CLI Example: .. code-block:: bash salt '*' redis.exists foo ''' server = _connect(host, port, db, password) return server.exists(key)
Set a keys time to live in seconds
def expire(key, seconds, host=None, port=None, db=None, password=None): ''' Set a keys time to live in seconds CLI Example: .. code-block:: bash salt '*' redis.expire foo 300 ''' server = _connect(host, port, db, password) return server.expire(key, seconds)
Set a keys expire at given UNIX time
def expireat(key, timestamp, host=None, port=None, db=None, password=None): ''' Set a keys expire at given UNIX time CLI Example: .. code-block:: bash salt '*' redis.expireat foo 1400000000 ''' server = _connect(host, port, db, password) return server.expireat(key, timestamp)
Remove all keys from all databases
def flushall(host=None, port=None, db=None, password=None): ''' Remove all keys from all databases CLI Example: .. code-block:: bash salt '*' redis.flushall ''' server = _connect(host, port, db, password) return server.flushall()
Remove all keys from the selected database
def flushdb(host=None, port=None, db=None, password=None): ''' Remove all keys from the selected database CLI Example: .. code-block:: bash salt '*' redis.flushdb ''' server = _connect(host, port, db, password) return server.flushdb()
Get redis key value
def get_key(key, host=None, port=None, db=None, password=None): ''' Get redis key value CLI Example: .. code-block:: bash salt '*' redis.get_key foo ''' server = _connect(host, port, db, password) return server.get(key)
Determine if a hash fields exists.
def hexists(key, field, host=None, port=None, db=None, password=None): ''' Determine if a hash fields exists. .. versionadded:: 2017.7.0 CLI Example: .. code-block:: bash salt '*' redis.hexists foo_hash bar_field ''' server = _connect(host, port, db, password) return server.h...
Get all fields and values from a redis hash returns dict
def hgetall(key, host=None, port=None, db=None, password=None): ''' Get all fields and values from a redis hash, returns dict CLI Example: .. code-block:: bash salt '*' redis.hgetall foo_hash ''' server = _connect(host, port, db, password) return server.hgetall(key)
Increment the integer value of a hash field by the given number.
def hincrby(key, field, increment=1, host=None, port=None, db=None, password=None): ''' Increment the integer value of a hash field by the given number. .. versionadded:: 2017.7.0 CLI Example: .. code-block:: bash salt '*' redis.hincrby foo_hash bar_field 5 ''' server = _connect(...
Returns number of fields of a hash.
def hlen(key, host=None, port=None, db=None, password=None): ''' Returns number of fields of a hash. .. versionadded:: 2017.7.0 CLI Example: .. code-block:: bash salt '*' redis.hlen foo_hash ''' server = _connect(host, port, db, password) return server.hlen(key)
Returns the values of all the given hash fields.
def hmget(key, *fields, **options): ''' Returns the values of all the given hash fields. .. versionadded:: 2017.7.0 CLI Example: .. code-block:: bash salt '*' redis.hmget foo_hash bar_field1 bar_field2 ''' host = options.get('host', None) port = options.get('port', None) ...
Sets multiple hash fields to multiple values.
def hmset(key, **fieldsvals): ''' Sets multiple hash fields to multiple values. .. versionadded:: 2017.7.0 CLI Example: .. code-block:: bash salt '*' redis.hmset foo_hash bar_field1=bar_value1 bar_field2=bar_value2 ''' host = fieldsvals.pop('host', None) port = fieldsvals.pop...
Set the value of a hash field.
def hset(key, field, value, host=None, port=None, db=None, password=None): ''' Set the value of a hash field. .. versionadded:: 2017.7.0 CLI Example: .. code-block:: bash salt '*' redis.hset foo_hash bar_field bar_value ''' server = _connect(host, port, db, password) return s...
Return all the values in a hash.
def hvals(key, host=None, port=None, db=None, password=None): ''' Return all the values in a hash. .. versionadded:: 2017.7.0 CLI Example: .. code-block:: bash salt '*' redis.hvals foo_hash bar_field1 bar_value1 ''' server = _connect(host, port, db, password) return server.hv...
Incrementally iterate hash fields and associated values.
def hscan(key, cursor=0, match=None, count=None, host=None, port=None, db=None, password=None): ''' Incrementally iterate hash fields and associated values. .. versionadded:: 2017.7.0 CLI Example: .. code-block:: bash salt '*' redis.hscan foo_hash match='field_prefix_*' count=1 ''' ...
Get information and statistics about the server
def info(host=None, port=None, db=None, password=None): ''' Get information and statistics about the server CLI Example: .. code-block:: bash salt '*' redis.info ''' server = _connect(host, port, db, password) return server.info()
Get redis keys supports glob style patterns
def keys(pattern='*', host=None, port=None, db=None, password=None): ''' Get redis keys, supports glob style patterns CLI Example: .. code-block:: bash salt '*' redis.keys salt '*' redis.keys test* ''' server = _connect(host, port, db, password) return server.keys(pattern)
Get redis key type
def key_type(key, host=None, port=None, db=None, password=None): ''' Get redis key type CLI Example: .. code-block:: bash salt '*' redis.type foo ''' server = _connect(host, port, db, password) return server.type(key)
Get the UNIX time in seconds of the last successful save to disk
def lastsave(host=None, port=None, db=None, password=None): ''' Get the UNIX time in seconds of the last successful save to disk CLI Example: .. code-block:: bash salt '*' redis.lastsave ''' # Use of %s to get the timestamp is not supported by Python. The reason it # works is beca...
Get the length of a list in Redis
def llen(key, host=None, port=None, db=None, password=None): ''' Get the length of a list in Redis CLI Example: .. code-block:: bash salt '*' redis.llen foo_list ''' server = _connect(host, port, db, password) return server.llen(key)
Ping the server returns False on connection errors
def ping(host=None, port=None, db=None, password=None): ''' Ping the server, returns False on connection errors CLI Example: .. code-block:: bash salt '*' redis.ping ''' server = _connect(host, port, db, password) try: return server.ping() except redis.ConnectionError:...
Synchronously save the dataset to disk
def save(host=None, port=None, db=None, password=None): ''' Synchronously save the dataset to disk CLI Example: .. code-block:: bash salt '*' redis.save ''' server = _connect(host, port, db, password) return server.save()
Set redis key value
def set_key(key, value, host=None, port=None, db=None, password=None): ''' Set redis key value CLI Example: .. code-block:: bash salt '*' redis.set_key foo bar ''' server = _connect(host, port, db, password) return server.set(key, value)
Synchronously save the dataset to disk and then shut down the server
def shutdown(host=None, port=None, db=None, password=None): ''' Synchronously save the dataset to disk and then shut down the server CLI Example: .. code-block:: bash salt '*' redis.shutdown ''' server = _connect(host, port, db, password) try: # Return false if unable to p...
Make the server a slave of another instance or promote it as master
def slaveof(master_host=None, master_port=None, host=None, port=None, db=None, password=None): ''' Make the server a slave of another instance, or promote it as master CLI Example: .. code-block:: bash # Become slave of redis-n01.example.com:6379 salt '*' redis.slaveof red...
Get members in a Redis set
def smembers(key, host=None, port=None, db=None, password=None): ''' Get members in a Redis set CLI Example: .. code-block:: bash salt '*' redis.smembers foo_set ''' server = _connect(host, port, db, password) return list(server.smembers(key))
Return the current server UNIX time in seconds
def time(host=None, port=None, db=None, password=None): ''' Return the current server UNIX time in seconds CLI Example: .. code-block:: bash salt '*' redis.time ''' server = _connect(host, port, db, password) return server.time()[0]
Get the length of a sorted set in Redis
def zcard(key, host=None, port=None, db=None, password=None): ''' Get the length of a sorted set in Redis CLI Example: .. code-block:: bash salt '*' redis.zcard foo_sorted ''' server = _connect(host, port, db, password) return server.zcard(key)
Get a range of values from a sorted set in Redis by index
def zrange(key, start, stop, host=None, port=None, db=None, password=None): ''' Get a range of values from a sorted set in Redis by index CLI Example: .. code-block:: bash salt '*' redis.zrange foo_sorted 0 10 ''' server = _connect(host, port, db, password) return server.zrange(ke...
Get ip for sentinel master
def sentinel_get_master_ip(master, host=None, port=None, password=None): ''' Get ip for sentinel master .. versionadded: 2016.3.0 CLI Example: .. code-block:: bash salt '*' redis.sentinel_get_master_ip 'mymaster' ''' server = _sconnect(host, port, password) ret = server.senti...
Get host information about slave
def get_master_ip(host=None, port=None, password=None): ''' Get host information about slave .. versionadded: 2016.3.0 CLI Example: .. code-block:: bash salt '*' redis.get_master_ip ''' server = _connect(host, port, password) srv_info = server.info() ret = (srv_info.get('...
Create a boto3 client connection to EFS
def _get_conn(key=None, keyid=None, profile=None, region=None, **kwargs): ''' Create a boto3 client connection to EFS ''' client = None if profile: if isinstance(profile, six.string_types): if profile in __pillar__: ...
Creates a new empty file system.
def create_file_system(name, performance_mode='generalPurpose', keyid=None, key=None, profile=None, region=None, creation_token=None, **kwargs): ''' Cr...
Creates a mount target for a file system. You can then mount the file system on EC2 instances via the mount target.
def create_mount_target(filesystemid, subnetid, ipaddress=None, securitygroups=None, keyid=None, key=None, profile=None, region=None, ...
Creates or overwrites tags associated with a file system. Each tag is a key - value pair. If a tag key specified in the request already exists on the file system this operation overwrites its value with the value provided in the request.
def create_tags(filesystemid, tags, keyid=None, key=None, profile=None, region=None, **kwargs): ''' Creates or overwrites tags associated with a file system. Each tag is a key-value pair. If a tag key specified i...
Deletes a file system permanently severing access to its contents. Upon return the file system no longer exists and you can t access any contents of the deleted file system. You can t delete a file system that is in use. That is if the file system has any mount targets you must first delete them.
def delete_file_system(filesystemid, keyid=None, key=None, profile=None, region=None, **kwargs): ''' Deletes a file system, permanently severing access to its contents. Upon return, the file sy...
Deletes the specified mount target.
def delete_mount_target(mounttargetid, keyid=None, key=None, profile=None, region=None, **kwargs): ''' Deletes the specified mount target. This operation forcibly breaks any mounts of the file...
Deletes the specified tags from a file system.
def delete_tags(filesystemid, tags, keyid=None, key=None, profile=None, region=None, **kwargs): ''' Deletes the specified tags from a file system. filesystemid (string) - ID of the file system for whose ...
Get all EFS properties or a specific instance property if filesystemid is specified
def get_file_systems(filesystemid=None, keyid=None, key=None, profile=None, region=None, creation_token=None, **kwargs): ''' Get all EFS properties or a specific instance property if...
Get all the EFS mount point properties for a specific filesystemid or the properties for a specific mounttargetid. One or the other must be specified
def get_mount_targets(filesystemid=None, mounttargetid=None, keyid=None, key=None, profile=None, region=None, **kwargs): ''' Get all the EFS mount point properties for a specific f...
Return the tags associated with an EFS instance.
def get_tags(filesystemid, keyid=None, key=None, profile=None, region=None, **kwargs): ''' Return the tags associated with an EFS instance. filesystemid (string) - ID of the file system whose tags to list returns (list) -...
Modifies the set of security groups in effect for a mount target
def set_security_groups(mounttargetid, securitygroup, keyid=None, key=None, profile=None, region=None, **kwargs): ''' Modifies the set of security groups in effect for ...
Ensure an update is installed on the minion
def installed(name, source): ''' Ensure an update is installed on the minion Args: name(str): Name of the Windows KB ("KB123456") source (str): Source of .msu file corresponding to the KB Example: .. code-block:: yaml KB123456: wusa.ins...
Ensure an update is uninstalled from the minion
def uninstalled(name): ''' Ensure an update is uninstalled from the minion Args: name(str): Name of the Windows KB ("KB123456") Example: .. code-block:: yaml KB123456: wusa.uninstalled ''' ret = {'name': name, 'changes': {}, 'r...
Send an email with the data
def send(kwargs, opts): ''' Send an email with the data ''' opt_keys = ( 'smtp.to', 'smtp.from', 'smtp.host', 'smtp.port', 'smtp.tls', 'smtp.username', 'smtp.password', 'smtp.subject', 'smtp.gpgowner', 'smtp.content', ) ...
Get a list of IP addresses from a CIDR.
def list_cidr_ips(cidr): ''' Get a list of IP addresses from a CIDR. CLI example:: salt myminion netaddress.list_cidr_ips 192.168.0.0/20 ''' ips = netaddr.IPNetwork(cidr) return [six.text_type(ip) for ip in list(ips)]
Get a list of IPv6 addresses from a CIDR.
def list_cidr_ips_ipv6(cidr): ''' Get a list of IPv6 addresses from a CIDR. CLI example:: salt myminion netaddress.list_cidr_ips_ipv6 192.168.0.0/20 ''' ips = netaddr.IPNetwork(cidr) return [six.text_type(ip.ipv6()) for ip in list(ips)]
Get the netmask address associated with a CIDR address.
def cidr_netmask(cidr): ''' Get the netmask address associated with a CIDR address. CLI example:: salt myminion netaddress.cidr_netmask 192.168.0.0/20 ''' ips = netaddr.IPNetwork(cidr) return six.text_type(ips.netmask)
Get the broadcast address associated with a CIDR address.
def cidr_broadcast(cidr): ''' Get the broadcast address associated with a CIDR address. CLI example:: salt myminion netaddress.cidr_netmask 192.168.0.0/20 ''' ips = netaddr.IPNetwork(cidr) return six.text_type(ips.broadcast)
Restart OpenStack service immediately or only if it s running longer than specified value
def restart_service(service_name, minimum_running_time=None): ''' Restart OpenStack service immediately, or only if it's running longer than specified value CLI Example: .. code-block:: bash salt '*' openstack_mng.restart_service neutron salt '*' openstack_mng.restart_service neut...
Returns options used for the MySQL connection.
def _get_options(ret=None): ''' Returns options used for the MySQL connection. ''' defaults = {'host': 'salt', 'user': 'salt', 'pass': 'salt', 'db': 'salt', 'port': 3306, 'ssl_ca': None, 'ssl_cert': None, ...
Return a mysql cursor
def _get_serv(ret=None, commit=False): ''' Return a mysql cursor ''' _options = _get_options(ret) connect = True if __context__ and 'mysql_returner_conn' in __context__: try: log.debug('Trying to reuse MySQL connection pool') conn = __context__['mysql_returner_co...
Return data to a mysql server
def returner(ret): ''' Return data to a mysql server ''' # if a minion is returning a standalone job, get a jobid if ret['jid'] == 'req': ret['jid'] = prep_jid(nocache=ret.get('nocache', False)) save_load(ret['jid'], ret) try: with _get_serv(ret, commit=True) as cur: ...
Return event to mysql server
def event_return(events): ''' Return event to mysql server Requires that configuration be enabled via 'event_return' option in master config. ''' with _get_serv(events, commit=True) as cur: for event in events: tag = event.get('tag', '') data = event.get('data', ...
Save the load to the specified jid id
def save_load(jid, load, minions=None): ''' Save the load to the specified jid id ''' with _get_serv(commit=True) as cur: sql = '''INSERT INTO `jids` (`jid`, `load`) VALUES (%s, %s)''' try: cur.execute(sql, (jid, salt.utils.json.dumps(load))) except MySQLdb.Integrit...