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

Better output of snactor discover when inspection fails #338

Open
vojtechsokol opened this issue Aug 12, 2018 · 4 comments
Open

Better output of snactor discover when inspection fails #338

vojtechsokol opened this issue Aug 12, 2018 · 4 comments
Labels
enhancement help wanted usability Issues that have an impact on the usability

Comments

@vojtechsokol
Copy link
Member

vojtechsokol commented Aug 12, 2018

When an actor or a model contains a bug, snactor discover fails and no output is shown.

Reproducer:
Install leapp framework, create new repo and actor:

pip install git+https://github.com/leapp-to/leapp
snactor repo new discover-bug
cd discover-bug
snactor new-actor discover-bug

The actor is buggy, as it is missing a tag attribute.

Running snactor discover fails because of this:

$ snactor discover

Process Process-1:
Traceback (most recent call last):
  File "/usr/lib/python2.7/multiprocessing/process.py", line 258, in _bootstrap
    self.run()
  File "/usr/lib/python2.7/multiprocessing/process.py", line 114, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python2.7/dist-packages/leapp/repository/actor_definition.py", line 26, in inspect_actor
    result = [get_actor_metadata(actor) for actor in get_actors()]
  File "/usr/local/lib/python2.7/dist-packages/leapp/actors/__init__.py", line 276, in get_actors
    get_actor_metadata(actor)
  File "/usr/local/lib/python2.7/dist-packages/leapp/actors/__init__.py", line 261, in get_actor_metadata
    _get_attribute(actor, 'tags', _is_tag_tuple, required=True),
  File "/usr/local/lib/python2.7/dist-packages/leapp/actors/__init__.py", line 242, in _get_attribute
    raise MissingActorAttributeError('Actor {} is missing attribute {}'.format(actor, name))
MissingActorAttributeError: Actor <class 'actor.DiscoverBug'> is missing attribute tags
No handlers could be found for logger "leapp.repository.discover-bug"
Inspection of actor in actors/bug failed

Similar thing happens when there is a bug in a model - create new model and don't fill in the topic:

snactor new-model buggy-model

The discover subcommand now does not output the traceback but still doesn't show the discovered objects.

$ snactor discover

Missing topic in Model BuggyModel

I expect the discover subcommand to deal with the buggy objects and show object where inspection was ok and possibly also the buggy ones, e.g.:

$ snactor discover
Repository:
  Name: common
  Path: /home/vsokol/leapp-actors/repos/common

Actors(2):
   - ActorExample1                 actors/actorexample1
   - ActorExample2                 actors/actorexample2

Models(0):

Tags(0):

Topics(0):

Workflows(0):

Inspection failures(1):
   - Actor: DiscoverBug            actors/discover-bug      Missing attribute 'tags'
   - Model: BuggyModel             models/buggy-model.py    Missing topic
@vinzenz vinzenz added enhancement help wanted usability Issues that have an impact on the usability labels Sep 4, 2018
@shaded-enmity
Copy link
Member

@vinzenz @vojtechsokol This is something that bites me almost every time, I think we should switch to using ast module for discover so that we can handle this use case in a more robust way.

@shaded-enmity
Copy link
Member

I whip up something quick, @vojtechsokol can you please try #375 ?

@vojtechsokol
Copy link
Member Author

I think this issue shouldn't be closed as the problem still persists. If I use the solution from #375, the traceback is gone which is nice, however I don't get any information if there is some failure.

@bocekm bocekm reopened this Dec 19, 2019
@bocekm
Copy link
Member

bocekm commented Dec 19, 2019

Related: RHELLEAPP-980

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement help wanted usability Issues that have an impact on the usability
Projects
None yet
Development

No branches or pull requests

4 participants