leapp icon indicating copy to clipboard operation
leapp copied to clipboard

Duplicated lines from leapp.linter

Open artmello opened this issue 7 years ago • 2 comments

In a Fedora 28 machine, using Python 2.7.14, I create the following project:

(env) $ snactor new-project sandbox
New project sandbox has been created in /home/amello/red_hat/vms/leapp-centos/sandbox/sandbox
(env) $ cd sandbox/
(env) [sandbox]$ snactor new-tag Scan
New tag Scan has been created in /home/amello/red_hat/vms/leapp-centos/sandbox/sandbox/tags/scan.py
(env) [sandbox]$ snactor new-actor A
New actor A has been created at /home/amello/red_hat/vms/leapp-centos/sandbox/sandbox/actors/a/actor.py

This is the code of actor A, with field tags not being a tuple:

from leapp.actors import Actor
from leapp.tags import ScanTag


class A(Actor):
    name = 'a'
    description = 'Sample actor A.'
    consumes = ()
    produces = ()
    tags = (ScanTag)

    def process(self):
        self.log.info("Starting actor A")

When I try to run actor A, leapp.linter warns me multiple times about the same problem.

(env) [sandbox]$ snactor run A
2018-05-07 23:11:33.260 INFO     PID: 22995 leapp: Logging has been initialized
2018-05-07 23:11:33.270 INFO     PID: 22995 leapp.repository.sandbox: New repository 'sandbox' initialized at /home/amello/red_hat/vms/leapp-centos/sandbox/sandbox
2018-05-07 23:11:33.302 WARNING  PID: 22997 leapp.linter: Actor <class 'actor.A'> field tags should be a tuple of Tags
2018-05-07 23:11:33.314 WARNING  PID: 22997 leapp.linter: Actor <class 'actor.A'> field tags should be a tuple of Tags
2018-05-07 23:11:33.349 WARNING  PID: 23010 leapp.linter: Actor <class 'actor.A'> field tags should be a tuple of Tags
2018-05-07 23:11:33.360 INFO     PID: 23010 leapp.actors.a: Starting actor A

artmello avatar May 07 '18 23:05 artmello

Attempted fix: https://github.com/leapp-to/leapp/commit/abfe3fb439e6238f588df4eb516fbe60f4c29684

vinzenz avatar Jun 14 '18 12:06 vinzenz

There are still duplicit lines from linter (not three same lines but only two, so there's a progress here):

$ snactor repo new NewRepo
New repository NewRepo has been created in /home/user/NewRepo
$ snactor new-tag NewTag
New tag NewTag has been created in /home/user/NewRepo/tags/newtag.py
$ snactor new-model NewModel
New model NewModel has been created in /home/user/NewRepo/models/newmodel.py
NewModel.topic = NewTopic
NewActor.consumes = (NewModel)
NewActor.tags = (NewTag)
$ snactor run NewActor
2018-11-13 21:58:19.668 INFO     PID: 3212 leapp: Logging has been initialized
2018-11-13 21:58:19.681 INFO     PID: 3212 leapp.repository.NewRepo: A new repository 'NewRepo' is initialized at /home/user/NewRepo
2018-11-13 21:58:19.700 WARNING  PID: 3217 leapp.linter: Actor <class 'actor.NewActor'> field tags should be a tuple of Tags
2018-11-13 21:58:19.710 WARNING  PID: 3217 leapp.linter: Actor <class 'actor.NewActor'> field consumes should be a tuple of Models
2018-11-13 21:58:19.737 WARNING  PID: 3233 leapp.linter: Actor <class 'actor.NewActor'> field tags should be a tuple of Tags
2018-11-13 21:58:19.748 WARNING  PID: 3233 leapp.linter: Actor <class 'actor.NewActor'> field consumes should be a tuple of Models
$ rpm -q snactor python2-leapp python2
snactor-0.3-1.devel.20181112.git.238.noarch
python2-leapp-0.3-1.devel.20181112.git.238.noarch
python2-2.7.13-17.fc27.x86_64

vojtechsokol avatar Nov 13 '18 22:11 vojtechsokol