From b633b0eda6a77a727be1ff01426a979b6dfe37b7 Mon Sep 17 00:00:00 2001 From: Ali Rizvi-Santiago Date: Tue, 26 Feb 2019 19:46:12 -0600 Subject: [PATCH] As per the conversation at saltstack/stack#51809, all returners need to explicitly handle the 'req' jid and generate a new one. --- salt/returners/etcd_return.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/salt/returners/etcd_return.py b/salt/returners/etcd_return.py index c097399e84b2..774f13f5280b 100644 --- a/salt/returners/etcd_return.py +++ b/salt/returners/etcd_return.py @@ -185,12 +185,13 @@ def returner(ret): write_profile = __opts__.get('etcd.returner_write_profile') client, path, ttl = _get_conn(__opts__, write_profile) - # If a minion is returning a standalone job, make sure to save the load as - # it's likely there's no load saved since this job came directly from a - # minion. + # If a minion is returning a standalone job, update the jid for the load + # when it's saved since this job came directly from a minion. if ret['jid'] == 'req': - log.debug('sdstack_etcd returner received a new job id request ({jid:s}) for {data}'.format(jid=ret['jid'], data=ret)) - save_load(ret['jid'], ret) + new_jid = prep_jid(nocache=ret.get('nocache', False)) + log.debug('sdstack_etcd returner satisfying a new job id request ({jid:s}) with id {new:s} for {data}'.format(jid=ret['jid'], new=new_jid, data=ret)) + ret['jid'] = new_jid + save_load(new_jid, ret) # Update the given minion in the external job cache with the current (latest job) # This is used by get_fun() to return the last function that was called