INSTRUCTION
stringlengths
1
8.43k
RESPONSE
stringlengths
75
104k
Ensure that TCP keepalives are set for the socket.
def _set_tcp_keepalive(sock, opts): ''' Ensure that TCP keepalives are set for the socket. ''' if hasattr(socket, 'SO_KEEPALIVE'): if opts.get('tcp_keepalive', False): sock.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1) if hasattr(socket, 'SOL_TCP'): ...
In case of authentication errors try to renegotiate authentication and retry the method. Indeed we can fail too early in case of a master restart during a minion state execution call
def _crypted_transfer(self, load, tries=3, timeout=60): ''' In case of authentication errors, try to renegotiate authentication and retry the method. Indeed, we can fail too early in case of a master restart during a minion state execution call ''' @tornado.gen.co...
Send the minion id to the master so that the master may better track the connection state of the minion. In case of authentication errors try to renegotiate authentication and retry the method.
def send_id(self, tok, force_auth): ''' Send the minion id to the master so that the master may better track the connection state of the minion. In case of authentication errors, try to renegotiate authentication and retry the method. ''' load = {'id': self.opts['...
Register an on_recv callback
def on_recv(self, callback): ''' Register an on_recv callback ''' if callback is None: return self.message_client.on_recv(callback) @tornado.gen.coroutine def wrap_callback(body): if not isinstance(body, dict): # TODO: For some rea...
Pre - fork we need to create the zmq router device
def pre_fork(self, process_manager): ''' Pre-fork we need to create the zmq router device ''' salt.transport.mixins.auth.AESReqServerMixin.pre_fork(self, process_manager) if USE_LOAD_BALANCER: self.socket_queue = multiprocessing.Queue() process_manager.add...
After forking we need to create all of the local sockets to listen to the router
def post_fork(self, payload_handler, io_loop): ''' After forking we need to create all of the local sockets to listen to the router payload_handler: function to call with your payloads ''' self.payload_handler = payload_handler self.io_loop = io_loop self...
Handle incoming messages from underylying tcp streams
def handle_message(self, stream, header, payload): ''' Handle incoming messages from underylying tcp streams ''' try: try: payload = self._decode_payload(payload) except Exception: stream.write(salt.transport.frame.frame_msg('bad lo...
Handle incoming streams and add messages to the incoming queue
def handle_stream(self, stream, address): ''' Handle incoming streams and add messages to the incoming queue ''' log.trace('Req client %s connected', address) self.clients.append((stream, address)) unpacker = msgpack.Unpacker() try: while True: ...
Shutdown the whole server
def shutdown(self): ''' Shutdown the whole server ''' for item in self.clients: client, address = item client.close() self.clients.remove(item)
Override _create_stream () in TCPClient.
def _create_stream(self, max_buffer_size, af, addr, **kwargs): # pylint: disable=unused-argument ''' Override _create_stream() in TCPClient. Tornado 4.5 added the kwargs 'source_ip' and 'source_port'. Due to this, use **kwargs to swallow these and any future kwargs to maintain ...
Try to connect for the rest of time!
def _connect(self): ''' Try to connect for the rest of time! ''' while True: if self._closing: break try: kwargs = {} if self.source_ip or self.source_port: if tornado.version_info >= (4, 5): ...
Register a callback for received messages ( that we didn t initiate )
def on_recv(self, callback): ''' Register a callback for received messages (that we didn't initiate) ''' if callback is None: self._on_recv = callback else: def wrap_recv(header, body): callback(body) self._on_recv = wrap_recv
Send given message and return a future
def send(self, msg, timeout=None, callback=None, raw=False): ''' Send given message, and return a future ''' message_id = self._message_id() header = {'mid': message_id} future = tornado.concurrent.Future() if callback is not None: def handle_future(f...
Bind to the interface specified in the configuration file
def _publish_daemon(self, **kwargs): ''' Bind to the interface specified in the configuration file ''' salt.utils.process.appendproctitle(self.__class__.__name__) log_queue = kwargs.get('log_queue') if log_queue is not None: salt.log.setup.set_multiprocessing...
Do anything necessary pre - fork. Since this is on the master side this will primarily be used to create IPC channels and create our daemon process to do the actual publishing
def pre_fork(self, process_manager, kwargs=None): ''' Do anything necessary pre-fork. Since this is on the master side this will primarily be used to create IPC channels and create our daemon process to do the actual publishing ''' process_manager.add_process(self._publis...
Publish load to minions
def publish(self, load): ''' Publish "load" to minions ''' payload = {'enc': 'aes'} crypticle = salt.crypt.Crypticle(self.opts, salt.master.SMaster.secrets['aes']['secret'].value) payload['load'] = crypticle.dumps(load) if self.opts['sign_pub_messages']: ...
Find the first file to match the path and ref read the file out of git and send the path to the newly cached file
def find_file(path, tgt_env='base', **kwargs): # pylint: disable=W0613 ''' Find the first file to match the path and ref, read the file out of git and send the path to the newly cached file ''' return _gitfs().find_file(path, tgt_env=tgt_env, **kwargs)
Build an appropriate error message from a given option and a list of expected values.
def _error_msg_iface(iface, option, expected): ''' Build an appropriate error message from a given option and a list of expected values. ''' msg = 'Invalid option -- Interface: {0}, Option: {1}, Expected: [{2}]' return msg.format(iface, option, '|'.join(str(e) for e in expected))
Build an appropriate error message from a given option and a list of expected values.
def _error_msg_routes(iface, option, expected): ''' Build an appropriate error message from a given option and a list of expected values. ''' msg = 'Invalid option -- Route interface: {0}, Option: {1}, Expected: [{2}]' return msg.format(iface, option, expected)
Build an appropriate error message from a given option and a list of expected values.
def _error_msg_network(option, expected): ''' Build an appropriate error message from a given option and a list of expected values. ''' msg = 'Invalid network setting -- Setting: {0}, Expected: [{1}]' return msg.format(option, '|'.join(str(e) for e in expected))
Log and raise an error with a logical formatted message.
def _raise_error_iface(iface, option, expected): ''' Log and raise an error with a logical formatted message. ''' msg = _error_msg_iface(iface, option, expected) log.error(msg) raise AttributeError(msg)
Log and raise an error with a logical formatted message.
def _raise_error_network(option, expected): ''' Log and raise an error with a logical formatted message. ''' msg = _error_msg_network(option, expected) log.error(msg) raise AttributeError(msg)
Log and raise an error with a logical formatted message.
def _raise_error_routes(iface, option, expected): ''' Log and raise an error with a logical formatted message. ''' msg = _error_msg_routes(iface, option, expected) log.error(msg) raise AttributeError(msg)
Reads and returns the contents of a text file
def _read_file(path): ''' Reads and returns the contents of a text file ''' try: with salt.utils.files.flopen(path, 'rb') as contents: return [salt.utils.stringutils.to_str(line) for line in contents.readlines()] except (OSError, IOError): return ''
Parse/ etc/ default/ networking and return current configuration
def _parse_current_network_settings(): ''' Parse /etc/default/networking and return current configuration ''' opts = salt.utils.odict.OrderedDict() opts['networking'] = '' if os.path.isfile(_DEB_NETWORKING_FILE): with salt.utils.files.fopen(_DEB_NETWORKING_FILE) as contents: ...
validate an integer
def __int(value): '''validate an integer''' valid, _value = False, value try: _value = int(value) valid = True except ValueError: pass return (valid, _value, 'integer')
validate a float
def __float(value): '''validate a float''' valid, _value = False, value try: _value = float(value) valid = True except ValueError: pass return (valid, _value, 'float')
validate an IPv4 dotted quad or integer CIDR netmask
def __ipv4_netmask(value): '''validate an IPv4 dotted quad or integer CIDR netmask''' valid, errmsg = False, 'dotted quad or integer CIDR (0->32)' valid, value, _ = __int(value) if not (valid and 0 <= value <= 32): valid = salt.utils.validate.net.netmask(value) return (valid, value, errmsg)
validate an IPv6 integer netmask
def __ipv6_netmask(value): '''validate an IPv6 integer netmask''' valid, errmsg = False, 'IPv6 netmask (0->128)' valid, value, _ = __int(value) valid = (valid and 0 <= value <= 128) return (valid, value, errmsg)
validate that a value is in within and optionally a dtype
def __within2(value, within=None, errmsg=None, dtype=None): '''validate that a value is in ``within`` and optionally a ``dtype``''' valid, _value = False, value if dtype: try: _value = dtype(value) # TODO: this is a bit loose when dtype is a class valid = _value in within ...
validate that a value contains one or more space - delimited values
def __space_delimited_list(value): '''validate that a value contains one or more space-delimited values''' if isinstance(value, six.string_types): value = value.strip().split() if hasattr(value, '__iter__') and value != []: return (True, value, 'space-delimited string') else: re...
lookup the validation function for a [ addrfam ] [ attr ] and return the results
def _validate_interface_option(attr, value, addrfam='inet'): '''lookup the validation function for a [addrfam][attr] and return the results :param attr: attribute name :param value: raw setting value :param addrfam: address family (inet, inet6, ''' valid, _value, errmsg = False, value, 'Unk...
Parse/ etc/ network/ interfaces and return current configured interfaces
def _parse_interfaces(interface_files=None): ''' Parse /etc/network/interfaces and return current configured interfaces ''' if interface_files is None: interface_files = [] # Add this later. if os.path.exists(_DEB_NETWORK_DIR): interface_files += ['{0}/{1}'.format(_DE...
Filters given options and outputs valid settings for ETHTOOLS_OPTS If an option has a value that is not expected this function will log what the Interface Setting and what it was expecting.
def _parse_ethtool_opts(opts, iface): ''' Filters given options and outputs valid settings for ETHTOOLS_OPTS If an option has a value that is not expected, this function will log what the Interface, Setting and what it was expecting. ''' config = {} if 'autoneg' in opts: if opts...
Filters given options and outputs valid settings for ETHTOOLS_PPPOE_OPTS If an option has a value that is not expected this function will log what the Interface Setting and what it was expecting.
def _parse_ethtool_pppoe_opts(opts, iface): ''' Filters given options and outputs valid settings for ETHTOOLS_PPPOE_OPTS If an option has a value that is not expected, this function will log what the Interface, Setting and what it was expecting. ''' config = {} for opt in _DEB_CONFIG_PP...
Filters given options and outputs valid settings for requested operation. If an option has a value that is not expected this function will log what the Interface Setting and what it was expecting.
def _parse_settings_bond(opts, iface): ''' Filters given options and outputs valid settings for requested operation. If an option has a value that is not expected, this function will log what the Interface, Setting and what it was expecting. ''' bond_def = { # 803.ad aggregation sel...
Filters given options and outputs valid settings for bond2. If an option has a value that is not expected this function will log what the Interface Setting and what it was expecting.
def _parse_settings_bond_2(opts, iface, bond_def): ''' Filters given options and outputs valid settings for bond2. If an option has a value that is not expected, this function will log what the Interface, Setting and what it was expecting. ''' bond = {'mode': '2'} valid = ['list of ips...
Filters given options and outputs valid settings for BRIDGING_OPTS If an option has a value that is not expected this function will log the Interface Setting and what was expected.
def _parse_bridge_opts(opts, iface): ''' Filters given options and outputs valid settings for BRIDGING_OPTS If an option has a value that is not expected, this function will log the Interface, Setting and what was expected. ''' config = {} if 'ports' in opts: if isinstance(opts['por...
Filters given options and outputs valid settings for a network interface.
def _parse_settings_eth(opts, iface_type, enabled, iface): ''' Filters given options and outputs valid settings for a network interface. ''' adapters = salt.utils.odict.OrderedDict() adapters[iface] = salt.utils.odict.OrderedDict() adapters[iface]['type'] = iface_type adapters[iface]['...
Filters given options and outputs valid settings for a network interface.
def _parse_settings_source(opts, iface_type, enabled, iface): ''' Filters given options and outputs valid settings for a network interface. ''' adapters = salt.utils.odict.OrderedDict() adapters[iface] = salt.utils.odict.OrderedDict() adapters[iface]['type'] = iface_type adapters[iface...
Filters given options and outputs valid settings for the global network settings file.
def _parse_network_settings(opts, current): ''' Filters given options and outputs valid settings for the global network settings file. ''' # Normalize keys opts = dict((k.lower(), v) for (k, v) in six.iteritems(opts)) current = dict((k.lower(), v) for (k, v) in six.iteritems(current)) re...
Filters given options and outputs valid settings for the route settings file.
def _parse_routes(iface, opts): ''' Filters given options and outputs valid settings for the route settings file. ''' # Normalize keys opts = dict((k.lower(), v) for (k, v) in six.iteritems(opts)) result = {} if 'routes' not in opts: _raise_error_routes(iface, 'routes', 'List of ...
Writes a file to disk
def _write_file(iface, data, folder, pattern): ''' Writes a file to disk ''' filename = os.path.join(folder, pattern.format(iface)) if not os.path.exists(folder): msg = '{0} cannot be written. {1} does not exist' msg = msg.format(filename, folder) log.error(msg) raise...
Writes a file to disk If file does not exist only create if create argument is True
def _write_file_network(data, filename, create=False): ''' Writes a file to disk If file does not exist, only create if create argument is True ''' if not os.path.exists(filename) and not create: msg = '{0} cannot be written. {0} does not exist\ and create is set to False...
Return what would be written to disk
def _read_temp(data): ''' Return what would be written to disk ''' tout = StringIO() tout.write(data) tout.seek(0) output = tout.readlines() tout.close() return output
Return what would be written to disk for interfaces
def _read_temp_ifaces(iface, data): ''' Return what would be written to disk for interfaces ''' try: template = JINJA.get_template('debian_eth.jinja') except jinja2.exceptions.TemplateNotFound: log.error('Could not load template debian_eth.jinja') return '' ifcfg = templ...
Writes a file to disk
def _write_file_ifaces(iface, data, **settings): ''' Writes a file to disk ''' try: eth_template = JINJA.get_template('debian_eth.jinja') source_template = JINJA.get_template('debian_source.jinja') except jinja2.exceptions.TemplateNotFound: log.error('Could not load template ...
Writes a file to disk
def _write_file_ppp_ifaces(iface, data): ''' Writes a file to disk ''' try: template = JINJA.get_template('debian_ppp_eth.jinja') except jinja2.exceptions.TemplateNotFound: log.error('Could not load template debian_ppp_eth.jinja') return '' adapters = _parse_interfaces()...
Create a bond script in/ etc/ modprobe. d with the passed settings and load the bonding kernel module.
def build_bond(iface, **settings): ''' Create a bond script in /etc/modprobe.d with the passed settings and load the bonding kernel module. CLI Example: .. code-block:: bash salt '*' ip.build_bond bond0 mode=balance-alb ''' deb_major = __grains__['osrelease'][:1] opts = _pars...
Build an interface script for a network interface.
def build_interface(iface, iface_type, enabled, **settings): ''' Build an interface script for a network interface. CLI Example: .. code-block:: bash salt '*' ip.build_interface eth0 eth <settings> ''' iface_type = iface_type.lower() if iface_type not in _IFACE_TYPES: _r...
Add route scripts for a network interface using up commands.
def build_routes(iface, **settings): ''' Add route scripts for a network interface using up commands. CLI Example: .. code-block:: bash salt '*' ip.build_routes eth0 <settings> ''' opts = _parse_routes(iface, settings) try: template = JINJA.get_template('route_eth.jinja')...
Return the content of a bond script
def get_bond(iface): ''' Return the content of a bond script CLI Example: .. code-block:: bash salt '*' ip.get_bond bond0 ''' path = os.path.join(_DEB_NETWORK_CONF_FILES, '{0}.conf'.format(iface)) return _read_file(path)
Return the contents of an interface script
def get_interface(iface): ''' Return the contents of an interface script CLI Example: .. code-block:: bash salt '*' ip.get_interface eth0 ''' adapters = _parse_interfaces() if iface in adapters: try: if iface == 'source': template = JINJA.get_t...
Return the contents of the global network script.
def get_network_settings(): ''' Return the contents of the global network script. CLI Example: .. code-block:: bash salt '*' ip.get_network_settings ''' skip_etc_default_networking = ( __grains__['osfullname'] == 'Ubuntu' and int(__grains__['osrelease'].split('.')[0]) ...
Return the routes for the interface
def get_routes(iface): ''' Return the routes for the interface CLI Example: .. code-block:: bash salt '*' ip.get_routes eth0 ''' filename = os.path.join(_DEB_NETWORK_UP_DIR, 'route-{0}'.format(iface)) results = _read_file(filename) filename = os.path.join(_DEB_NETWORK_DOWN_D...
Apply global network configuration.
def apply_network_settings(**settings): ''' Apply global network configuration. CLI Example: .. code-block:: bash salt '*' ip.apply_network_settings ''' if 'require_reboot' not in settings: settings['require_reboot'] = False if 'apply_hostname' not in settings: se...
Build the global network script.
def build_network_settings(**settings): ''' Build the global network script. CLI Example: .. code-block:: bash salt '*' ip.build_network_settings <settings> ''' changes = [] # Read current configuration and store default values current_network_settings = _parse_current_networ...
Set a single salt process environment variable. Returns True on success.
def setval(key, val, false_unsets=False, permanent=False): ''' Set a single salt process environment variable. Returns True on success. key The environment key to set. Must be a string. val The value to set. Must be a string or False. Refer to the 'false_unsets' parameter f...
Set multiple salt process environment variables from a dict. Returns a dict.
def setenv(environ, false_unsets=False, clear_all=False, update_minion=False, permanent=False): ''' Set multiple salt process environment variables from a dict. Returns a dict. environ Must be a dict. The top-level keys of the dict are the names of the environment variables to set. Each...
Get a single salt process environment variable.
def get(key, default=''): ''' Get a single salt process environment variable. key String used as the key for environment lookup. default If the key is not found in the environment, return this value. Default: '' CLI Example: .. code-block:: bash salt '*' env...
Determine whether the key exists in the current salt process environment dictionary. Optionally compare the current value of the environment against the supplied value string.
def has_value(key, value=None): ''' Determine whether the key exists in the current salt process environment dictionary. Optionally compare the current value of the environment against the supplied value string. key Must be a string. Used as key for environment lookup. value: O...
Get one or more salt process environment variables. Returns a dict.
def item(keys, default=''): ''' Get one or more salt process environment variables. Returns a dict. keys Either a string or a list of strings that will be used as the keys for environment lookup. default If the key is not found in the environment, return this value. ...
Extract key and value from key = val string.
def _extract_key_val(kv, delimiter='='): '''Extract key and value from key=val string. Example: >>> _extract_key_val('foo=bar') ('foo', 'bar') ''' pieces = kv.split(delimiter) key = pieces[0] val = delimiter.join(pieces[1:]) return key, val
Execute a command and read the output as YAML
def ext_pillar(minion_id, pillar, # pylint: disable=W0613 repo_string): ''' Execute a command and read the output as YAML ''' # split the branch, repo name and optional extra (key=val) parameters. options = repo_string.strip().split() branch = options[0] repo_l...
Returns the directory of the pillars ( repo cache + branch + root )
def pillar_dir(self): ''' Returns the directory of the pillars (repo cache + branch + root) ''' repo_dir = self.repo_dir root = self.root branch = self.branch if branch == 'trunk' or branch == 'base': working_dir = os.path.join(repo_dir, 'trunk', root)...
Accept the key for the VM on the hyper if authorized.
def ext_pillar(hyper_id, pillar, name, key): ''' Accept the key for the VM on the hyper, if authorized. ''' vk = salt.utils.virt.VirtKey(hyper_id, name, __opts__) ok = vk.accept(key) pillar['virtkey'] = {name: ok} return {}
Set a Physical Device to be used as an LVM Physical Volume
def pv_present(name, **kwargs): ''' Set a Physical Device to be used as an LVM Physical Volume name The device name to initialize. kwargs Any supported options to pvcreate. See :mod:`linux_lvm <salt.modules.linux_lvm>` for more details. ''' ret = {'changes': {}, ...
Ensure that a Physical Device is not being used by lvm
def pv_absent(name): ''' Ensure that a Physical Device is not being used by lvm name The device name to initialize. ''' ret = {'changes': {}, 'comment': '', 'name': name, 'result': True} if not __salt__['lvm.pvdisplay'](name, quiet=True): ret['c...
Create an LVM Volume Group
def vg_present(name, devices=None, **kwargs): ''' Create an LVM Volume Group name The Volume Group name to create devices A list of devices that will be added to the Volume Group kwargs Any supported options to vgcreate. See :mod:`linux_lvm <salt.modules.linux_lvm>...
Create a new Logical Volume
def lv_present(name, vgname=None, size=None, extents=None, snapshot=None, pv='', thinvolume=False, thinpool=False, force=False, **kwargs): ''' Create a new Logical Volume n...
Remove a given existing Logical Volume from a named existing volume group
def lv_absent(name, vgname=None): ''' Remove a given existing Logical Volume from a named existing volume group name The Logical Volume to remove vgname The name of the Volume Group on which the Logical Volume resides ''' ret = {'changes': {}, 'comment': '', ...
Return a client object for accessing consul
def get_conn(profile): ''' Return a client object for accessing consul ''' params = {} for key in ('host', 'port', 'token', 'scheme', 'consistency', 'dc', 'verify'): if key in profile: params[key] = profile[key] if HAS_CONSUL: return consul.Consul(**params) else:...
Called once for each message produced to indicate delivery result. Triggered by poll () or flush ().
def _delivery_report(err, msg): ''' Called once for each message produced to indicate delivery result. Triggered by poll() or flush(). ''' if err is not None: log.error('Message delivery failed: %s', err) else: log.debug('Message delivered to %s [%s]', msg.topic(), msg.partition())
Return information to a Kafka server
def returner(ret): ''' Return information to a Kafka server ''' if __salt__['config.option']('returner.kafka.topic'): topic = __salt__['config.option']('returner.kafka.topic') conn = _get_conn() producer = Producer({'bootstrap.servers': conn}) producer.poll(0) pr...
Verify that the correct versions of composer dependencies are present.
def installed(name, composer=None, php=None, user=None, prefer_source=None, prefer_dist=None, no_scripts=None, no_plugins=None, optimize=None, no_dev=None, quiet=False, ...
Composer update the directory to ensure we have the latest versions of all project dependencies.
def update(name, composer=None, php=None, user=None, prefer_source=None, prefer_dist=None, no_scripts=None, no_plugins=None, optimize=None, no_dev=None, quiet=False, composer_home='/root', ...
Check to see if a cache cluster exists.
def exists(name, region=None, key=None, keyid=None, profile=None): ''' Check to see if a cache cluster exists. CLI example:: salt myminion boto_elasticache.exists myelasticache ''' conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile) try: conn.describe_cache_...
Check to see if a replication group exists.
def group_exists(name, region=None, key=None, keyid=None, profile=None): ''' Check to see if a replication group exists. CLI example:: salt myminion boto_elasticache.group_exists myelasticache ''' conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile) try: conn...
Create replication group.
def create_replication_group(name, primary_cluster_id, replication_group_description, wait=None, region=None, key=None, keyid=None, profile=None): ''' Create replication group. CLI example:: salt myminion boto_elasticache.create_replication...
Get replication group information.
def describe_replication_group(name, region=None, key=None, keyid=None, profile=None, parameter=None): ''' Get replication group information. CLI example:: salt myminion boto_elasticache.describe_replication_group mygroup ''' conn = _get_conn(region=region, k...
Get the configuration for a cache cluster.
def get_config(name, region=None, key=None, keyid=None, profile=None): ''' Get the configuration for a cache cluster. CLI example:: salt myminion boto_elasticache.get_config myelasticache ''' conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile) if not conn: r...
Get hostname from cache node
def get_node_host(name, region=None, key=None, keyid=None, profile=None): ''' Get hostname from cache node CLI example:: salt myminion boto_elasticache.get_node_host myelasticache ''' conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile) if not conn: return No...
Get hostname from replication cache group
def get_group_host(name, region=None, key=None, keyid=None, profile=None): ''' Get hostname from replication cache group CLI example:: salt myminion boto_elasticache.get_group_host myelasticachegroup ''' conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile) if not con...
Return a list of all cache subnet groups with details
def get_all_cache_subnet_groups(name=None, region=None, key=None, keyid=None, profile=None): ''' Return a list of all cache subnet groups with details CLI example:: salt myminion boto_elasticache.get_all_subnet_groups region=us-east-1 ''' conn = _get_conn(re...
Return a list of all cache subnet group names
def list_cache_subnet_groups(name=None, region=None, key=None, keyid=None, profile=None): ''' Return a list of all cache subnet group names CLI example:: salt myminion boto_elasticache.list_subnet_groups region=us-east-1 ''' return [g['CacheSubnetGroupName'] fo...
Check to see if an ElastiCache subnet group exists.
def subnet_group_exists(name, tags=None, region=None, key=None, keyid=None, profile=None): ''' Check to see if an ElastiCache subnet group exists. CLI example:: salt myminion boto_elasticache.subnet_group_exists my-param-group \ region=us-east-1 ''' conn = _get_conn(region=...
Create an ElastiCache subnet group
def create_subnet_group(name, description, subnet_ids=None, subnet_names=None, tags=None, region=None, key=None, keyid=None, profile=None): ''' Create an ElastiCache subnet group CLI example to create an ElastiCache subnet group:: salt myminion boto_elasticache.create_subne...
Get information about a cache subnet group.
def get_cache_subnet_group(name, region=None, key=None, keyid=None, profile=None): ''' Get information about a cache subnet group. CLI example:: salt myminion boto_elasticache.get_cache_subnet_group mycache_subnet_group ''' conn = _get_conn(region=region, key=key...
Delete an ElastiCache subnet group.
def delete_subnet_group(name, region=None, key=None, keyid=None, profile=None): ''' Delete an ElastiCache subnet group. CLI example:: salt myminion boto_elasticache.delete_subnet_group my-subnet-group \ region=us-east-1 ''' conn = _get_conn(region=region, key=key, keyid=key...
Create a cache cluster.
def create(name, num_cache_nodes=None, engine=None, cache_node_type=None, replication_group_id=None, engine_version=None, cache_parameter_group_name=None, cache_subnet_group_name=None, cache_security_group_names=None, security_group_ids=None, snapshot_arns=None, preferred_ava...
Delete a cache cluster.
def delete(name, wait=False, region=None, key=None, keyid=None, profile=None): ''' Delete a cache cluster. CLI example:: salt myminion boto_elasticache.delete myelasticache ''' conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile) try: conn.delete_cache_cluste...
Create a cache security group.
def create_cache_security_group(name, description, region=None, key=None, keyid=None, profile=None): ''' Create a cache security group. CLI example:: salt myminion boto_elasticache.create_cache_security_group myelasticachesg 'My Cache Security Group' ''' con...
Delete a cache security group.
def delete_cache_security_group(name, region=None, key=None, keyid=None, profile=None): ''' Delete a cache security group. CLI example:: salt myminion boto_elasticache.delete_cache_security_group myelasticachesg 'My Cache Security Group' ''' conn = _get_conn...
Authorize network ingress from an ec2 security group to a cache security group.
def authorize_cache_security_group_ingress(name, ec2_security_group_name, ec2_security_group_owner_id, region=None, key=None, keyid=None, profile=None): ''' Authorize network ingress ...
Safely get the string to print out try the configured outputter then fall back to nested and then to raw
def try_printout(data, out, opts, **kwargs): ''' Safely get the string to print out, try the configured outputter, then fall back to nested and then to raw ''' try: printout = get_printout(out, opts)(data, **kwargs) if printout is not None: return printout.rstrip() ex...
Get the progress bar from the given outputter
def get_progress(opts, out, progress): ''' Get the progress bar from the given outputter ''' return salt.loader.raw_mod(opts, out, 'rawmodule', mod='output')['{0}.progress_iter'.format(out)](progress)
Update the progress iterator for the given outputter
def update_progress(opts, progress, progress_iter, out): ''' Update the progress iterator for the given outputter ''' # Look up the outputter try: progress_outputter = salt.loader.outputters(opts)[out] except KeyError: # Outputter is not loaded log.warning('Progress outputter no...
Print the passed data using the desired output
def display_output(data, out=None, opts=None, **kwargs): ''' Print the passed data using the desired output ''' if opts is None: opts = {} display_data = try_printout(data, out, opts, **kwargs) output_filename = opts.get('output_file', None) log.trace('data = %s', data) try: ...
Return a printer function
def get_printout(out, opts=None, **kwargs): ''' Return a printer function ''' if opts is None: opts = {} if 'output' in opts and opts['output'] != 'highstate': # new --out option, but don't choke when using --out=highstate at CLI # See Issue #29796 for more information. ...
Return the formatted outputter string for the passed data
def out_format(data, out, opts=None, **kwargs): ''' Return the formatted outputter string for the passed data ''' return try_printout(data, out, opts, **kwargs)