Job cache on the master contains only partial job result information

13 views
Skip to first unread message

Szymon Juraszczyk

unread,
Aug 23, 2016, 8:11:17 AM8/23/16
to Salt-users, gavin...@credit-suisse.com
Hi

I start a job to execute cmd.run with arg "rm /nonexistent" on a minion.
I get it's result on the eventbus:

{'tag': 'salt/job/20160823124251202948/ret/minionname.my.domain',
'data': {'fun_args': None, 'jid': '20160823124251202948', 'return': "rm:
cannot remove `/nonexistent': No such file or directory", 'retcode': 1,
'success': True, '_stamp': '2016-08-23T10:42:51.473637', 'fun':
'cmd.run', 'master_id': 'mastername.my.domain', 'id':
'minionname.my.domain'}}

So I get the command output ('return') and also 'retcode' plus 'success'.

However, when I look in the job cache files on the master in
/var/cache/salt/master/jobs, the return.p file for that minion only
contains the 'return' part of the result. There is no way that any of
the runner modules such as jobs.list_job, jobs.lookup_jid or
jobs.print_job returned the missing information.

Amazingly, when I turn on the local job cache on the minion, then it
stores the complete information in

/var/cache/salt/minion/minion_jobs/<jobid>/return.p

Consequently, saltutil.find_cached_job executed on that minion returns
complete information about that job.

The question is, was that job cache on the master intentionally made
this way that it contains only partial information and if so, why is that?

I would imagine that the job cache could be used to retrieve the job
result in the same form as it originally came in. In my use case that
result of cmd.run without the retcode is of very limited usability.

--
Regards,
Szymon Juraszczyk, szy...@juraszczyk.com
Reply all
Reply to author
Forward
0 new messages