Search is not available for this dataset
text stringlengths 75 104k |
|---|
def _format_info(data):
'''
Return user information in a pretty way
'''
# Put GECOS info into a list
gecos_field = salt.utils.stringutils.to_unicode(data.pw_gecos).split(',', 4)
# Make sure our list has at least five elements
while len(gecos_field) < 5:
gecos_field.append('')
re... |
def list_users(root=None):
'''
Return a list of all users
root
Directory to chroot into
CLI Example:
.. code-block:: bash
salt '*' user.list_users
'''
if root is not None and __grains__['kernel'] != 'AIX':
getpwall = functools.partial(_getpwall, root=root)
els... |
def rename(name, new_name, root=None):
'''
Change the username for a named user
name
User to modify
new_name
New value of the login name
root
Directory to chroot into
CLI Example:
.. code-block:: bash
salt '*' user.rename name new_name
'''
if inf... |
def _getpwnam(name, root=None):
'''
Alternative implementation for getpwnam, that use only /etc/passwd
'''
root = '/' if not root else root
passwd = os.path.join(root, 'etc/passwd')
with salt.utils.files.fopen(passwd) as fp_:
for line in fp_:
line = salt.utils.stringutils.to_... |
def add_subgids(name, first=100000, last=110000):
'''
Add a range of subordinate gids to the user
name
User to modify
first
Begin of the range
last
End of the range
CLI Examples:
.. code-block:: bash
salt '*' user.add_subgids foo
salt '*' user.ad... |
def capability_installed(name,
source=None,
limit_access=False,
image=None,
restart=False):
'''
Install a DISM capability
Args:
name (str): The capability to install
source (str): The optiona... |
def package_removed(name, image=None, restart=False):
'''
Uninstall a package
Args:
name (str): The full path to the package. Can be either a .cab file or a
folder. Should point to the original source of the package, not to
where the file is installed. This can also be the n... |
def ping(host, timeout=False, return_boolean=False):
'''
Performs an ICMP ping to a host
.. versionchanged:: 2015.8.0
Added support for SunOS
CLI Example:
.. code-block:: bash
salt '*' network.ping archlinux.org
.. versionadded:: 2015.5.0
Return a True or False instead ... |
def _netstat_linux():
'''
Return netstat information for Linux distros
'''
ret = []
cmd = 'netstat -tulpnea'
out = __salt__['cmd.run'](cmd)
for line in out.splitlines():
comps = line.split()
if line.startswith('tcp'):
ret.append({
'proto': comps[0]... |
def _ss_linux():
'''
Return ss information for Linux distros
(netstat is deprecated and may not be available)
'''
ret = []
cmd = 'ss -tulpnea'
out = __salt__['cmd.run'](cmd)
for line in out.splitlines():
comps = line.split()
ss_user = 0
ss_inode = 0
ss_pro... |
def _netinfo_openbsd():
'''
Get process information for network connections using fstat
'''
ret = {}
_fstat_re = re.compile(
r'internet(6)? (?:stream tcp 0x\S+ (\S+)|dgram udp (\S+))'
r'(?: [<>=-]+ (\S+))?$'
)
out = __salt__['cmd.run']('fstat')
for line in out.splitlines(... |
def _netinfo_freebsd_netbsd():
'''
Get process information for network connections using sockstat
'''
ret = {}
# NetBSD requires '-n' to disable port-to-service resolution
out = __salt__['cmd.run'](
'sockstat -46 {0} | tail -n+2'.format(
'-n' if __grains__['kernel'] == 'NetBS... |
def _ppid():
'''
Return a dict of pid to ppid mappings
'''
ret = {}
if __grains__['kernel'] == 'SunOS':
cmd = 'ps -a -o pid,ppid | tail +2'
else:
cmd = 'ps -ax -o pid,ppid | tail -n+2'
out = __salt__['cmd.run'](cmd, python_shell=True)
for line in out.splitlines():
... |
def _netstat_bsd():
'''
Return netstat information for BSD flavors
'''
ret = []
if __grains__['kernel'] == 'NetBSD':
for addr_family in ('inet', 'inet6'):
cmd = 'netstat -f {0} -an | tail -n+3'.format(addr_family)
out = __salt__['cmd.run'](cmd, python_shell=True)
... |
def _netstat_sunos():
'''
Return netstat information for SunOS flavors
'''
log.warning('User and program not (yet) supported on SunOS')
ret = []
for addr_family in ('inet', 'inet6'):
# Lookup TCP connections
cmd = 'netstat -f {0} -P tcp -an | tail +5'.format(addr_family)
... |
def _netstat_aix():
'''
Return netstat information for SunOS flavors
'''
ret = []
## AIX 6.1 - 7.2, appears to ignore addr_family field contents
## for addr_family in ('inet', 'inet6'):
for addr_family in ('inet',):
# Lookup connections
cmd = 'netstat -n -a -f {0} | tail -n +... |
def _ip_route_linux():
'''
Return ip routing information for Linux distros
(netstat is deprecated and may not be available)
'''
# table main closest to old netstat inet output
ret = []
cmd = 'ip -4 route show table main'
out = __salt__['cmd.run'](cmd, python_shell=True)
for line in o... |
def _netstat_route_freebsd():
'''
Return netstat routing information for FreeBSD and macOS
'''
ret = []
cmd = 'netstat -f inet -rn | tail -n+5'
out = __salt__['cmd.run'](cmd, python_shell=True)
for line in out.splitlines():
comps = line.split()
if __grains__['os'] == 'FreeBSD... |
def _netstat_route_netbsd():
'''
Return netstat routing information for NetBSD
'''
ret = []
cmd = 'netstat -f inet -rn | tail -n+5'
out = __salt__['cmd.run'](cmd, python_shell=True)
for line in out.splitlines():
comps = line.split()
ret.append({
'addr_family': 'in... |
def _netstat_route_sunos():
'''
Return netstat routing information for SunOS
'''
ret = []
cmd = 'netstat -f inet -rn | tail +5'
out = __salt__['cmd.run'](cmd, python_shell=True)
for line in out.splitlines():
comps = line.split()
ret.append({
'addr_family': 'inet',... |
def netstat():
'''
Return information on open ports and states
.. note::
On BSD minions, the output contains PID info (where available) for each
netstat entry, fetched from sockstat/fstat output.
.. versionchanged:: 2014.1.4
Added support for OpenBSD, FreeBSD, and NetBSD
.... |
def active_tcp():
'''
Return a dict containing information on all of the running TCP connections (currently linux and solaris only)
.. versionchanged:: 2015.8.4
Added support for SunOS
CLI Example:
.. code-block:: bash
salt '*' network.active_tcp
'''
if __grains__['kerne... |
def traceroute(host):
'''
Performs a traceroute to a 3rd party host
.. versionchanged:: 2015.8.0
Added support for SunOS
.. versionchanged:: 2016.11.4
Added support for AIX
CLI Example:
.. code-block:: bash
salt '*' network.traceroute archlinux.org
'''
ret = ... |
def dig(host):
'''
Performs a DNS lookup with dig
CLI Example:
.. code-block:: bash
salt '*' network.dig archlinux.org
'''
cmd = 'dig {0}'.format(salt.utils.network.sanitize_host(host))
return __salt__['cmd.run'](cmd) |
def arp():
'''
Return the arp table from the minion
.. versionchanged:: 2015.8.0
Added support for SunOS
CLI Example:
.. code-block:: bash
salt '*' network.arp
'''
ret = {}
out = __salt__['cmd.run']('arp -an')
for line in out.splitlines():
comps = line.spl... |
def convert_cidr(cidr):
'''
returns the network address, subnet mask and broadcast address of a cidr address
.. versionadded:: 2016.3.0
CLI Example:
.. code-block:: bash
salt '*' network.convert_cidr 172.31.0.0/16
'''
ret = {'network': None,
'netmask': None,
... |
def mod_hostname(hostname):
'''
Modify hostname
.. versionchanged:: 2015.8.0
Added support for SunOS (Solaris 10, Illumos, SmartOS)
CLI Example:
.. code-block:: bash
salt '*' network.mod_hostname master.saltstack.com
'''
#
# SunOS tested on SmartOS and OmniOS (Solaris... |
def _get_bufsize_linux(iface):
'''
Return network interface buffer information using ethtool
'''
ret = {'result': False}
cmd = '/sbin/ethtool -g {0}'.format(iface)
out = __salt__['cmd.run'](cmd)
pat = re.compile(r'^(.+):\s+(\d+)$')
suffix = 'max-'
for line in out.splitlines():
... |
def _mod_bufsize_linux(iface, *args, **kwargs):
'''
Modify network interface buffer sizes using ethtool
'''
ret = {'result': False,
'comment': 'Requires rx=<val> tx==<val> rx-mini=<val> and/or rx-jumbo=<val>'}
cmd = '/sbin/ethtool -G ' + iface
if not kwargs:
return ret
if ... |
def mod_bufsize(iface, *args, **kwargs):
'''
Modify network interface buffers (currently linux only)
CLI Example:
.. code-block:: bash
salt '*' network.mod_bufsize tx=<val> rx=<val> rx-mini=<val> rx-jumbo=<val>
'''
if __grains__['kernel'] == 'Linux':
if os.path.exists('/sbin/e... |
def routes(family=None):
'''
Return currently configured routes from routing table
.. versionchanged:: 2015.8.0
Added support for SunOS (Solaris 10, Illumos, SmartOS)
.. versionchanged:: 2016.11.4
Added support for AIX
CLI Example:
.. code-block:: bash
salt '*' netwo... |
def default_route(family=None):
'''
Return default route(s) from routing table
.. versionchanged:: 2015.8.0
Added support for SunOS (Solaris 10, Illumos, SmartOS)
.. versionchanged:: 2016.11.4
Added support for AIX
CLI Example:
.. code-block:: bash
salt '*' network.d... |
def get_route(ip):
'''
Return routing information for given destination ip
.. versionadded:: 2015.5.3
.. versionchanged:: 2015.8.0
Added support for SunOS (Solaris 10, Illumos, SmartOS)
Added support for OpenBSD
.. versionchanged:: 2016.11.4
Added support for AIX
CLI ... |
def ifacestartswith(cidr):
'''
Retrieve the interface name from a specific CIDR
.. versionadded:: 2016.11.0
CLI Example:
.. code-block:: bash
salt '*' network.ifacestartswith 10.0
'''
net_list = interfaces()
intfnames = []
pattern = six.text_type(cidr)
size = len(patt... |
def iphexval(ip):
'''
Retrieve the hexadecimal representation of an IP address
.. versionadded:: 2016.11.0
CLI Example:
.. code-block:: bash
salt '*' network.iphexval 10.0.0.1
'''
a = ip.split('.')
hexval = ['%02X' % int(x) for x in a] # pylint: disable=E1321
return ''.j... |
def present(name, Name=None,
ScheduleExpression=None,
EventPattern=None,
Description=None,
RoleArn=None,
State=None,
Targets=None,
region=None, key=None, keyid=None, profile=None):
'''
Ensure trail exists.
name
The name of... |
def absent(name, Name=None, region=None, key=None, keyid=None, profile=None):
'''
Ensure CloudWatch event rule with passed properties is absent.
name
The name of the state definition.
Name
Name of the event rule. Defaults to the value of the 'name' param if
not provided.
... |
def list_nodes(profile, **libcloud_kwargs):
'''
Return a list of nodes
:param profile: The profile key
:type profile: ``str``
:param libcloud_kwargs: Extra arguments for the driver's list_nodes method
:type libcloud_kwargs: ``dict``
CLI Example:
.. code-block:: bash
salt m... |
def list_sizes(profile, location_id=None, **libcloud_kwargs):
'''
Return a list of node sizes
:param profile: The profile key
:type profile: ``str``
:param location_id: The location key, from list_locations
:type location_id: ``str``
:param libcloud_kwargs: Extra arguments for the drive... |
def list_locations(profile, **libcloud_kwargs):
'''
Return a list of locations for this cloud
:param profile: The profile key
:type profile: ``str``
:param libcloud_kwargs: Extra arguments for the driver's list_locations method
:type libcloud_kwargs: ``dict``
CLI Example:
.. code-b... |
def reboot_node(node_id, profile, **libcloud_kwargs):
'''
Reboot a node in the cloud
:param node_id: Unique ID of the node to reboot
:type node_id: ``str``
:param profile: The profile key
:type profile: ``str``
:param libcloud_kwargs: Extra arguments for the driver's reboot_node method
... |
def list_volumes(profile, **libcloud_kwargs):
'''
Return a list of storage volumes for this cloud
:param profile: The profile key
:type profile: ``str``
:param libcloud_kwargs: Extra arguments for the driver's list_volumes method
:type libcloud_kwargs: ``dict``
CLI Example:
.. code... |
def list_volume_snapshots(volume_id, profile, **libcloud_kwargs):
'''
Return a list of storage volumes snapshots for this cloud
:param volume_id: The volume identifier
:type volume_id: ``str``
:param profile: The profile key
:type profile: ``str``
:param libcloud_kwargs: Extra arguments... |
def create_volume(size, name, profile, location_id=None, **libcloud_kwargs):
'''
Create a storage volume
:param size: Size of volume in gigabytes (required)
:type size: ``int``
:param name: Name of the volume to be created
:type name: ``str``
:param location_id: Which data center to creat... |
def create_volume_snapshot(volume_id, profile, name=None, **libcloud_kwargs):
'''
Create a storage volume snapshot
:param volume_id: Volume ID from which to create the new
snapshot.
:type volume_id: ``str``
:param profile: The profile key
:type profile: ``str``
... |
def attach_volume(node_id, volume_id, profile, device=None, **libcloud_kwargs):
'''
Attaches volume to node.
:param node_id: Node ID to target
:type node_id: ``str``
:param volume_id: Volume ID from which to attach
:type volume_id: ``str``
:param profile: The profile key
:type pr... |
def detach_volume(volume_id, profile, **libcloud_kwargs):
'''
Detaches a volume from a node.
:param volume_id: Volume ID from which to detach
:type volume_id: ``str``
:param profile: The profile key
:type profile: ``str``
:param libcloud_kwargs: Extra arguments for the driver's detach_... |
def destroy_volume_snapshot(volume_id, snapshot_id, profile, **libcloud_kwargs):
'''
Destroy a volume snapshot.
:param volume_id: Volume ID from which the snapshot belongs
:type volume_id: ``str``
:param snapshot_id: Volume Snapshot ID from which to destroy
:type snapshot_id: ``str``
... |
def list_images(profile, location_id=None, **libcloud_kwargs):
'''
Return a list of images for this cloud
:param profile: The profile key
:type profile: ``str``
:param location_id: The location key, from list_locations
:type location_id: ``str``
:param libcloud_kwargs: Extra arguments f... |
def create_image(node_id, name, profile, description=None, **libcloud_kwargs):
'''
Create an image from a node
:param node_id: Node to run the task on.
:type node_id: ``str``
:param name: name for new image.
:type name: ``str``
:param profile: The profile key
:type profile: ``str``
... |
def delete_image(image_id, profile, **libcloud_kwargs):
'''
Delete an image of a node
:param image_id: Image to delete
:type image_id: ``str``
:param profile: The profile key
:type profile: ``str``
:param libcloud_kwargs: Extra arguments for the driver's delete_image method
:type li... |
def get_image(image_id, profile, **libcloud_kwargs):
'''
Get an image of a node
:param image_id: Image to fetch
:type image_id: ``str``
:param profile: The profile key
:type profile: ``str``
:param libcloud_kwargs: Extra arguments for the driver's delete_image method
:type libcloud_... |
def copy_image(source_region, image_id, name, profile, description=None, **libcloud_kwargs):
'''
Copies an image from a source region to the current region.
:param source_region: Region to copy the node from.
:type source_region: ``str``
:param image_id: Image to copy.
:type image_id: ``str``
... |
def list_key_pairs(profile, **libcloud_kwargs):
'''
List all the available key pair objects.
:param profile: The profile key
:type profile: ``str``
:param libcloud_kwargs: Extra arguments for the driver's list_key_pairs method
:type libcloud_kwargs: ``dict``
CLI Example:
.. code-bl... |
def get_key_pair(name, profile, **libcloud_kwargs):
'''
Get a single key pair by name
:param name: Name of the key pair to retrieve.
:type name: ``str``
:param profile: The profile key
:type profile: ``str``
:param libcloud_kwargs: Extra arguments for the driver's get_key_pair method
... |
def import_key_pair(name, key, profile, key_type=None, **libcloud_kwargs):
'''
Import a new public key from string or a file path
:param name: Key pair name.
:type name: ``str``
:param key: Public key material, the string or a path to a file
:type key: ``str`` or path ``str``
:param prof... |
def delete_key_pair(name, profile, **libcloud_kwargs):
'''
Delete a key pair
:param name: Key pair name.
:type name: ``str``
:param profile: The profile key
:type profile: ``str``
:param libcloud_kwargs: Extra arguments for the driver's import_key_pair_from_xxx method
:type libclou... |
def _get_by_id(collection, id):
'''
Get item from a list by the id field
'''
matches = [item for item in collection if item.id == id]
if not matches:
raise ValueError('Could not find a matching item')
elif len(matches) > 1:
raise ValueError('The id matched {0} items, not 1'.forma... |
def monitor(name):
'''
Get the summary from module monit and try to see if service is
being monitored. If not then monitor the service.
'''
ret = {'result': None,
'name': name,
'comment': '',
'changes': {}
}
result = __salt__['monit.summary'](name)
... |
def status(jboss_config, host=None, server_config=None):
'''
Get status of running jboss instance.
jboss_config
Configuration dictionary with properties specified above.
host
The name of the host. JBoss domain mode only - and required if running in domain mode.
The host name is ... |
def stop_server(jboss_config, host=None):
'''
Stop running jboss instance
jboss_config
Configuration dictionary with properties specified above.
host
The name of the host. JBoss domain mode only - and required if running in domain mode.
The host name is the "name" attribute of t... |
def reload_(jboss_config, host=None):
'''
Reload running jboss instance
jboss_config
Configuration dictionary with properties specified above.
host
The name of the host. JBoss domain mode only - and required if running in domain mode.
The host name is the "name" attribute of the... |
def create_datasource(jboss_config, name, datasource_properties, profile=None):
'''
Create datasource in running jboss instance
jboss_config
Configuration dictionary with properties specified above.
name
Datasource name
datasource_properties
A dictionary of datasource proper... |
def update_datasource(jboss_config, name, new_properties, profile=None):
'''
Update an existing datasource in running jboss instance.
If the property doesn't exist if will be created, if it does, it will be updated with the new value
jboss_config
Configuration dictionary with properties specifi... |
def read_datasource(jboss_config, name, profile=None):
'''
Read datasource properties in the running jboss instance.
jboss_config
Configuration dictionary with properties specified above.
name
Datasource name
profile
Profile name (JBoss domain mode only)
CLI Example:
... |
def create_simple_binding(jboss_config, binding_name, value, profile=None):
'''
Create a simple jndi binding in the running jboss instance
jboss_config
Configuration dictionary with properties specified above.
binding_name
Binding name to be created
value
Binding value
p... |
def read_simple_binding(jboss_config, binding_name, profile=None):
'''
Read jndi binding in the running jboss instance
jboss_config
Configuration dictionary with properties specified above.
binding_name
Binding name to be created
profile
The profile name (JBoss domain mode o... |
def remove_datasource(jboss_config, name, profile=None):
'''
Remove an existing datasource from the running jboss instance.
jboss_config
Configuration dictionary with properties specified above.
name
Datasource name
profile
The profile (JBoss domain mode only)
CLI Examp... |
def deploy(jboss_config, source_file):
'''
Deploy the application on the jboss instance from the local file system where minion is running.
jboss_config
Configuration dictionary with properties specified above.
source_file
Source file to deploy from
CLI Example:
.. code-block:... |
def list_deployments(jboss_config):
'''
List all deployments on the jboss instance
jboss_config
Configuration dictionary with properties specified above.
CLI Example:
.. code-block:: bash
salt '*' jboss7.list_deployments '{"cli_path": "integration.modules.sysmod.SysModuleTest.... |
def undeploy(jboss_config, deployment):
'''
Undeploy the application from jboss instance
jboss_config
Configuration dictionary with properties specified above.
deployment
Deployment name to undeploy
CLI Example:
.. code-block:: bash
salt '*' jboss7.undeploy '{"cli_pat... |
def get_timestamp_at(time_in=None, time_at=None):
'''
Computes the timestamp for a future event that may occur in ``time_in`` time
or at ``time_at``.
'''
if time_in:
if isinstance(time_in, int):
hours = 0
minutes = time_in
else:
time_in = time_in.r... |
def get_time_at(time_in=None, time_at=None, out_fmt='%Y-%m-%dT%H:%M:%S'):
'''
Return the time in human readable format for a future event that may occur
in ``time_in`` time, or at ``time_at``.
'''
dt = get_timestamp_at(time_in=time_in, time_at=time_at)
return time.strftime(out_fmt, time.localtim... |
def _path_is_abs(path):
'''
Return a bool telling whether or ``path`` is absolute. If ``path`` is None,
return ``True``. This function is designed to validate variables which
optionally contain a file path.
'''
if path is None:
return True
try:
return os.path.isabs(path)
... |
def extracted(name,
source,
source_hash=None,
source_hash_name=None,
source_hash_update=False,
skip_verify=False,
password=None,
options=None,
list_options=None,
force=False,
overw... |
def get_config():
'''
Get the status of all the firewall profiles
Returns:
dict: A dictionary of all profiles on the system
Raises:
CommandExecutionError: If the command fails
CLI Example:
.. code-block:: bash
salt '*' firewall.get_config
'''
profiles = {}
... |
def enable(profile='allprofiles'):
'''
.. versionadded:: 2015.5.0
Enable firewall profile
Args:
profile (Optional[str]): The name of the profile to enable. Default is
``allprofiles``. Valid options are:
- allprofiles
- domainprofile
- privatepro... |
def get_rule(name='all'):
'''
.. versionadded:: 2015.5.0
Display all matching rules as specified by name
Args:
name (Optional[str]): The full name of the rule. ``all`` will return all
rules. Default is ``all``
Returns:
dict: A dictionary of all rules or rules that matc... |
def add_rule(name, localport, protocol='tcp', action='allow', dir='in',
remoteip='any'):
'''
.. versionadded:: 2015.5.0
Add a new inbound or outbound rule to the firewall policy
Args:
name (str): The name of the rule. Must be unique and cannot be "all".
Required.
... |
def delete_rule(name=None,
localport=None,
protocol=None,
dir=None,
remoteip=None):
'''
.. versionadded:: 2015.8.0
Delete an existing firewall rule identified by name and optionally by ports,
protocols, direction, and remote IP.
Args:... |
def get_settings(profile, section, store='local'):
'''
Get the firewall property from the specified profile in the specified store
as returned by ``netsh advfirewall``.
.. versionadded:: 2018.3.4
.. versionadded:: 2019.2.0
Args:
profile (str):
The firewall profile to query... |
def get_all_settings(domain, store='local'):
'''
Gets all the properties for the specified profile in the specified store
.. versionadded:: 2018.3.4
.. versionadded:: 2019.2.0
Args:
profile (str):
The firewall profile to query. Valid options are:
- domain
... |
def set_firewall_settings(profile, inbound=None, outbound=None, store='local'):
'''
Set the firewall inbound/outbound settings for the specified profile and
store
.. versionadded:: 2018.3.4
.. versionadded:: 2019.2.0
Args:
profile (str):
The firewall profile to query. Vali... |
def set_logging_settings(profile, setting, value, store='local'):
r'''
Configure logging settings for the Windows firewall.
.. versionadded:: 2018.3.4
.. versionadded:: 2019.2.0
Args:
profile (str):
The firewall profile to configure. Valid options are:
- domain
... |
def set_settings(profile, setting, value, store='local'):
'''
Configure firewall settings.
.. versionadded:: 2018.3.4
.. versionadded:: 2019.2.0
Args:
profile (str):
The firewall profile to configure. Valid options are:
- domain
- public
- ... |
def set_state(profile, state, store='local'):
'''
Configure the firewall state.
.. versionadded:: 2018.3.4
.. versionadded:: 2019.2.0
Args:
profile (str):
The firewall profile to configure. Valid options are:
- domain
- public
- private
... |
def _get_jinja_error(trace, context=None):
'''
Return the error line and error message output from
a stacktrace.
If we are in a macro, also output inside the message the
exact location of the error in the macro
'''
if not context:
context = {}
out = ''
error = _get_jinja_erro... |
def render_genshi_tmpl(tmplstr, context, tmplpath=None):
'''
Render a Genshi template. A method should be passed in as part of the
context. If no method is passed in, xml is assumed. Valid methods are:
.. code-block:
- xml
- xhtml
- html
- text
- newtext
... |
def render_cheetah_tmpl(tmplstr, context, tmplpath=None):
'''
Render a Cheetah template.
'''
from Cheetah.Template import Template
return salt.utils.data.decode(Template(tmplstr, searchList=[context])) |
def py(sfn, string=False, **kwargs): # pylint: disable=C0103
'''
Render a template from a python source file
Returns::
{'result': bool,
'data': <Error data or rendered file path>}
'''
if not os.path.isfile(sfn):
return {}
base_fname = os.path.basename(sfn)
name =... |
def get_balances():
'''
Gets information about fund in the user's account. This method returns the
following information: Available Balance, Account Balance, Earned Amount,
Withdrawable Amount and Funds Required for AutoRenew.
.. note::
If a domain setup with automatic renewal is expiring w... |
def check_balances(minimum=100):
'''
Checks if the provided minimum value is present in the user's account.
Returns a boolean. Returns ``False`` if the user's account balance is less
than the provided minimum or ``True`` if greater than the minimum.
minimum : 100
The value to check
CL... |
def _get_master_uri(master_ip,
master_port,
source_ip=None,
source_port=None):
'''
Return the ZeroMQ URI to connect the Minion to the Master.
It supports different source IP / port, given the ZeroMQ syntax:
// Connecting using a IP address and ... |
def _set_tcp_keepalive(zmq_socket, opts):
'''
Ensure that TCP keepalives are set as specified in "opts".
Warning: Failure to set TCP keepalives on the salt-master can result in
not detecting the loss of a minion when the connection is lost or when
it's host has been terminated without first closing... |
def _uncrypted_transfer(self, load, tries=3, timeout=60):
'''
Send a load across the wire in cleartext
:param dict load: A load to send across the wire
:param int tries: The number of times to make before failure
:param int timeout: The number of seconds on a response before fai... |
def send(self, load, tries=3, timeout=60, raw=False):
'''
Send a request, return a future which will complete when we send the message
'''
if self.crypt == 'clear':
ret = yield self._uncrypted_transfer(load, tries=tries, timeout=timeout)
else:
ret = yield ... |
def master_pub(self):
'''
Return the master publish port
'''
return _get_master_uri(self.opts['master_ip'],
self.publish_port,
source_ip=self.opts.get('source_ip'),
source_port=self.opts.get('sou... |
def _decode_messages(self, messages):
'''
Take the zmq messages, decrypt/decode them into a payload
:param list messages: A list of messages to be decoded
'''
messages_len = len(messages)
# if it was one message, then its old style
if messages_len == 1:
... |
def stream(self):
'''
Return the current zmqstream, creating one if necessary
'''
if not hasattr(self, '_stream'):
self._stream = zmq.eventloop.zmqstream.ZMQStream(self._socket, io_loop=self.io_loop)
return self._stream |
def on_recv(self, callback):
'''
Register a callback for received messages (that we didn't initiate)
:param func callback: A function which should be called when data is received
'''
if callback is None:
return self.stream.on_recv(None)
@tornado.gen.coroutin... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.