#69 Improve error messages for missing input to runtask
Closed: Fixed None Opened 10 years ago by tflink.

With the cli argument changes in #127, we end up with some rather confusing error messages if the -t argument is omitted (as @mkrizek noted in D56).

While this isn't anything that couldn't be figured out, the error messages are far from user-friendly. Rework the validation code so that the error messages are easier to understand without knowing how the -t and -i args are translated to stuff like envr and bodhi_id.


This ticket had assigned some Differential requests:
D110

Just to re-iterate, the problem is that:

$ python runtask.py -i xchat-2.8.8-21.fc20 -a x86_64 task-rpmlint/rpmlint.yml
[libtaskotron:logger.py:63] 2014-04-15 16:39:29 DEBUG doing stream logging
[libtaskotron:logger.py:34] 2014-04-15 16:39:29 CRITICAL Traceback (most recent call last):
File "runtask.py", line 4, in <module>
runner.main()
File "/home/mkrizek/devel/libtaskotron/libtaskotron/runner.py", line 182, in main
task_runner.run()
File "/home/mkrizek/devel/libtaskotron/libtaskotron/runner.py", line 28, in run
self._validate_input()
File "/home/mkrizek/devel/libtaskotron/libtaskotron/runner.py", line 125, in _validate_input
'was not defined' % arg)
TaskotronYamlError: Required input arg envr was not defined

If you omit -t argument, the error message might be confusing for someone because it asks for envr and the type is koji_build.

Just out of curiosity - is there any use-case where we'd want to omit the -t argument while still providing the -i one?

Just out of curiosity - is there any use-case where we'd want to omit the -t argument while still providing the -i one?

No, I don't think so. But there are far more interesting questions:

  1. Should we be able to provide several items with the same type, like this?
runtask -i nvr1 -i nvr2 -i nvr3 -t koji_build task.yaml
  1. What if some of our checks would like to receive several items of //different// types? Something like this:
runtask -i nvr1 -t koji_build -i tag1 -t koji_tag task.yaml

So the initial problem of this was fixed as a part of D110. Do we want to close this and create a new ticket for the "several items with the same type"?

Yes, it seems fixed:

$ runtask -i xchat-2.8.8-21.fc20 -a x86_64 task-rpmlint/rpmlint.yml
[libtaskotron:logger.py:65] 2014-05-29 14:21:14 DEBUG   doing stream logging
[libtaskotron:config.py:155] 2014-05-29 14:21:14 DEBUG   Trying to open configuration file: /etc/taskotron/taskotron.yaml
[libtaskotron:config.py:165] 2014-05-29 14:21:14 DEBUG   Trying to parse configuration file: /etc/taskotron/taskotron.yaml
[libtaskotron:config.py:63] 2014-05-29 14:21:14 DEBUG   Using config profile: development
[libtaskotron:config.py:243] 2014-05-29 14:21:14 WARNING Failed to create a required directory, please create it manually: [Errno 13] Permission denied: '/var/log/taskotron'
[libtaskotron:logger.py:34] 2014-05-29 14:21:14 CRITICAL Traceback (most recent call last):
  File "/home/kparal/devel/taskotron/env_taskotron/bin/runtask", line 9, in <module>
    load_entry_point('libtaskotron==0.0.3', 'console_scripts', 'runtask')()
  File "/home/kparal/devel/taskotron/libtaskotron/libtaskotron/runner.py", line 199, in main
    task_runner.run()
  File "/home/kparal/devel/taskotron/libtaskotron/libtaskotron/runner.py", line 31, in run
    self._validate_input()
  File "/home/kparal/devel/taskotron/libtaskotron/libtaskotron/runner.py", line 138, in _validate_input
    "was not defined" % arg)
TaskotronYamlError: Required input arg 'koji_build' was not defined

Let's close this, thanks Martin. I wouldn't file a new ticket about the other issues mentioned as long as we don't really need that functionality.

Metadata Update from @tflink:
- Issue tagged with: easyfix

6 years ago

Login to comment on this ticket.

Metadata