StackStorm / StackStorm/st2

st2stream doesn't return errors to st2client

Open
#5,317 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
6.5k
Forks
787
PR merge metrics
No merged PRs in 30d

Description

SUMMARY

This is specific to a pack install and I'm not sure if anything else is affected by st2stream not returning errors to st2client.

Carrying part of the conversion over from https://github.com/StackStorm/st2/issues/5303#issuecomment-892134776

The scenario here is when installing a pack without having the global stream_view permissions st2stream errors out, but never sends that error back to st2client to inform the user. The error is however logged in the st2stream log file.

STACKSTORM VERSION

Known versions this happens on
st2 3.4.1, on Python 3.6.8
st2 3.5.0, on Python 3.6.8

OS, environment, install method

Post what OS you are running this on, along with any other relevant information/

  • OL7
  • HA install with a controller node running web, redis, rabbitmq, and mongo and 2 cluster nodes running everything else.

Steps to reproduce the problem

See the setup is in the other thread as its specific to RBAC and nothing else.

Expected Results

st2stream should return an error to st2client so it can be reported to the user as to what the failure is.

The log does record this error

2021-08-03 19:02:29,809 139735081647144 DEBUG error_handling [-] API call failed: User "packuser" doesn't have required permission "stream_view" (exception_class='ResourceTypeAccessDeniedError',exception_message='User "packuser" doesn\'t have required permission "stream_view"',exception_data={'permission_type': 'stream_view', 'user_db': <UserDB: UserDB(id=60f6a1e06a82029b060389a6, is_service=False, name="packuser", nicknames={})>})

Actual Results

Without the st2stream returning an error st2client fails out with an AttributeError exception. The process(s) still continues in the background. The full debug output is also in the other thread.

Traceback (most recent call last):
  File "/opt/stackstorm/st2/lib/python3.6/site-packages/st2client/shell.py", line 408, in run
    func(args)
  File "/opt/stackstorm/st2/lib/python3.6/site-packages/st2client/commands/resource.py", line 48, in decorate
    return func(*args, **kwargs)
  File "/opt/stackstorm/st2/lib/python3.6/site-packages/st2client/commands/pack.py", line 274, in run_and_print
    packs = instance.result['output']['packs_list']
AttributeError: 'Execution' object has no attribute 'result'

Thanks!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the pack-install scenario with the global stream_view permission missing, then inspect the st2stream log and the st2client traceback in st2client/commands/pack.py. Trace how the permission error is handled between st2stream and st2client; done means st2client reports the underlying error instead of raising AttributeError while the process continues in the background.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.