Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Cisphyx committed Oct 18, 2024
1 parent cb64693 commit e2d5c6f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
6 changes: 6 additions & 0 deletions changes/39c9411d0cd4b9d627167ad850643b4f.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
desc: Fixed an issue where variables containing heavy objects were passed in/out of
the ``runas`` and ``view.exec`` commands which could result in unexpected behavior.
prs: []
type: bug
...
16 changes: 8 additions & 8 deletions docs/synapse/userguides/storm_ref_cmd.rstorm
Original file line number Diff line number Diff line change
Expand Up @@ -2948,12 +2948,16 @@ The ``view.exec`` command executes a Storm query in the specified view.

The ``view.exec`` command creates its own execution environment (sub-runtime) to execute a Storm
query in a different view. This results in a firm separation boundary between the source view and
the destination view where nodes do not pass in or out across the ``view.exec`` boundary. Pipelines,
events, messages, etc will NOT pass from the destination view to the source view or vice-versa. This
includes ``$lib.print(...)``, ``$lib.warn(...)``, and other functions that may print to the CLI.
the destination view where nodes and heavy objects do not pass in or out across the ``view.exec``
boundary. Pipelines, events, messages, etc will NOT pass from the destination view to the source view
or vice-versa. This includes ``$lib.print(...)``, ``$lib.warn(...)``, and other functions that
may print to the CLI.

Variables declared before the ``view.exec`` are accessible in the destination view (including
assignment). The interactive help example demonstrates this behavior:
assignment). One exception to this is that heavy objects (for example ``View`` objects or functions)
will not
be passed into or out of the destination view and will not be accessible. The interactive
help example demonstrates this behavior:

::

Expand All @@ -2969,10 +2973,6 @@ the ``view.exec`` query. Also note the sub-query executed in the ``view.exec`` m
different value back to ``$fqdn`` to be accessed by the source view (that doesn't happen in this
example though).

Inline functions are bound to the scope they are declared in. For ``view.exec``, this means that a
function declared outside the ``view.exec`` command will still run in the original scope/view, not
the view specified to ``view.exec``.

**Syntax:**

.. storm-cli:: view.exec --help
Expand Down
6 changes: 4 additions & 2 deletions synapse/lib/storm.py
Original file line number Diff line number Diff line change
Expand Up @@ -5146,8 +5146,8 @@ class ViewExecCmd(Cmd):
'''
Execute a storm query in a different view.
NOTE: Variables are passed through but nodes are not. The behavior of this command may be
non-intuitive in relation to the way storm normally operates. For further information on
NOTE: Variables are passed through but nodes and heavy objects are not. The behavior of this command
may be non-intuitive in relation to the way storm normally operates. For further information on
behavior and limitations when using `view.exec`, reference the `view.exec` section of the
Synapse User Guide: https://v.vtx.lk/view-exec.
Expand Down Expand Up @@ -5981,6 +5981,8 @@ class RunAsCmd(Cmd):
NOTE: This command requires admin privileges.
NOTE: Variables are passed through but nodes and heavy objects are not.
Examples:
// Create a node as another user.
Expand Down

0 comments on commit e2d5c6f

Please sign in to comment.