Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug background capture #1957

Merged
merged 3 commits into from
Nov 16, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions synapse/lib/storm.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import synapse.lib.config as s_config
import synapse.lib.scrape as s_scrape
import synapse.lib.grammar as s_grammar
import synapse.lib.msgpack as s_msgpack
import synapse.lib.spooled as s_spooled
import synapse.lib.stormctrl as s_stormctrl
import synapse.lib.provenance as s_provenance
Expand Down Expand Up @@ -2532,7 +2533,8 @@ async def execStormTask(self, query, opts):

core = self.runt.snap.core
user = core._userFromOpts(opts)
info = {'query': str(query), 'opts': opts,
info = {'query': query.text,
'opts': opts,
'background': True}

await core.boss.promote('storm', user=user, info=info)
Expand All @@ -2550,10 +2552,13 @@ async def execStormCmd(self, runt, genr):
async for item in genr:
yield item

runtprims = await s_stormtypes.toprim(self.runt.vars)
runtvars = {k: v for (k, v) in runtprims.items() if s_msgpack.isok(v)}

opts = {
'user': runt.user.iden,
'view': runt.snap.view.iden,
'vars': dict(runt.vars),
'vars': runtvars,
}

query = await runt.getStormQuery(self.opts.query)
Expand Down