Module Expr Str ImportFrom alias Import alias Import alias Import alias ImportFrom alias ImportFrom alias identifier alias identifier alias identifier Import alias Import alias Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Str FunctionDef arguments args defaults body Return NameLoad decorator_list FunctionDef arguments args NameParam defaults NameLoad body Expr Str Assign NameStore Dict Str Str Str Str Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad NameLoad NameLoad keyword NameLoad keyword NameLoad If CompareNotIn Str NameLoad body Expr Call AttributeLoad NameLoad attr Str Assign SubscriptStore NameLoad Index Str Str If CompareNotIn Str NameLoad body Expr Call AttributeLoad NameLoad attr Str Assign SubscriptStore NameLoad Index Str Str Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr Assign SubscriptStore NameLoad Index Str SubscriptLoad NameLoad Index Str Assign SubscriptStore NameLoad Index Str Call AttributeLoad NameLoad attr Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults NameLoad NameLoad body Expr Str Assign NameStore Call NameLoad NameLoad Assign NameStore Call NameLoad NameLoad keyword NameLoad If NameLoad body Expr Call AttributeLoad NameLoad attr Str NameLoad Assign AttributeStore NameLoad attr Lambda arguments args defaults NameLoad TryExcept body Assign NameStore Call AttributeLoad NameLoad attr NameLoad handlers ExceptHandler type NameLoad name NameStore body Return Dict Str Call AttributeLoad Str attr NameLoad Return Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call NameLoad NameLoad Assign NameStore Call NameLoad Str BinOpAdd SubscriptLoad NameLoad Index Str Str If CompareNotIn SubscriptLoad NameLoad Index Str NameLoad body Assign NameStore Call NameLoad Str BinOpAdd SubscriptLoad NameLoad Index Str SubscriptLoad NameLoad Index Str If BoolOpOr CompareNotIn Str NameLoad CompareIsNot SubscriptLoad NameLoad Index Str NameLoad body Expr Call AttributeLoad NameLoad attr Call AttributeLoad Str attr SubscriptLoad NameLoad Index Str Expr Call AttributeLoad NameLoad attr Str Return Expr Call AttributeLoad NameLoad attr Call AttributeLoad Str attr SubscriptLoad NameLoad Index Str Assign NameStore Call NameLoad NameLoad Assign NameStore Call NameLoad Str BinOpAdd BinOpAdd BinOpAdd SubscriptLoad NameLoad Index Str SubscriptLoad NameLoad Index Str Str SubscriptLoad NameLoad Index Str Str Call AttributeLoad NameLoad attr NameLoad If BoolOpOr CompareNotIn Str NameLoad CompareIsNot SubscriptLoad NameLoad Index Str NameLoad body Expr Call AttributeLoad NameLoad attr Call AttributeLoad Str attr NameLoad Expr Call AttributeLoad NameLoad attr Str decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call NameLoad keyword NameLoad Assign NameStore Call NameLoad Str BinOpAdd BinOpAdd BinOpAdd SubscriptLoad NameLoad Index Str SubscriptLoad NameLoad Index Str Str NameLoad If CompareIn Str NameLoad body Expr Call AttributeLoad NameLoad attr Call AttributeLoad Str attr NameLoad NameLoad Return Dict Return Dict SubscriptLoad NameLoad Index Str NameLoad decorator_list FunctionDef arguments args defaults body Expr Str Assign NameStore Call NameLoad keyword NameLoad Assign NameStore Call NameLoad Str BinOpAdd BinOpAdd SubscriptLoad NameLoad Index Str SubscriptLoad NameLoad Index Str Str If CompareNotIn Str NameLoad body Expr Call AttributeLoad NameLoad attr Call AttributeLoad Str attr NameLoad Return Dict Assign NameStore Dict For NameStore SubscriptLoad NameLoad Index Str body Assign NameStore SubscriptLoad NameLoad Index Str If UnaryOpNot Call AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr NameLoad body Continue Assign SubscriptStore NameLoad Index NameLoad Call AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr NameLoad SubscriptLoad NameLoad Index Str Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call NameLoad keyword NameLoad Assign NameStore Dict For NameStore Call NameLoad body Assign NameStore Call NameLoad Str BinOpAdd BinOpAdd SubscriptLoad NameLoad Index Str SubscriptLoad NameLoad Index Str Call AttributeLoad Str attr NameLoad NameLoad NameLoad NameLoad If CompareIn Str NameLoad body Expr Call AttributeLoad NameLoad attr Call AttributeLoad Str attr SubscriptLoad NameLoad Index Str Continue If CompareLt Call NameLoad SubscriptLoad NameLoad Index Str Num body Continue Assign SubscriptStore NameLoad Index NameLoad SubscriptLoad SubscriptLoad SubscriptLoad NameLoad Index Str Index Num Index Str Return NameLoad decorator_list FunctionDef arguments args defaults body Expr Str Assign NameStore Call NameLoad keyword NameLoad If UnaryOpNot Call NameLoad body Return ListLoad Assign NameStore Call NameLoad Str BinOpAdd BinOpAdd SubscriptLoad NameLoad Index Str SubscriptLoad NameLoad Index Str Str If CompareNotIn Str NameLoad body Expr Call AttributeLoad NameLoad attr Call AttributeLoad Str attr NameLoad Return ListLoad Assign NameStore ListLoad For NameStore SubscriptLoad NameLoad Index Str body Expr Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index Str Return NameLoad decorator_list FunctionDef arguments args defaults body Expr Str Assign NameStore Call NameLoad keyword NameLoad Assign NameStore Call NameLoad Str BinOpAdd BinOpAdd SubscriptLoad NameLoad Index Str SubscriptLoad NameLoad Index Str Str If CompareIn Str NameLoad body Return Call NameLoad For NameStore Call NameLoad body If CompareNotIn NameLoad SubscriptLoad NameLoad Index Str body Return Call NameLoad Return NameLoad decorator_list FunctionDef arguments args defaults body Expr Str Assign NameStore Dict Assign SubscriptStore NameLoad Index Str Dict Assign SubscriptStore SubscriptLoad NameLoad Index Str Index Str Str Assign SubscriptStore SubscriptLoad NameLoad Index Str Index Str Str Assign SubscriptStore NameLoad Index Str Dict Assign SubscriptStore SubscriptLoad NameLoad Index Str Index Str Str Return NameLoad decorator_list FunctionDef arguments args defaults body Expr Str Assign NameStore Call NameLoad keyword NameLoad Assign NameStore Dict Assign SubscriptStore NameLoad Index Str Call NameLoad Assign SubscriptStore NameLoad Index Str Str Assign NameStore Call NameLoad Str BinOpAdd BinOpAdd SubscriptLoad NameLoad Index Str SubscriptLoad NameLoad Index Str Str Str Call AttributeLoad NameLoad attr NameLoad If CompareIn Str NameLoad body Expr Call AttributeLoad NameLoad attr Call AttributeLoad Str attr SubscriptLoad NameLoad Index Str Return NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults NameLoad NameLoad body Expr Str Return IfExp CompareIsNot NameLoad NameLoad NameLoad Call AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Pass decorator_list
N/A N/A 
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/'

Alternative configuration values can be used by prefacing the configuration.
Any values not found in the alternative configuration will be pulled from
the default location:

.. code-block:: yaml

    alternative.couchdb.db: 'salt'
    alternative.couchdb.url: 'http://salt:5984/'

To use the couchdb returner, append ``--return couchdb`` to the salt command. Example:

.. code-block:: bash

    salt '*' test.ping --return couchdb

To use the alternative configuration, append ``--return_config alternative`` to the salt command.

.. versionadded:: 2015.5.0

.. code-block:: bash

    salt '*' test.ping --return couchdb --return_config alternative

To override individual configuration items, append --return_kwargs '{"key:": "value"}' to the salt command.

.. versionadded:: 2016.3.0

.. code-block:: bash

    salt '*' test.ping --return couchdb --return_kwargs '{"db": "another-salt"}'

On concurrent database access
==============================

As this returner creates a couchdb document whith the salt job id as document id
and as only one document with a given id can exist in a given couchdb database,
it is advised for most setups that every minion be configured to write to it own
database (the value of ``couchdb.db`` may be suffixed with the minion id),
otherwise multi-minion targeting can lead to losing output:

* the first returning minion is able to create a document in the database
* other minions fail with ``{'error': 'HTTP Error 409: Conflict'}``
 __future__ absolute_import N/A logging N/A time N/A json salt.ext.six.moves.urllib.error HTTPError salt.ext.six.moves.urllib.request Request _Request HTTPHandler _HTTPHandler build_opener _build_opener N/A salt.utils.jid N/A salt.returners N/A log N/A N/A logging getLogger __name__ N/A __virtualname__ couchdb __virtual__ N/A N/A N/A N/A N/A __virtualname__ N/A _get_options N/A N/A ret N/A None N/A N/A 
    Get the couchdb options from salt.
     N/A attrs N/A url db url db N/A _options N/A N/A N/A salt returners get_returner_options __virtualname__ ret attrs __salt__ __salt__ __opts__ __opts__ N/A N/A url _options N/A N/A N/A N/A log debug Using default url. N/A N/A _options N/A url http://salt:5984/ N/A N/A db _options N/A N/A N/A N/A log debug Using default database. N/A N/A _options N/A db salt N/A _options N/A _generate_doc N/A N/A ret N/A N/A N/A 
    Create a object that will be saved into the database based on
    options.
     N/A retc N/A N/A ret copy N/A N/A retc N/A _id N/A ret N/A jid N/A N/A retc N/A timestamp N/A N/A time time N/A retc N/A _request N/A N/A method url content_type _data N/A None None N/A N/A 
    Makes a HTTP request. Returns the JSON parse, or an obj with an error.
     N/A opener N/A _build_opener _HTTPHandler N/A request N/A _Request url data _data N/A content_type N/A N/A N/A N/A request add_header Content-Type content_type N/A N/A request get_method N/A N/A N/A N/A method N/A N/A N/A handler N/A N/A opener open request N/A N/A N/A HTTPError N/A exc N/A N/A N/A error N/A N/A {0} format exc N/A N/A N/A json loads N/A N/A handler read N/A returner N/A N/A ret N/A N/A N/A 
    Take in the return and shove it into the couchdb database.
     N/A options N/A _get_options ret N/A _response N/A _request GET N/A N/A options N/A url _all_dbs N/A N/A N/A options N/A db _response N/A N/A _response N/A _request PUT N/A N/A options N/A url N/A options N/A db N/A N/A N/A ok _response N/A N/A _response N/A ok True N/A N/A N/A N/A log error N/A N/A Unable to create database "{0}" format N/A options N/A db N/A N/A N/A log error Nothing logged! Lost data. N/A N/A N/A N/A log info N/A N/A Created database "{0}" format N/A options N/A db N/A doc N/A _generate_doc ret N/A _response N/A _request PUT N/A N/A N/A N/A options N/A url N/A options N/A db / N/A doc N/A _id application/json N/A N/A json dumps doc N/A N/A N/A ok _response N/A N/A _response N/A ok True N/A N/A N/A N/A log error N/A N/A Unable to create document: "{0}" format _response N/A N/A N/A log error Nothing logged! Lost data. N/A get_jid N/A N/A jid N/A N/A N/A 
    Get the document with a given JID.
     N/A options N/A _get_options ret None N/A _response N/A _request GET N/A N/A N/A N/A options N/A url N/A options N/A db / jid N/A N/A error _response N/A N/A N/A N/A log error N/A N/A Unable to get JID "{0}" : "{1}" format jid _response N/A N/A N/A N/A N/A _response N/A id _response N/A get_jids N/A N/A N/A N/A N/A 
    List all the jobs that we have..
     N/A options N/A _get_options ret None N/A _response N/A _request GET N/A N/A N/A options N/A url N/A options N/A db /_all_docs?include_docs=true N/A N/A total_rows _response N/A N/A N/A N/A log error N/A N/A Didn't get valid response from requesting all docs: {0} format _response N/A N/A N/A ret N/A N/A row N/A _response N/A rows N/A N/A jid N/A row N/A id N/A N/A N/A N/A N/A N/A salt utils jid is_jid jid N/A N/A N/A N/A ret N/A jid N/A N/A N/A N/A salt utils jid format_jid_instance jid N/A row N/A doc N/A ret N/A get_fun N/A N/A fun N/A N/A N/A 
    Return a dict with key being minion and value
    being the job details of the last run of function 'fun'.
     N/A options N/A _get_options ret None N/A _ret N/A N/A minion N/A get_minions N/A N/A _response N/A _request GET N/A N/A N/A options N/A url N/A options N/A db N/A N/A /_design/salt/_view/by-minion-fun-timestamp?descending=true&endkey=["{0}","{1}",0]&startkey=["{2}","{3}",9999999999]&limit=1 format minion fun minion fun N/A N/A error _response N/A N/A N/A N/A log warning N/A N/A Got an error when querying for last command by a minion: {0} format N/A _response N/A error N/A N/A N/A N/A len N/A _response N/A rows 1 N/A N/A N/A N/A _ret N/A minion N/A N/A N/A _response N/A rows N/A 0 N/A value N/A _ret N/A get_minions N/A N/A N/A N/A N/A 
    Return a list of minion identifiers from a request of the view.
     N/A options N/A _get_options ret None N/A N/A N/A ensure_views N/A N/A N/A N/A _response N/A _request GET N/A N/A N/A options N/A url N/A options N/A db /_design/salt/_view/minions?group=true N/A N/A rows _response N/A N/A N/A N/A log error N/A N/A Unable to get available minions: {0} format _response N/A N/A N/A _ret N/A N/A row N/A _response N/A rows N/A N/A N/A N/A _ret append N/A row N/A key N/A _ret N/A ensure_views N/A N/A N/A N/A N/A 
    This function makes sure that all the views that should
    exist in the design document do exist.
     N/A options N/A _get_options ret None N/A _response N/A _request GET N/A N/A N/A options N/A url N/A options N/A db /_design/salt N/A N/A error _response N/A N/A N/A set_salt_view N/A view N/A get_valid_salt_views N/A N/A N/A view N/A _response N/A views N/A N/A N/A set_salt_view N/A True N/A get_valid_salt_views N/A N/A N/A N/A N/A 
    Returns a dict object of views that should be
    part of the salt design document.
     N/A ret N/A N/A N/A ret N/A minions N/A N/A N/A N/A ret N/A minions N/A map function( doc ){ emit( doc.id, null ); } N/A N/A N/A ret N/A minions N/A reduce function( keys,values,rereduce ){ return key[0]; } N/A N/A ret N/A by-minion-fun-timestamp N/A N/A N/A N/A ret N/A by-minion-fun-timestamp N/A map function( doc ){ emit( [doc.id,doc.fun,doc.timestamp], doc ); } N/A ret N/A set_salt_view N/A N/A N/A N/A N/A 
    Helper function that sets the salt design
    document. Uses get_valid_salt_views and some hardcoded values.
     N/A options N/A _get_options ret None N/A new_doc N/A N/A N/A new_doc N/A views N/A get_valid_salt_views N/A N/A new_doc N/A language javascript N/A _response N/A _request PUT N/A N/A N/A options N/A url N/A options N/A db /_design/salt application/json N/A N/A json dumps new_doc N/A N/A error _response N/A N/A N/A N/A log warning N/A N/A Unable to set the salt design document: {0} format N/A _response N/A error N/A False N/A True N/A prep_jid N/A N/A nocache passed_jid N/A False None N/A N/A 
    Do any work necessary to prepare a JID, including sending a custom id
     N/A N/A N/A passed_jid None passed_jid N/A N/A N/A N/A salt utils jid gen_jid N/A save_minions N/A N/A jid minions N/A N/A N/A 
    Included for API consistency
     N/A N/A