Module Expr Str ImportFrom alias Import alias Import alias Import alias Import alias Import alias Import alias Import alias identifier TryExcept body Import alias Assign NameStore NameLoad handlers ExceptHandler type NameLoad body Assign NameStore NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Str Assign NameStore Str Assign NameStore Str Assign NameStore Str FunctionDef arguments args defaults body If UnaryOpNot NameLoad body Expr Call AttributeLoad NameLoad attr Str Return NameLoad Return Str decorator_list FunctionDef arguments args defaults body Expr Str TryExcept body Assign NameStore Call AttributeLoad NameLoad attr keyword SubscriptLoad NameLoad Index Str keyword SubscriptLoad NameLoad Index Str keyword SubscriptLoad NameLoad Index Str keyword SubscriptLoad NameLoad Index Str keyword SubscriptLoad NameLoad Index Str handlers ExceptHandler type AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr BinOpAdd Str Call NameLoad SubscriptLoad Call AttributeLoad NameLoad attr Index Num Return NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Expr Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Dict Str Str Str Str Str Call AttributeLoad NameLoad attr Str Str Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Str Str Call AttributeLoad NameLoad attr Str Str Call AttributeLoad NameLoad attr Str ListLoad Call AttributeLoad NameLoad attr Str Str Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr Dict Str Call AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr Assign NameStore Str Expr Call AttributeLoad NameLoad attr NameLoad TupleLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr If UnaryOpNot NameLoad body Return NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults NameLoad NameLoad body Expr Str Assign NameStore Call NameLoad If CompareIs NameLoad NameLoad body Return NameLoad Assign NameStore Call AttributeLoad NameLoad attr If CompareIs NameLoad NameLoad body Assign NameStore Call NameLoad NameLoad orelse Assign NameStore NameLoad While UnaryOpNot NameLoad body Expr Call AttributeLoad NameLoad attr Str Assign NameStore Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call NameLoad If CompareIs NameLoad NameLoad body Return NameLoad Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore Str Expr Call AttributeLoad NameLoad attr NameLoad TupleLoad SubscriptLoad NameLoad Index Str SubscriptLoad NameLoad Index Str Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Call NameLoad SubscriptLoad NameLoad Index Str Str Str SubscriptLoad NameLoad Index Str Call AttributeLoad NameLoad attr Str Expr Call NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call NameLoad If CompareIs NameLoad NameLoad body Return NameLoad Assign NameStore Call AttributeLoad NameLoad attr For NameStore NameLoad body Assign NameStore Call AttributeLoad NameLoad attr Str Str Assign NameStore Call AttributeLoad NameLoad attr Str Str Assign NameStore Str Expr Call AttributeLoad NameLoad attr NameLoad TupleLoad NameLoad Call AttributeLoad NameLoad attr NameLoad SubscriptLoad NameLoad Index Str Expr Call NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore Call NameLoad NameLoad Assign NameStore Call NameLoad If CompareIs NameLoad NameLoad body Return NameLoad Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore Str Expr Call AttributeLoad NameLoad attr NameLoad TupleLoad NameLoad Call AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr NameLoad Call NameLoad Call AttributeLoad NameLoad attr Str Call NameLoad Call AttributeLoad NameLoad attr Str Call NameLoad Call AttributeLoad NameLoad attr Str Call NameLoad Call AttributeLoad NameLoad attr Str Call NameLoad Call AttributeLoad NameLoad attr Str Call NameLoad Call AttributeLoad NameLoad attr Str Call NameLoad Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Str Call NameLoad Call AttributeLoad NameLoad attr Str Expr Call NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Pass decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr Str Str NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Dict Assign SubscriptStore NameLoad Index Str SubscriptLoad NameLoad Index Num Assign SubscriptStore NameLoad Index Str SubscriptLoad NameLoad Index Num Assign SubscriptStore NameLoad Index Str SubscriptLoad NameLoad Index Num Assign SubscriptStore NameLoad Index Str SubscriptLoad NameLoad Index Num Assign SubscriptStore NameLoad Index Str SubscriptLoad NameLoad Index Num Assign SubscriptStore NameLoad Index Str SubscriptLoad NameLoad Index Num Assign SubscriptStore NameLoad Index Str SubscriptLoad NameLoad Index Num Assign SubscriptStore NameLoad Index Str SubscriptLoad NameLoad Index Num Assign SubscriptStore NameLoad Index Str SubscriptLoad NameLoad Index Num Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call NameLoad NameLoad Assign NameStore Call NameLoad If CompareIs NameLoad NameLoad body Return NameLoad Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore Str Expr Call AttributeLoad NameLoad attr NameLoad TupleLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr If NameLoad body Return Call NameLoad NameLoad Expr Call NameLoad NameLoad Return Dict decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call NameLoad NameLoad Assign NameStore Call NameLoad If CompareIs NameLoad NameLoad body Return NameLoad Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore Str Expr Call AttributeLoad NameLoad attr NameLoad TupleLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore Dict If NameLoad body For TupleStore NameStore NameStore NameLoad body Assign SubscriptStore NameLoad Index NameLoad Dict Assign SubscriptStore SubscriptLoad NameLoad Index NameLoad Index Str Call AttributeLoad NameLoad attr NameLoad Expr Call NameLoad NameLoad Return NameLoad decorator_list FunctionDef arguments args defaults body Expr Str Assign NameStore Call NameLoad Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore Str If CompareNotEq SubscriptLoad NameLoad Index Str Num body Assign NameStore BinOpAdd BinOpAdd BinOpAdd NameLoad Str Call NameLoad SubscriptLoad NameLoad Index Str Str Expr Call AttributeLoad NameLoad attr NameLoad Assign NameStore Dict Assign NameStore Call AttributeLoad NameLoad attr While NameLoad body Assign NameStore Call NameLoad NameLoad Assign SubscriptStore NameLoad Index SubscriptLoad NameLoad Index Str Call NameLoad SubscriptLoad NameLoad Index Str NameLoad Assign NameStore Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Return NameLoad decorator_list FunctionDef arguments args defaults body Expr Str Return decorator_list
N/A N/A 
Use a postgresql server for the master job cache. This helps the job cache to
cope with scale.

:maintainer:    gjredelinghuys@gmail.com
:maturity:      New
:depends:       psycopg2
:platform:      all

To enable this returner the minion will need the psycopg2 installed and
the following values configured in the master config:

.. code-block:: yaml

    master_job_cache: postgres_local_cache
    master_job_cache.postgres.host: 'salt'
    master_job_cache.postgres.user: 'salt'
    master_job_cache.postgres.passwd: 'salt'
    master_job_cache.postgres.db: 'salt'
    master_job_cache.postgres.port: 5432

Running the following command as the postgres user should create the database
correctly:

.. code-block:: sql

    psql << EOF
    CREATE ROLE salt WITH PASSWORD 'salt';
    CREATE DATABASE salt WITH OWNER salt;
    EOF

In case the postgres database is a remote host, you'll need this command also:

.. code-block:: sql

   ALTER ROLE salt WITH LOGIN;

and then:

.. code-block:: sql

    psql -h localhost -U salt << EOF
    --
    -- Table structure for table 'jids'
    --

    DROP TABLE IF EXISTS jids;
    CREATE TABLE jids (
      jid   varchar(20) PRIMARY KEY,
      started TIMESTAMP WITH TIME ZONE DEFAULT now(),
      tgt_type text NOT NULL,
      cmd text NOT NULL,
      tgt text NOT NULL,
      kwargs text NOT NULL,
      ret text NOT NULL,
      username text NOT NULL,
      arg text NOT NULL,
      fun text NOT NULL
    );

    --
    -- Table structure for table 'salt_returns'
    --
    -- note that 'success' must not have NOT NULL constraint, since
    -- some functions don't provide it.

    DROP TABLE IF EXISTS salt_returns;
    CREATE TABLE salt_returns (
      added     TIMESTAMP WITH TIME ZONE DEFAULT now(),
      fun       text NOT NULL,
      jid       varchar(20) NOT NULL,
      return    text NOT NULL,
      id        text NOT NULL,
      success   boolean
    );
    CREATE INDEX ON salt_returns (added);
    CREATE INDEX ON salt_returns (id);
    CREATE INDEX ON salt_returns (jid);
    CREATE INDEX ON salt_returns (fun);

    DROP TABLE IF EXISTS salt_events;
    CREATE TABLE salt_events (
      id SERIAL,
      tag text NOT NULL,
      data text NOT NULL,
      alter_time TIMESTAMP WITH TIME ZONE DEFAULT now(),
      master_id text NOT NULL
    );
    CREATE INDEX ON salt_events (tag);
    CREATE INDEX ON salt_events (data);
    CREATE INDEX ON salt_events (id);
    CREATE INDEX ON salt_events (master_id);
    EOF

Required python modules: psycopg2
 __future__ absolute_import N/A json N/A logging N/A re N/A sys N/A salt.utils N/A salt.utils.jid N/A salt.ext.six six N/A N/A N/A psycopg2 N/A HAS_POSTGRES True N/A N/A N/A ImportError N/A N/A HAS_POSTGRES False N/A log N/A N/A logging getLogger __name__ N/A LOAD_P .load.p N/A MINIONS_P .minions.p N/A RETURN_P return.p N/A OUT_P out.p __virtual__ N/A N/A N/A N/A N/A N/A HAS_POSTGRES N/A N/A N/A N/A log info Could not import psycopg2, postgres_local_cache disabled. N/A False N/A postgres_local_cache N/A _get_conn N/A N/A N/A N/A N/A 
    Return a postgres connection.
     N/A N/A N/A conn N/A N/A psycopg2 connect host N/A __opts__ N/A master_job_cache.postgres.host user N/A __opts__ N/A master_job_cache.postgres.user password N/A __opts__ N/A master_job_cache.postgres.passwd database N/A __opts__ N/A master_job_cache.postgres.db port N/A __opts__ N/A master_job_cache.postgres.port N/A N/A N/A N/A psycopg2 OperationalError N/A N/A N/A N/A log error N/A Could not connect to SQL server:  N/A str N/A N/A N/A sys exc_info N/A 0 N/A None N/A conn N/A _close_conn N/A N/A conn N/A N/A N/A 
    Close the postgres connection.
     N/A N/A N/A conn commit N/A N/A N/A conn close N/A _format_job_instance N/A N/A job N/A N/A N/A 
    Format the job instance correctly
     N/A ret N/A Function Arguments Target Target-type User N/A N/A job get fun unknown-function N/A N/A json loads N/A N/A job get arg [] N/A N/A job get tgt unknown-target N/A N/A job get tgt_type N/A N/A N/A job get user root N/A ret N/A _format_jid_instance N/A N/A jid job N/A N/A N/A 
    Format the jid correctly
     N/A ret N/A _format_job_instance job N/A N/A N/A ret update N/A StartTime N/A N/A N/A N/A salt utils jid jid_to_time jid N/A ret N/A _gen_jid N/A N/A cur N/A N/A N/A 
    Generate an unique job id
     N/A jid N/A N/A N/A N/A salt utils jid gen_jid N/A sql SELECT jid FROM jids WHERE jid = %s N/A N/A N/A cur execute sql N/A jid N/A data N/A N/A cur fetchall N/A N/A data N/A N/A jid N/A None N/A prep_jid N/A N/A nocache passed_jid N/A False None N/A N/A 
    Return a job id and prepare the job id directory
    This is the function responsible for making sure jids don't collide
    (unless its passed a jid). So do what you have to do to make sure that
    stays the case
     N/A conn N/A _get_conn N/A N/A conn None N/A N/A None N/A cur N/A N/A conn cursor N/A N/A passed_jid None N/A N/A jid N/A _gen_jid cur N/A N/A jid passed_jid N/A N/A jid N/A N/A N/A N/A log info jid clash, generating a new one N/A jid N/A _gen_jid cur N/A N/A N/A cur close N/A N/A N/A conn close N/A jid N/A returner N/A N/A load N/A N/A N/A 
    Return data to a postgres server
     N/A conn N/A _get_conn N/A N/A conn None N/A N/A None N/A cur N/A N/A conn cursor N/A sql INSERT INTO salt_returns
            (fun, jid, return, id, success)
            VALUES (%s, %s, %s, %s, %s) N/A N/A N/A cur execute sql N/A N/A load N/A fun N/A load N/A jid N/A N/A json dumps N/A N/A six text_type N/A str N/A load N/A return utf-8 replace N/A load N/A id N/A N/A load get success N/A N/A _close_conn conn N/A event_return N/A N/A events N/A N/A N/A 
    Return event to a postgres server

    Require that configuration be enabled via 'event_return'
    option in master config.
     N/A conn N/A _get_conn N/A N/A conn None N/A N/A None N/A cur N/A N/A conn cursor N/A event events N/A N/A tag N/A N/A event get tag N/A data N/A N/A event get data N/A sql INSERT INTO salt_events
                (tag, data, master_id)
                VALUES (%s, %s, %s) N/A N/A N/A cur execute sql N/A tag N/A N/A json dumps data N/A __opts__ N/A id N/A N/A _close_conn conn N/A save_load N/A N/A jid clear_load N/A N/A N/A 
    Save the load to the specified jid id
     N/A jid N/A _escape_jid jid N/A conn N/A _get_conn N/A N/A conn None N/A N/A None N/A cur N/A N/A conn cursor N/A sql INSERT INTO jids (jid, started, tgt_type, cmd, tgt, kwargs, ret, username, arg, fun) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s) N/A N/A N/A cur execute sql N/A jid N/A N/A N/A N/A salt utils jid jid_to_time jid N/A str N/A N/A clear_load get tgt_type N/A str N/A N/A clear_load get cmd N/A str N/A N/A clear_load get tgt N/A str N/A N/A clear_load get kwargs N/A str N/A N/A clear_load get ret N/A str N/A N/A clear_load get user N/A str N/A N/A json dumps N/A N/A clear_load get arg N/A str N/A N/A clear_load get fun N/A N/A _close_conn conn N/A save_minions N/A N/A jid minions N/A N/A N/A 
    Included for API consistency
     N/A N/A _escape_jid N/A N/A jid N/A N/A N/A 
    Do proper formatting of the jid
     N/A jid N/A str jid N/A jid N/A N/A re sub '* jid N/A jid N/A _build_dict N/A N/A data N/A N/A N/A 
    Rebuild dict
     N/A result N/A N/A N/A result N/A jid N/A data N/A 0 N/A N/A result N/A tgt_type N/A data N/A 1 N/A N/A result N/A cmd N/A data N/A 2 N/A N/A result N/A tgt N/A data N/A 3 N/A N/A result N/A kwargs N/A data N/A 4 N/A N/A result N/A ret N/A data N/A 5 N/A N/A result N/A user N/A data N/A 6 N/A N/A result N/A arg N/A data N/A 7 N/A N/A result N/A fun N/A data N/A 8 N/A result N/A get_load N/A N/A jid N/A N/A N/A 
    Return the load data that marks a specified jid
     N/A jid N/A _escape_jid jid N/A conn N/A _get_conn N/A N/A conn None N/A N/A None N/A cur N/A N/A conn cursor N/A sql SELECT jid, tgt_type, cmd, tgt, kwargs, ret, username, arg, fun FROM jids WHERE jid = %s N/A N/A N/A cur execute sql N/A jid N/A data N/A N/A cur fetchone N/A data N/A N/A N/A _build_dict data N/A N/A _close_conn conn N/A N/A N/A get_jid N/A N/A jid N/A N/A N/A 
    Return the information returned when the specified job id was executed
     N/A jid N/A _escape_jid jid N/A conn N/A _get_conn N/A N/A conn None N/A N/A None N/A cur N/A N/A conn cursor N/A sql SELECT id, return FROM salt_returns WHERE jid = %s N/A N/A N/A cur execute sql N/A jid N/A data N/A N/A cur fetchall N/A ret N/A N/A data N/A N/A N/A minion full_ret data N/A N/A N/A ret N/A minion N/A N/A N/A N/A ret N/A minion N/A return N/A N/A json loads full_ret N/A N/A _close_conn conn N/A ret N/A get_jids N/A N/A N/A N/A N/A 
    Return a list of all job ids
    For master job cache this also formats the output and returns a string
     N/A conn N/A _get_conn N/A cur N/A N/A conn cursor N/A sql SELECT jid, tgt_type, cmd, tgt, kwargs, ret, username, arg, fun FROM jids N/A N/A N/A __opts__ N/A keep_jobs 0 N/A N/A sql N/A N/A N/A sql  WHERE started > NOW() - INTERVAL ' N/A str N/A __opts__ N/A keep_jobs ' HOUR N/A N/A N/A cur execute sql N/A ret N/A N/A data N/A N/A cur fetchone N/A data N/A N/A data_dict N/A _build_dict data N/A N/A ret N/A N/A data_dict N/A jid N/A _format_jid_instance N/A data_dict N/A jid data_dict N/A data N/A N/A cur fetchone N/A N/A N/A cur close N/A N/A N/A conn close N/A ret N/A clean_old_jobs N/A N/A N/A N/A N/A 
    Clean out the old jobs from the job cache
     N/A N/A