repository_name stringclasses 316
values | func_path_in_repository stringlengths 6 223 | func_name stringlengths 1 134 | language stringclasses 1
value | func_code_string stringlengths 57 65.5k | func_documentation_string stringlengths 1 46.3k | split_name stringclasses 1
value | func_code_url stringlengths 91 315 | called_functions listlengths 1 156 ⌀ | enclosing_scope stringlengths 2 1.48M |
|---|---|---|---|---|---|---|---|---|---|
saltstack/salt | salt/modules/rh_ip.py | _read_file | python | def _read_file(path):
'''
Reads and returns the contents of a file
'''
try:
with salt.utils.files.fopen(path, 'rb') as rfh:
lines = salt.utils.stringutils.to_unicode(rfh.read()).splitlines()
try:
lines.remove('')
except ValueError:
... | Reads and returns the contents of a file | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rh_ip.py#L933-L946 | [
"def fopen(*args, **kwargs):\n '''\n Wrapper around open() built-in to set CLOEXEC on the fd.\n\n This flag specifies that the file descriptor should be closed when an exec\n function is invoked;\n\n When a file descriptor is allocated (as with open or dup), this bit is\n initially cleared on the ... | # -*- coding: utf-8 -*-
'''
The networking module for RHEL/Fedora based distros
'''
from __future__ import absolute_import, unicode_literals, print_function
# Import python libs
import logging
import os.path
import os
# Import third party libs
import jinja2
import jinja2.exceptions
# Import salt libs
import salt.uti... |
saltstack/salt | salt/modules/rh_ip.py | _write_file_iface | python | def _write_file_iface(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)
... | Writes a file to disk | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rh_ip.py#L949-L960 | [
"def fopen(*args, **kwargs):\n '''\n Wrapper around open() built-in to set CLOEXEC on the fd.\n\n This flag specifies that the file descriptor should be closed when an exec\n function is invoked;\n\n When a file descriptor is allocated (as with open or dup), this bit is\n initially cleared on the ... | # -*- coding: utf-8 -*-
'''
The networking module for RHEL/Fedora based distros
'''
from __future__ import absolute_import, unicode_literals, print_function
# Import python libs
import logging
import os.path
import os
# Import third party libs
import jinja2
import jinja2.exceptions
# Import salt libs
import salt.uti... |
saltstack/salt | salt/modules/rh_ip.py | _write_file_network | python | def _write_file_network(data, filename):
'''
Writes a file to disk
'''
with salt.utils.files.fopen(filename, 'w') as fp_:
fp_.write(salt.utils.stringutils.to_str(data)) | Writes a file to disk | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rh_ip.py#L963-L968 | [
"def fopen(*args, **kwargs):\n '''\n Wrapper around open() built-in to set CLOEXEC on the fd.\n\n This flag specifies that the file descriptor should be closed when an exec\n function is invoked;\n\n When a file descriptor is allocated (as with open or dup), this bit is\n initially cleared on the ... | # -*- coding: utf-8 -*-
'''
The networking module for RHEL/Fedora based distros
'''
from __future__ import absolute_import, unicode_literals, print_function
# Import python libs
import logging
import os.path
import os
# Import third party libs
import jinja2
import jinja2.exceptions
# Import salt libs
import salt.uti... |
saltstack/salt | salt/modules/rh_ip.py | build_bond | python | 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
'''
rh_major = __grains__['osrelease'][:1]
opts = _parse... | 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 | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rh_ip.py#L980-L1017 | [
"def _read_file(path):\n '''\n Reads and returns the contents of a file\n '''\n try:\n with salt.utils.files.fopen(path, 'rb') as rfh:\n lines = salt.utils.stringutils.to_unicode(rfh.read()).splitlines()\n try:\n lines.remove('')\n except ValueError... | # -*- coding: utf-8 -*-
'''
The networking module for RHEL/Fedora based distros
'''
from __future__ import absolute_import, unicode_literals, print_function
# Import python libs
import logging
import os.path
import os
# Import third party libs
import jinja2
import jinja2.exceptions
# Import salt libs
import salt.uti... |
saltstack/salt | salt/modules/rh_ip.py | build_interface | python | 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>
'''
if __grains__['os'] == 'Fedora':
if __grains__['osmajorrelease'] >= 18:
... | Build an interface script for a network interface.
CLI Example:
.. code-block:: bash
salt '*' ip.build_interface eth0 eth <settings> | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rh_ip.py#L1020-L1074 | [
"def _read_file(path):\n '''\n Reads and returns the contents of a file\n '''\n try:\n with salt.utils.files.fopen(path, 'rb') as rfh:\n lines = salt.utils.stringutils.to_unicode(rfh.read()).splitlines()\n try:\n lines.remove('')\n except ValueError... | # -*- coding: utf-8 -*-
'''
The networking module for RHEL/Fedora based distros
'''
from __future__ import absolute_import, unicode_literals, print_function
# Import python libs
import logging
import os.path
import os
# Import third party libs
import jinja2
import jinja2.exceptions
# Import salt libs
import salt.uti... |
saltstack/salt | salt/modules/rh_ip.py | build_routes | python | def build_routes(iface, **settings):
'''
Build a route script for a network interface.
CLI Example:
.. code-block:: bash
salt '*' ip.build_routes eth0 <settings>
'''
template = 'rh6_route_eth.jinja'
try:
if int(__grains__['osrelease'][0]) < 6:
template = 'rout... | Build a route script for a network interface.
CLI Example:
.. code-block:: bash
salt '*' ip.build_routes eth0 <settings> | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rh_ip.py#L1077-L1130 | [
"def _read_file(path):\n '''\n Reads and returns the contents of a file\n '''\n try:\n with salt.utils.files.fopen(path, 'rb') as rfh:\n lines = salt.utils.stringutils.to_unicode(rfh.read()).splitlines()\n try:\n lines.remove('')\n except ValueError... | # -*- coding: utf-8 -*-
'''
The networking module for RHEL/Fedora based distros
'''
from __future__ import absolute_import, unicode_literals, print_function
# Import python libs
import logging
import os.path
import os
# Import third party libs
import jinja2
import jinja2.exceptions
# Import salt libs
import salt.uti... |
saltstack/salt | salt/modules/rh_ip.py | get_bond | python | 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(_RH_NETWORK_CONF_FILES, '{0}.conf'.format(iface))
return _read_file(path) | Return the content of a bond script
CLI Example:
.. code-block:: bash
salt '*' ip.get_bond bond0 | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rh_ip.py#L1149-L1160 | [
"def _read_file(path):\n '''\n Reads and returns the contents of a file\n '''\n try:\n with salt.utils.files.fopen(path, 'rb') as rfh:\n lines = salt.utils.stringutils.to_unicode(rfh.read()).splitlines()\n try:\n lines.remove('')\n except ValueError... | # -*- coding: utf-8 -*-
'''
The networking module for RHEL/Fedora based distros
'''
from __future__ import absolute_import, unicode_literals, print_function
# Import python libs
import logging
import os.path
import os
# Import third party libs
import jinja2
import jinja2.exceptions
# Import salt libs
import salt.uti... |
saltstack/salt | salt/modules/rh_ip.py | get_interface | python | def get_interface(iface):
'''
Return the contents of an interface script
CLI Example:
.. code-block:: bash
salt '*' ip.get_interface eth0
'''
path = os.path.join(_RH_NETWORK_SCRIPT_DIR, 'ifcfg-{0}'.format(iface))
return _read_file(path) | Return the contents of an interface script
CLI Example:
.. code-block:: bash
salt '*' ip.get_interface eth0 | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rh_ip.py#L1163-L1174 | [
"def _read_file(path):\n '''\n Reads and returns the contents of a file\n '''\n try:\n with salt.utils.files.fopen(path, 'rb') as rfh:\n lines = salt.utils.stringutils.to_unicode(rfh.read()).splitlines()\n try:\n lines.remove('')\n except ValueError... | # -*- coding: utf-8 -*-
'''
The networking module for RHEL/Fedora based distros
'''
from __future__ import absolute_import, unicode_literals, print_function
# Import python libs
import logging
import os.path
import os
# Import third party libs
import jinja2
import jinja2.exceptions
# Import salt libs
import salt.uti... |
saltstack/salt | salt/modules/rh_ip.py | get_routes | python | def get_routes(iface):
'''
Return the contents of the interface routes script.
CLI Example:
.. code-block:: bash
salt '*' ip.get_routes eth0
'''
path = os.path.join(_RH_NETWORK_SCRIPT_DIR, 'route-{0}'.format(iface))
path6 = os.path.join(_RH_NETWORK_SCRIPT_DIR, 'route6-{0}'.format(... | Return the contents of the interface routes script.
CLI Example:
.. code-block:: bash
salt '*' ip.get_routes eth0 | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rh_ip.py#L1193-L1207 | [
"def _read_file(path):\n '''\n Reads and returns the contents of a file\n '''\n try:\n with salt.utils.files.fopen(path, 'rb') as rfh:\n lines = salt.utils.stringutils.to_unicode(rfh.read()).splitlines()\n try:\n lines.remove('')\n except ValueError... | # -*- coding: utf-8 -*-
'''
The networking module for RHEL/Fedora based distros
'''
from __future__ import absolute_import, unicode_literals, print_function
# Import python libs
import logging
import os.path
import os
# Import third party libs
import jinja2
import jinja2.exceptions
# Import salt libs
import salt.uti... |
saltstack/salt | salt/modules/rh_ip.py | apply_network_settings | python | 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... | Apply global network configuration.
CLI Example:
.. code-block:: bash
salt '*' ip.apply_network_settings | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rh_ip.py#L1223-L1260 | null | # -*- coding: utf-8 -*-
'''
The networking module for RHEL/Fedora based distros
'''
from __future__ import absolute_import, unicode_literals, print_function
# Import python libs
import logging
import os.path
import os
# Import third party libs
import jinja2
import jinja2.exceptions
# Import salt libs
import salt.uti... |
saltstack/salt | salt/modules/rh_ip.py | build_network_settings | python | def build_network_settings(**settings):
'''
Build the global network script.
CLI Example:
.. code-block:: bash
salt '*' ip.build_network_settings <settings>
'''
# Read current configuration and store default values
current_network_settings = _parse_rh_config(_RH_NETWORK_FILE)
... | Build the global network script.
CLI Example:
.. code-block:: bash
salt '*' ip.build_network_settings <settings> | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rh_ip.py#L1263-L1291 | [
"def _read_file(path):\n '''\n Reads and returns the contents of a file\n '''\n try:\n with salt.utils.files.fopen(path, 'rb') as rfh:\n lines = salt.utils.stringutils.to_unicode(rfh.read()).splitlines()\n try:\n lines.remove('')\n except ValueError... | # -*- coding: utf-8 -*-
'''
The networking module for RHEL/Fedora based distros
'''
from __future__ import absolute_import, unicode_literals, print_function
# Import python libs
import logging
import os.path
import os
# Import third party libs
import jinja2
import jinja2.exceptions
# Import salt libs
import salt.uti... |
saltstack/salt | salt/modules/gnomedesktop.py | setIdleDelay | python | def setIdleDelay(delaySeconds, **kwargs):
'''
Set the current idle delay setting in seconds
CLI Example:
.. code-block:: bash
salt '*' gnome.setIdleDelay <seconds> user=<username>
'''
_gsession = _GSettings(user=kwargs.get('user'),
schema='org.gnome.desktop... | Set the current idle delay setting in seconds
CLI Example:
.. code-block:: bash
salt '*' gnome.setIdleDelay <seconds> user=<username> | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/gnomedesktop.py#L144-L158 | [
"def _set(self, value):\n '''\n set the value for user in gsettings\n\n '''\n user = self.USER\n try:\n uid = pwd.getpwnam(user).pw_uid\n except KeyError:\n log.info('User does not exist')\n result = {}\n result['retcode'] = 1\n result['stdout'] = 'User {0} does ... | # -*- coding: utf-8 -*-
'''
GNOME implementations
'''
# Import Python libs
from __future__ import absolute_import, print_function, unicode_literals
import re
import logging
try:
import pwd
HAS_PWD = True
except ImportError:
HAS_PWD = False
# Import Salt libs
import salt.utils.path
# Import 3rd-party libs... |
saltstack/salt | salt/modules/gnomedesktop.py | setClockFormat | python | def setClockFormat(clockFormat, **kwargs):
'''
Set the clock format, either 12h or 24h format.
CLI Example:
.. code-block:: bash
salt '*' gnome.setClockFormat <12h|24h> user=<username>
'''
if clockFormat != '12h' and clockFormat != '24h':
return False
_gsession = _GSettin... | Set the clock format, either 12h or 24h format.
CLI Example:
.. code-block:: bash
salt '*' gnome.setClockFormat <12h|24h> user=<username> | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/gnomedesktop.py#L178-L194 | [
"def _set(self, value):\n '''\n set the value for user in gsettings\n\n '''\n user = self.USER\n try:\n uid = pwd.getpwnam(user).pw_uid\n except KeyError:\n log.info('User does not exist')\n result = {}\n result['retcode'] = 1\n result['stdout'] = 'User {0} does ... | # -*- coding: utf-8 -*-
'''
GNOME implementations
'''
# Import Python libs
from __future__ import absolute_import, print_function, unicode_literals
import re
import logging
try:
import pwd
HAS_PWD = True
except ImportError:
HAS_PWD = False
# Import Salt libs
import salt.utils.path
# Import 3rd-party libs... |
saltstack/salt | salt/modules/gnomedesktop.py | setClockShowDate | python | def setClockShowDate(kvalue, **kwargs):
'''
Set whether the date is visible in the clock
CLI Example:
.. code-block:: bash
salt '*' gnome.setClockShowDate <True|False> user=<username>
'''
if kvalue is not True and kvalue is not False:
return False
_gsession = _GSettings(u... | Set whether the date is visible in the clock
CLI Example:
.. code-block:: bash
salt '*' gnome.setClockShowDate <True|False> user=<username> | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/gnomedesktop.py#L214-L230 | [
"def _set(self, value):\n '''\n set the value for user in gsettings\n\n '''\n user = self.USER\n try:\n uid = pwd.getpwnam(user).pw_uid\n except KeyError:\n log.info('User does not exist')\n result = {}\n result['retcode'] = 1\n result['stdout'] = 'User {0} does ... | # -*- coding: utf-8 -*-
'''
GNOME implementations
'''
# Import Python libs
from __future__ import absolute_import, print_function, unicode_literals
import re
import logging
try:
import pwd
HAS_PWD = True
except ImportError:
HAS_PWD = False
# Import Salt libs
import salt.utils.path
# Import 3rd-party libs... |
saltstack/salt | salt/modules/gnomedesktop.py | getIdleActivation | python | def getIdleActivation(**kwargs):
'''
Get whether the idle activation is enabled
CLI Example:
.. code-block:: bash
salt '*' gnome.getIdleActivation user=<username>
'''
_gsession = _GSettings(user=kwargs.get('user'),
schema='org.gnome.desktop.screensaver',
... | Get whether the idle activation is enabled
CLI Example:
.. code-block:: bash
salt '*' gnome.getIdleActivation user=<username> | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/gnomedesktop.py#L233-L247 | [
"def _get(self):\n '''\n get the value for user in gsettings\n\n '''\n user = self.USER\n try:\n uid = pwd.getpwnam(user).pw_uid\n except KeyError:\n log.info('User does not exist')\n return False\n\n cmd = self.gsetting_command + ['get', str(self.SCHEMA), str(self.KEY)]\n ... | # -*- coding: utf-8 -*-
'''
GNOME implementations
'''
# Import Python libs
from __future__ import absolute_import, print_function, unicode_literals
import re
import logging
try:
import pwd
HAS_PWD = True
except ImportError:
HAS_PWD = False
# Import Salt libs
import salt.utils.path
# Import 3rd-party libs... |
saltstack/salt | salt/modules/gnomedesktop.py | get | python | def get(schema=None, key=None, user=None, **kwargs):
'''
Get key in a particular GNOME schema
CLI Example:
.. code-block:: bash
salt '*' gnome.get user=<username> schema=org.gnome.desktop.screensaver key=idle-activation-enabled
'''
_gsession = _GSettings(user=user, schema=schema, key... | Get key in a particular GNOME schema
CLI Example:
.. code-block:: bash
salt '*' gnome.get user=<username> schema=org.gnome.desktop.screensaver key=idle-activation-enabled | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/gnomedesktop.py#L269-L281 | [
"def _get(self):\n '''\n get the value for user in gsettings\n\n '''\n user = self.USER\n try:\n uid = pwd.getpwnam(user).pw_uid\n except KeyError:\n log.info('User does not exist')\n return False\n\n cmd = self.gsetting_command + ['get', str(self.SCHEMA), str(self.KEY)]\n ... | # -*- coding: utf-8 -*-
'''
GNOME implementations
'''
# Import Python libs
from __future__ import absolute_import, print_function, unicode_literals
import re
import logging
try:
import pwd
HAS_PWD = True
except ImportError:
HAS_PWD = False
# Import Salt libs
import salt.utils.path
# Import 3rd-party libs... |
saltstack/salt | salt/modules/gnomedesktop.py | set_ | python | def set_(schema=None, key=None, user=None, value=None, **kwargs):
'''
Set key in a particular GNOME schema
CLI Example:
.. code-block:: bash
salt '*' gnome.set user=<username> schema=org.gnome.desktop.screensaver key=idle-activation-enabled value=False
'''
_gsession = _GSettings(user... | Set key in a particular GNOME schema
CLI Example:
.. code-block:: bash
salt '*' gnome.set user=<username> schema=org.gnome.desktop.screensaver key=idle-activation-enabled value=False | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/gnomedesktop.py#L284-L296 | [
"def _set(self, value):\n '''\n set the value for user in gsettings\n\n '''\n user = self.USER\n try:\n uid = pwd.getpwnam(user).pw_uid\n except KeyError:\n log.info('User does not exist')\n result = {}\n result['retcode'] = 1\n result['stdout'] = 'User {0} does ... | # -*- coding: utf-8 -*-
'''
GNOME implementations
'''
# Import Python libs
from __future__ import absolute_import, print_function, unicode_literals
import re
import logging
try:
import pwd
HAS_PWD = True
except ImportError:
HAS_PWD = False
# Import Salt libs
import salt.utils.path
# Import 3rd-party libs... |
saltstack/salt | salt/modules/gnomedesktop.py | _GSettings._get | python | def _get(self):
'''
get the value for user in gsettings
'''
user = self.USER
try:
uid = pwd.getpwnam(user).pw_uid
except KeyError:
log.info('User does not exist')
return False
cmd = self.gsetting_command + ['get', str(self.SCH... | get the value for user in gsettings | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/gnomedesktop.py#L66-L89 | null | class _GSettings(object):
def __init__(self, user, schema, key):
self.SCHEMA = schema
self.KEY = key
self.USER = user
self.UID = None
self.HOME = None
@property
def gsetting_command(self):
'''
return the command to run the gsettings binary
'''... |
saltstack/salt | salt/modules/gnomedesktop.py | _GSettings._set | python | def _set(self, value):
'''
set the value for user in gsettings
'''
user = self.USER
try:
uid = pwd.getpwnam(user).pw_uid
except KeyError:
log.info('User does not exist')
result = {}
result['retcode'] = 1
result[... | set the value for user in gsettings | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/gnomedesktop.py#L91-L110 | null | class _GSettings(object):
def __init__(self, user, schema, key):
self.SCHEMA = schema
self.KEY = key
self.USER = user
self.UID = None
self.HOME = None
@property
def gsetting_command(self):
'''
return the command to run the gsettings binary
'''... |
saltstack/salt | salt/modules/rpm_lowpkg.py | bin_pkg_info | python | def bin_pkg_info(path, saltenv='base'):
'''
.. versionadded:: 2015.8.0
Parses RPM metadata and returns a dictionary of information about the
package (name, version, etc.).
path
Path to the file. Can either be an absolute path to a file on the
minion, or a salt fileserver URL (e.g. ... | .. versionadded:: 2015.8.0
Parses RPM metadata and returns a dictionary of information about the
package (name, version, etc.).
path
Path to the file. Can either be an absolute path to a file on the
minion, or a salt fileserver URL (e.g. ``salt://path/to/file.rpm``).
If a salt file... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rpm_lowpkg.py#L65-L128 | [
"def parse_pkginfo(line, osarch=None):\n '''\n A small helper to parse an rpm/repoquery command's output. Returns a\n pkginfo namedtuple.\n '''\n try:\n name, epoch, version, release, arch, repoid, install_time = line.split('_|-')\n # Handle unpack errors (should never happen with the query... | # -*- coding: utf-8 -*-
'''
Support for rpm
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import logging
import os
import re
import datetime
from salt.utils.versions import LooseVersion
# Import Salt libs
import salt.utils.decorators.path
import salt.utils.itertools... |
saltstack/salt | salt/modules/rpm_lowpkg.py | list_pkgs | python | def list_pkgs(*packages, **kwargs):
'''
List the packages currently installed in a dict::
{'<package_name>': '<version>'}
root
use root as top level directory (default: "/")
CLI Example:
.. code-block:: bash
salt '*' lowpkg.list_pkgs
'''
pkgs = {}
cmd = ['rpm... | List the packages currently installed in a dict::
{'<package_name>': '<version>'}
root
use root as top level directory (default: "/")
CLI Example:
.. code-block:: bash
salt '*' lowpkg.list_pkgs | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rpm_lowpkg.py#L131-L160 | [
"def split(orig, sep=None):\n '''\n Generator function for iterating through large strings, particularly useful\n as a replacement for str.splitlines().\n\n See http://stackoverflow.com/a/3865367\n '''\n exp = re.compile(r'\\s+' if sep is None else re.escape(sep))\n pos = 0\n length = len(or... | # -*- coding: utf-8 -*-
'''
Support for rpm
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import logging
import os
import re
import datetime
from salt.utils.versions import LooseVersion
# Import Salt libs
import salt.utils.decorators.path
import salt.utils.itertools... |
saltstack/salt | salt/modules/rpm_lowpkg.py | verify | python | def verify(*packages, **kwargs):
'''
Runs an rpm -Va on a system, and returns the results in a dict
root
use root as top level directory (default: "/")
Files with an attribute of config, doc, ghost, license or readme in the
package header can be ignored using the ``ignore_types`` keyword a... | Runs an rpm -Va on a system, and returns the results in a dict
root
use root as top level directory (default: "/")
Files with an attribute of config, doc, ghost, license or readme in the
package header can be ignored using the ``ignore_types`` keyword argument
CLI Example:
.. code-block:... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rpm_lowpkg.py#L163-L262 | [
"def split(orig, sep=None):\n '''\n Generator function for iterating through large strings, particularly useful\n as a replacement for str.splitlines().\n\n See http://stackoverflow.com/a/3865367\n '''\n exp = re.compile(r'\\s+' if sep is None else re.escape(sep))\n pos = 0\n length = len(or... | # -*- coding: utf-8 -*-
'''
Support for rpm
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import logging
import os
import re
import datetime
from salt.utils.versions import LooseVersion
# Import Salt libs
import salt.utils.decorators.path
import salt.utils.itertools... |
saltstack/salt | salt/modules/rpm_lowpkg.py | modified | python | def modified(*packages, **flags):
'''
List the modified files that belong to a package. Not specifying any packages
will return a list of _all_ modified files on the system's RPM database.
.. versionadded:: 2015.5.0
root
use root as top level directory (default: "/")
CLI examples:
... | List the modified files that belong to a package. Not specifying any packages
will return a list of _all_ modified files on the system's RPM database.
.. versionadded:: 2015.5.0
root
use root as top level directory (default: "/")
CLI examples:
.. code-block:: bash
salt '*' lowpk... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rpm_lowpkg.py#L265-L340 | [
"def split(orig, sep=None):\n '''\n Generator function for iterating through large strings, particularly useful\n as a replacement for str.splitlines().\n\n See http://stackoverflow.com/a/3865367\n '''\n exp = re.compile(r'\\s+' if sep is None else re.escape(sep))\n pos = 0\n length = len(or... | # -*- coding: utf-8 -*-
'''
Support for rpm
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import logging
import os
import re
import datetime
from salt.utils.versions import LooseVersion
# Import Salt libs
import salt.utils.decorators.path
import salt.utils.itertools... |
saltstack/salt | salt/modules/rpm_lowpkg.py | file_list | python | def file_list(*packages, **kwargs):
'''
List the files that belong to a package. Not specifying any packages will
return a list of _every_ file on the system's rpm database (not generally
recommended).
root
use root as top level directory (default: "/")
CLI Examples:
.. code-block... | List the files that belong to a package. Not specifying any packages will
return a list of _every_ file on the system's rpm database (not generally
recommended).
root
use root as top level directory (default: "/")
CLI Examples:
.. code-block:: bash
salt '*' lowpkg.file_list httpd... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rpm_lowpkg.py#L343-L373 | null | # -*- coding: utf-8 -*-
'''
Support for rpm
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import logging
import os
import re
import datetime
from salt.utils.versions import LooseVersion
# Import Salt libs
import salt.utils.decorators.path
import salt.utils.itertools... |
saltstack/salt | salt/modules/rpm_lowpkg.py | file_dict | python | def file_dict(*packages, **kwargs):
'''
List the files that belong to a package, sorted by group. Not specifying
any packages will return a list of _every_ file on the system's rpm
database (not generally recommended).
root
use root as top level directory (default: "/")
CLI Examples:
... | List the files that belong to a package, sorted by group. Not specifying
any packages will return a list of _every_ file on the system's rpm
database (not generally recommended).
root
use root as top level directory (default: "/")
CLI Examples:
.. code-block:: bash
salt '*' lowpk... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rpm_lowpkg.py#L376-L420 | [
"def split(orig, sep=None):\n '''\n Generator function for iterating through large strings, particularly useful\n as a replacement for str.splitlines().\n\n See http://stackoverflow.com/a/3865367\n '''\n exp = re.compile(r'\\s+' if sep is None else re.escape(sep))\n pos = 0\n length = len(or... | # -*- coding: utf-8 -*-
'''
Support for rpm
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import logging
import os
import re
import datetime
from salt.utils.versions import LooseVersion
# Import Salt libs
import salt.utils.decorators.path
import salt.utils.itertools... |
saltstack/salt | salt/modules/rpm_lowpkg.py | owner | python | def owner(*paths, **kwargs):
'''
Return the name of the package that owns the file. Multiple file paths can
be passed. If a single path is passed, a string will be returned,
and if multiple paths are passed, a dictionary of file/package name pairs
will be returned.
If the file is not owned by a... | Return the name of the package that owns the file. Multiple file paths can
be passed. If a single path is passed, a string will be returned,
and if multiple paths are passed, a dictionary of file/package name pairs
will be returned.
If the file is not owned by a package, or is not present on the minion... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rpm_lowpkg.py#L423-L458 | null | # -*- coding: utf-8 -*-
'''
Support for rpm
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import logging
import os
import re
import datetime
from salt.utils.versions import LooseVersion
# Import Salt libs
import salt.utils.decorators.path
import salt.utils.itertools... |
saltstack/salt | salt/modules/rpm_lowpkg.py | diff | python | def diff(package_path, path):
'''
Return a formatted diff between current file and original in a package.
NOTE: this function includes all files (configuration and not), but does
not work on binary content.
:param package: Full pack of the RPM file
:param path: Full path to the installed file
... | Return a formatted diff between current file and original in a package.
NOTE: this function includes all files (configuration and not), but does
not work on binary content.
:param package: Full pack of the RPM file
:param path: Full path to the installed file
:return: Difference or empty string. Fo... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rpm_lowpkg.py#L464-L490 | null | # -*- coding: utf-8 -*-
'''
Support for rpm
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import logging
import os
import re
import datetime
from salt.utils.versions import LooseVersion
# Import Salt libs
import salt.utils.decorators.path
import salt.utils.itertools... |
saltstack/salt | salt/modules/rpm_lowpkg.py | info | python | def info(*packages, **kwargs):
'''
Return a detailed package(s) summary information.
If no packages specified, all packages will be returned.
:param packages:
:param attr:
Comma-separated package attributes. If no 'attr' is specified, all available attributes returned.
Valid attri... | Return a detailed package(s) summary information.
If no packages specified, all packages will be returned.
:param packages:
:param attr:
Comma-separated package attributes. If no 'attr' is specified, all available attributes returned.
Valid attributes are:
version, vendor, rel... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rpm_lowpkg.py#L493-L674 | null | # -*- coding: utf-8 -*-
'''
Support for rpm
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import logging
import os
import re
import datetime
from salt.utils.versions import LooseVersion
# Import Salt libs
import salt.utils.decorators.path
import salt.utils.itertools... |
saltstack/salt | salt/modules/rpm_lowpkg.py | version_cmp | python | def version_cmp(ver1, ver2, ignore_epoch=False):
'''
.. versionadded:: 2015.8.9
Do a cmp-style comparison on two packages. Return -1 if ver1 < ver2, 0 if
ver1 == ver2, and 1 if ver1 > ver2. Return None if there was a problem
making the comparison.
ignore_epoch : False
Set to ``True`` t... | .. versionadded:: 2015.8.9
Do a cmp-style comparison on two packages. Return -1 if ver1 < ver2, 0 if
ver1 == ver2, and 1 if ver1 > ver2. Return None if there was a problem
making the comparison.
ignore_epoch : False
Set to ``True`` to ignore the epoch when comparing versions
.. versio... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rpm_lowpkg.py#L677-L791 | [
"def version_cmp(pkg1, pkg2, ignore_epoch=False):\n '''\n Compares two version strings using salt.utils.versions.LooseVersion. This\n is a fallback for providers which don't have a version comparison utility\n built into them. Return -1 if version1 < version2, 0 if version1 ==\n version2, and 1 if v... | # -*- coding: utf-8 -*-
'''
Support for rpm
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import logging
import os
import re
import datetime
from salt.utils.versions import LooseVersion
# Import Salt libs
import salt.utils.decorators.path
import salt.utils.itertools... |
saltstack/salt | salt/modules/rpm_lowpkg.py | checksum | python | def checksum(*paths, **kwargs):
'''
Return if the signature of a RPM file is valid.
root
use root as top level directory (default: "/")
CLI Example:
.. code-block:: bash
salt '*' lowpkg.checksum /path/to/package1.rpm
salt '*' lowpkg.checksum /path/to/package1.rpm /path/to... | Return if the signature of a RPM file is valid.
root
use root as top level directory (default: "/")
CLI Example:
.. code-block:: bash
salt '*' lowpkg.checksum /path/to/package1.rpm
salt '*' lowpkg.checksum /path/to/package1.rpm /path/to/package2.rpm | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rpm_lowpkg.py#L794-L825 | null | # -*- coding: utf-8 -*-
'''
Support for rpm
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import logging
import os
import re
import datetime
from salt.utils.versions import LooseVersion
# Import Salt libs
import salt.utils.decorators.path
import salt.utils.itertools... |
saltstack/salt | salt/modules/haproxyconn.py | _get_conn | python | def _get_conn(socket=DEFAULT_SOCKET_URL):
'''
Get connection to haproxy socket.
'''
assert os.path.exists(socket), '{0} does not exist.'.format(socket)
issock = os.stat(socket).st_mode
assert stat.S_ISSOCK(issock), '{0} is not a socket.'.format(socket)
ha_conn = haproxy.conn.HaPConn(socket)
... | Get connection to haproxy socket. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/haproxyconn.py#L44-L52 | null | # -*- coding: utf-8 -*-
'''
Support for haproxy
.. versionadded:: 2014.7.0
'''
# Import Python libs
from __future__ import absolute_import, generators, print_function, unicode_literals
import os
import logging
import stat
import time
try:
import haproxy.cmds
import haproxy.conn
HAS_HAPROXY = True
except ... |
saltstack/salt | salt/modules/haproxyconn.py | list_servers | python | def list_servers(backend, socket=DEFAULT_SOCKET_URL, objectify=False):
'''
List servers in haproxy backend.
backend
haproxy backend
socket
haproxy stats socket, default ``/var/run/haproxy.sock``
CLI Example:
.. code-block:: bash
salt '*' haproxy.list_servers mysql
... | List servers in haproxy backend.
backend
haproxy backend
socket
haproxy stats socket, default ``/var/run/haproxy.sock``
CLI Example:
.. code-block:: bash
salt '*' haproxy.list_servers mysql | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/haproxyconn.py#L55-L73 | [
"def _get_conn(socket=DEFAULT_SOCKET_URL):\n '''\n Get connection to haproxy socket.\n '''\n assert os.path.exists(socket), '{0} does not exist.'.format(socket)\n issock = os.stat(socket).st_mode\n assert stat.S_ISSOCK(issock), '{0} is not a socket.'.format(socket)\n ha_conn = haproxy.conn.HaPC... | # -*- coding: utf-8 -*-
'''
Support for haproxy
.. versionadded:: 2014.7.0
'''
# Import Python libs
from __future__ import absolute_import, generators, print_function, unicode_literals
import os
import logging
import stat
import time
try:
import haproxy.cmds
import haproxy.conn
HAS_HAPROXY = True
except ... |
saltstack/salt | salt/modules/haproxyconn.py | enable_server | python | def enable_server(name, backend, socket=DEFAULT_SOCKET_URL):
'''
Enable Server in haproxy
name
Server to enable
backend
haproxy backend, or all backends if "*" is supplied
socket
haproxy stats socket, default ``/var/run/haproxy.sock``
CLI Example:
.. code-block::... | Enable Server in haproxy
name
Server to enable
backend
haproxy backend, or all backends if "*" is supplied
socket
haproxy stats socket, default ``/var/run/haproxy.sock``
CLI Example:
.. code-block:: bash
salt '*' haproxy.enable_server web1.example.com www | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/haproxyconn.py#L158-L190 | [
"def _get_conn(socket=DEFAULT_SOCKET_URL):\n '''\n Get connection to haproxy socket.\n '''\n assert os.path.exists(socket), '{0} does not exist.'.format(socket)\n issock = os.stat(socket).st_mode\n assert stat.S_ISSOCK(issock), '{0} is not a socket.'.format(socket)\n ha_conn = haproxy.conn.HaPC... | # -*- coding: utf-8 -*-
'''
Support for haproxy
.. versionadded:: 2014.7.0
'''
# Import Python libs
from __future__ import absolute_import, generators, print_function, unicode_literals
import os
import logging
import stat
import time
try:
import haproxy.cmds
import haproxy.conn
HAS_HAPROXY = True
except ... |
saltstack/salt | salt/modules/haproxyconn.py | get_weight | python | def get_weight(name, backend, socket=DEFAULT_SOCKET_URL):
'''
Get server weight
name
Server name
backend
haproxy backend
socket
haproxy stats socket, default ``/var/run/haproxy.sock``
CLI Example:
.. code-block:: bash
salt '*' haproxy.get_weight web1.exa... | Get server weight
name
Server name
backend
haproxy backend
socket
haproxy stats socket, default ``/var/run/haproxy.sock``
CLI Example:
.. code-block:: bash
salt '*' haproxy.get_weight web1.example.com www | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/haproxyconn.py#L228-L249 | [
"def _get_conn(socket=DEFAULT_SOCKET_URL):\n '''\n Get connection to haproxy socket.\n '''\n assert os.path.exists(socket), '{0} does not exist.'.format(socket)\n issock = os.stat(socket).st_mode\n assert stat.S_ISSOCK(issock), '{0} is not a socket.'.format(socket)\n ha_conn = haproxy.conn.HaPC... | # -*- coding: utf-8 -*-
'''
Support for haproxy
.. versionadded:: 2014.7.0
'''
# Import Python libs
from __future__ import absolute_import, generators, print_function, unicode_literals
import os
import logging
import stat
import time
try:
import haproxy.cmds
import haproxy.conn
HAS_HAPROXY = True
except ... |
saltstack/salt | salt/modules/haproxyconn.py | set_state | python | def set_state(name, backend, state, socket=DEFAULT_SOCKET_URL):
'''
Force a server's administrative state to a new state. This can be useful to
disable load balancing and/or any traffic to a server. Setting the state to
"ready" puts the server in normal mode, and the command is the equivalent of
the... | Force a server's administrative state to a new state. This can be useful to
disable load balancing and/or any traffic to a server. Setting the state to
"ready" puts the server in normal mode, and the command is the equivalent of
the "enable server" command. Setting the state to "maint" disables any traffic
... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/haproxyconn.py#L280-L320 | [
"def _get_conn(socket=DEFAULT_SOCKET_URL):\n '''\n Get connection to haproxy socket.\n '''\n assert os.path.exists(socket), '{0} does not exist.'.format(socket)\n issock = os.stat(socket).st_mode\n assert stat.S_ISSOCK(issock), '{0} is not a socket.'.format(socket)\n ha_conn = haproxy.conn.HaPC... | # -*- coding: utf-8 -*-
'''
Support for haproxy
.. versionadded:: 2014.7.0
'''
# Import Python libs
from __future__ import absolute_import, generators, print_function, unicode_literals
import os
import logging
import stat
import time
try:
import haproxy.cmds
import haproxy.conn
HAS_HAPROXY = True
except ... |
saltstack/salt | salt/modules/haproxyconn.py | show_frontends | python | def show_frontends(socket=DEFAULT_SOCKET_URL):
'''
Show HaProxy frontends
socket
haproxy stats socket, default ``/var/run/haproxy.sock``
CLI Example:
.. code-block:: bash
salt '*' haproxy.show_frontends
'''
ha_conn = _get_conn(socket)
ha_cmd = haproxy.cmds.showFronten... | Show HaProxy frontends
socket
haproxy stats socket, default ``/var/run/haproxy.sock``
CLI Example:
.. code-block:: bash
salt '*' haproxy.show_frontends | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/haproxyconn.py#L323-L338 | [
"def _get_conn(socket=DEFAULT_SOCKET_URL):\n '''\n Get connection to haproxy socket.\n '''\n assert os.path.exists(socket), '{0} does not exist.'.format(socket)\n issock = os.stat(socket).st_mode\n assert stat.S_ISSOCK(issock), '{0} is not a socket.'.format(socket)\n ha_conn = haproxy.conn.HaPC... | # -*- coding: utf-8 -*-
'''
Support for haproxy
.. versionadded:: 2014.7.0
'''
# Import Python libs
from __future__ import absolute_import, generators, print_function, unicode_literals
import os
import logging
import stat
import time
try:
import haproxy.cmds
import haproxy.conn
HAS_HAPROXY = True
except ... |
saltstack/salt | salt/modules/haproxyconn.py | show_backends | python | def show_backends(socket=DEFAULT_SOCKET_URL):
'''
Show HaProxy Backends
socket
haproxy stats socket, default ``/var/run/haproxy.sock``
CLI Example:
.. code-block:: bash
salt '*' haproxy.show_backends
'''
ha_conn = _get_conn(socket)
ha_cmd = haproxy.cmds.showBackends()... | Show HaProxy Backends
socket
haproxy stats socket, default ``/var/run/haproxy.sock``
CLI Example:
.. code-block:: bash
salt '*' haproxy.show_backends | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/haproxyconn.py#L358-L373 | [
"def _get_conn(socket=DEFAULT_SOCKET_URL):\n '''\n Get connection to haproxy socket.\n '''\n assert os.path.exists(socket), '{0} does not exist.'.format(socket)\n issock = os.stat(socket).st_mode\n assert stat.S_ISSOCK(issock), '{0} is not a socket.'.format(socket)\n ha_conn = haproxy.conn.HaPC... | # -*- coding: utf-8 -*-
'''
Support for haproxy
.. versionadded:: 2014.7.0
'''
# Import Python libs
from __future__ import absolute_import, generators, print_function, unicode_literals
import os
import logging
import stat
import time
try:
import haproxy.cmds
import haproxy.conn
HAS_HAPROXY = True
except ... |
saltstack/salt | salt/modules/haproxyconn.py | get_sessions | python | def get_sessions(name, backend, socket=DEFAULT_SOCKET_URL):
'''
.. versionadded:: 2016.11.0
Get number of current sessions on server in backend (scur)
name
Server name
backend
haproxy backend
socket
haproxy stats socket, default ``/var/run/haproxy.sock``
CLI Exam... | .. versionadded:: 2016.11.0
Get number of current sessions on server in backend (scur)
name
Server name
backend
haproxy backend
socket
haproxy stats socket, default ``/var/run/haproxy.sock``
CLI Example:
.. code-block:: bash
salt '*' haproxy.get_sessions we... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/haproxyconn.py#L402-L435 | [
"def _get_conn(socket=DEFAULT_SOCKET_URL):\n '''\n Get connection to haproxy socket.\n '''\n assert os.path.exists(socket), '{0} does not exist.'.format(socket)\n issock = os.stat(socket).st_mode\n assert stat.S_ISSOCK(issock), '{0} is not a socket.'.format(socket)\n ha_conn = haproxy.conn.HaPC... | # -*- coding: utf-8 -*-
'''
Support for haproxy
.. versionadded:: 2014.7.0
'''
# Import Python libs
from __future__ import absolute_import, generators, print_function, unicode_literals
import os
import logging
import stat
import time
try:
import haproxy.cmds
import haproxy.conn
HAS_HAPROXY = True
except ... |
saltstack/salt | salt/states/beacon.py | present | python | def present(name,
save=False,
**kwargs):
'''
Ensure beacon is configured with the included beacon data.
Args:
name (str):
The name of the beacon ensure is configured.
save (bool):
``True`` updates the beacons.conf. Default is ``False``.
... | Ensure beacon is configured with the included beacon data.
Args:
name (str):
The name of the beacon ensure is configured.
save (bool):
``True`` updates the beacons.conf. Default is ``False``.
Returns:
dict: A dictionary of information about the results of the ... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/beacon.py#L80-L160 | [
"def iteritems(d, **kw):\n return d.iteritems(**kw)\n"
] | # -*- coding: utf-8 -*-
'''
Management of the Salt beacons
==============================
.. versionadded:: 2015.8.0
.. code-block:: yaml
ps:
beacon.present:
- save: True
- enable: False
- services:
salt-master: running
apache2: stopped
sh:
beacon.... |
saltstack/salt | salt/modules/netscaler.py | _connect | python | def _connect(**kwargs):
'''
Initialise netscaler connection
'''
connargs = dict()
# Shamelessy ripped from the mysql module
def __connarg(name, key=None, default=None):
'''
Add key to connargs, only if name exists in our kwargs or as
netscaler.<name> in __opts__ or __pil... | Initialise netscaler connection | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netscaler.py#L89-L132 | [
"def __connarg(name, key=None, default=None):\n '''\n Add key to connargs, only if name exists in our kwargs or as\n netscaler.<name> in __opts__ or __pillar__ Evaluate in said order - kwargs,\n opts then pillar. To avoid collision with other functions, kwargs-based\n connection arguments are prefixe... | # -*- coding: utf-8 -*-
'''
Module to provide Citrix Netscaler compatibility to Salt (compatible with netscaler 9.2+)
.. versionadded:: 2015.2.0
:depends:
- nsnitro Python module
.. note::
You can install nsnitro using:
.. code-block:: bash
pip install nsnitro
:configuration: This module accepts ... |
saltstack/salt | salt/modules/netscaler.py | _servicegroup_get | python | def _servicegroup_get(sg_name, **connection_args):
'''
Return a service group ressource or None
'''
nitro = _connect(**connection_args)
if nitro is None:
return None
sg = NSServiceGroup()
sg.set_servicegroupname(sg_name)
try:
sg = NSServiceGroup.get(nitro, sg)
except ... | Return a service group ressource or None | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netscaler.py#L144-L159 | [
"def _connect(**kwargs):\n '''\n Initialise netscaler connection\n '''\n connargs = dict()\n\n # Shamelessy ripped from the mysql module\n def __connarg(name, key=None, default=None):\n '''\n Add key to connargs, only if name exists in our kwargs or as\n netscaler.<name> in __... | # -*- coding: utf-8 -*-
'''
Module to provide Citrix Netscaler compatibility to Salt (compatible with netscaler 9.2+)
.. versionadded:: 2015.2.0
:depends:
- nsnitro Python module
.. note::
You can install nsnitro using:
.. code-block:: bash
pip install nsnitro
:configuration: This module accepts ... |
saltstack/salt | salt/modules/netscaler.py | _servicegroup_get_servers | python | def _servicegroup_get_servers(sg_name, **connection_args):
'''
Returns a list of members of a servicegroup or None
'''
nitro = _connect(**connection_args)
if nitro is None:
return None
sg = NSServiceGroup()
sg.set_servicegroupname(sg_name)
try:
sg = NSServiceGroup.get_ser... | Returns a list of members of a servicegroup or None | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netscaler.py#L162-L177 | [
"def _connect(**kwargs):\n '''\n Initialise netscaler connection\n '''\n connargs = dict()\n\n # Shamelessy ripped from the mysql module\n def __connarg(name, key=None, default=None):\n '''\n Add key to connargs, only if name exists in our kwargs or as\n netscaler.<name> in __... | # -*- coding: utf-8 -*-
'''
Module to provide Citrix Netscaler compatibility to Salt (compatible with netscaler 9.2+)
.. versionadded:: 2015.2.0
:depends:
- nsnitro Python module
.. note::
You can install nsnitro using:
.. code-block:: bash
pip install nsnitro
:configuration: This module accepts ... |
saltstack/salt | salt/modules/netscaler.py | _servicegroup_get_server | python | def _servicegroup_get_server(sg_name, s_name, s_port=None, **connection_args):
'''
Returns a member of a service group or None
'''
ret = None
servers = _servicegroup_get_servers(sg_name, **connection_args)
if servers is None:
return None
for server in servers:
if server.get_s... | Returns a member of a service group or None | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netscaler.py#L180-L193 | [
"def _servicegroup_get_servers(sg_name, **connection_args):\n '''\n Returns a list of members of a servicegroup or None\n '''\n nitro = _connect(**connection_args)\n if nitro is None:\n return None\n sg = NSServiceGroup()\n sg.set_servicegroupname(sg_name)\n try:\n sg = NSServi... | # -*- coding: utf-8 -*-
'''
Module to provide Citrix Netscaler compatibility to Salt (compatible with netscaler 9.2+)
.. versionadded:: 2015.2.0
:depends:
- nsnitro Python module
.. note::
You can install nsnitro using:
.. code-block:: bash
pip install nsnitro
:configuration: This module accepts ... |
saltstack/salt | salt/modules/netscaler.py | servicegroup_exists | python | def servicegroup_exists(sg_name, sg_type=None, **connection_args):
'''
Checks if a service group exists
CLI Example:
.. code-block:: bash
salt '*' netscaler.servicegroup_exists 'serviceGroupName'
'''
sg = _servicegroup_get(sg_name, **connection_args)
if sg is None:
return ... | Checks if a service group exists
CLI Example:
.. code-block:: bash
salt '*' netscaler.servicegroup_exists 'serviceGroupName' | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netscaler.py#L196-L211 | [
"def _servicegroup_get(sg_name, **connection_args):\n '''\n Return a service group ressource or None\n '''\n nitro = _connect(**connection_args)\n if nitro is None:\n return None\n sg = NSServiceGroup()\n sg.set_servicegroupname(sg_name)\n try:\n sg = NSServiceGroup.get(nitro, ... | # -*- coding: utf-8 -*-
'''
Module to provide Citrix Netscaler compatibility to Salt (compatible with netscaler 9.2+)
.. versionadded:: 2015.2.0
:depends:
- nsnitro Python module
.. note::
You can install nsnitro using:
.. code-block:: bash
pip install nsnitro
:configuration: This module accepts ... |
saltstack/salt | salt/modules/netscaler.py | servicegroup_add | python | def servicegroup_add(sg_name, sg_type='HTTP', **connection_args):
'''
Add a new service group
If no service type is specified, HTTP will be used.
Most common service types: HTTP, SSL, and SSL_BRIDGE
CLI Example:
.. code-block:: bash
salt '*' netscaler.servicegroup_add 'serviceGroupNam... | Add a new service group
If no service type is specified, HTTP will be used.
Most common service types: HTTP, SSL, and SSL_BRIDGE
CLI Example:
.. code-block:: bash
salt '*' netscaler.servicegroup_add 'serviceGroupName'
salt '*' netscaler.servicegroup_add 'serviceGroupName' 'serviceGrou... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netscaler.py#L214-L242 | [
"def _connect(**kwargs):\n '''\n Initialise netscaler connection\n '''\n connargs = dict()\n\n # Shamelessy ripped from the mysql module\n def __connarg(name, key=None, default=None):\n '''\n Add key to connargs, only if name exists in our kwargs or as\n netscaler.<name> in __... | # -*- coding: utf-8 -*-
'''
Module to provide Citrix Netscaler compatibility to Salt (compatible with netscaler 9.2+)
.. versionadded:: 2015.2.0
:depends:
- nsnitro Python module
.. note::
You can install nsnitro using:
.. code-block:: bash
pip install nsnitro
:configuration: This module accepts ... |
saltstack/salt | salt/modules/netscaler.py | servicegroup_delete | python | def servicegroup_delete(sg_name, **connection_args):
'''
Delete a new service group
CLI Example:
.. code-block:: bash
salt '*' netscaler.servicegroup_delete 'serviceGroupName'
'''
ret = True
sg = _servicegroup_get(sg_name, **connection_args)
if sg is None:
return False... | Delete a new service group
CLI Example:
.. code-block:: bash
salt '*' netscaler.servicegroup_delete 'serviceGroupName' | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netscaler.py#L245-L268 | [
"def _connect(**kwargs):\n '''\n Initialise netscaler connection\n '''\n connargs = dict()\n\n # Shamelessy ripped from the mysql module\n def __connarg(name, key=None, default=None):\n '''\n Add key to connargs, only if name exists in our kwargs or as\n netscaler.<name> in __... | # -*- coding: utf-8 -*-
'''
Module to provide Citrix Netscaler compatibility to Salt (compatible with netscaler 9.2+)
.. versionadded:: 2015.2.0
:depends:
- nsnitro Python module
.. note::
You can install nsnitro using:
.. code-block:: bash
pip install nsnitro
:configuration: This module accepts ... |
saltstack/salt | salt/modules/netscaler.py | servicegroup_server_exists | python | def servicegroup_server_exists(sg_name, s_name, s_port=None, **connection_args):
'''
Check if a server:port combination is a member of a servicegroup
CLI Example:
.. code-block:: bash
salt '*' netscaler.servicegroup_server_exists 'serviceGroupName' 'serverName' 'serverPort'
'''
return... | Check if a server:port combination is a member of a servicegroup
CLI Example:
.. code-block:: bash
salt '*' netscaler.servicegroup_server_exists 'serviceGroupName' 'serverName' 'serverPort' | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netscaler.py#L271-L281 | [
"def _servicegroup_get_server(sg_name, s_name, s_port=None, **connection_args):\n '''\n Returns a member of a service group or None\n '''\n ret = None\n servers = _servicegroup_get_servers(sg_name, **connection_args)\n if servers is None:\n return None\n for server in servers:\n i... | # -*- coding: utf-8 -*-
'''
Module to provide Citrix Netscaler compatibility to Salt (compatible with netscaler 9.2+)
.. versionadded:: 2015.2.0
:depends:
- nsnitro Python module
.. note::
You can install nsnitro using:
.. code-block:: bash
pip install nsnitro
:configuration: This module accepts ... |
saltstack/salt | salt/modules/netscaler.py | servicegroup_server_up | python | def servicegroup_server_up(sg_name, s_name, s_port, **connection_args):
'''
Check if a server:port combination is in state UP in a servicegroup
CLI Example:
.. code-block:: bash
salt '*' netscaler.servicegroup_server_up 'serviceGroupName' 'serverName' 'serverPort'
'''
server = _servic... | Check if a server:port combination is in state UP in a servicegroup
CLI Example:
.. code-block:: bash
salt '*' netscaler.servicegroup_server_up 'serviceGroupName' 'serverName' 'serverPort' | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netscaler.py#L284-L295 | [
"def _servicegroup_get_server(sg_name, s_name, s_port=None, **connection_args):\n '''\n Returns a member of a service group or None\n '''\n ret = None\n servers = _servicegroup_get_servers(sg_name, **connection_args)\n if servers is None:\n return None\n for server in servers:\n i... | # -*- coding: utf-8 -*-
'''
Module to provide Citrix Netscaler compatibility to Salt (compatible with netscaler 9.2+)
.. versionadded:: 2015.2.0
:depends:
- nsnitro Python module
.. note::
You can install nsnitro using:
.. code-block:: bash
pip install nsnitro
:configuration: This module accepts ... |
saltstack/salt | salt/modules/netscaler.py | servicegroup_server_enable | python | def servicegroup_server_enable(sg_name, s_name, s_port, **connection_args):
'''
Enable a server:port member of a servicegroup
CLI Example:
.. code-block:: bash
salt '*' netscaler.servicegroup_server_enable 'serviceGroupName' 'serverName' 'serverPort'
'''
ret = True
server = _servi... | Enable a server:port member of a servicegroup
CLI Example:
.. code-block:: bash
salt '*' netscaler.servicegroup_server_enable 'serviceGroupName' 'serverName' 'serverPort' | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netscaler.py#L298-L321 | [
"def _connect(**kwargs):\n '''\n Initialise netscaler connection\n '''\n connargs = dict()\n\n # Shamelessy ripped from the mysql module\n def __connarg(name, key=None, default=None):\n '''\n Add key to connargs, only if name exists in our kwargs or as\n netscaler.<name> in __... | # -*- coding: utf-8 -*-
'''
Module to provide Citrix Netscaler compatibility to Salt (compatible with netscaler 9.2+)
.. versionadded:: 2015.2.0
:depends:
- nsnitro Python module
.. note::
You can install nsnitro using:
.. code-block:: bash
pip install nsnitro
:configuration: This module accepts ... |
saltstack/salt | salt/modules/netscaler.py | servicegroup_server_add | python | def servicegroup_server_add(sg_name, s_name, s_port, **connection_args):
'''
Add a server:port member to a servicegroup
CLI Example:
.. code-block:: bash
salt '*' netscaler.servicegroup_server_add 'serviceGroupName' 'serverName' 'serverPort'
'''
# Nitro will throw an error if the serv... | Add a server:port member to a servicegroup
CLI Example:
.. code-block:: bash
salt '*' netscaler.servicegroup_server_add 'serviceGroupName' 'serverName' 'serverPort' | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netscaler.py#L350-L378 | [
"def _connect(**kwargs):\n '''\n Initialise netscaler connection\n '''\n connargs = dict()\n\n # Shamelessy ripped from the mysql module\n def __connarg(name, key=None, default=None):\n '''\n Add key to connargs, only if name exists in our kwargs or as\n netscaler.<name> in __... | # -*- coding: utf-8 -*-
'''
Module to provide Citrix Netscaler compatibility to Salt (compatible with netscaler 9.2+)
.. versionadded:: 2015.2.0
:depends:
- nsnitro Python module
.. note::
You can install nsnitro using:
.. code-block:: bash
pip install nsnitro
:configuration: This module accepts ... |
saltstack/salt | salt/modules/netscaler.py | _service_get | python | def _service_get(s_name, **connection_args):
'''
Returns a service ressource or None
'''
nitro = _connect(**connection_args)
if nitro is None:
return None
service = NSService()
service.set_name(s_name)
try:
service = NSService.get(nitro, service)
except NSNitroError a... | Returns a service ressource or None | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netscaler.py#L412-L427 | [
"def _connect(**kwargs):\n '''\n Initialise netscaler connection\n '''\n connargs = dict()\n\n # Shamelessy ripped from the mysql module\n def __connarg(name, key=None, default=None):\n '''\n Add key to connargs, only if name exists in our kwargs or as\n netscaler.<name> in __... | # -*- coding: utf-8 -*-
'''
Module to provide Citrix Netscaler compatibility to Salt (compatible with netscaler 9.2+)
.. versionadded:: 2015.2.0
:depends:
- nsnitro Python module
.. note::
You can install nsnitro using:
.. code-block:: bash
pip install nsnitro
:configuration: This module accepts ... |
saltstack/salt | salt/modules/netscaler.py | service_up | python | def service_up(s_name, **connection_args):
'''
Checks if a service is UP
CLI Example:
.. code-block:: bash
salt '*' netscaler.service_up 'serviceName'
'''
service = _service_get(s_name, **connection_args)
return service is not None and service.get_svrstate() == 'UP' | Checks if a service is UP
CLI Example:
.. code-block:: bash
salt '*' netscaler.service_up 'serviceName' | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netscaler.py#L443-L454 | [
"def _service_get(s_name, **connection_args):\n '''\n Returns a service ressource or None\n '''\n nitro = _connect(**connection_args)\n if nitro is None:\n return None\n service = NSService()\n service.set_name(s_name)\n try:\n service = NSService.get(nitro, service)\n excep... | # -*- coding: utf-8 -*-
'''
Module to provide Citrix Netscaler compatibility to Salt (compatible with netscaler 9.2+)
.. versionadded:: 2015.2.0
:depends:
- nsnitro Python module
.. note::
You can install nsnitro using:
.. code-block:: bash
pip install nsnitro
:configuration: This module accepts ... |
saltstack/salt | salt/modules/netscaler.py | service_enable | python | def service_enable(s_name, **connection_args):
'''
Enable a service
CLI Example:
.. code-block:: bash
salt '*' netscaler.service_enable 'serviceName'
'''
ret = True
service = _service_get(s_name, **connection_args)
if service is None:
return False
nitro = _connect... | Enable a service
CLI Example:
.. code-block:: bash
salt '*' netscaler.service_enable 'serviceName' | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netscaler.py#L457-L481 | [
"def _connect(**kwargs):\n '''\n Initialise netscaler connection\n '''\n connargs = dict()\n\n # Shamelessy ripped from the mysql module\n def __connarg(name, key=None, default=None):\n '''\n Add key to connargs, only if name exists in our kwargs or as\n netscaler.<name> in __... | # -*- coding: utf-8 -*-
'''
Module to provide Citrix Netscaler compatibility to Salt (compatible with netscaler 9.2+)
.. versionadded:: 2015.2.0
:depends:
- nsnitro Python module
.. note::
You can install nsnitro using:
.. code-block:: bash
pip install nsnitro
:configuration: This module accepts ... |
saltstack/salt | salt/modules/netscaler.py | service_disable | python | def service_disable(s_name, s_delay=None, **connection_args):
'''
Disable a service
CLI Example:
.. code-block:: bash
salt '*' netscaler.service_disable 'serviceName'
salt '*' netscaler.service_disable 'serviceName' 'delayInSeconds'
'''
ret = True
service = _service_get(s_... | Disable a service
CLI Example:
.. code-block:: bash
salt '*' netscaler.service_disable 'serviceName'
salt '*' netscaler.service_disable 'serviceName' 'delayInSeconds' | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netscaler.py#L484-L510 | [
"def _connect(**kwargs):\n '''\n Initialise netscaler connection\n '''\n connargs = dict()\n\n # Shamelessy ripped from the mysql module\n def __connarg(name, key=None, default=None):\n '''\n Add key to connargs, only if name exists in our kwargs or as\n netscaler.<name> in __... | # -*- coding: utf-8 -*-
'''
Module to provide Citrix Netscaler compatibility to Salt (compatible with netscaler 9.2+)
.. versionadded:: 2015.2.0
:depends:
- nsnitro Python module
.. note::
You can install nsnitro using:
.. code-block:: bash
pip install nsnitro
:configuration: This module accepts ... |
saltstack/salt | salt/modules/netscaler.py | server_exists | python | def server_exists(s_name, ip=None, s_state=None, **connection_args):
'''
Checks if a server exists
CLI Example:
.. code-block:: bash
salt '*' netscaler.server_exists 'serverName'
'''
server = _server_get(s_name, **connection_args)
if server is None:
return False
if ip ... | Checks if a server exists
CLI Example:
.. code-block:: bash
salt '*' netscaler.server_exists 'serverName' | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netscaler.py#L528-L545 | [
"def _server_get(s_name, **connection_args):\n nitro = _connect(**connection_args)\n if nitro is None:\n return None\n server = NSServer()\n server.set_name(s_name)\n try:\n server = NSServer.get(nitro, server)\n except NSNitroError as error:\n log.debug('netscaler module erro... | # -*- coding: utf-8 -*-
'''
Module to provide Citrix Netscaler compatibility to Salt (compatible with netscaler 9.2+)
.. versionadded:: 2015.2.0
:depends:
- nsnitro Python module
.. note::
You can install nsnitro using:
.. code-block:: bash
pip install nsnitro
:configuration: This module accepts ... |
saltstack/salt | salt/modules/netscaler.py | server_add | python | def server_add(s_name, s_ip, s_state=None, **connection_args):
'''
Add a server
Note: The default server state is ENABLED
CLI Example:
.. code-block:: bash
salt '*' netscaler.server_add 'serverName' 'serverIpAddress'
salt '*' netscaler.server_add 'serverName' 'serverIpAddress' 'se... | Add a server
Note: The default server state is ENABLED
CLI Example:
.. code-block:: bash
salt '*' netscaler.server_add 'serverName' 'serverIpAddress'
salt '*' netscaler.server_add 'serverName' 'serverIpAddress' 'serverState' | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netscaler.py#L548-L577 | [
"def _connect(**kwargs):\n '''\n Initialise netscaler connection\n '''\n connargs = dict()\n\n # Shamelessy ripped from the mysql module\n def __connarg(name, key=None, default=None):\n '''\n Add key to connargs, only if name exists in our kwargs or as\n netscaler.<name> in __... | # -*- coding: utf-8 -*-
'''
Module to provide Citrix Netscaler compatibility to Salt (compatible with netscaler 9.2+)
.. versionadded:: 2015.2.0
:depends:
- nsnitro Python module
.. note::
You can install nsnitro using:
.. code-block:: bash
pip install nsnitro
:configuration: This module accepts ... |
saltstack/salt | salt/modules/netscaler.py | server_delete | python | def server_delete(s_name, **connection_args):
'''
Delete a server
CLI Example:
.. code-block:: bash
salt '*' netscaler.server_delete 'serverName'
'''
ret = True
server = _server_get(s_name, **connection_args)
if server is None:
return False
nitro = _connect(**conne... | Delete a server
CLI Example:
.. code-block:: bash
salt '*' netscaler.server_delete 'serverName' | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netscaler.py#L580-L603 | [
"def _connect(**kwargs):\n '''\n Initialise netscaler connection\n '''\n connargs = dict()\n\n # Shamelessy ripped from the mysql module\n def __connarg(name, key=None, default=None):\n '''\n Add key to connargs, only if name exists in our kwargs or as\n netscaler.<name> in __... | # -*- coding: utf-8 -*-
'''
Module to provide Citrix Netscaler compatibility to Salt (compatible with netscaler 9.2+)
.. versionadded:: 2015.2.0
:depends:
- nsnitro Python module
.. note::
You can install nsnitro using:
.. code-block:: bash
pip install nsnitro
:configuration: This module accepts ... |
saltstack/salt | salt/modules/netscaler.py | server_update | python | def server_update(s_name, s_ip, **connection_args):
'''
Update a server's attributes
CLI Example:
.. code-block:: bash
salt '*' netscaler.server_update 'serverName' 'serverIP'
'''
altered = False
cur_server = _server_get(s_name, **connection_args)
if cur_server is None:
... | Update a server's attributes
CLI Example:
.. code-block:: bash
salt '*' netscaler.server_update 'serverName' 'serverIP' | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netscaler.py#L606-L639 | [
"def _connect(**kwargs):\n '''\n Initialise netscaler connection\n '''\n connargs = dict()\n\n # Shamelessy ripped from the mysql module\n def __connarg(name, key=None, default=None):\n '''\n Add key to connargs, only if name exists in our kwargs or as\n netscaler.<name> in __... | # -*- coding: utf-8 -*-
'''
Module to provide Citrix Netscaler compatibility to Salt (compatible with netscaler 9.2+)
.. versionadded:: 2015.2.0
:depends:
- nsnitro Python module
.. note::
You can install nsnitro using:
.. code-block:: bash
pip install nsnitro
:configuration: This module accepts ... |
saltstack/salt | salt/modules/netscaler.py | server_enabled | python | def server_enabled(s_name, **connection_args):
'''
Check if a server is enabled globally
CLI Example:
.. code-block:: bash
salt '*' netscaler.server_enabled 'serverName'
'''
server = _server_get(s_name, **connection_args)
return server is not None and server.get_state() == 'ENABLE... | Check if a server is enabled globally
CLI Example:
.. code-block:: bash
salt '*' netscaler.server_enabled 'serverName' | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netscaler.py#L642-L653 | [
"def _server_get(s_name, **connection_args):\n nitro = _connect(**connection_args)\n if nitro is None:\n return None\n server = NSServer()\n server.set_name(s_name)\n try:\n server = NSServer.get(nitro, server)\n except NSNitroError as error:\n log.debug('netscaler module erro... | # -*- coding: utf-8 -*-
'''
Module to provide Citrix Netscaler compatibility to Salt (compatible with netscaler 9.2+)
.. versionadded:: 2015.2.0
:depends:
- nsnitro Python module
.. note::
You can install nsnitro using:
.. code-block:: bash
pip install nsnitro
:configuration: This module accepts ... |
saltstack/salt | salt/modules/netscaler.py | server_enable | python | def server_enable(s_name, **connection_args):
'''
Enables a server globally
CLI Example:
.. code-block:: bash
salt '*' netscaler.server_enable 'serverName'
'''
ret = True
server = _server_get(s_name, **connection_args)
if server is None:
return False
if server.get_... | Enables a server globally
CLI Example:
.. code-block:: bash
salt '*' netscaler.server_enable 'serverName' | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netscaler.py#L656-L681 | [
"def _connect(**kwargs):\n '''\n Initialise netscaler connection\n '''\n connargs = dict()\n\n # Shamelessy ripped from the mysql module\n def __connarg(name, key=None, default=None):\n '''\n Add key to connargs, only if name exists in our kwargs or as\n netscaler.<name> in __... | # -*- coding: utf-8 -*-
'''
Module to provide Citrix Netscaler compatibility to Salt (compatible with netscaler 9.2+)
.. versionadded:: 2015.2.0
:depends:
- nsnitro Python module
.. note::
You can install nsnitro using:
.. code-block:: bash
pip install nsnitro
:configuration: This module accepts ... |
saltstack/salt | salt/modules/netscaler.py | vserver_exists | python | def vserver_exists(v_name, v_ip=None, v_port=None, v_type=None, **connection_args):
'''
Checks if a vserver exists
CLI Example:
.. code-block:: bash
salt '*' netscaler.vserver_exists 'vserverName'
'''
vserver = _vserver_get(v_name, **connection_args)
if vserver is None:
re... | Checks if a vserver exists
CLI Example:
.. code-block:: bash
salt '*' netscaler.vserver_exists 'vserverName' | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netscaler.py#L727-L746 | [
"def _vserver_get(v_name, **connection_args):\n nitro = _connect(**connection_args)\n vserver = NSLBVServer()\n vserver.set_name(v_name)\n if nitro is None:\n return None\n try:\n vserver = NSLBVServer.get(nitro, vserver)\n except NSNitroError as error:\n log.debug('netscaler ... | # -*- coding: utf-8 -*-
'''
Module to provide Citrix Netscaler compatibility to Salt (compatible with netscaler 9.2+)
.. versionadded:: 2015.2.0
:depends:
- nsnitro Python module
.. note::
You can install nsnitro using:
.. code-block:: bash
pip install nsnitro
:configuration: This module accepts ... |
saltstack/salt | salt/modules/netscaler.py | vserver_add | python | def vserver_add(v_name, v_ip, v_port, v_type, **connection_args):
'''
Add a new lb vserver
CLI Example:
.. code-block:: bash
salt '*' netscaler.vserver_add 'vserverName' 'vserverIP' 'vserverPort' 'vserverType'
salt '*' netscaler.vserver_add 'alex.patate.chaude.443' '1.2.3.4' '443' 'SS... | Add a new lb vserver
CLI Example:
.. code-block:: bash
salt '*' netscaler.vserver_add 'vserverName' 'vserverIP' 'vserverPort' 'vserverType'
salt '*' netscaler.vserver_add 'alex.patate.chaude.443' '1.2.3.4' '443' 'SSL' | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netscaler.py#L749-L777 | [
"def _connect(**kwargs):\n '''\n Initialise netscaler connection\n '''\n connargs = dict()\n\n # Shamelessy ripped from the mysql module\n def __connarg(name, key=None, default=None):\n '''\n Add key to connargs, only if name exists in our kwargs or as\n netscaler.<name> in __... | # -*- coding: utf-8 -*-
'''
Module to provide Citrix Netscaler compatibility to Salt (compatible with netscaler 9.2+)
.. versionadded:: 2015.2.0
:depends:
- nsnitro Python module
.. note::
You can install nsnitro using:
.. code-block:: bash
pip install nsnitro
:configuration: This module accepts ... |
saltstack/salt | salt/modules/netscaler.py | vserver_delete | python | def vserver_delete(v_name, **connection_args):
'''
Delete a lb vserver
CLI Example:
.. code-block:: bash
salt '*' netscaler.vserver_delete 'vserverName'
'''
ret = True
vserver = _vserver_get(v_name, **connection_args)
if vserver is None:
return False
nitro = _conne... | Delete a lb vserver
CLI Example:
.. code-block:: bash
salt '*' netscaler.vserver_delete 'vserverName' | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netscaler.py#L780-L803 | [
"def _connect(**kwargs):\n '''\n Initialise netscaler connection\n '''\n connargs = dict()\n\n # Shamelessy ripped from the mysql module\n def __connarg(name, key=None, default=None):\n '''\n Add key to connargs, only if name exists in our kwargs or as\n netscaler.<name> in __... | # -*- coding: utf-8 -*-
'''
Module to provide Citrix Netscaler compatibility to Salt (compatible with netscaler 9.2+)
.. versionadded:: 2015.2.0
:depends:
- nsnitro Python module
.. note::
You can install nsnitro using:
.. code-block:: bash
pip install nsnitro
:configuration: This module accepts ... |
saltstack/salt | salt/modules/netscaler.py | vserver_servicegroup_add | python | def vserver_servicegroup_add(v_name, sg_name, **connection_args):
'''
Bind a servicegroup to a vserver
CLI Example:
.. code-block:: bash
salt '*' netscaler.vserver_servicegroup_add 'vserverName' 'serviceGroupName'
'''
ret = True
if vserver_servicegroup_exists(v_name, sg_name, **co... | Bind a servicegroup to a vserver
CLI Example:
.. code-block:: bash
salt '*' netscaler.vserver_servicegroup_add 'vserverName' 'serviceGroupName' | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netscaler.py#L838-L863 | [
"def _connect(**kwargs):\n '''\n Initialise netscaler connection\n '''\n connargs = dict()\n\n # Shamelessy ripped from the mysql module\n def __connarg(name, key=None, default=None):\n '''\n Add key to connargs, only if name exists in our kwargs or as\n netscaler.<name> in __... | # -*- coding: utf-8 -*-
'''
Module to provide Citrix Netscaler compatibility to Salt (compatible with netscaler 9.2+)
.. versionadded:: 2015.2.0
:depends:
- nsnitro Python module
.. note::
You can install nsnitro using:
.. code-block:: bash
pip install nsnitro
:configuration: This module accepts ... |
saltstack/salt | salt/modules/netscaler.py | vserver_sslcert_add | python | def vserver_sslcert_add(v_name, sc_name, **connection_args):
'''
Binds a SSL certificate to a vserver
CLI Example:
.. code-block:: bash
salt '*' netscaler.vserver_sslcert_add 'vserverName' 'sslCertificateName'
'''
ret = True
if vserver_sslcert_exists(v_name, sc_name, **connection_... | Binds a SSL certificate to a vserver
CLI Example:
.. code-block:: bash
salt '*' netscaler.vserver_sslcert_add 'vserverName' 'sslCertificateName' | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netscaler.py#L925-L950 | [
"def _connect(**kwargs):\n '''\n Initialise netscaler connection\n '''\n connargs = dict()\n\n # Shamelessy ripped from the mysql module\n def __connarg(name, key=None, default=None):\n '''\n Add key to connargs, only if name exists in our kwargs or as\n netscaler.<name> in __... | # -*- coding: utf-8 -*-
'''
Module to provide Citrix Netscaler compatibility to Salt (compatible with netscaler 9.2+)
.. versionadded:: 2015.2.0
:depends:
- nsnitro Python module
.. note::
You can install nsnitro using:
.. code-block:: bash
pip install nsnitro
:configuration: This module accepts ... |
saltstack/salt | salt/modules/libcloud_dns.py | list_zones | python | def list_zones(profile):
'''
List zones for the given profile
:param profile: The profile key
:type profile: ``str``
CLI Example:
.. code-block:: bash
salt myminion libcloud_dns.list_zones profile1
'''
conn = _get_driver(profile=profile)
return [_simple_zone(zone) for zo... | List zones for the given profile
:param profile: The profile key
:type profile: ``str``
CLI Example:
.. code-block:: bash
salt myminion libcloud_dns.list_zones profile1 | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/libcloud_dns.py#L103-L117 | [
"def _get_driver(profile):\n config = __salt__['config.option']('libcloud_dns')[profile]\n cls = get_driver(config['driver'])\n args = config.copy()\n del args['driver']\n args['key'] = config.get('key')\n args['secret'] = config.get('secret', None)\n args['secure'] = config.get('secure', True)... | # -*- coding: utf-8 -*-
'''
Apache Libcloud DNS Management
==============================
Connection module for Apache Libcloud DNS management
.. versionadded:: 2016.11.0
:configuration:
This module uses a configuration profile for one or multiple DNS providers
.. code-block:: yaml
libcloud_dns:
... |
saltstack/salt | salt/modules/libcloud_dns.py | list_records | python | def list_records(zone_id, profile, type=None):
'''
List records for the given zone_id on the given profile
:param zone_id: Zone to export.
:type zone_id: ``str``
:param profile: The profile key
:type profile: ``str``
:param type: The record type, e.g. A, NS
:type type: ``str``
... | List records for the given zone_id on the given profile
:param zone_id: Zone to export.
:type zone_id: ``str``
:param profile: The profile key
:type profile: ``str``
:param type: The record type, e.g. A, NS
:type type: ``str``
CLI Example:
.. code-block:: bash
salt mymin... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/libcloud_dns.py#L120-L144 | [
"def _get_driver(profile):\n config = __salt__['config.option']('libcloud_dns')[profile]\n cls = get_driver(config['driver'])\n args = config.copy()\n del args['driver']\n args['key'] = config.get('key')\n args['secret'] = config.get('secret', None)\n args['secure'] = config.get('secure', True)... | # -*- coding: utf-8 -*-
'''
Apache Libcloud DNS Management
==============================
Connection module for Apache Libcloud DNS management
.. versionadded:: 2016.11.0
:configuration:
This module uses a configuration profile for one or multiple DNS providers
.. code-block:: yaml
libcloud_dns:
... |
saltstack/salt | salt/modules/libcloud_dns.py | get_zone | python | def get_zone(zone_id, profile):
'''
Get zone information for the given zone_id on the given profile
:param zone_id: Zone to export.
:type zone_id: ``str``
:param profile: The profile key
:type profile: ``str``
CLI Example:
.. code-block:: bash
salt myminion libcloud_dns.ge... | Get zone information for the given zone_id on the given profile
:param zone_id: Zone to export.
:type zone_id: ``str``
:param profile: The profile key
:type profile: ``str``
CLI Example:
.. code-block:: bash
salt myminion libcloud_dns.get_zone google.com profile1 | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/libcloud_dns.py#L147-L164 | [
"def _get_driver(profile):\n config = __salt__['config.option']('libcloud_dns')[profile]\n cls = get_driver(config['driver'])\n args = config.copy()\n del args['driver']\n args['key'] = config.get('key')\n args['secret'] = config.get('secret', None)\n args['secure'] = config.get('secure', True)... | # -*- coding: utf-8 -*-
'''
Apache Libcloud DNS Management
==============================
Connection module for Apache Libcloud DNS management
.. versionadded:: 2016.11.0
:configuration:
This module uses a configuration profile for one or multiple DNS providers
.. code-block:: yaml
libcloud_dns:
... |
saltstack/salt | salt/modules/libcloud_dns.py | get_record | python | def get_record(zone_id, record_id, profile):
'''
Get record information for the given zone_id on the given profile
:param zone_id: Zone to export.
:type zone_id: ``str``
:param record_id: Record to delete.
:type record_id: ``str``
:param profile: The profile key
:type profile: ``st... | Get record information for the given zone_id on the given profile
:param zone_id: Zone to export.
:type zone_id: ``str``
:param record_id: Record to delete.
:type record_id: ``str``
:param profile: The profile key
:type profile: ``str``
CLI Example:
.. code-block:: bash
... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/libcloud_dns.py#L167-L187 | [
"def _get_driver(profile):\n config = __salt__['config.option']('libcloud_dns')[profile]\n cls = get_driver(config['driver'])\n args = config.copy()\n del args['driver']\n args['key'] = config.get('key')\n args['secret'] = config.get('secret', None)\n args['secure'] = config.get('secure', True)... | # -*- coding: utf-8 -*-
'''
Apache Libcloud DNS Management
==============================
Connection module for Apache Libcloud DNS management
.. versionadded:: 2016.11.0
:configuration:
This module uses a configuration profile for one or multiple DNS providers
.. code-block:: yaml
libcloud_dns:
... |
saltstack/salt | salt/modules/libcloud_dns.py | create_zone | python | def create_zone(domain, profile, type='master', ttl=None):
'''
Create a new zone.
:param domain: Zone domain name (e.g. example.com)
:type domain: ``str``
:param profile: The profile key
:type profile: ``str``
:param type: Zone type (master / slave).
:type type: ``str``
:param ... | Create a new zone.
:param domain: Zone domain name (e.g. example.com)
:type domain: ``str``
:param profile: The profile key
:type profile: ``str``
:param type: Zone type (master / slave).
:type type: ``str``
:param ttl: TTL for new records. (optional)
:type ttl: ``int``
CLI E... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/libcloud_dns.py#L190-L214 | [
"def _get_driver(profile):\n config = __salt__['config.option']('libcloud_dns')[profile]\n cls = get_driver(config['driver'])\n args = config.copy()\n del args['driver']\n args['key'] = config.get('key')\n args['secret'] = config.get('secret', None)\n args['secure'] = config.get('secure', True)... | # -*- coding: utf-8 -*-
'''
Apache Libcloud DNS Management
==============================
Connection module for Apache Libcloud DNS management
.. versionadded:: 2016.11.0
:configuration:
This module uses a configuration profile for one or multiple DNS providers
.. code-block:: yaml
libcloud_dns:
... |
saltstack/salt | salt/modules/libcloud_dns.py | update_zone | python | def update_zone(zone_id, domain, profile, type='master', ttl=None):
'''
Update an existing zone.
:param zone_id: Zone ID to update.
:type zone_id: ``str``
:param domain: Zone domain name (e.g. example.com)
:type domain: ``str``
:param profile: The profile key
:type profile: ``str``... | Update an existing zone.
:param zone_id: Zone ID to update.
:type zone_id: ``str``
:param domain: Zone domain name (e.g. example.com)
:type domain: ``str``
:param profile: The profile key
:type profile: ``str``
:param type: Zone type (master / slave).
:type type: ``str``
:pa... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/libcloud_dns.py#L217-L244 | [
"def _get_driver(profile):\n config = __salt__['config.option']('libcloud_dns')[profile]\n cls = get_driver(config['driver'])\n args = config.copy()\n del args['driver']\n args['key'] = config.get('key')\n args['secret'] = config.get('secret', None)\n args['secure'] = config.get('secure', True)... | # -*- coding: utf-8 -*-
'''
Apache Libcloud DNS Management
==============================
Connection module for Apache Libcloud DNS management
.. versionadded:: 2016.11.0
:configuration:
This module uses a configuration profile for one or multiple DNS providers
.. code-block:: yaml
libcloud_dns:
... |
saltstack/salt | salt/modules/libcloud_dns.py | create_record | python | def create_record(name, zone_id, type, data, profile):
'''
Create a new record.
:param name: Record name without the domain name (e.g. www).
Note: If you want to create a record for a base domain
name, you should specify empty string ('') for this
argument... | Create a new record.
:param name: Record name without the domain name (e.g. www).
Note: If you want to create a record for a base domain
name, you should specify empty string ('') for this
argument.
:type name: ``str``
:param zone_id: Zone where the requ... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/libcloud_dns.py#L247-L278 | [
"def _get_driver(profile):\n config = __salt__['config.option']('libcloud_dns')[profile]\n cls = get_driver(config['driver'])\n args = config.copy()\n del args['driver']\n args['key'] = config.get('key')\n args['secret'] = config.get('secret', None)\n args['secure'] = config.get('secure', True)... | # -*- coding: utf-8 -*-
'''
Apache Libcloud DNS Management
==============================
Connection module for Apache Libcloud DNS management
.. versionadded:: 2016.11.0
:configuration:
This module uses a configuration profile for one or multiple DNS providers
.. code-block:: yaml
libcloud_dns:
... |
saltstack/salt | salt/modules/libcloud_dns.py | delete_zone | python | def delete_zone(zone_id, profile):
'''
Delete a zone.
:param zone_id: Zone to delete.
:type zone_id: ``str``
:param profile: The profile key
:type profile: ``str``
:rtype: ``bool``
CLI Example:
.. code-block:: bash
salt myminion libcloud_dns.delete_zone google.com pro... | Delete a zone.
:param zone_id: Zone to delete.
:type zone_id: ``str``
:param profile: The profile key
:type profile: ``str``
:rtype: ``bool``
CLI Example:
.. code-block:: bash
salt myminion libcloud_dns.delete_zone google.com profile1 | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/libcloud_dns.py#L281-L301 | [
"def _get_driver(profile):\n config = __salt__['config.option']('libcloud_dns')[profile]\n cls = get_driver(config['driver'])\n args = config.copy()\n del args['driver']\n args['key'] = config.get('key')\n args['secret'] = config.get('secret', None)\n args['secure'] = config.get('secure', True)... | # -*- coding: utf-8 -*-
'''
Apache Libcloud DNS Management
==============================
Connection module for Apache Libcloud DNS management
.. versionadded:: 2016.11.0
:configuration:
This module uses a configuration profile for one or multiple DNS providers
.. code-block:: yaml
libcloud_dns:
... |
saltstack/salt | salt/modules/libcloud_dns.py | delete_record | python | def delete_record(zone_id, record_id, profile):
'''
Delete a record.
:param zone_id: Zone to delete.
:type zone_id: ``str``
:param record_id: Record to delete.
:type record_id: ``str``
:param profile: The profile key
:type profile: ``str``
:rtype: ``bool``
CLI Example:
... | Delete a record.
:param zone_id: Zone to delete.
:type zone_id: ``str``
:param record_id: Record to delete.
:type record_id: ``str``
:param profile: The profile key
:type profile: ``str``
:rtype: ``bool``
CLI Example:
.. code-block:: bash
salt myminion libcloud_dns.... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/libcloud_dns.py#L304-L327 | [
"def _get_driver(profile):\n config = __salt__['config.option']('libcloud_dns')[profile]\n cls = get_driver(config['driver'])\n args = config.copy()\n del args['driver']\n args['key'] = config.get('key')\n args['secret'] = config.get('secret', None)\n args['secure'] = config.get('secure', True)... | # -*- coding: utf-8 -*-
'''
Apache Libcloud DNS Management
==============================
Connection module for Apache Libcloud DNS management
.. versionadded:: 2016.11.0
:configuration:
This module uses a configuration profile for one or multiple DNS providers
.. code-block:: yaml
libcloud_dns:
... |
saltstack/salt | salt/modules/libcloud_dns.py | get_bind_data | python | def get_bind_data(zone_id, profile):
'''
Export Zone to the BIND compatible format.
:param zone_id: Zone to export.
:type zone_id: ``str``
:param profile: The profile key
:type profile: ``str``
:return: Zone data in BIND compatible format.
:rtype: ``str``
CLI Example:
.. c... | Export Zone to the BIND compatible format.
:param zone_id: Zone to export.
:type zone_id: ``str``
:param profile: The profile key
:type profile: ``str``
:return: Zone data in BIND compatible format.
:rtype: ``str``
CLI Example:
.. code-block:: bash
salt myminion libcloud_... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/libcloud_dns.py#L330-L351 | [
"def _get_driver(profile):\n config = __salt__['config.option']('libcloud_dns')[profile]\n cls = get_driver(config['driver'])\n args = config.copy()\n del args['driver']\n args['key'] = config.get('key')\n args['secret'] = config.get('secret', None)\n args['secure'] = config.get('secure', True)... | # -*- coding: utf-8 -*-
'''
Apache Libcloud DNS Management
==============================
Connection module for Apache Libcloud DNS management
.. versionadded:: 2016.11.0
:configuration:
This module uses a configuration profile for one or multiple DNS providers
.. code-block:: yaml
libcloud_dns:
... |
saltstack/salt | salt/modules/libcloud_dns.py | extra | python | def extra(method, profile, **libcloud_kwargs):
'''
Call an extended method on the driver
:param method: Driver's method name
:type method: ``str``
:param profile: The profile key
:type profile: ``str``
:param libcloud_kwargs: Extra arguments for the driver's delete_container method
... | Call an extended method on the driver
:param method: Driver's method name
:type method: ``str``
:param profile: The profile key
:type profile: ``str``
:param libcloud_kwargs: Extra arguments for the driver's delete_container method
:type libcloud_kwargs: ``dict``
CLI Example:
.. ... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/libcloud_dns.py#L354-L376 | [
"def _get_driver(profile):\n config = __salt__['config.option']('libcloud_dns')[profile]\n cls = get_driver(config['driver'])\n args = config.copy()\n del args['driver']\n args['key'] = config.get('key')\n args['secret'] = config.get('secret', None)\n args['secure'] = config.get('secure', True)... | # -*- coding: utf-8 -*-
'''
Apache Libcloud DNS Management
==============================
Connection module for Apache Libcloud DNS management
.. versionadded:: 2016.11.0
:configuration:
This module uses a configuration profile for one or multiple DNS providers
.. code-block:: yaml
libcloud_dns:
... |
saltstack/salt | salt/modules/libcloud_dns.py | _string_to_record_type | python | def _string_to_record_type(string):
'''
Return a string representation of a DNS record type to a
libcloud RecordType ENUM.
:param string: A record type, e.g. A, TXT, NS
:type string: ``str``
:rtype: :class:`RecordType`
'''
string = string.upper()
record_type = getattr(RecordType, ... | Return a string representation of a DNS record type to a
libcloud RecordType ENUM.
:param string: A record type, e.g. A, TXT, NS
:type string: ``str``
:rtype: :class:`RecordType` | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/libcloud_dns.py#L379-L391 | null | # -*- coding: utf-8 -*-
'''
Apache Libcloud DNS Management
==============================
Connection module for Apache Libcloud DNS management
.. versionadded:: 2016.11.0
:configuration:
This module uses a configuration profile for one or multiple DNS providers
.. code-block:: yaml
libcloud_dns:
... |
saltstack/salt | salt/modules/ifttt.py | _query | python | def _query(event=None,
method='GET',
args=None,
header_dict=None,
data=None):
'''
Make a web call to IFTTT.
'''
secret_key = __salt__['config.get']('ifttt.secret_key') or \
__salt__['config.get']('ifttt:secret_key')
path = 'https://maker.ifttt.com/... | Make a web call to IFTTT. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ifttt.py#L37-L70 | null | # -*- coding: utf-8 -*-
'''
Support for IFTTT
.. versionadded:: 2015.8.0
Requires an ``api_key`` in ``/etc/salt/minion``:
.. code-block: yaml
ifttt:
secret_key: '280d4699-a817-4719-ba6f-ca56e573e44f'
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import ... |
saltstack/salt | salt/modules/ifttt.py | trigger_event | python | def trigger_event(event=None, **kwargs):
'''
Trigger a configured event in IFTTT.
:param event: The name of the event to trigger.
:return: A dictionary with status, text, and error if result was failure.
'''
res = {'result': False, 'message': 'Something went wrong'}
data = {}
... | Trigger a configured event in IFTTT.
:param event: The name of the event to trigger.
:return: A dictionary with status, text, and error if result was failure. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ifttt.py#L73-L101 | [
"def dumps(obj, **kwargs):\n '''\n .. versionadded:: 2018.3.0\n\n Wraps json.dumps, and assumes that ensure_ascii is False (unless explicitly\n passed as True) for unicode compatibility. Note that setting it to True\n will mess up any unicode characters, as they will be dumped as the string\n lite... | # -*- coding: utf-8 -*-
'''
Support for IFTTT
.. versionadded:: 2015.8.0
Requires an ``api_key`` in ``/etc/salt/minion``:
.. code-block: yaml
ifttt:
secret_key: '280d4699-a817-4719-ba6f-ca56e573e44f'
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import ... |
saltstack/salt | salt/proxy/napalm.py | init | python | def init(opts):
'''
Opens the connection with the network device.
'''
NETWORK_DEVICE.update(salt.utils.napalm.get_device(opts))
DETAILS['initialized'] = True
return True | Opens the connection with the network device. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/napalm.py#L202-L208 | [
"def get_device(opts, salt_obj=None):\n '''\n Initialise the connection with the network device through NAPALM.\n :param: opts\n :return: the network device object\n '''\n log.debug('Setting up NAPALM connection')\n network_device = get_device_opts(opts, salt_obj=salt_obj)\n provider_lib = n... | # -*- coding: utf-8 -*-
'''
NAPALM: Network Automation and Programmability Abstraction Layer with Multivendor support
=========================================================================================
.. versionadded:: 2016.11.0
Proxy minion for managing network devices via NAPALM_ library.
:codeauthor: Mirce... |
saltstack/salt | salt/proxy/napalm.py | alive | python | def alive(opts):
'''
Return the connection status with the remote device.
.. versionadded:: 2017.7.0
'''
if salt.utils.napalm.not_always_alive(opts):
return True # don't force reconnection for not-always alive proxies
# or regular minion
is_alive_ret = call('is_alive', **{})
... | Return the connection status with the remote device.
.. versionadded:: 2017.7.0 | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/napalm.py#L211-L234 | [
"def not_always_alive(opts):\n '''\n Should this proxy be always alive?\n '''\n return (is_proxy(opts) and not is_always_alive(opts)) or is_minion(opts)\n"
] | # -*- coding: utf-8 -*-
'''
NAPALM: Network Automation and Programmability Abstraction Layer with Multivendor support
=========================================================================================
.. versionadded:: 2016.11.0
Proxy minion for managing network devices via NAPALM_ library.
:codeauthor: Mirce... |
saltstack/salt | salt/proxy/napalm.py | shutdown | python | def shutdown(opts):
'''
Closes connection with the device.
'''
try:
if not NETWORK_DEVICE.get('UP', False):
raise Exception('not connected!')
NETWORK_DEVICE.get('DRIVER').close()
except Exception as error:
port = NETWORK_DEVICE.get('OPTIONAL_ARGS', {}).get('port')... | Closes connection with the device. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/napalm.py#L282-L299 | null | # -*- coding: utf-8 -*-
'''
NAPALM: Network Automation and Programmability Abstraction Layer with Multivendor support
=========================================================================================
.. versionadded:: 2016.11.0
Proxy minion for managing network devices via NAPALM_ library.
:codeauthor: Mirce... |
saltstack/salt | salt/proxy/napalm.py | call | python | def call(method, *args, **kwargs):
'''
Calls a specific method from the network driver instance.
Please check the readthedocs_ page for the updated list of getters.
.. _readthedocs: http://napalm.readthedocs.org/en/latest/support/index.html#getters-support-matrix
:param method: specifies the name ... | Calls a specific method from the network driver instance.
Please check the readthedocs_ page for the updated list of getters.
.. _readthedocs: http://napalm.readthedocs.org/en/latest/support/index.html#getters-support-matrix
:param method: specifies the name of the method to be called
:param params: c... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/napalm.py#L306-L346 | [
"def iteritems(d, **kw):\n return d.iteritems(**kw)\n",
"def call(napalm_device, method, *args, **kwargs):\n '''\n Calls arbitrary methods from the network driver instance.\n Please check the readthedocs_ page for the updated list of getters.\n\n .. _readthedocs: http://napalm.readthedocs.org/en/la... | # -*- coding: utf-8 -*-
'''
NAPALM: Network Automation and Programmability Abstraction Layer with Multivendor support
=========================================================================================
.. versionadded:: 2016.11.0
Proxy minion for managing network devices via NAPALM_ library.
:codeauthor: Mirce... |
saltstack/salt | salt/modules/win_license.py | info | python | def info():
'''
Return information about the license, if the license is not
correctly activated this will return None.
CLI Example:
.. code-block:: bash
salt '*' license.info
'''
cmd = r'cscript C:\Windows\System32\slmgr.vbs /dli'
out = __salt__['cmd.run'](cmd)
match = re... | Return information about the license, if the license is not
correctly activated this will return None.
CLI Example:
.. code-block:: bash
salt '*' license.info | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_license.py#L106-L132 | null | # -*- coding: utf-8 -*-
'''
This module allows you to manage windows licensing via slmgr.vbs
.. code-block:: bash
salt '*' license.install XXXXX-XXXXX-XXXXX-XXXXX-XXXXX
'''
# Import Python Libs
from __future__ import absolute_import, unicode_literals, print_function
import re
import logging
# Import Salt Libs
i... |
saltstack/salt | salt/states/boto_apigateway.py | present | python | def present(name, api_name, swagger_file, stage_name, api_key_required,
lambda_integration_role, lambda_region=None, stage_variables=None,
region=None, key=None, keyid=None, profile=None,
lambda_funcname_format='{stage}_{api}_{resource}_{method}',
authorization_type='NONE... | Ensure the spcified api_name with the corresponding swaggerfile is deployed to the
given stage_name in AWS ApiGateway.
this state currently only supports ApiGateway integration with AWS Lambda, and CORS support is
handled through a Mock integration.
There may be multiple deployments for the API object... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_apigateway.py#L79-L339 | [
"def _get_stage_variables(stage_variables):\n '''\n Helper function to retrieve stage variables from pillars/options, if the\n input is a string\n '''\n ret = dict()\n if stage_variables is None:\n return ret\n\n if isinstance(stage_variables, six.string_types):\n if stage_variabl... | # -*- coding: utf-8 -*-
'''
Manage Apigateway Rest APIs
===========================
.. versionadded:: 2016.11.0
:depends:
- boto >= 2.8.0
- boto3 >= 1.2.1
- botocore >= 1.4.49
Create and destroy rest apis depending on a swagger version 2 definition file.
Be aware that this interacts with Amazon's services, and... |
saltstack/salt | salt/states/boto_apigateway.py | _get_stage_variables | python | def _get_stage_variables(stage_variables):
'''
Helper function to retrieve stage variables from pillars/options, if the
input is a string
'''
ret = dict()
if stage_variables is None:
return ret
if isinstance(stage_variables, six.string_types):
if stage_variables in __opts__:... | Helper function to retrieve stage variables from pillars/options, if the
input is a string | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_apigateway.py#L342-L365 | null | # -*- coding: utf-8 -*-
'''
Manage Apigateway Rest APIs
===========================
.. versionadded:: 2016.11.0
:depends:
- boto >= 2.8.0
- boto3 >= 1.2.1
- botocore >= 1.4.49
Create and destroy rest apis depending on a swagger version 2 definition file.
Be aware that this interacts with Amazon's services, and... |
saltstack/salt | salt/states/boto_apigateway.py | absent | python | def absent(name, api_name, stage_name, nuke_api=False, region=None, key=None, keyid=None, profile=None):
'''
Ensure the stage_name associated with the given api_name deployed by boto_apigateway's
present state is removed. If the currently associated deployment to the given stage_name has
no other stage... | Ensure the stage_name associated with the given api_name deployed by boto_apigateway's
present state is removed. If the currently associated deployment to the given stage_name has
no other stages associated with it, the deployment will also be removed.
name
Name of the swagger file in YAML format
... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_apigateway.py#L368-L443 | [
"def no_more_deployments_remain(self):\n '''\n Helper function to find whether there are deployments left with stages associated\n '''\n no_more_deployments = True\n deployments = __salt__['boto_apigateway.describe_api_deployments'](restApiId=self.restApiId,\n ... | # -*- coding: utf-8 -*-
'''
Manage Apigateway Rest APIs
===========================
.. versionadded:: 2016.11.0
:depends:
- boto >= 2.8.0
- boto3 >= 1.2.1
- botocore >= 1.4.49
Create and destroy rest apis depending on a swagger version 2 definition file.
Be aware that this interacts with Amazon's services, and... |
saltstack/salt | salt/states/boto_apigateway.py | _gen_md5_filehash | python | def _gen_md5_filehash(fname, *args):
'''
helper function to generate a md5 hash of the swagger definition file
any extra argument passed to the function is converted to a string
and participates in the hash calculation
'''
_hash = hashlib.md5()
with salt.utils.files.fopen(fname, 'rb') as f:
... | helper function to generate a md5 hash of the swagger definition file
any extra argument passed to the function is converted to a string
and participates in the hash calculation | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_apigateway.py#L447-L460 | null | # -*- coding: utf-8 -*-
'''
Manage Apigateway Rest APIs
===========================
.. versionadded:: 2016.11.0
:depends:
- boto >= 2.8.0
- boto3 >= 1.2.1
- botocore >= 1.4.49
Create and destroy rest apis depending on a swagger version 2 definition file.
Be aware that this interacts with Amazon's services, and... |
saltstack/salt | salt/states/boto_apigateway.py | _dict_to_json_pretty | python | def _dict_to_json_pretty(d, sort_keys=True):
'''
helper function to generate pretty printed json output
'''
return salt.utils.json.dumps(d, indent=4, separators=(',', ': '), sort_keys=sort_keys) | helper function to generate pretty printed json output | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_apigateway.py#L463-L467 | [
"def dumps(obj, **kwargs):\n '''\n .. versionadded:: 2018.3.0\n\n Wraps json.dumps, and assumes that ensure_ascii is False (unless explicitly\n passed as True) for unicode compatibility. Note that setting it to True\n will mess up any unicode characters, as they will be dumped as the string\n lite... | # -*- coding: utf-8 -*-
'''
Manage Apigateway Rest APIs
===========================
.. versionadded:: 2016.11.0
:depends:
- boto >= 2.8.0
- boto3 >= 1.2.1
- botocore >= 1.4.49
Create and destroy rest apis depending on a swagger version 2 definition file.
Be aware that this interacts with Amazon's services, and... |
saltstack/salt | salt/states/boto_apigateway.py | _name_matches | python | def _name_matches(name, matches):
'''
Helper function to see if given name has any of the patterns in given matches
'''
for m in matches:
if name.endswith(m):
return True
if name.lower().endswith('_' + m.lower()):
return True
if name.lower() == m.lower():
... | Helper function to see if given name has any of the patterns in given matches | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_apigateway.py#L472-L483 | null | # -*- coding: utf-8 -*-
'''
Manage Apigateway Rest APIs
===========================
.. versionadded:: 2016.11.0
:depends:
- boto >= 2.8.0
- boto3 >= 1.2.1
- botocore >= 1.4.49
Create and destroy rest apis depending on a swagger version 2 definition file.
Be aware that this interacts with Amazon's services, and... |
saltstack/salt | salt/states/boto_apigateway.py | _object_reducer | python | def _object_reducer(o, names=('id', 'name', 'path', 'httpMethod',
'statusCode', 'Created', 'Deleted',
'Updated', 'Flushed', 'Associated', 'Disassociated')):
'''
Helper function to reduce the amount of information that will be kept in the change log
... | Helper function to reduce the amount of information that will be kept in the change log
for API GW related return values | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_apigateway.py#L486-L511 | null | # -*- coding: utf-8 -*-
'''
Manage Apigateway Rest APIs
===========================
.. versionadded:: 2016.11.0
:depends:
- boto >= 2.8.0
- boto3 >= 1.2.1
- botocore >= 1.4.49
Create and destroy rest apis depending on a swagger version 2 definition file.
Be aware that this interacts with Amazon's services, and... |
saltstack/salt | salt/states/boto_apigateway.py | _log_changes | python | def _log_changes(ret, changekey, changevalue):
'''
For logging create/update/delete operations to AWS ApiGateway
'''
cl = ret['changes'].get('new', [])
cl.append({changekey: _object_reducer(changevalue)})
ret['changes']['new'] = cl
return ret | For logging create/update/delete operations to AWS ApiGateway | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_apigateway.py#L514-L521 | [
"def _object_reducer(o, names=('id', 'name', 'path', 'httpMethod',\n 'statusCode', 'Created', 'Deleted',\n 'Updated', 'Flushed', 'Associated', 'Disassociated')):\n '''\n Helper function to reduce the amount of information that will be kept in the chang... | # -*- coding: utf-8 -*-
'''
Manage Apigateway Rest APIs
===========================
.. versionadded:: 2016.11.0
:depends:
- boto >= 2.8.0
- boto3 >= 1.2.1
- botocore >= 1.4.49
Create and destroy rest apis depending on a swagger version 2 definition file.
Be aware that this interacts with Amazon's services, and... |
saltstack/salt | salt/states/boto_apigateway.py | _log_error_and_abort | python | def _log_error_and_abort(ret, obj):
'''
helper function to update errors in the return structure
'''
ret['result'] = False
ret['abort'] = True
if 'error' in obj:
ret['comment'] = '{0}'.format(obj.get('error'))
return ret | helper function to update errors in the return structure | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_apigateway.py#L524-L532 | null | # -*- coding: utf-8 -*-
'''
Manage Apigateway Rest APIs
===========================
.. versionadded:: 2016.11.0
:depends:
- boto >= 2.8.0
- boto3 >= 1.2.1
- botocore >= 1.4.49
Create and destroy rest apis depending on a swagger version 2 definition file.
Be aware that this interacts with Amazon's services, and... |
saltstack/salt | salt/states/boto_apigateway.py | usage_plan_present | python | def usage_plan_present(name, plan_name, description=None, throttle=None, quota=None, region=None, key=None, keyid=None,
profile=None):
'''
Ensure the spcifieda usage plan with the corresponding metrics is deployed
.. versionadded:: 2017.7.0
name
name of the state
pl... | Ensure the spcifieda usage plan with the corresponding metrics is deployed
.. versionadded:: 2017.7.0
name
name of the state
plan_name
[Required] name of the usage plan
throttle
[Optional] throttling parameters expressed as a dictionary.
If provided, at least one of t... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_apigateway.py#L1688-L1826 | null | # -*- coding: utf-8 -*-
'''
Manage Apigateway Rest APIs
===========================
.. versionadded:: 2016.11.0
:depends:
- boto >= 2.8.0
- boto3 >= 1.2.1
- botocore >= 1.4.49
Create and destroy rest apis depending on a swagger version 2 definition file.
Be aware that this interacts with Amazon's services, and... |
saltstack/salt | salt/states/boto_apigateway.py | usage_plan_absent | python | def usage_plan_absent(name, plan_name, region=None, key=None, keyid=None, profile=None):
'''
Ensures usage plan identified by name is no longer present
.. versionadded:: 2017.7.0
name
name of the state
plan_name
name of the plan to remove
.. code-block:: yaml
usage p... | Ensures usage plan identified by name is no longer present
.. versionadded:: 2017.7.0
name
name of the state
plan_name
name of the plan to remove
.. code-block:: yaml
usage plan absent:
boto_apigateway.usage_plan_absent:
- plan_name: my_usage_plan
... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_apigateway.py#L1829-L1892 | null | # -*- coding: utf-8 -*-
'''
Manage Apigateway Rest APIs
===========================
.. versionadded:: 2016.11.0
:depends:
- boto >= 2.8.0
- boto3 >= 1.2.1
- botocore >= 1.4.49
Create and destroy rest apis depending on a swagger version 2 definition file.
Be aware that this interacts with Amazon's services, and... |
saltstack/salt | salt/states/boto_apigateway.py | usage_plan_association_present | python | def usage_plan_association_present(name, plan_name, api_stages, region=None, key=None, keyid=None, profile=None):
'''
Ensures usage plan identified by name is added to provided api_stages
.. versionadded:: 2017.7.0
name
name of the state
plan_name
name of the plan to use
api_... | Ensures usage plan identified by name is added to provided api_stages
.. versionadded:: 2017.7.0
name
name of the state
plan_name
name of the plan to use
api_stages
list of dictionaries, where each dictionary consists of the following keys:
apiId
apiId of... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_apigateway.py#L1895-L1985 | null | # -*- coding: utf-8 -*-
'''
Manage Apigateway Rest APIs
===========================
.. versionadded:: 2016.11.0
:depends:
- boto >= 2.8.0
- boto3 >= 1.2.1
- botocore >= 1.4.49
Create and destroy rest apis depending on a swagger version 2 definition file.
Be aware that this interacts with Amazon's services, and... |
saltstack/salt | salt/states/boto_apigateway.py | _Swagger._validate_error_response_model | python | def _validate_error_response_model(self, paths, mods):
'''
Helper function to help validate the convention established in the swagger file on how
to handle response code mapping/integration
'''
for path, ops in paths:
for opname, opobj in six.iteritems(ops):
... | Helper function to help validate the convention established in the swagger file on how
to handle response code mapping/integration | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_apigateway.py#L754-L796 | null | class _Swagger(object):
'''
this is a helper class that holds the swagger definition file and the associated logic
related to how to interpret the file and apply it to AWS Api Gateway.
The main interface to the outside world is in deploy_api, deploy_models, and deploy_resources
methods.
'''
... |
saltstack/salt | salt/states/boto_apigateway.py | _Swagger._validate_lambda_funcname_format | python | def _validate_lambda_funcname_format(self):
'''
Checks if the lambda function name format contains only known elements
:return: True on success, ValueError raised on error
'''
try:
if self._lambda_funcname_format:
known_kwargs = dict(stage='',
... | Checks if the lambda function name format contains only known elements
:return: True on success, ValueError raised on error | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_apigateway.py#L798-L813 | null | class _Swagger(object):
'''
this is a helper class that holds the swagger definition file and the associated logic
related to how to interpret the file and apply it to AWS Api Gateway.
The main interface to the outside world is in deploy_api, deploy_models, and deploy_resources
methods.
'''
... |
saltstack/salt | salt/states/boto_apigateway.py | _Swagger._validate_swagger_file | python | def _validate_swagger_file(self):
'''
High level check/validation of the input swagger file based on
https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md
This is not a full schema compliance check, but rather make sure that the input file (YAML or
JSON) can be... | High level check/validation of the input swagger file based on
https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md
This is not a full schema compliance check, but rather make sure that the input file (YAML or
JSON) can be read into a dictionary, and we check for the content ... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_apigateway.py#L815-L844 | null | class _Swagger(object):
'''
this is a helper class that holds the swagger definition file and the associated logic
related to how to interpret the file and apply it to AWS Api Gateway.
The main interface to the outside world is in deploy_api, deploy_models, and deploy_resources
methods.
'''
... |
saltstack/salt | salt/states/boto_apigateway.py | _Swagger.models | python | def models(self):
'''
generator to return the tuple of model and its schema to create on aws.
'''
model_dict = self._build_all_dependencies()
while True:
model = self._get_model_without_dependencies(model_dict)
if not model:
break
... | generator to return the tuple of model and its schema to create on aws. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_apigateway.py#L898-L907 | [
"def _models(self):\n '''\n returns an iterator for the models specified in the swagger file\n '''\n models = self._cfg.get('definitions')\n if not models:\n raise ValueError('Definitions Object has no values, You need to define them in your swagger file')\n\n return models\n",
"def _buil... | class _Swagger(object):
'''
this is a helper class that holds the swagger definition file and the associated logic
related to how to interpret the file and apply it to AWS Api Gateway.
The main interface to the outside world is in deploy_api, deploy_models, and deploy_resources
methods.
'''
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.