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/cassandra_cql.py
list_users
python
def list_users(contact_points=None, port=None, cql_user=None, cql_pass=None): ''' List existing users in this Cassandra cluster. :param contact_points: The Cassandra cluster addresses, can either be a string or a list of IPs. :type contact_points: str | list[str] :param port: The Cassand...
List existing users in this Cassandra cluster. :param contact_points: The Cassandra cluster addresses, can either be a string or a list of IPs. :type contact_points: str | list[str] :param port: The Cassandra cluster port, defaults to None. :type port: int :param cql_user: ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cassandra_cql.py#L797-L833
[ "def cql_query(query, contact_points=None, port=None, cql_user=None, cql_pass=None):\n '''\n Run a query on a Cassandra cluster and return a dictionary.\n\n :param query: The query to execute.\n :type query: str\n :param contact_points: The Cassandra cluster addresses, can either b...
# -*- coding: utf-8 -*- ''' Cassandra Database Module .. versionadded:: 2015.5.0 This module works with Cassandra v2 and v3 and hence generates queries based on the internal schema of said version. :depends: DataStax Python Driver for Apache Cassandra https://github.com/datastax/python-driver pip...
saltstack/salt
salt/modules/cassandra_cql.py
create_user
python
def create_user(username, password, superuser=False, contact_points=None, port=None, cql_user=None, cql_pass=None): ''' Create a new cassandra user with credentials and superuser status. :param username: The name of the new user. :type username: str :param password: The password ...
Create a new cassandra user with credentials and superuser status. :param username: The name of the new user. :type username: str :param password: The password of the new user. :type password: str :param superuser: Is the new user going to be a superuser? default: Fal...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cassandra_cql.py#L836-L882
[ "def cql_query(query, contact_points=None, port=None, cql_user=None, cql_pass=None):\n '''\n Run a query on a Cassandra cluster and return a dictionary.\n\n :param query: The query to execute.\n :type query: str\n :param contact_points: The Cassandra cluster addresses, can either b...
# -*- coding: utf-8 -*- ''' Cassandra Database Module .. versionadded:: 2015.5.0 This module works with Cassandra v2 and v3 and hence generates queries based on the internal schema of said version. :depends: DataStax Python Driver for Apache Cassandra https://github.com/datastax/python-driver pip...
saltstack/salt
salt/modules/cassandra_cql.py
list_permissions
python
def list_permissions(username=None, resource=None, resource_type='keyspace', permission=None, contact_points=None, port=None, cql_user=None, cql_pass=None): ''' List permissions. :param username: The name of the user to list permissions for. :type username: str :pa...
List permissions. :param username: The name of the user to list permissions for. :type username: str :param resource: The resource (keyspace or table), if None, permissions for all resources are listed. :type resource: str :param resource_type: The resource_type (keyspace...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cassandra_cql.py#L939-L994
[ "def cql_query(query, contact_points=None, port=None, cql_user=None, cql_pass=None):\n '''\n Run a query on a Cassandra cluster and return a dictionary.\n\n :param query: The query to execute.\n :type query: str\n :param contact_points: The Cassandra cluster addresses, can either b...
# -*- coding: utf-8 -*- ''' Cassandra Database Module .. versionadded:: 2015.5.0 This module works with Cassandra v2 and v3 and hence generates queries based on the internal schema of said version. :depends: DataStax Python Driver for Apache Cassandra https://github.com/datastax/python-driver pip...
saltstack/salt
salt/modules/cassandra_cql.py
grant_permission
python
def grant_permission(username, resource=None, resource_type='keyspace', permission=None, contact_points=None, port=None, cql_user=None, cql_pass=None): ''' Grant permissions to a user. :param username: The name of the user to grant permissions to. :type username: str ...
Grant permissions to a user. :param username: The name of the user to grant permissions to. :type username: str :param resource: The resource (keyspace or table), if None, permissions for all resources are granted. :type resource: str :param resource_type: The resource_ty...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cassandra_cql.py#L997-L1046
[ "def cql_query(query, contact_points=None, port=None, cql_user=None, cql_pass=None):\n '''\n Run a query on a Cassandra cluster and return a dictionary.\n\n :param query: The query to execute.\n :type query: str\n :param contact_points: The Cassandra cluster addresses, can either b...
# -*- coding: utf-8 -*- ''' Cassandra Database Module .. versionadded:: 2015.5.0 This module works with Cassandra v2 and v3 and hence generates queries based on the internal schema of said version. :depends: DataStax Python Driver for Apache Cassandra https://github.com/datastax/python-driver pip...
saltstack/salt
salt/beacons/journald.py
_get_journal
python
def _get_journal(): ''' Return the active running journal object ''' if 'systemd.journald' in __context__: return __context__['systemd.journald'] __context__['systemd.journald'] = systemd.journal.Reader() # get to the end of the journal __context__['systemd.journald'].seek_tail() ...
Return the active running journal object
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/beacons/journald.py#L33-L43
null
# -*- coding: utf-8 -*- ''' A simple beacon to watch journald for specific entries ''' # Import Python libs from __future__ import absolute_import, unicode_literals # Import salt libs import salt.utils.data import salt.ext.six from salt.ext.six.moves import map # Import third party libs try: import systemd.journ...
saltstack/salt
salt/beacons/journald.py
beacon
python
def beacon(config): ''' The journald beacon allows for the systemd journal to be parsed and linked objects to be turned into events. This beacons config will return all sshd jornal entries .. code-block:: yaml beacons: journald: - services: sshd: ...
The journald beacon allows for the systemd journal to be parsed and linked objects to be turned into events. This beacons config will return all sshd jornal entries .. code-block:: yaml beacons: journald: - services: sshd: SYSLOG_IDENTIFIER:...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/beacons/journald.py#L64-L104
[ "def simple_types_filter(data):\n '''\n Convert the data list, dictionary into simple types, i.e., int, float, string,\n bool, etc.\n '''\n if data is None:\n return data\n\n simpletypes_keys = (six.string_types, six.text_type, six.integer_types, float, bool)\n simpletypes_values = tuple...
# -*- coding: utf-8 -*- ''' A simple beacon to watch journald for specific entries ''' # Import Python libs from __future__ import absolute_import, unicode_literals # Import salt libs import salt.utils.data import salt.ext.six from salt.ext.six.moves import map # Import third party libs try: import systemd.journ...
saltstack/salt
salt/returners/couchdb_return.py
_get_options
python
def _get_options(ret=None): ''' Get the couchdb options from salt. ''' attrs = {'url': 'url', 'db': 'db', 'user': 'user', 'passwd': 'passwd', 'redact_pws': 'redact_pws', 'minimum_return': 'minimum_return'} _options = salt.returners.ge...
Get the couchdb options from salt.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/couchdb_return.py#L96-L136
[ "def get_returner_options(virtualname=None,\n ret=None,\n attrs=None,\n **kwargs):\n '''\n Get the returner options from salt.\n\n :param str virtualname: The returner virtualname (as returned\n by __virtual__()\n :param ret:...
# -*- coding: utf-8 -*- ''' Simple returner for CouchDB. Optional configuration settings are listed below, along with sane defaults: .. code-block:: yaml couchdb.db: 'salt' couchdb.url: 'http://salt:5984/' couchdb.user: None couchdb.passwd: None couchdb.redact_pws: None couchdb.minimum_return:...
saltstack/salt
salt/returners/couchdb_return.py
_generate_doc
python
def _generate_doc(ret): ''' Create a object that will be saved into the database based on options. ''' # Create a copy of the object that we will return. retc = ret.copy() # Set the ID of the document to be the JID. retc["_id"] = ret["jid"] # Add a timestamp field to the document ...
Create a object that will be saved into the database based on options.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/couchdb_return.py#L151-L166
null
# -*- coding: utf-8 -*- ''' Simple returner for CouchDB. Optional configuration settings are listed below, along with sane defaults: .. code-block:: yaml couchdb.db: 'salt' couchdb.url: 'http://salt:5984/' couchdb.user: None couchdb.passwd: None couchdb.redact_pws: None couchdb.minimum_return:...
saltstack/salt
salt/returners/couchdb_return.py
_request
python
def _request(method, url, content_type=None, _data=None, user=None, passwd=None): ''' Makes a HTTP request. Returns the JSON parse, or an obj with an error. ''' opener = _build_opener(_HTTPHandler) request = _Request(url, data=_data) if content_type: request.add_header('Content-Type', co...
Makes a HTTP request. Returns the JSON parse, or an obj with an error.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/couchdb_return.py#L169-L187
[ "def loads(s, **kwargs):\n '''\n .. versionadded:: 2018.3.0\n\n Wraps json.loads and prevents a traceback in the event that a bytestring is\n passed to the function. (Python < 3.6 cannot load bytestrings)\n\n You can pass an alternate json module (loaded via import_json() above)\n using the _json_...
# -*- coding: utf-8 -*- ''' Simple returner for CouchDB. Optional configuration settings are listed below, along with sane defaults: .. code-block:: yaml couchdb.db: 'salt' couchdb.url: 'http://salt:5984/' couchdb.user: None couchdb.passwd: None couchdb.redact_pws: None couchdb.minimum_return:...
saltstack/salt
salt/returners/couchdb_return.py
_generate_event_doc
python
def _generate_event_doc(event): ''' Create a object that will be saved into the database based in options. ''' # Create a copy of the object that we will return. eventc = event.copy() # Set the ID of the document to be the JID. eventc["_id"] = '{}-{}'.format( ...
Create a object that will be saved into the database based in options.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/couchdb_return.py#L190-L212
null
# -*- coding: utf-8 -*- ''' Simple returner for CouchDB. Optional configuration settings are listed below, along with sane defaults: .. code-block:: yaml couchdb.db: 'salt' couchdb.url: 'http://salt:5984/' couchdb.user: None couchdb.passwd: None couchdb.redact_pws: None couchdb.minimum_return:...
saltstack/salt
salt/returners/couchdb_return.py
returner
python
def returner(ret): ''' Take in the return and shove it into the couchdb database. ''' options = _get_options(ret) # Check to see if the database exists. _response = _request("GET", options['url'] + "_all_dbs", user=options['user'], ...
Take in the return and shove it into the couchdb database.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/couchdb_return.py#L215-L269
[ "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 -*- ''' Simple returner for CouchDB. Optional configuration settings are listed below, along with sane defaults: .. code-block:: yaml couchdb.db: 'salt' couchdb.url: 'http://salt:5984/' couchdb.user: None couchdb.passwd: None couchdb.redact_pws: None couchdb.minimum_return:...
saltstack/salt
salt/returners/couchdb_return.py
event_return
python
def event_return(events): ''' Return event to CouchDB server Requires that configuration be enabled via 'event_return' option in master config. Example: event_return: - couchdb ''' log.debug('events data is: %s', events) options = _get_options() # Check to see if the d...
Return event to CouchDB server Requires that configuration be enabled via 'event_return' option in master config. Example: event_return: - couchdb
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/couchdb_return.py#L272-L318
[ "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 -*- ''' Simple returner for CouchDB. Optional configuration settings are listed below, along with sane defaults: .. code-block:: yaml couchdb.db: 'salt' couchdb.url: 'http://salt:5984/' couchdb.user: None couchdb.passwd: None couchdb.redact_pws: None couchdb.minimum_return:...
saltstack/salt
salt/returners/couchdb_return.py
get_jids
python
def get_jids(): ''' List all the jobs that we have.. ''' options = _get_options(ret=None) _response = _request("GET", options['url'] + options['db'] + "/_all_docs?include_docs=true") # Make sure the 'total_rows' is returned.. if not error out. if 'total_rows' not in _response: log.e...
List all the jobs that we have..
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/couchdb_return.py#L333-L356
[ "def _get_options(ret=None):\n '''\n Get the couchdb options from salt.\n '''\n attrs = {'url': 'url',\n 'db': 'db',\n 'user': 'user',\n 'passwd': 'passwd',\n 'redact_pws': 'redact_pws',\n 'minimum_return': 'minimum_return'}\n\n _options = s...
# -*- coding: utf-8 -*- ''' Simple returner for CouchDB. Optional configuration settings are listed below, along with sane defaults: .. code-block:: yaml couchdb.db: 'salt' couchdb.url: 'http://salt:5984/' couchdb.user: None couchdb.passwd: None couchdb.redact_pws: None couchdb.minimum_return:...
saltstack/salt
salt/returners/couchdb_return.py
get_fun
python
def get_fun(fun): ''' Return a dict with key being minion and value being the job details of the last run of function 'fun'. ''' # Get the options.. options = _get_options(ret=None) # Define a simple return object. _ret = {} # get_minions takes care of calling ensure_views for us....
Return a dict with key being minion and value being the job details of the last run of function 'fun'.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/couchdb_return.py#L359-L399
[ "def _get_options(ret=None):\n '''\n Get the couchdb options from salt.\n '''\n attrs = {'url': 'url',\n 'db': 'db',\n 'user': 'user',\n 'passwd': 'passwd',\n 'redact_pws': 'redact_pws',\n 'minimum_return': 'minimum_return'}\n\n _options = s...
# -*- coding: utf-8 -*- ''' Simple returner for CouchDB. Optional configuration settings are listed below, along with sane defaults: .. code-block:: yaml couchdb.db: 'salt' couchdb.url: 'http://salt:5984/' couchdb.user: None couchdb.passwd: None couchdb.redact_pws: None couchdb.minimum_return:...
saltstack/salt
salt/returners/couchdb_return.py
get_minions
python
def get_minions(): ''' Return a list of minion identifiers from a request of the view. ''' options = _get_options(ret=None) # Make sure the views are valid, which includes the minions.. if not ensure_views(): return [] # Make the request for the view.. _response = _request("GET...
Return a list of minion identifiers from a request of the view.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/couchdb_return.py#L402-L427
[ "def _get_options(ret=None):\n '''\n Get the couchdb options from salt.\n '''\n attrs = {'url': 'url',\n 'db': 'db',\n 'user': 'user',\n 'passwd': 'passwd',\n 'redact_pws': 'redact_pws',\n 'minimum_return': 'minimum_return'}\n\n _options = s...
# -*- coding: utf-8 -*- ''' Simple returner for CouchDB. Optional configuration settings are listed below, along with sane defaults: .. code-block:: yaml couchdb.db: 'salt' couchdb.url: 'http://salt:5984/' couchdb.user: None couchdb.passwd: None couchdb.redact_pws: None couchdb.minimum_return:...
saltstack/salt
salt/returners/couchdb_return.py
ensure_views
python
def ensure_views(): ''' This function makes sure that all the views that should exist in the design document do exist. ''' # Get the options so we have the URL and DB.. options = _get_options(ret=None) # Make a request to check if the design document exists. _response = _request("GET",...
This function makes sure that all the views that should exist in the design document do exist.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/couchdb_return.py#L430-L456
[ "def _get_options(ret=None):\n '''\n Get the couchdb options from salt.\n '''\n attrs = {'url': 'url',\n 'db': 'db',\n 'user': 'user',\n 'passwd': 'passwd',\n 'redact_pws': 'redact_pws',\n 'minimum_return': 'minimum_return'}\n\n _options = s...
# -*- coding: utf-8 -*- ''' Simple returner for CouchDB. Optional configuration settings are listed below, along with sane defaults: .. code-block:: yaml couchdb.db: 'salt' couchdb.url: 'http://salt:5984/' couchdb.user: None couchdb.passwd: None couchdb.redact_pws: None couchdb.minimum_return:...
saltstack/salt
salt/returners/couchdb_return.py
set_salt_view
python
def set_salt_view(): ''' Helper function that sets the salt design document. Uses get_valid_salt_views and some hardcoded values. ''' options = _get_options(ret=None) # Create the new object that we will shove in as the design doc. new_doc = {} new_doc['views'] = get_valid_salt_views()...
Helper function that sets the salt design document. Uses get_valid_salt_views and some hardcoded values.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/couchdb_return.py#L477-L497
[ "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 -*- ''' Simple returner for CouchDB. Optional configuration settings are listed below, along with sane defaults: .. code-block:: yaml couchdb.db: 'salt' couchdb.url: 'http://salt:5984/' couchdb.user: None couchdb.passwd: None couchdb.redact_pws: None couchdb.minimum_return:...
saltstack/salt
salt/returners/couchdb_return.py
get_load
python
def get_load(jid): ''' Included for API consistency ''' options = _get_options(ret=None) _response = _request("GET", options['url'] + options['db'] + '/' + jid) if 'error' in _response: log.error('Unable to get JID "%s" : "%s"', jid, _response) return {} return {_response['id...
Included for API consistency
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/couchdb_return.py#L521-L530
[ "def _get_options(ret=None):\n '''\n Get the couchdb options from salt.\n '''\n attrs = {'url': 'url',\n 'db': 'db',\n 'user': 'user',\n 'passwd': 'passwd',\n 'redact_pws': 'redact_pws',\n 'minimum_return': 'minimum_return'}\n\n _options = s...
# -*- coding: utf-8 -*- ''' Simple returner for CouchDB. Optional configuration settings are listed below, along with sane defaults: .. code-block:: yaml couchdb.db: 'salt' couchdb.url: 'http://salt:5984/' couchdb.user: None couchdb.passwd: None couchdb.redact_pws: None couchdb.minimum_return:...
saltstack/salt
salt/modules/heat.py
_auth
python
def _auth(profile=None, api_version=1, **connection_args): ''' Set up heat credentials, returns `heatclient.client.Client`. Optional parameter "api_version" defaults to 1. Only intended to be used within heat-enabled modules ''' if profile: prefix = profile + ':keystone.' else:...
Set up heat credentials, returns `heatclient.client.Client`. Optional parameter "api_version" defaults to 1. Only intended to be used within heat-enabled modules
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/heat.py#L102-L171
[ "def get(key, default=None):\n '''\n Checks connection_args, then salt-minion config,\n falls back to specified default value.\n '''\n return connection_args.get('connection_' + key,\n __salt__['config.get'](prefix + key, default))\n" ]
# -*- coding: utf-8 -*- ''' Module for handling OpenStack Heat calls .. versionadded:: 2017.7.0 :depends: - heatclient Python module :configuration: This module is not usable until the user, password, tenant, and auth URL are specified either in a pillar or in the minion's config file. For example:: ...
saltstack/salt
salt/modules/heat.py
_parse_environment
python
def _parse_environment(env_str): ''' Parsing template ''' try: env = salt.utils.yaml.safe_load(env_str) except salt.utils.yaml.YAMLError as exc: raise ValueError(six.text_type(exc)) else: if env is None: env = {} elif not isinstance(env, dict): ...
Parsing template
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/heat.py#L196-L216
[ "def safe_load(stream, Loader=SaltYamlSafeLoader):\n '''\n .. versionadded:: 2018.3.0\n\n Helper function which automagically uses our custom loader.\n '''\n return yaml.load(stream, Loader=Loader)\n" ]
# -*- coding: utf-8 -*- ''' Module for handling OpenStack Heat calls .. versionadded:: 2017.7.0 :depends: - heatclient Python module :configuration: This module is not usable until the user, password, tenant, and auth URL are specified either in a pillar or in the minion's config file. For example:: ...
saltstack/salt
salt/modules/heat.py
_get_stack_events
python
def _get_stack_events(h_client, stack_id, event_args): ''' Get event for stack ''' event_args['stack_id'] = stack_id event_args['resource_name'] = None try: events = h_client.events.list(**event_args) except heatclient.exc.HTTPNotFound as exc: raise heatclient.exc.CommandErro...
Get event for stack
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/heat.py#L219-L232
null
# -*- coding: utf-8 -*- ''' Module for handling OpenStack Heat calls .. versionadded:: 2017.7.0 :depends: - heatclient Python module :configuration: This module is not usable until the user, password, tenant, and auth URL are specified either in a pillar or in the minion's config file. For example:: ...
saltstack/salt
salt/modules/heat.py
_poll_for_events
python
def _poll_for_events(h_client, stack_name, action=None, poll_period=5, timeout=60, marker=None): ''' Polling stack events ''' if action: stop_status = ('{0}_FAILED'.format(action), '{0}_COMPLETE'.format(action)) stop_check = lambda a: a in stop_status else: ...
Polling stack events
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/heat.py#L235-L283
[ "def _get_stack_events(h_client, stack_id, event_args):\n '''\n Get event for stack\n '''\n event_args['stack_id'] = stack_id\n event_args['resource_name'] = None\n try:\n events = h_client.events.list(**event_args)\n except heatclient.exc.HTTPNotFound as exc:\n raise heatclient.e...
# -*- coding: utf-8 -*- ''' Module for handling OpenStack Heat calls .. versionadded:: 2017.7.0 :depends: - heatclient Python module :configuration: This module is not usable until the user, password, tenant, and auth URL are specified either in a pillar or in the minion's config file. For example:: ...
saltstack/salt
salt/modules/heat.py
list_stack
python
def list_stack(profile=None): ''' Return a list of available stack (heat stack-list) profile Profile to use CLI Example: .. code-block:: bash salt '*' heat.list_stack profile=openstack1 ''' ret = {} h_client = _auth(profile) for stack in h_client.stacks.list(): ...
Return a list of available stack (heat stack-list) profile Profile to use CLI Example: .. code-block:: bash salt '*' heat.list_stack profile=openstack1
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/heat.py#L286-L314
[ "def _auth(profile=None, api_version=1, **connection_args):\n '''\n Set up heat credentials, returns\n `heatclient.client.Client`. Optional parameter\n \"api_version\" defaults to 1.\n\n Only intended to be used within heat-enabled modules\n '''\n\n if profile:\n prefix = profile + ':key...
# -*- coding: utf-8 -*- ''' Module for handling OpenStack Heat calls .. versionadded:: 2017.7.0 :depends: - heatclient Python module :configuration: This module is not usable until the user, password, tenant, and auth URL are specified either in a pillar or in the minion's config file. For example:: ...
saltstack/salt
salt/modules/heat.py
show_stack
python
def show_stack(name=None, profile=None): ''' Return details about a specific stack (heat stack-show) name Name of the stack profile Profile to use CLI Example: .. code-block:: bash salt '*' heat.show_stack name=mystack profile=openstack1 ''' h_client = _auth(...
Return details about a specific stack (heat stack-show) name Name of the stack profile Profile to use CLI Example: .. code-block:: bash salt '*' heat.show_stack name=mystack profile=openstack1
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/heat.py#L317-L362
[ "def _auth(profile=None, api_version=1, **connection_args):\n '''\n Set up heat credentials, returns\n `heatclient.client.Client`. Optional parameter\n \"api_version\" defaults to 1.\n\n Only intended to be used within heat-enabled modules\n '''\n\n if profile:\n prefix = profile + ':key...
# -*- coding: utf-8 -*- ''' Module for handling OpenStack Heat calls .. versionadded:: 2017.7.0 :depends: - heatclient Python module :configuration: This module is not usable until the user, password, tenant, and auth URL are specified either in a pillar or in the minion's config file. For example:: ...
saltstack/salt
salt/modules/heat.py
delete_stack
python
def delete_stack(name=None, poll=0, timeout=60, profile=None): ''' Delete a stack (heat stack-delete) name Name of the stack poll Poll and report events until stack complete timeout Stack creation timeout in minute profile Profile to use CLI Examples: ...
Delete a stack (heat stack-delete) name Name of the stack poll Poll and report events until stack complete timeout Stack creation timeout in minute profile Profile to use CLI Examples: .. code-block:: bash salt '*' heat.delete_stack name=mystack po...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/heat.py#L365-L428
[ "def _auth(profile=None, api_version=1, **connection_args):\n '''\n Set up heat credentials, returns\n `heatclient.client.Client`. Optional parameter\n \"api_version\" defaults to 1.\n\n Only intended to be used within heat-enabled modules\n '''\n\n if profile:\n prefix = profile + ':key...
# -*- coding: utf-8 -*- ''' Module for handling OpenStack Heat calls .. versionadded:: 2017.7.0 :depends: - heatclient Python module :configuration: This module is not usable until the user, password, tenant, and auth URL are specified either in a pillar or in the minion's config file. For example:: ...
saltstack/salt
salt/modules/heat.py
create_stack
python
def create_stack(name=None, template_file=None, environment=None, parameters=None, poll=0, rollback=False, timeout=60, profile=None, enviroment=None): ''' Create a stack (heat stack-create) name Name of the new stack template_file File of template ...
Create a stack (heat stack-create) name Name of the new stack template_file File of template environment File of environment parameters Parameter dict used to create the stack poll Poll and report events until stack complete rollback Enable r...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/heat.py#L431-L623
[ "def mkstemp(*args, **kwargs):\n '''\n Helper function which does exactly what ``tempfile.mkstemp()`` does but\n accepts another argument, ``close_fd``, which, by default, is true and closes\n the fd before returning the file path. Something commonly done throughout\n Salt's code.\n '''\n if 'p...
# -*- coding: utf-8 -*- ''' Module for handling OpenStack Heat calls .. versionadded:: 2017.7.0 :depends: - heatclient Python module :configuration: This module is not usable until the user, password, tenant, and auth URL are specified either in a pillar or in the minion's config file. For example:: ...
saltstack/salt
salt/modules/heat.py
template_stack
python
def template_stack(name=None, profile=None): ''' Return template a specific stack (heat stack-template) name Name of the stack profile Profile to use CLI Example: .. code-block:: bash salt '*' heat.template_stack name=mystack profile=openstack1 ''' h_client =...
Return template a specific stack (heat stack-template) name Name of the stack profile Profile to use CLI Example: .. code-block:: bash salt '*' heat.template_stack name=mystack profile=openstack1
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/heat.py#L824-L871
[ "def safe_dump(data, stream=None, **kwargs):\n '''\n Use a custom dumper to ensure that defaultdict and OrderedDict are\n represented properly. Ensure that unicode strings are encoded unless\n explicitly told not to.\n '''\n if 'allow_unicode' not in kwargs:\n kwargs['allow_unicode'] = True...
# -*- coding: utf-8 -*- ''' Module for handling OpenStack Heat calls .. versionadded:: 2017.7.0 :depends: - heatclient Python module :configuration: This module is not usable until the user, password, tenant, and auth URL are specified either in a pillar or in the minion's config file. For example:: ...
saltstack/salt
salt/states/uptime.py
monitored
python
def monitored(name, **params): ''' Makes sure an URL is monitored by uptime. Checks if URL is already monitored, and if not, adds it. ''' ret = {'name': name, 'changes': {}, 'result': None, 'comment': ''} if __salt__['uptime.check_exists'](name=name): ret['result'] = True ret['...
Makes sure an URL is monitored by uptime. Checks if URL is already monitored, and if not, adds it.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/uptime.py#L47-L75
null
# -*- coding: utf-8 -*- ''' Monitor Web Server with Uptime ============================== `Uptime <https://github.com/fzaninotto/uptime>`_ is an open source remote monitoring application using Node.js, MongoDB, and Twitter Bootstrap. .. warning:: This state module is beta. It might be changed later to include ...
saltstack/salt
salt/modules/zk_concurrency.py
lock_holders
python
def lock_holders(path, zk_hosts=None, identifier=None, max_concurrency=1, timeout=None, ephemeral_lease=False, profile=None, scheme=None, username=None, password=None,...
Return an un-ordered list of lock holders path The path in zookeeper where the lock is zk_hosts zookeeper connect string identifier Name to identify this minion, if unspecified defaults to hostname max_concurrency Maximum number of lock holders timeout ti...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zk_concurrency.py#L154-L198
[ "def _get_zk_conn(profile=None, **connection_args):\n if profile:\n prefix = 'zookeeper:' + profile\n else:\n prefix = 'zookeeper'\n\n def get(key, default=None):\n '''\n look in connection_args first, then default to config file\n '''\n return connection_args.get(...
# -*- coding: utf-8 -*- ''' Concurrency controls in zookeeper ========================================================================= :depends: kazoo :configuration: See :py:mod:`salt.modules.zookeeper` for setup instructions. This module allows you to acquire and release a slot. This is primarily useful for ensure...
saltstack/salt
salt/modules/zk_concurrency.py
lock
python
def lock(path, zk_hosts=None, identifier=None, max_concurrency=1, timeout=None, ephemeral_lease=False, force=False, # foricble get the lock regardless of open slots profile=None, scheme=None, username=None, password=None, ...
Get lock (with optional timeout) path The path in zookeeper where the lock is zk_hosts zookeeper connect string identifier Name to identify this minion, if unspecified defaults to the hostname max_concurrency Maximum number of lock holders timeout timeout...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zk_concurrency.py#L201-L264
[ "def _get_zk_conn(profile=None, **connection_args):\n if profile:\n prefix = 'zookeeper:' + profile\n else:\n prefix = 'zookeeper'\n\n def get(key, default=None):\n '''\n look in connection_args first, then default to config file\n '''\n return connection_args.get(...
# -*- coding: utf-8 -*- ''' Concurrency controls in zookeeper ========================================================================= :depends: kazoo :configuration: See :py:mod:`salt.modules.zookeeper` for setup instructions. This module allows you to acquire and release a slot. This is primarily useful for ensure...
saltstack/salt
salt/modules/zk_concurrency.py
unlock
python
def unlock(path, zk_hosts=None, # in case you need to unlock without having run lock (failed execution for example) identifier=None, max_concurrency=1, ephemeral_lease=False, scheme=None, profile=None, username=None, password=None,...
Remove lease from semaphore path The path in zookeeper where the lock is zk_hosts zookeeper connect string identifier Name to identify this minion, if unspecified defaults to hostname max_concurrency Maximum number of lock holders timeout timeout to wait ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zk_concurrency.py#L267-L320
[ "def _get_zk_conn(profile=None, **connection_args):\n if profile:\n prefix = 'zookeeper:' + profile\n else:\n prefix = 'zookeeper'\n\n def get(key, default=None):\n '''\n look in connection_args first, then default to config file\n '''\n return connection_args.get(...
# -*- coding: utf-8 -*- ''' Concurrency controls in zookeeper ========================================================================= :depends: kazoo :configuration: See :py:mod:`salt.modules.zookeeper` for setup instructions. This module allows you to acquire and release a slot. This is primarily useful for ensure...
saltstack/salt
salt/modules/zk_concurrency.py
party_members
python
def party_members(path, zk_hosts=None, min_nodes=1, blocking=False, profile=None, scheme=None, username=None, password=None, default_acl=None, ): ''' ...
Get the List of identifiers in a particular party, optionally waiting for the specified minimum number of nodes (min_nodes) to appear path The path in zookeeper where the lock is zk_hosts zookeeper connect string min_nodes The minimum number of nodes expected to be present in ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zk_concurrency.py#L323-L364
[ "def _get_zk_conn(profile=None, **connection_args):\n if profile:\n prefix = 'zookeeper:' + profile\n else:\n prefix = 'zookeeper'\n\n def get(key, default=None):\n '''\n look in connection_args first, then default to config file\n '''\n return connection_args.get(...
# -*- coding: utf-8 -*- ''' Concurrency controls in zookeeper ========================================================================= :depends: kazoo :configuration: See :py:mod:`salt.modules.zookeeper` for setup instructions. This module allows you to acquire and release a slot. This is primarily useful for ensure...
saltstack/salt
salt/modules/chef.py
_default_logfile
python
def _default_logfile(exe_name): ''' Retrieve the logfile name ''' if salt.utils.platform.is_windows(): tmp_dir = os.path.join(__opts__['cachedir'], 'tmp') if not os.path.isdir(tmp_dir): os.mkdir(tmp_dir) logfile_tmp = tempfile.NamedTemporaryFile(dir=tmp_dir, ...
Retrieve the logfile name
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/chef.py#L32-L52
null
# -*- coding: utf-8 -*- ''' Execute chef in server or solo mode ''' # Import Python libs from __future__ import absolute_import, print_function, unicode_literals import logging import os import tempfile # Import Salt libs import salt.utils.path import salt.utils.platform import salt.utils.decorators.path # Import 3r...
saltstack/salt
salt/modules/chef.py
client
python
def client(whyrun=False, localmode=False, logfile=None, **kwargs): ''' Execute a chef client run and return a dict with the stderr, stdout, return code, and pid. CLI Example: .. code-block:: bash salt '*' chef.client server=https://localhost server ...
Execute a chef client run and return a dict with the stderr, stdout, return code, and pid. CLI Example: .. code-block:: bash salt '*' chef.client server=https://localhost server The chef server URL client_key Set the client key file location config The confi...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/chef.py#L56-L141
[ "def _default_logfile(exe_name):\n '''\n Retrieve the logfile name\n '''\n if salt.utils.platform.is_windows():\n tmp_dir = os.path.join(__opts__['cachedir'], 'tmp')\n if not os.path.isdir(tmp_dir):\n os.mkdir(tmp_dir)\n logfile_tmp = tempfile.NamedTemporaryFile(dir=tmp_d...
# -*- coding: utf-8 -*- ''' Execute chef in server or solo mode ''' # Import Python libs from __future__ import absolute_import, print_function, unicode_literals import logging import os import tempfile # Import Salt libs import salt.utils.path import salt.utils.platform import salt.utils.decorators.path # Import 3r...
saltstack/salt
salt/modules/chef.py
solo
python
def solo(whyrun=False, logfile=None, **kwargs): ''' Execute a chef solo run and return a dict with the stderr, stdout, return code, and pid. CLI Example: .. code-block:: bash salt '*' chef.solo override-runlist=test config The configuration file to use ...
Execute a chef solo run and return a dict with the stderr, stdout, return code, and pid. CLI Example: .. code-block:: bash salt '*' chef.solo override-runlist=test config The configuration file to use environment Set the Chef Environment on the node group Gr...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/chef.py#L145-L206
[ "def _default_logfile(exe_name):\n '''\n Retrieve the logfile name\n '''\n if salt.utils.platform.is_windows():\n tmp_dir = os.path.join(__opts__['cachedir'], 'tmp')\n if not os.path.isdir(tmp_dir):\n os.mkdir(tmp_dir)\n logfile_tmp = tempfile.NamedTemporaryFile(dir=tmp_d...
# -*- coding: utf-8 -*- ''' Execute chef in server or solo mode ''' # Import Python libs from __future__ import absolute_import, print_function, unicode_literals import logging import os import tempfile # Import Salt libs import salt.utils.path import salt.utils.platform import salt.utils.decorators.path # Import 3r...
saltstack/salt
salt/transport/frame.py
frame_msg
python
def frame_msg(body, header=None, raw_body=False): # pylint: disable=unused-argument ''' Frame the given message with our wire protocol ''' framed_msg = {} if header is None: header = {} framed_msg['head'] = header framed_msg['body'] = body return salt.utils.msgpack.dumps(framed...
Frame the given message with our wire protocol
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/transport/frame.py#L11-L21
[ "def packb(o, **kwargs):\n '''\n .. versionadded:: 2018.3.4\n\n Wraps msgpack.packb and ensures that the passed object is unwrapped if it\n is a proxy.\n\n By default, this function uses the msgpack module and falls back to\n msgpack_pure, if the msgpack is not available. You can pass an alternate...
# -*- coding: utf-8 -*- ''' Helper functions for transport components to handle message framing ''' # Import python libs from __future__ import absolute_import, print_function, unicode_literals import salt.utils.msgpack from salt.ext import six def frame_msg_ipc(body, header=None, raw_body=False): # pylint: disable...
saltstack/salt
salt/transport/frame.py
frame_msg_ipc
python
def frame_msg_ipc(body, header=None, raw_body=False): # pylint: disable=unused-argument ''' Frame the given message with our wire protocol for IPC For IPC, we don't need to be backwards compatible, so use the more efficient "use_bin_type=True" on Python 3. ''' framed_msg = {} if header is ...
Frame the given message with our wire protocol for IPC For IPC, we don't need to be backwards compatible, so use the more efficient "use_bin_type=True" on Python 3.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/transport/frame.py#L24-L40
[ "def packb(o, **kwargs):\n '''\n .. versionadded:: 2018.3.4\n\n Wraps msgpack.packb and ensures that the passed object is unwrapped if it\n is a proxy.\n\n By default, this function uses the msgpack module and falls back to\n msgpack_pure, if the msgpack is not available. You can pass an alternate...
# -*- coding: utf-8 -*- ''' Helper functions for transport components to handle message framing ''' # Import python libs from __future__ import absolute_import, print_function, unicode_literals import salt.utils.msgpack from salt.ext import six def frame_msg(body, header=None, raw_body=False): # pylint: disable=unus...
saltstack/salt
salt/transport/frame.py
_decode_embedded_list
python
def _decode_embedded_list(src): ''' Convert enbedded bytes to strings if possible. List helper. ''' output = [] for elem in src: if isinstance(elem, dict): elem = _decode_embedded_dict(elem) elif isinstance(elem, list): elem = _decode_embedded_list(elem) ...
Convert enbedded bytes to strings if possible. List helper.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/transport/frame.py#L43-L60
null
# -*- coding: utf-8 -*- ''' Helper functions for transport components to handle message framing ''' # Import python libs from __future__ import absolute_import, print_function, unicode_literals import salt.utils.msgpack from salt.ext import six def frame_msg(body, header=None, raw_body=False): # pylint: disable=unus...
saltstack/salt
salt/transport/frame.py
_decode_embedded_dict
python
def _decode_embedded_dict(src): ''' Convert enbedded bytes to strings if possible. Dict helper. ''' output = {} for key, val in six.iteritems(src): if isinstance(val, dict): val = _decode_embedded_dict(val) elif isinstance(val, list): val = _decode_embedde...
Convert enbedded bytes to strings if possible. Dict helper.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/transport/frame.py#L63-L85
null
# -*- coding: utf-8 -*- ''' Helper functions for transport components to handle message framing ''' # Import python libs from __future__ import absolute_import, print_function, unicode_literals import salt.utils.msgpack from salt.ext import six def frame_msg(body, header=None, raw_body=False): # pylint: disable=unus...
saltstack/salt
salt/transport/frame.py
decode_embedded_strs
python
def decode_embedded_strs(src): ''' Convert enbedded bytes to strings if possible. This is necessary because Python 3 makes a distinction between these types. This wouldn't be needed if we used "use_bin_type=True" when encoding and "encoding='utf-8'" when decoding. Unfortunately, this would brea...
Convert enbedded bytes to strings if possible. This is necessary because Python 3 makes a distinction between these types. This wouldn't be needed if we used "use_bin_type=True" when encoding and "encoding='utf-8'" when decoding. Unfortunately, this would break backwards compatibility due to a chan...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/transport/frame.py#L88-L112
null
# -*- coding: utf-8 -*- ''' Helper functions for transport components to handle message framing ''' # Import python libs from __future__ import absolute_import, print_function, unicode_literals import salt.utils.msgpack from salt.ext import six def frame_msg(body, header=None, raw_body=False): # pylint: disable=unus...
saltstack/salt
salt/states/disk.py
_validate_int
python
def _validate_int(name, value, limits=(), strip='%'): ''' Validate the named integer within the supplied limits inclusive and strip supplied unit characters ''' comment = '' # Must be integral try: if isinstance(value, string_types): value = value.strip(' ' + strip) ...
Validate the named integer within the supplied limits inclusive and strip supplied unit characters
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/disk.py#L57-L75
null
# -*- coding: utf-8 -*- ''' Disk monitoring state Monitor the state of disk resources. The ``disk.status`` function can be used to report that the used space of a filesystem is within the specified limits. .. code-block:: sls used_space: disk.status: - name: /dev/xda1 - maximum: 79% ...
saltstack/salt
salt/states/disk.py
status
python
def status(name, maximum=None, minimum=None, absolute=False, free=False): ''' Return the current disk usage stats for the named mount point name Disk mount or directory for which to check used space maximum The maximum disk utilization minimum The minimum disk utilization ...
Return the current disk usage stats for the named mount point name Disk mount or directory for which to check used space maximum The maximum disk utilization minimum The minimum disk utilization absolute By default, the utilization is measured in percentage. Set ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/disk.py#L154-L210
[ "def _validate_int(name, value, limits=(), strip='%'):\n '''\n Validate the named integer within the supplied limits inclusive and\n strip supplied unit characters\n '''\n comment = ''\n # Must be integral\n try:\n if isinstance(value, string_types):\n value = value.strip(' ' ...
# -*- coding: utf-8 -*- ''' Disk monitoring state Monitor the state of disk resources. The ``disk.status`` function can be used to report that the used space of a filesystem is within the specified limits. .. code-block:: sls used_space: disk.status: - name: /dev/xda1 - maximum: 79% ...
saltstack/salt
salt/states/ssh_known_hosts.py
present
python
def present( name, user=None, fingerprint=None, key=None, port=None, enc=None, config=None, hash_known_hosts=True, timeout=5, fingerprint_hash_type=None): ''' Verifies that the specified host is known by the specified user On m...
Verifies that the specified host is known by the specified user On many systems, specifically those running with openssh 4 or older, the ``enc`` option must be set, only openssh 5 and above can detect the key type. name The name of the remote host (e.g. "github.com") Note that only a s...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/ssh_known_hosts.py#L45-L191
null
# -*- coding: utf-8 -*- ''' Control of SSH known_hosts entries ================================== Manage the information stored in the known_hosts files. .. code-block:: yaml github.com: ssh_known_hosts: - present - user: root - fingerprint: 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df...
saltstack/salt
salt/states/ssh_known_hosts.py
absent
python
def absent(name, user=None, config=None): ''' Verifies that the specified host is not known by the given user name The host name Note that only single host names are supported. If foo.example.com and bar.example.com are the same machine and you need to exclude both, you wil...
Verifies that the specified host is not known by the given user name The host name Note that only single host names are supported. If foo.example.com and bar.example.com are the same machine and you need to exclude both, you will need one Salt state for each. user The ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/ssh_known_hosts.py#L194-L245
null
# -*- coding: utf-8 -*- ''' Control of SSH known_hosts entries ================================== Manage the information stored in the known_hosts files. .. code-block:: yaml github.com: ssh_known_hosts: - present - user: root - fingerprint: 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df...
saltstack/salt
salt/engines/__init__.py
start_engines
python
def start_engines(opts, proc_mgr, proxy=None): ''' Fire up the configured engines! ''' utils = salt.loader.utils(opts, proxy=proxy) if opts['__role'] == 'master': runners = salt.loader.runner(opts, utils=utils) else: runners = [] funcs = salt.loader.minion_mods(opts, utils=ut...
Fire up the configured engines!
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/engines/__init__.py#L20-L77
[ "def add_process(self, tgt, args=None, kwargs=None, name=None):\n '''\n Create a processes and args + kwargs\n This will deterimine if it is a Process class, otherwise it assumes\n it is a function\n '''\n if args is None:\n args = []\n\n if kwargs is None:\n kwargs = {}\n\n if...
# -*- coding: utf-8 -*- ''' Initialize the engines system. This plugin system allows for complex services to be encapsulated within the salt plugin environment ''' # Import python libs from __future__ import absolute_import, print_function, unicode_literals import multiprocessing import logging # Import salt libs impo...
saltstack/salt
salt/engines/__init__.py
Engine.run
python
def run(self): ''' Run the master service! ''' self.utils = salt.loader.utils(self.opts, proxy=self.proxy) if salt.utils.platform.is_windows(): # Calculate function references since they can't be pickled. if self.opts['__role'] == 'master': ...
Run the master service!
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/engines/__init__.py#L124-L149
null
class Engine(SignalHandlingMultiprocessingProcess): ''' Execute the given engine in a new process ''' def __init__(self, opts, fun, config, funcs, runners, proxy, **kwargs): ''' Set up the process executor ''' super(Engine, self).__init__(**kwargs) self.opts = opt...
saltstack/salt
salt/roster/range.py
targets
python
def targets(tgt, tgt_type='range', **kwargs): ''' Return the targets from a range query ''' r = seco.range.Range(__opts__['range_server']) log.debug('Range connection to \'%s\' established', __opts__['range_server']) hosts = [] try: log.debug('Querying range for \'%s\'', tgt) ...
Return the targets from a range query
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/roster/range.py#L35-L66
null
# -*- coding: utf-8 -*- ''' This roster resolves targets from a range server. :depends: seco.range, https://github.com/ytoolshed/range When you want to use a range query for target matching, use ``--roster range``. For example: .. code-block:: bash salt-ssh --roster range '%%%example.range.cluster' test.ping '...
saltstack/salt
salt/modules/modjk.py
_auth
python
def _auth(url, user, passwd, realm): ''' returns a authentication handler. ''' basic = _HTTPBasicAuthHandler() basic.add_password(realm=realm, uri=url, user=user, passwd=passwd) digest = _HTTPDigestAuthHandler() digest.add_password(realm=realm, uri=url, user=user, passwd=passwd) return ...
returns a authentication handler.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/modjk.py#L56-L65
null
# -*- coding: utf-8 -*- ''' Control Modjk via the Apache Tomcat "Status" worker (http://tomcat.apache.org/connectors-doc/reference/status.html) Below is an example of the configuration needed for this module. This configuration data can be placed either in :ref:`grains <targeting-grains>` or :ref:`pillar <salt-pillars...
saltstack/salt
salt/modules/modjk.py
_do_http
python
def _do_http(opts, profile='default'): ''' Make the http request and return the data ''' ret = {} url = __salt__['config.get']('modjk:{0}:url'.format(profile), '') user = __salt__['config.get']('modjk:{0}:user'.format(profile), '') passwd = __salt__['config.get']('modjk:{0}:pass'.format(pr...
Make the http request and return the data
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/modjk.py#L68-L97
[ "def _auth(url, user, passwd, realm):\n '''\n returns a authentication handler.\n '''\n\n basic = _HTTPBasicAuthHandler()\n basic.add_password(realm=realm, uri=url, user=user, passwd=passwd)\n digest = _HTTPDigestAuthHandler()\n digest.add_password(realm=realm, uri=url, user=user, passwd=passwd...
# -*- coding: utf-8 -*- ''' Control Modjk via the Apache Tomcat "Status" worker (http://tomcat.apache.org/connectors-doc/reference/status.html) Below is an example of the configuration needed for this module. This configuration data can be placed either in :ref:`grains <targeting-grains>` or :ref:`pillar <salt-pillars...
saltstack/salt
salt/modules/modjk.py
_worker_ctl
python
def _worker_ctl(worker, lbn, vwa, profile='default'): ''' enable/disable/stop a worker ''' cmd = { 'cmd': 'update', 'mime': 'prop', 'w': lbn, 'sw': worker, 'vwa': vwa, } return _do_http(cmd, profile)['worker.result.type'] == 'OK'
enable/disable/stop a worker
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/modjk.py#L100-L112
[ "def _do_http(opts, profile='default'):\n '''\n Make the http request and return the data\n '''\n\n ret = {}\n\n url = __salt__['config.get']('modjk:{0}:url'.format(profile), '')\n user = __salt__['config.get']('modjk:{0}:user'.format(profile), '')\n passwd = __salt__['config.get']('modjk:{0}:p...
# -*- coding: utf-8 -*- ''' Control Modjk via the Apache Tomcat "Status" worker (http://tomcat.apache.org/connectors-doc/reference/status.html) Below is an example of the configuration needed for this module. This configuration data can be placed either in :ref:`grains <targeting-grains>` or :ref:`pillar <salt-pillars...
saltstack/salt
salt/modules/modjk.py
list_configured_members
python
def list_configured_members(lbn, profile='default'): ''' Return a list of member workers from the configuration files CLI Examples: .. code-block:: bash salt '*' modjk.list_configured_members loadbalancer1 salt '*' modjk.list_configured_members loadbalancer1 other-profile ''' ...
Return a list of member workers from the configuration files CLI Examples: .. code-block:: bash salt '*' modjk.list_configured_members loadbalancer1 salt '*' modjk.list_configured_members loadbalancer1 other-profile
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/modjk.py#L172-L191
[ "def dump_config(profile='default'):\n '''\n Dump the original configuration that was loaded from disk\n\n CLI Examples:\n\n .. code-block:: bash\n\n salt '*' modjk.dump_config\n salt '*' modjk.dump_config other-profile\n '''\n\n cmd = {\n 'cmd': 'dump',\n 'mime': 'prop...
# -*- coding: utf-8 -*- ''' Control Modjk via the Apache Tomcat "Status" worker (http://tomcat.apache.org/connectors-doc/reference/status.html) Below is an example of the configuration needed for this module. This configuration data can be placed either in :ref:`grains <targeting-grains>` or :ref:`pillar <salt-pillars...
saltstack/salt
salt/modules/modjk.py
workers
python
def workers(profile='default'): ''' Return a list of member workers and their status CLI Examples: .. code-block:: bash salt '*' modjk.workers salt '*' modjk.workers other-profile ''' config = get_running(profile) lbn = config['worker.list'].split(',') worker_list = [...
Return a list of member workers and their status CLI Examples: .. code-block:: bash salt '*' modjk.workers salt '*' modjk.workers other-profile
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/modjk.py#L194-L227
[ "def get_running(profile='default'):\n '''\n Get the current running config (not from disk)\n\n CLI Examples:\n\n .. code-block:: bash\n\n salt '*' modjk.get_running\n salt '*' modjk.get_running other-profile\n '''\n\n cmd = {\n 'cmd': 'list',\n 'mime': 'prop',\n }\n...
# -*- coding: utf-8 -*- ''' Control Modjk via the Apache Tomcat "Status" worker (http://tomcat.apache.org/connectors-doc/reference/status.html) Below is an example of the configuration needed for this module. This configuration data can be placed either in :ref:`grains <targeting-grains>` or :ref:`pillar <salt-pillars...
saltstack/salt
salt/modules/modjk.py
recover_all
python
def recover_all(lbn, profile='default'): ''' Set the all the workers in lbn to recover and activate them if they are not CLI Examples: .. code-block:: bash salt '*' modjk.recover_all loadbalancer1 salt '*' modjk.recover_all loadbalancer1 other-profile ''' ret = {} config ...
Set the all the workers in lbn to recover and activate them if they are not CLI Examples: .. code-block:: bash salt '*' modjk.recover_all loadbalancer1 salt '*' modjk.recover_all loadbalancer1 other-profile
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/modjk.py#L230-L257
[ "def get_running(profile='default'):\n '''\n Get the current running config (not from disk)\n\n CLI Examples:\n\n .. code-block:: bash\n\n salt '*' modjk.get_running\n salt '*' modjk.get_running other-profile\n '''\n\n cmd = {\n 'cmd': 'list',\n 'mime': 'prop',\n }\n...
# -*- coding: utf-8 -*- ''' Control Modjk via the Apache Tomcat "Status" worker (http://tomcat.apache.org/connectors-doc/reference/status.html) Below is an example of the configuration needed for this module. This configuration data can be placed either in :ref:`grains <targeting-grains>` or :ref:`pillar <salt-pillars...
saltstack/salt
salt/modules/modjk.py
lb_edit
python
def lb_edit(lbn, settings, profile='default'): ''' Edit the loadbalancer settings Note: http://tomcat.apache.org/connectors-doc/reference/status.html Data Parameters for the standard Update Action CLI Examples: .. code-block:: bash salt '*' modjk.lb_edit loadbalancer1 "{'vlr': 1, 'vl...
Edit the loadbalancer settings Note: http://tomcat.apache.org/connectors-doc/reference/status.html Data Parameters for the standard Update Action CLI Examples: .. code-block:: bash salt '*' modjk.lb_edit loadbalancer1 "{'vlr': 1, 'vlt': 60}" salt '*' modjk.lb_edit loadbalancer1 "{'vl...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/modjk.py#L280-L299
[ "def _do_http(opts, profile='default'):\n '''\n Make the http request and return the data\n '''\n\n ret = {}\n\n url = __salt__['config.get']('modjk:{0}:url'.format(profile), '')\n user = __salt__['config.get']('modjk:{0}:user'.format(profile), '')\n passwd = __salt__['config.get']('modjk:{0}:p...
# -*- coding: utf-8 -*- ''' Control Modjk via the Apache Tomcat "Status" worker (http://tomcat.apache.org/connectors-doc/reference/status.html) Below is an example of the configuration needed for this module. This configuration data can be placed either in :ref:`grains <targeting-grains>` or :ref:`pillar <salt-pillars...
saltstack/salt
salt/modules/modjk.py
bulk_stop
python
def bulk_stop(workers, lbn, profile='default'): ''' Stop all the given workers in the specific load balancer CLI Examples: .. code-block:: bash salt '*' modjk.bulk_stop node1,node2,node3 loadbalancer1 salt '*' modjk.bulk_stop node1,node2,node3 loadbalancer1 other-profile salt...
Stop all the given workers in the specific load balancer CLI Examples: .. code-block:: bash salt '*' modjk.bulk_stop node1,node2,node3 loadbalancer1 salt '*' modjk.bulk_stop node1,node2,node3 loadbalancer1 other-profile salt '*' modjk.bulk_stop ["node1","node2","node3"] loadbalancer1...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/modjk.py#L302-L328
[ "def worker_stop(worker, lbn, profile='default'):\n '''\n Set the worker to stopped state in the lbn load balancer\n\n CLI Examples:\n\n .. code-block:: bash\n\n salt '*' modjk.worker_activate node1 loadbalancer1\n salt '*' modjk.worker_activate node1 loadbalancer1 other-profile\n '''\n...
# -*- coding: utf-8 -*- ''' Control Modjk via the Apache Tomcat "Status" worker (http://tomcat.apache.org/connectors-doc/reference/status.html) Below is an example of the configuration needed for this module. This configuration data can be placed either in :ref:`grains <targeting-grains>` or :ref:`pillar <salt-pillars...
saltstack/salt
salt/modules/modjk.py
bulk_activate
python
def bulk_activate(workers, lbn, profile='default'): ''' Activate all the given workers in the specific load balancer CLI Examples: .. code-block:: bash salt '*' modjk.bulk_activate node1,node2,node3 loadbalancer1 salt '*' modjk.bulk_activate node1,node2,node3 loadbalancer1 other-profi...
Activate all the given workers in the specific load balancer CLI Examples: .. code-block:: bash salt '*' modjk.bulk_activate node1,node2,node3 loadbalancer1 salt '*' modjk.bulk_activate node1,node2,node3 loadbalancer1 other-profile salt '*' modjk.bulk_activate ["node1","node2","node3...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/modjk.py#L331-L357
[ "def worker_activate(worker, lbn, profile='default'):\n '''\n Set the worker to activate state in the lbn load balancer\n\n CLI Examples:\n\n .. code-block:: bash\n\n salt '*' modjk.worker_activate node1 loadbalancer1\n salt '*' modjk.worker_activate node1 loadbalancer1 other-profile\n ...
# -*- coding: utf-8 -*- ''' Control Modjk via the Apache Tomcat "Status" worker (http://tomcat.apache.org/connectors-doc/reference/status.html) Below is an example of the configuration needed for this module. This configuration data can be placed either in :ref:`grains <targeting-grains>` or :ref:`pillar <salt-pillars...
saltstack/salt
salt/modules/modjk.py
bulk_disable
python
def bulk_disable(workers, lbn, profile='default'): ''' Disable all the given workers in the specific load balancer CLI Examples: .. code-block:: bash salt '*' modjk.bulk_disable node1,node2,node3 loadbalancer1 salt '*' modjk.bulk_disable node1,node2,node3 loadbalancer1 other-profile ...
Disable all the given workers in the specific load balancer CLI Examples: .. code-block:: bash salt '*' modjk.bulk_disable node1,node2,node3 loadbalancer1 salt '*' modjk.bulk_disable node1,node2,node3 loadbalancer1 other-profile salt '*' modjk.bulk_disable ["node1","node2","node3"] l...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/modjk.py#L360-L386
[ "def worker_disable(worker, lbn, profile='default'):\n '''\n Set the worker to disable state in the lbn load balancer\n\n CLI Examples:\n\n .. code-block:: bash\n\n salt '*' modjk.worker_disable node1 loadbalancer1\n salt '*' modjk.worker_disable node1 loadbalancer1 other-profile\n '''\...
# -*- coding: utf-8 -*- ''' Control Modjk via the Apache Tomcat "Status" worker (http://tomcat.apache.org/connectors-doc/reference/status.html) Below is an example of the configuration needed for this module. This configuration data can be placed either in :ref:`grains <targeting-grains>` or :ref:`pillar <salt-pillars...
saltstack/salt
salt/modules/modjk.py
bulk_recover
python
def bulk_recover(workers, lbn, profile='default'): ''' Recover all the given workers in the specific load balancer CLI Examples: .. code-block:: bash salt '*' modjk.bulk_recover node1,node2,node3 loadbalancer1 salt '*' modjk.bulk_recover node1,node2,node3 loadbalancer1 other-profile ...
Recover all the given workers in the specific load balancer CLI Examples: .. code-block:: bash salt '*' modjk.bulk_recover node1,node2,node3 loadbalancer1 salt '*' modjk.bulk_recover node1,node2,node3 loadbalancer1 other-profile salt '*' modjk.bulk_recover ["node1","node2","node3"] l...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/modjk.py#L389-L415
[ "def worker_recover(worker, lbn, profile='default'):\n '''\n Set the worker to recover\n this module will fail if it is in OK state\n\n CLI Examples:\n\n .. code-block:: bash\n\n salt '*' modjk.worker_recover node1 loadbalancer1\n salt '*' modjk.worker_recover node1 loadbalancer1 other-...
# -*- coding: utf-8 -*- ''' Control Modjk via the Apache Tomcat "Status" worker (http://tomcat.apache.org/connectors-doc/reference/status.html) Below is an example of the configuration needed for this module. This configuration data can be placed either in :ref:`grains <targeting-grains>` or :ref:`pillar <salt-pillars...
saltstack/salt
salt/modules/modjk.py
worker_status
python
def worker_status(worker, profile='default'): ''' Return the state of the worker CLI Examples: .. code-block:: bash salt '*' modjk.worker_status node1 salt '*' modjk.worker_status node1 other-profile ''' config = get_running(profile) try: return { 'act...
Return the state of the worker CLI Examples: .. code-block:: bash salt '*' modjk.worker_status node1 salt '*' modjk.worker_status node1 other-profile
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/modjk.py#L418-L437
[ "def get_running(profile='default'):\n '''\n Get the current running config (not from disk)\n\n CLI Examples:\n\n .. code-block:: bash\n\n salt '*' modjk.get_running\n salt '*' modjk.get_running other-profile\n '''\n\n cmd = {\n 'cmd': 'list',\n 'mime': 'prop',\n }\n...
# -*- coding: utf-8 -*- ''' Control Modjk via the Apache Tomcat "Status" worker (http://tomcat.apache.org/connectors-doc/reference/status.html) Below is an example of the configuration needed for this module. This configuration data can be placed either in :ref:`grains <targeting-grains>` or :ref:`pillar <salt-pillars...
saltstack/salt
salt/modules/modjk.py
worker_recover
python
def worker_recover(worker, lbn, profile='default'): ''' Set the worker to recover this module will fail if it is in OK state CLI Examples: .. code-block:: bash salt '*' modjk.worker_recover node1 loadbalancer1 salt '*' modjk.worker_recover node1 loadbalancer1 other-profile '''...
Set the worker to recover this module will fail if it is in OK state CLI Examples: .. code-block:: bash salt '*' modjk.worker_recover node1 loadbalancer1 salt '*' modjk.worker_recover node1 loadbalancer1 other-profile
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/modjk.py#L440-L459
[ "def _do_http(opts, profile='default'):\n '''\n Make the http request and return the data\n '''\n\n ret = {}\n\n url = __salt__['config.get']('modjk:{0}:url'.format(profile), '')\n user = __salt__['config.get']('modjk:{0}:user'.format(profile), '')\n passwd = __salt__['config.get']('modjk:{0}:p...
# -*- coding: utf-8 -*- ''' Control Modjk via the Apache Tomcat "Status" worker (http://tomcat.apache.org/connectors-doc/reference/status.html) Below is an example of the configuration needed for this module. This configuration data can be placed either in :ref:`grains <targeting-grains>` or :ref:`pillar <salt-pillars...
saltstack/salt
salt/modules/modjk.py
worker_edit
python
def worker_edit(worker, lbn, settings, profile='default'): ''' Edit the worker settings Note: http://tomcat.apache.org/connectors-doc/reference/status.html Data Parameters for the standard Update Action CLI Examples: .. code-block:: bash salt '*' modjk.worker_edit node1 loadbalancer1...
Edit the worker settings Note: http://tomcat.apache.org/connectors-doc/reference/status.html Data Parameters for the standard Update Action CLI Examples: .. code-block:: bash salt '*' modjk.worker_edit node1 loadbalancer1 "{'vwf': 500, 'vwd': 60}" salt '*' modjk.worker_edit node1 loa...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/modjk.py#L507-L527
[ "def _do_http(opts, profile='default'):\n '''\n Make the http request and return the data\n '''\n\n ret = {}\n\n url = __salt__['config.get']('modjk:{0}:url'.format(profile), '')\n user = __salt__['config.get']('modjk:{0}:user'.format(profile), '')\n passwd = __salt__['config.get']('modjk:{0}:p...
# -*- coding: utf-8 -*- ''' Control Modjk via the Apache Tomcat "Status" worker (http://tomcat.apache.org/connectors-doc/reference/status.html) Below is an example of the configuration needed for this module. This configuration data can be placed either in :ref:`grains <targeting-grains>` or :ref:`pillar <salt-pillars...
saltstack/salt
salt/modules/nginx.py
build_info
python
def build_info(): ''' Return server and build arguments CLI Example: .. code-block:: bash salt '*' nginx.build_info ''' ret = {'info': []} out = __salt__['cmd.run']('{0} -V'.format(__detect_os())) for i in out.splitlines(): if i.startswith('configure argument'): ...
Return server and build arguments CLI Example: .. code-block:: bash salt '*' nginx.build_info
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nginx.py#L50-L70
null
# -*- coding: utf-8 -*- ''' Support for nginx ''' from __future__ import absolute_import, print_function, unicode_literals # Import 3rd-party libs from salt.ext.six.moves.urllib.request import urlopen as _urlopen # pylint: disable=no-name-in-module,import-error # Import salt libs import salt.utils.path import salt.u...
saltstack/salt
salt/modules/nginx.py
signal
python
def signal(signal=None): ''' Signals nginx to start, reload, reopen or stop. CLI Example: .. code-block:: bash salt '*' nginx.signal reload ''' valid_signals = ('start', 'reopen', 'stop', 'quit', 'reload') if signal not in valid_signals: return # Make sure you use th...
Signals nginx to start, reload, reopen or stop. CLI Example: .. code-block:: bash salt '*' nginx.signal reload
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nginx.py#L102-L136
null
# -*- coding: utf-8 -*- ''' Support for nginx ''' from __future__ import absolute_import, print_function, unicode_literals # Import 3rd-party libs from salt.ext.six.moves.urllib.request import urlopen as _urlopen # pylint: disable=no-name-in-module,import-error # Import salt libs import salt.utils.path import salt.u...
saltstack/salt
salt/modules/nginx.py
status
python
def status(url="http://127.0.0.1/status"): resp = _urlopen(url) status_data = resp.read() resp.close() lines = status_data.splitlines() if not len(lines) == 4: return # "Active connections: 1 " active_connections = lines[0].split()[2] # "server accepts handled requests" # " ...
Return the data from an Nginx status page as a dictionary. http://wiki.nginx.org/HttpStubStatusModule url The URL of the status page. Defaults to 'http://127.0.0.1/status' CLI Example: .. code-block:: bash salt '*' nginx.status
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nginx.py#L139-L175
null
# -*- coding: utf-8 -*- ''' Support for nginx ''' from __future__ import absolute_import, print_function, unicode_literals # Import 3rd-party libs from salt.ext.six.moves.urllib.request import urlopen as _urlopen # pylint: disable=no-name-in-module,import-error # Import salt libs import salt.utils.path import salt.u...
saltstack/salt
salt/proxy/esxi.py
init
python
def init(opts): ''' This function gets called when the proxy starts up. For ESXi devices, the host, login credentials, and, if configured, the protocol and port are cached. ''' log.debug('Initting esxi proxy module in process %s', os.getpid()) log.debug('Validating esxi proxy input') sch...
This function gets called when the proxy starts up. For ESXi devices, the host, login credentials, and, if configured, the protocol and port are cached.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/esxi.py#L314-L414
[ "def merge(obj_a, obj_b, strategy='smart', renderer='yaml', merge_lists=False):\n if strategy == 'smart':\n if renderer.split('|')[-1] == 'yamlex' or renderer.startswith('yamlex_'):\n strategy = 'aggregate'\n else:\n strategy = 'recurse'\n\n if strategy == 'list':\n ...
# -*- coding: utf-8 -*- ''' Proxy Minion interface module for managing VMware ESXi hosts. .. versionadded:: 2015.8.4 **Special Note: SaltStack thanks** `Adobe Corporation <http://adobe.com/>`_ **for their support in creating this Proxy Minion integration.** This proxy minion enables VMware ESXi (hereafter referred t...
saltstack/salt
salt/proxy/esxi.py
ping
python
def ping(): ''' Returns True if connection is to be done via a vCenter (no connection is attempted). Check to see if the host is responding when connecting directly via an ESXi host. CLI Example: .. code-block:: bash salt esxi-host test.ping ''' if DETAILS.get('esxi_host'): ...
Returns True if connection is to be done via a vCenter (no connection is attempted). Check to see if the host is responding when connecting directly via an ESXi host. CLI Example: .. code-block:: bash salt esxi-host test.ping
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/esxi.py#L436-L461
null
# -*- coding: utf-8 -*- ''' Proxy Minion interface module for managing VMware ESXi hosts. .. versionadded:: 2015.8.4 **Special Note: SaltStack thanks** `Adobe Corporation <http://adobe.com/>`_ **for their support in creating this Proxy Minion integration.** This proxy minion enables VMware ESXi (hereafter referred t...
saltstack/salt
salt/proxy/esxi.py
ch_config
python
def ch_config(cmd, *args, **kwargs): ''' This function is called by the :mod:`salt.modules.esxi.cmd <salt.modules.esxi.cmd>` shim. It then calls whatever is passed in ``cmd`` inside the :mod:`salt.modules.vsphere <salt.modules.vsphere>` module. Passes the return through from the vsphere module. ...
This function is called by the :mod:`salt.modules.esxi.cmd <salt.modules.esxi.cmd>` shim. It then calls whatever is passed in ``cmd`` inside the :mod:`salt.modules.vsphere <salt.modules.vsphere>` module. Passes the return through from the vsphere module. cmd The command to call inside salt....
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/esxi.py#L472-L505
null
# -*- coding: utf-8 -*- ''' Proxy Minion interface module for managing VMware ESXi hosts. .. versionadded:: 2015.8.4 **Special Note: SaltStack thanks** `Adobe Corporation <http://adobe.com/>`_ **for their support in creating this Proxy Minion integration.** This proxy minion enables VMware ESXi (hereafter referred t...
saltstack/salt
salt/proxy/esxi.py
find_credentials
python
def find_credentials(host): ''' Cycle through all the possible credentials and return the first one that works. ''' user_names = [__pillar__['proxy'].get('username', 'root')] passwords = __pillar__['proxy']['passwords'] for user in user_names: for password in passwords: t...
Cycle through all the possible credentials and return the first one that works.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/esxi.py#L508-L531
null
# -*- coding: utf-8 -*- ''' Proxy Minion interface module for managing VMware ESXi hosts. .. versionadded:: 2015.8.4 **Special Note: SaltStack thanks** `Adobe Corporation <http://adobe.com/>`_ **for their support in creating this Proxy Minion integration.** This proxy minion enables VMware ESXi (hereafter referred t...
saltstack/salt
salt/proxy/esxi.py
_grains
python
def _grains(host, protocol=None, port=None): ''' Helper function to the grains from the proxied device. ''' username, password = find_credentials(DETAILS['host']) ret = __salt__['vsphere.system_info'](host=host, username=username, ...
Helper function to the grains from the proxied device.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/esxi.py#L534-L545
[ "def find_credentials(host):\n '''\n Cycle through all the possible credentials and return the first one that\n works.\n '''\n user_names = [__pillar__['proxy'].get('username', 'root')]\n passwords = __pillar__['proxy']['passwords']\n for user in user_names:\n for password in passwords:\...
# -*- coding: utf-8 -*- ''' Proxy Minion interface module for managing VMware ESXi hosts. .. versionadded:: 2015.8.4 **Special Note: SaltStack thanks** `Adobe Corporation <http://adobe.com/>`_ **for their support in creating this Proxy Minion integration.** This proxy minion enables VMware ESXi (hereafter referred t...
saltstack/salt
salt/modules/telegram.py
post_message
python
def post_message(message, chat_id=None, token=None): ''' Send a message to a Telegram chat. :param message: The message to send to the Telegram chat. :param chat_id: (optional) The Telegram chat id. :param token: (optional) The Telegram API token. :return: Boolean if message was sent s...
Send a message to a Telegram chat. :param message: The message to send to the Telegram chat. :param chat_id: (optional) The Telegram chat id. :param token: (optional) The Telegram API token. :return: Boolean if message was sent successfully. CLI Example: .. code-block:: bash ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/telegram.py#L71-L97
[ "def _get_token():\n '''\n Retrieves and return the Telegram's configured token\n\n :return: String: the token string\n '''\n token = __salt__['config.get']('telegram:token') or \\\n __salt__['config.get']('telegram.token')\n if not token:\n raise SaltInvocationError('No Telegram ...
# -*- coding: utf-8 -*- ''' Module for sending messages via Telegram. :configuration: In order to send a message via the Telegram, certain configuration is required in /etc/salt/minion on the relevant minions or in the pillar. Some sample configs might look like:: telegram.chat_id: '123456789' ...
saltstack/salt
salt/modules/telegram.py
_post_message
python
def _post_message(message, chat_id, token): ''' Send a message to a Telegram chat. :param chat_id: The chat id. :param message: The message to send to the telegram chat. :param token: The Telegram API token. :return: Boolean if message was sent successfully. ''' ...
Send a message to a Telegram chat. :param chat_id: The chat id. :param message: The message to send to the telegram chat. :param token: The Telegram API token. :return: Boolean if message was sent successfully.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/telegram.py#L100-L140
null
# -*- coding: utf-8 -*- ''' Module for sending messages via Telegram. :configuration: In order to send a message via the Telegram, certain configuration is required in /etc/salt/minion on the relevant minions or in the pillar. Some sample configs might look like:: telegram.chat_id: '123456789' ...
saltstack/salt
salt/roster/ansible.py
targets
python
def targets(tgt, tgt_type='glob', **kwargs): ''' Return the targets from the ansible inventory_file Default: /etc/salt/roster ''' inventory = __runner__['salt.cmd']('cmd.run', 'ansible-inventory -i {0} --list'.format(get_roster_file(__opts__))) __context__['inventory'] = __utils__['json.loads'](...
Return the targets from the ansible inventory_file Default: /etc/salt/roster
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/roster/ansible.py#L115-L127
[ "def get_roster_file(options):\n '''\n Find respective roster file.\n\n :param options:\n :return:\n '''\n template = None\n # The __disable_custom_roster is always True if Salt SSH Client comes\n # from Salt API. In that case no way to define own 'roster_file', instead\n # this file need...
# -*- coding: utf-8 -*- ''' Read in an Ansible inventory file or script Flat inventory files should be in the regular ansible inventory format. .. code-block:: ini [servers] salt.gtmanfred.com ansible_ssh_user=gtmanfred ansible_ssh_host=127.0.0.1 ansible_ssh_port=22 ansible_ssh_pass='password' [desktop]...
saltstack/salt
salt/sdb/cache.py
set_
python
def set_(key, value, service=None, profile=None): # pylint: disable=W0613 ''' Set a key/value pair in the cache service ''' key, profile = _parse_key(key, profile) cache = salt.cache.Cache(__opts__) cache.store(profile['bank'], key, value) return get(key, service, profile)
Set a key/value pair in the cache service
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/sdb/cache.py#L66-L73
[ "def get(key, service=None, profile=None): # pylint: disable=W0613\n '''\n Get a value from the cache service\n '''\n key, profile = _parse_key(key, profile)\n cache = salt.cache.Cache(__opts__)\n return cache.fetch(profile['bank'], key=key)\n", "def _parse_key(key, profile):\n '''\n Pars...
# -*- coding: utf-8 -*- ''' cache Module :maintainer: SaltStack :maturity: New :platform: all .. versionadded:: 2017.7.0 This module provides access to Salt's cache subsystem. Like all sdb modules, the cache module requires a configuration profile to be configured in either the minion or master configu...
saltstack/salt
salt/sdb/cache.py
get
python
def get(key, service=None, profile=None): # pylint: disable=W0613 ''' Get a value from the cache service ''' key, profile = _parse_key(key, profile) cache = salt.cache.Cache(__opts__) return cache.fetch(profile['bank'], key=key)
Get a value from the cache service
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/sdb/cache.py#L76-L82
[ "def _parse_key(key, profile):\n '''\n Parse out a key and update the opts with any override data\n '''\n comps = key.split('?')\n if len(comps) > 1:\n for item in comps[1].split('&'):\n newkey, newval = item.split('=')\n profile[newkey] = newval\n if 'cachedir' in pro...
# -*- coding: utf-8 -*- ''' cache Module :maintainer: SaltStack :maturity: New :platform: all .. versionadded:: 2017.7.0 This module provides access to Salt's cache subsystem. Like all sdb modules, the cache module requires a configuration profile to be configured in either the minion or master configu...
saltstack/salt
salt/sdb/cache.py
delete
python
def delete(key, service=None, profile=None): # pylint: disable=W0613 ''' Get a value from the cache service ''' key, profile = _parse_key(key, profile) cache = salt.cache.Cache(__opts__) try: cache.flush(profile['bank'], key=key) return True except Exception: return ...
Get a value from the cache service
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/sdb/cache.py#L85-L95
[ "def _parse_key(key, profile):\n '''\n Parse out a key and update the opts with any override data\n '''\n comps = key.split('?')\n if len(comps) > 1:\n for item in comps[1].split('&'):\n newkey, newval = item.split('=')\n profile[newkey] = newval\n if 'cachedir' in pro...
# -*- coding: utf-8 -*- ''' cache Module :maintainer: SaltStack :maturity: New :platform: all .. versionadded:: 2017.7.0 This module provides access to Salt's cache subsystem. Like all sdb modules, the cache module requires a configuration profile to be configured in either the minion or master configu...
saltstack/salt
salt/sdb/cache.py
_parse_key
python
def _parse_key(key, profile): ''' Parse out a key and update the opts with any override data ''' comps = key.split('?') if len(comps) > 1: for item in comps[1].split('&'): newkey, newval = item.split('=') profile[newkey] = newval if 'cachedir' in profile: ...
Parse out a key and update the opts with any override data
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/sdb/cache.py#L98-L109
null
# -*- coding: utf-8 -*- ''' cache Module :maintainer: SaltStack :maturity: New :platform: all .. versionadded:: 2017.7.0 This module provides access to Salt's cache subsystem. Like all sdb modules, the cache module requires a configuration profile to be configured in either the minion or master configu...
saltstack/salt
salt/tokens/rediscluster.py
_redis_client
python
def _redis_client(opts): ''' Connect to the redis host and return a StrictRedisCluster client object. If connection fails then return None. ''' redis_host = opts.get("eauth_redis_host", "localhost") redis_port = opts.get("eauth_redis_port", 6379) try: return rediscluster.StrictRedisC...
Connect to the redis host and return a StrictRedisCluster client object. If connection fails then return None.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/tokens/rediscluster.py#L48-L62
null
# -*- coding: utf-8 -*- ''' Provide token storage in Redis cluster. To get started simply start a redis cluster and assign all hashslots to the connected nodes. Add the redis hostname and port to master configs as eauth_redis_host and eauth_redis_port. Default values for these configs are as follow: .. code-block:: ...
saltstack/salt
salt/tokens/rediscluster.py
mk_token
python
def mk_token(opts, tdata): ''' Mint a new token using the config option hash_type and store tdata with 'token' attribute set to the token. This module uses the hash of random 512 bytes as a token. :param opts: Salt master config options :param tdata: Token data to be stored with 'token' attirbu...
Mint a new token using the config option hash_type and store tdata with 'token' attribute set to the token. This module uses the hash of random 512 bytes as a token. :param opts: Salt master config options :param tdata: Token data to be stored with 'token' attirbute of this dict set to the token. :...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/tokens/rediscluster.py#L65-L99
[ "def _redis_client(opts):\n '''\n Connect to the redis host and return a StrictRedisCluster client object.\n If connection fails then return None.\n '''\n redis_host = opts.get(\"eauth_redis_host\", \"localhost\")\n redis_port = opts.get(\"eauth_redis_port\", 6379)\n try:\n return redisc...
# -*- coding: utf-8 -*- ''' Provide token storage in Redis cluster. To get started simply start a redis cluster and assign all hashslots to the connected nodes. Add the redis hostname and port to master configs as eauth_redis_host and eauth_redis_port. Default values for these configs are as follow: .. code-block:: ...
saltstack/salt
salt/tokens/rediscluster.py
get_token
python
def get_token(opts, tok): ''' Fetch the token data from the store. :param opts: Salt master config options :param tok: Token value to get :returns: Token data if successful. Empty dict if failed. ''' redis_client = _redis_client(opts) if not redis_client: return {} serial = ...
Fetch the token data from the store. :param opts: Salt master config options :param tok: Token value to get :returns: Token data if successful. Empty dict if failed.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/tokens/rediscluster.py#L102-L122
[ "def _redis_client(opts):\n '''\n Connect to the redis host and return a StrictRedisCluster client object.\n If connection fails then return None.\n '''\n redis_host = opts.get(\"eauth_redis_host\", \"localhost\")\n redis_port = opts.get(\"eauth_redis_port\", 6379)\n try:\n return redisc...
# -*- coding: utf-8 -*- ''' Provide token storage in Redis cluster. To get started simply start a redis cluster and assign all hashslots to the connected nodes. Add the redis hostname and port to master configs as eauth_redis_host and eauth_redis_port. Default values for these configs are as follow: .. code-block:: ...
saltstack/salt
salt/tokens/rediscluster.py
rm_token
python
def rm_token(opts, tok): ''' Remove token from the store. :param opts: Salt master config options :param tok: Token to remove :returns: Empty dict if successful. None if failed. ''' redis_client = _redis_client(opts) if not redis_client: return try: redis_client.dele...
Remove token from the store. :param opts: Salt master config options :param tok: Token to remove :returns: Empty dict if successful. None if failed.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/tokens/rediscluster.py#L125-L140
[ "def _redis_client(opts):\n '''\n Connect to the redis host and return a StrictRedisCluster client object.\n If connection fails then return None.\n '''\n redis_host = opts.get(\"eauth_redis_host\", \"localhost\")\n redis_port = opts.get(\"eauth_redis_port\", 6379)\n try:\n return redisc...
# -*- coding: utf-8 -*- ''' Provide token storage in Redis cluster. To get started simply start a redis cluster and assign all hashslots to the connected nodes. Add the redis hostname and port to master configs as eauth_redis_host and eauth_redis_port. Default values for these configs are as follow: .. code-block:: ...
saltstack/salt
salt/tokens/rediscluster.py
list_tokens
python
def list_tokens(opts): ''' List all tokens in the store. :param opts: Salt master config options :returns: List of dicts (token_data) ''' ret = [] redis_client = _redis_client(opts) if not redis_client: return [] serial = salt.payload.Serial(opts) try: return [k....
List all tokens in the store. :param opts: Salt master config options :returns: List of dicts (token_data)
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/tokens/rediscluster.py#L143-L159
[ "def _redis_client(opts):\n '''\n Connect to the redis host and return a StrictRedisCluster client object.\n If connection fails then return None.\n '''\n redis_host = opts.get(\"eauth_redis_host\", \"localhost\")\n redis_port = opts.get(\"eauth_redis_port\", 6379)\n try:\n return redisc...
# -*- coding: utf-8 -*- ''' Provide token storage in Redis cluster. To get started simply start a redis cluster and assign all hashslots to the connected nodes. Add the redis hostname and port to master configs as eauth_redis_host and eauth_redis_port. Default values for these configs are as follow: .. code-block:: ...
saltstack/salt
salt/states/wordpress.py
installed
python
def installed(name, user, admin_user, admin_password, admin_email, title, url): ''' Run the initial setup of wordpress name path to the wordpress installation user user that owns the files for the wordpress installation admin_user username for wordpress website administrat...
Run the initial setup of wordpress name path to the wordpress installation user user that owns the files for the wordpress installation admin_user username for wordpress website administrator user admin_password password for wordpress website administrator user a...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/wordpress.py#L16-L78
null
# -*- coding: utf-8 -*- ''' This state module is used to manage Wordpress installations :depends: wp binary from http://wp-cli.org/ ''' # Import Python libs from __future__ import absolute_import, print_function, unicode_literals def __virtual__(): return 'wordpress.show_plugin' in __salt__ def activated(nam...
saltstack/salt
salt/states/wordpress.py
activated
python
def activated(name, path, user): ''' Activate wordpress plugins name name of plugin to activate path path to wordpress installation user user who should own the files in the wordpress installation .. code-block:: yaml HyperDB: wordpress.activated: ...
Activate wordpress plugins name name of plugin to activate path path to wordpress installation user user who should own the files in the wordpress installation .. code-block:: yaml HyperDB: wordpress.activated: - path: /var/www/html ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/wordpress.py#L81-L135
null
# -*- coding: utf-8 -*- ''' This state module is used to manage Wordpress installations :depends: wp binary from http://wp-cli.org/ ''' # Import Python libs from __future__ import absolute_import, print_function, unicode_literals def __virtual__(): return 'wordpress.show_plugin' in __salt__ def installed(name...
saltstack/salt
salt/modules/scp_mod.py
_prepare_connection
python
def _prepare_connection(**kwargs): ''' Prepare the underlying SSH connection with the remote target. ''' paramiko_kwargs, scp_kwargs = _select_kwargs(**kwargs) ssh = paramiko.SSHClient() if paramiko_kwargs.pop('auto_add_policy', False): ssh.set_missing_host_key_policy(paramiko.AutoAddPol...
Prepare the underlying SSH connection with the remote target.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/scp_mod.py#L55-L66
[ "def _select_kwargs(**kwargs):\n paramiko_kwargs = {}\n scp_kwargs = {}\n PARAMIKO_KWARGS, _, _, _ = inspect.getargspec(paramiko.SSHClient.connect)\n PARAMIKO_KWARGS.pop(0) # strip self\n PARAMIKO_KWARGS.append('auto_add_policy')\n SCP_KWARGS, _, _, _ = inspect.getargspec(scp.SCPClient.__init__)\...
# -*- coding: utf-8 -*- ''' SCP Module ========== .. versionadded:: 2019.2.0 Module to copy files via `SCP <https://man.openbsd.org/scp>`_ ''' from __future__ import absolute_import, print_function, unicode_literals # Import python libs import logging import inspect # Import salt modules from salt.ext import six t...
saltstack/salt
salt/modules/scp_mod.py
get
python
def get(remote_path, local_path='', recursive=False, preserve_times=False, **kwargs): ''' Transfer files and directories from remote host to the localhost of the Minion. remote_path Path to retrieve from remote host. Since this is evaluated by scp on the ...
Transfer files and directories from remote host to the localhost of the Minion. remote_path Path to retrieve from remote host. Since this is evaluated by scp on the remote host, shell wildcards and environment variables may be used. recursive: ``False`` Transfer files and directori...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/scp_mod.py#L69-L151
[ "def _prepare_connection(**kwargs):\n '''\n Prepare the underlying SSH connection with the remote target.\n '''\n paramiko_kwargs, scp_kwargs = _select_kwargs(**kwargs)\n ssh = paramiko.SSHClient()\n if paramiko_kwargs.pop('auto_add_policy', False):\n ssh.set_missing_host_key_policy(paramik...
# -*- coding: utf-8 -*- ''' SCP Module ========== .. versionadded:: 2019.2.0 Module to copy files via `SCP <https://man.openbsd.org/scp>`_ ''' from __future__ import absolute_import, print_function, unicode_literals # Import python libs import logging import inspect # Import salt modules from salt.ext import six t...
saltstack/salt
salt/modules/scp_mod.py
put
python
def put(files, remote_path=None, recursive=False, preserve_times=False, saltenv='base', **kwargs): ''' Transfer files and directories to remote host. files A single path or a list of paths to be transferred. remote_path The path on the remote dev...
Transfer files and directories to remote host. files A single path or a list of paths to be transferred. remote_path The path on the remote device where to store the files. recursive: ``True`` Transfer files and directories recursively. preserve_times: ``False`` Prese...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/scp_mod.py#L154-L244
[ "def _prepare_connection(**kwargs):\n '''\n Prepare the underlying SSH connection with the remote target.\n '''\n paramiko_kwargs, scp_kwargs = _select_kwargs(**kwargs)\n ssh = paramiko.SSHClient()\n if paramiko_kwargs.pop('auto_add_policy', False):\n ssh.set_missing_host_key_policy(paramik...
# -*- coding: utf-8 -*- ''' SCP Module ========== .. versionadded:: 2019.2.0 Module to copy files via `SCP <https://man.openbsd.org/scp>`_ ''' from __future__ import absolute_import, print_function, unicode_literals # Import python libs import logging import inspect # Import salt modules from salt.ext import six t...
saltstack/salt
salt/modules/bigip.py
_build_session
python
def _build_session(username, password, trans_label=None): ''' Create a session to be used when connecting to iControl REST. ''' bigip = requests.session() bigip.auth = (username, password) bigip.verify = False bigip.headers.update({'Content-Type': 'application/json'}) if trans_label: ...
Create a session to be used when connecting to iControl REST.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bigip.py#L43-L62
null
# -*- coding: utf-8 -*- ''' An execution module which can manipulate an f5 bigip via iControl REST :maturity: develop :platform: f5_bigip_11.6 ''' # Import python libs from __future__ import absolute_import, print_function, unicode_literals import salt.utils.json # Import third party libs try: i...
saltstack/salt
salt/modules/bigip.py
_load_response
python
def _load_response(response): ''' Load the response from json data, return the dictionary or raw text ''' try: data = salt.utils.json.loads(response.text) except ValueError: data = response.text ret = {'code': response.status_code, 'content': data} return ret
Load the response from json data, return the dictionary or raw text
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bigip.py#L65-L77
[ "def loads(s, **kwargs):\n '''\n .. versionadded:: 2018.3.0\n\n Wraps json.loads and prevents a traceback in the event that a bytestring is\n passed to the function. (Python < 3.6 cannot load bytestrings)\n\n You can pass an alternate json module (loaded via import_json() above)\n using the _json_...
# -*- coding: utf-8 -*- ''' An execution module which can manipulate an f5 bigip via iControl REST :maturity: develop :platform: f5_bigip_11.6 ''' # Import python libs from __future__ import absolute_import, print_function, unicode_literals import salt.utils.json # Import third party libs try: i...
saltstack/salt
salt/modules/bigip.py
_load_connection_error
python
def _load_connection_error(hostname, error): ''' Format and Return a connection error ''' ret = {'code': None, 'content': 'Error: Unable to connect to the bigip device: {host}\n{error}'.format(host=hostname, error=error)} return ret
Format and Return a connection error
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bigip.py#L80-L87
null
# -*- coding: utf-8 -*- ''' An execution module which can manipulate an f5 bigip via iControl REST :maturity: develop :platform: f5_bigip_11.6 ''' # Import python libs from __future__ import absolute_import, print_function, unicode_literals import salt.utils.json # Import third party libs try: i...
saltstack/salt
salt/modules/bigip.py
_loop_payload
python
def _loop_payload(params): ''' Pass in a dictionary of parameters, loop through them and build a payload containing, parameters who's values are not None. ''' #construct the payload payload = {} #set the payload for param, value in six.iteritems(params): if value is not None: ...
Pass in a dictionary of parameters, loop through them and build a payload containing, parameters who's values are not None.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bigip.py#L90-L104
[ "def iteritems(d, **kw):\n return d.iteritems(**kw)\n" ]
# -*- coding: utf-8 -*- ''' An execution module which can manipulate an f5 bigip via iControl REST :maturity: develop :platform: f5_bigip_11.6 ''' # Import python libs from __future__ import absolute_import, print_function, unicode_literals import salt.utils.json # Import third party libs try: i...
saltstack/salt
salt/modules/bigip.py
_build_list
python
def _build_list(option_value, item_kind): ''' pass in an option to check for a list of items, create a list of dictionary of items to set for this option ''' #specify profiles if provided if option_value is not None: items = [] #if user specified none, return an empty list ...
pass in an option to check for a list of items, create a list of dictionary of items to set for this option
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bigip.py#L107-L135
null
# -*- coding: utf-8 -*- ''' An execution module which can manipulate an f5 bigip via iControl REST :maturity: develop :platform: f5_bigip_11.6 ''' # Import python libs from __future__ import absolute_import, print_function, unicode_literals import salt.utils.json # Import third party libs try: i...
saltstack/salt
salt/modules/bigip.py
_determine_toggles
python
def _determine_toggles(payload, toggles): ''' BigIP can't make up its mind if it likes yes / no or true or false. Figure out what it likes to hear without confusing the user. ''' for toggle, definition in six.iteritems(toggles): #did the user specify anything? if definition['value']...
BigIP can't make up its mind if it likes yes / no or true or false. Figure out what it likes to hear without confusing the user.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bigip.py#L138-L159
[ "def iteritems(d, **kw):\n return d.iteritems(**kw)\n" ]
# -*- coding: utf-8 -*- ''' An execution module which can manipulate an f5 bigip via iControl REST :maturity: develop :platform: f5_bigip_11.6 ''' # Import python libs from __future__ import absolute_import, print_function, unicode_literals import salt.utils.json # Import third party libs try: i...
saltstack/salt
salt/modules/bigip.py
_set_value
python
def _set_value(value): ''' A function to detect if user is trying to pass a dictionary or list. parse it and return a dictionary list or a string ''' #don't continue if already an acceptable data-type if isinstance(value, bool) or isinstance(value, dict) or isinstance(value, list): retu...
A function to detect if user is trying to pass a dictionary or list. parse it and return a dictionary list or a string
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bigip.py#L162-L219
[ "def _set_value(value):\n '''\n A function to detect if user is trying to pass a dictionary or list. parse it and return a\n dictionary list or a string\n '''\n #don't continue if already an acceptable data-type\n if isinstance(value, bool) or isinstance(value, dict) or isinstance(value, list):\n...
# -*- coding: utf-8 -*- ''' An execution module which can manipulate an f5 bigip via iControl REST :maturity: develop :platform: f5_bigip_11.6 ''' # Import python libs from __future__ import absolute_import, print_function, unicode_literals import salt.utils.json # Import third party libs try: i...
saltstack/salt
salt/modules/bigip.py
start_transaction
python
def start_transaction(hostname, username, password, label): ''' A function to connect to a bigip device and start a new transaction. hostname The host/address of the bigip device username The iControl REST username password The iControl REST password label The na...
A function to connect to a bigip device and start a new transaction. hostname The host/address of the bigip device username The iControl REST username password The iControl REST password label The name / alias for this transaction. The actual transaction id will...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bigip.py#L222-L268
[ "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 -*- ''' An execution module which can manipulate an f5 bigip via iControl REST :maturity: develop :platform: f5_bigip_11.6 ''' # Import python libs from __future__ import absolute_import, print_function, unicode_literals import salt.utils.json # Import third party libs try: i...
saltstack/salt
salt/modules/bigip.py
list_transaction
python
def list_transaction(hostname, username, password, label): ''' A function to connect to a bigip device and list an existing transaction. hostname The host/address of the bigip device username The iControl REST username password The iControl REST password label th...
A function to connect to a bigip device and list an existing transaction. hostname The host/address of the bigip device username The iControl REST username password The iControl REST password label the label of this transaction stored within the grain: ``bigip_f5...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bigip.py#L271-L307
[ "def _build_session(username, password, trans_label=None):\n '''\n Create a session to be used when connecting to iControl REST.\n '''\n\n bigip = requests.session()\n bigip.auth = (username, password)\n bigip.verify = False\n bigip.headers.update({'Content-Type': 'application/json'})\n\n if...
# -*- coding: utf-8 -*- ''' An execution module which can manipulate an f5 bigip via iControl REST :maturity: develop :platform: f5_bigip_11.6 ''' # Import python libs from __future__ import absolute_import, print_function, unicode_literals import salt.utils.json # Import third party libs try: i...
saltstack/salt
salt/modules/bigip.py
create_node
python
def create_node(hostname, username, password, name, address, trans_label=None): ''' A function to connect to a bigip device and create a node. hostname The host/address of the bigip device username The iControl REST username password The iControl REST password name ...
A function to connect to a bigip device and create a node. hostname The host/address of the bigip device username The iControl REST username password The iControl REST password name The name of the node address The address of the node trans_label ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bigip.py#L430-L469
[ "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 -*- ''' An execution module which can manipulate an f5 bigip via iControl REST :maturity: develop :platform: f5_bigip_11.6 ''' # Import python libs from __future__ import absolute_import, print_function, unicode_literals import salt.utils.json # Import third party libs try: i...
saltstack/salt
salt/modules/bigip.py
modify_node
python
def modify_node(hostname, username, password, name, connection_limit=None, description=None, dynamic_ratio=None, logging=None, monitor=None, rate_limit=None, ratio=None, session=None, ...
A function to connect to a bigip device and modify an existing node. hostname The host/address of the bigip device username The iControl REST username password The iControl REST password name The name of the node to modify connection_limit [integer] descr...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bigip.py#L472-L549
[ "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 -*- ''' An execution module which can manipulate an f5 bigip via iControl REST :maturity: develop :platform: f5_bigip_11.6 ''' # Import python libs from __future__ import absolute_import, print_function, unicode_literals import salt.utils.json # Import third party libs try: i...
saltstack/salt
salt/modules/bigip.py
create_pool
python
def create_pool(hostname, username, password, name, members=None, allow_nat=None, allow_snat=None, description=None, gateway_failsafe_device=None, ignore_persisted_weight=None, ip_tos_to_client=None, ip_tos_t...
A function to connect to a bigip device and create a pool. hostname The host/address of the bigip device username The iControl REST username password The iControl REST password name The name of the pool to create. members List of comma delimited pool members ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bigip.py#L622-L773
[ "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 -*- ''' An execution module which can manipulate an f5 bigip via iControl REST :maturity: develop :platform: f5_bigip_11.6 ''' # Import python libs from __future__ import absolute_import, print_function, unicode_literals import salt.utils.json # Import third party libs try: i...
saltstack/salt
salt/modules/bigip.py
replace_pool_members
python
def replace_pool_members(hostname, username, password, name, members): ''' A function to connect to a bigip device and replace members of an existing pool with new members. hostname The host/address of the bigip device username The iControl REST username password The iContro...
A function to connect to a bigip device and replace members of an existing pool with new members. hostname The host/address of the bigip device username The iControl REST username password The iControl REST password name The name of the pool to modify members ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bigip.py#L956-L1020
[ "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 -*- ''' An execution module which can manipulate an f5 bigip via iControl REST :maturity: develop :platform: f5_bigip_11.6 ''' # Import python libs from __future__ import absolute_import, print_function, unicode_literals import salt.utils.json # Import third party libs try: i...
saltstack/salt
salt/modules/bigip.py
add_pool_member
python
def add_pool_member(hostname, username, password, name, member): ''' A function to connect to a bigip device and add a new member to an existing pool. hostname The host/address of the bigip device username The iControl REST username password The iControl REST password na...
A function to connect to a bigip device and add a new member to an existing pool. hostname The host/address of the bigip device username The iControl REST username password The iControl REST password name The name of the pool to modify member The name of the ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bigip.py#L1023-L1076
[ "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 -*- ''' An execution module which can manipulate an f5 bigip via iControl REST :maturity: develop :platform: f5_bigip_11.6 ''' # Import python libs from __future__ import absolute_import, print_function, unicode_literals import salt.utils.json # Import third party libs try: i...