Bug 673108

Summary: RFE: workflow-tcms gets distro automagically from errata tool
Product: [Retired] Beaker Reporter: Karel Volný <kvolny>
Component: command lineAssignee: Petr Šplíchal <psplicha>
Status: CLOSED NOTABUG QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 0.7CC: azelinka, bpeck, dcallagh, mcsontos, ohudlick, pmuller, psplicha, rmancy
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: qa-tools-2.0-20 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-03-21 10:42:49 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Attachments:
Description Flags
try harder to determine distro none

Description Karel Volný 2011-01-27 13:23:52 UTC
Description of problem:
If bkr workflow-tcms is run with --errata specified, but no --run, it is unable to submit a job because it does not know which distro it should use.

It'd be nice if the workflow would try to determine the correct distro using information available from the Errata Tool.

Comment 1 Petr Šplíchal 2011-03-08 20:14:00 UTC
Thanks for the idea. Support for fetching the distro from the
Errata Tool pushed to git:

http://git.engineering.redhat.com/?p=users/psplicha/tcms;a=commitdiff;h=7507cc83beac06cbaa3f810bce1743d3fad35a28

Please note, that the workflow takes just the first build attached
to the first erratum as currently it's not possible to schedule
multiple distros using workflow-tcms.

Comment 2 Petr Muller 2011-03-09 17:28:53 UTC
Does not work for me:

$ bkr workflow-tcms --run 17655  --errata "2011:10583"
Inspecting TR#17655 - Systemtap :: PostAlpha :: RHEL6 for 2011:10583
11 test cases found
Traceback (most recent call last):
  File "/usr/bin/bkr", line 9, in <module>
    load_entry_point('bkr.client==0.6.4', 'console_scripts', 'bkr')()
  File "/usr/lib/python2.7/site-packages/bkr/client/main.py", line 55, in main
    return parser.run()
  File "/usr/lib/python2.7/site-packages/kobo/cli.py", line 282, in run
    cmd.run(*cmd_args, **cmd_kwargs)
  File "/usr/lib/python2.7/site-packages/bkr/client/commands/cmd_workflow_tcms.py", line 554, in run
    job.schedule([TestRun(id)])
  File "/usr/lib/python2.7/site-packages/bkr/client/commands/cmd_workflow_tcms.py", line 476, in schedule
    self.check_environment()
  File "/usr/lib/python2.7/site-packages/bkr/client/commands/cmd_workflow_tcms.py", line 304, in check_environment
    self.variants = [DefaultVariants[self.dist]]
KeyError: '6.1-g'

Comment 3 Bill Peck 2011-03-09 17:52:40 UTC
We always seem to be updating mappings.   Since we have to have a CPE product for everything it seems to me to make sense to use that.

cpe:/o:redhat:enterprise_linux:5:update5

I'm meeting with rel-eng Today and will discuss getting that added to the distros when we import them.  ET could support it too..  then we would have a common language to use company wide.

Comment 4 Petr Šplíchal 2011-03-10 08:07:56 UTC
(In reply to comment #2)
> Does not work for me:
>
> ...
>
> "/usr/lib/python2.7/site-packages/bkr/client/commands/cmd_workflow_tcms.py",
> line 304, in check_environment
>     self.variants = [DefaultVariants[self.dist]]
> KeyError: '6.1-g'

This is caused by specifying "Build: 6.1-general" in your test
run, which is not a valid build name. The workflow-tcms checks for
the distro in this order:

    1) command line --distro parameter
    2) test run build value
    3) errata tool

So your custom value from the test run wins in this case. If you
do want the workflow to fetch the distro from ET, just leave the
build field in the TCMS as unspecified. I've updated the workflow
to provide a more meaningfull error message:

http://git.engineering.redhat.com/?p=users/psplicha/tcms;a=commitdiff;h=f4a8a3f82371b36dce6928aa9cdd92ddb09f8cc2

(In reply to comment #3)
> We always seem to be updating mappings.   Since we have to have a CPE product
> for everything it seems to me to make sense to use that.
> 
> cpe:/o:redhat:enterprise_linux:5:update5
> 
> I'm meeting with rel-eng Today and will discuss getting that added to the
> distros when we import them.  ET could support it too..  then we would have a
> common language to use company wide.

That sounds great! Having a common naming across all tools will
definitely make things cleaner & easier.

Comment 5 Petr Muller 2011-03-10 11:45:11 UTC
(In reply to comment #4)
> > "/usr/lib/python2.7/site-packages/bkr/client/commands/cmd_workflow_tcms.py",
> > line 304, in check_environment
> >     self.variants = [DefaultVariants[self.dist]]
> > KeyError: '6.1-g'
> 
> This is caused by specifying "Build: 6.1-general" in your test
> run, which is not a valid build name. The workflow-tcms checks for
> the distro in this order:
> 
>     1) command line --distro parameter
>     2) test run build value
>     3) errata tool
> 
> So your custom value from the test run wins in this case. If you
> do want the workflow to fetch the distro from ET, just leave the
> build field in the TCMS as unspecified. I've updated the workflow
> to provide a more meaningfull error message:
> 
> http://git.engineering.redhat.com/?p=users/psplicha/tcms;a=commitdiff;h=f4a8a3f82371b36dce6928aa9cdd92ddb09f8cc2

Understood, and thx for the explanation. Would it be possible to alter the logic so that it still tries the ET option after TCMS one fails?

Comment 6 Petr Muller 2011-03-10 11:48:29 UTC
Created attachment 483422 [details]
try harder to determine distro

Something like this? The question is if when we should abort:

My patch:
try CLI arg, or try TCMS, or try ET, or bail out

The option (and maybe more correct) is this:

try CLI arg, if was supplied and wrong, bail out, else try TCMS, or try ET, or bail out.

Comment 7 Petr Muller 2011-03-10 11:51:03 UTC
also, the 'No distro specified' should be probably extended to something like 'No distro specified or obtained from other tools'.

Comment 8 Petr Šplíchal 2011-03-18 19:15:27 UTC
Thanks for the idea & patch! I've slightly modified it and pushed to git:
http://git.engineering.redhat.com/?p=users/psplicha/tcms;a=commitdiff;h=120fc38