Bug 1302950 - Beaker injects extra <system_type/> if <hostRequires/> already contains <system_type/> nested inside other elements
Summary: Beaker injects extra <system_type/> if <hostRequires/> already contains <syst...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Beaker
Classification: Retired
Component: general
Version: 22
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: 22.1
Assignee: Dan Callaghan
QA Contact: matt jia
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-01-29 06:19 UTC by Dan Callaghan
Modified: 2016-02-01 05:23 UTC (History)
9 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-02-01 04:31:06 UTC
Embargoed:


Attachments (Terms of Use)

Description Dan Callaghan 2016-01-29 06:19:49 UTC
Version-Release number of selected component (if applicable):
22.0

Steps to Reproduce:
1. Submit a job with <hostRequires/> like this:
<hostRequires>
  <and>
    <hostname op="=" value="example.com"/>
    <system_type value="Prototype"/>
  </and>
</hostRequires>
2. Clone the job to look at the XML

Actual results:
Beaker injects an extra contradictory <system_type/> filter:

      <hostRequires>
        <and>
          <system_type op="=" value="Prototype"/>
          <hostname op="=" value="example.invalid"/>
        </and>
        <system_type value="Machine"/>
      </hostRequires>

causing the recipe to abort with no matching systems.

Expected results:
Beaker should use the <hostRequires/> exactly as given, it should not inject any extra <system_type/> filter because there is already one present the job.

Additional info:
The workflow commands will produce a <hostRequires/> like the one above, because they always insert an <and/> at the top level. For example, this will submit a job to reproduce the bug:

bkr workflow-simple --family RedHatEnterpriseLinux7 --arch x86_64 --hostrequire 'hostname=example.invalid' --systype Prototype --task /distribution/reservesys

Comment 1 Dan Callaghan 2016-01-29 06:29:03 UTC
This is a regression in 22.0 due to a rather subtle mistake with the lxml conversion that we did.

http://gerrit.beaker-project.org/4647

Comment 2 Dan Callaghan 2016-01-29 06:33:39 UTC
Workaround is to change the <hostRequires/> so that it has a <system_type/> element as a top-level child. Using the example from comment 0 it could become either:

<hostRequires>
  <system_type value="Prototype"/>
  <and>
    <hostname op="=" value="example.com"/>
    <system_type value="Prototype"/>
  </and>
</hostRequires>

or simpler:

<hostRequires>
    <hostname op="=" value="example.com"/>
    <system_type value="Prototype"/>
</hostRequires>

or even just:

<hostRequires force="example.com"/>

Unfortunately if the job is being generated by a bkr workflow command, I cannot suggest any workaround because the workflow commands always unconditionally wrap the hostRequires inside an <and/> element.

Comment 5 matt jia 2016-02-01 03:58:22 UTC
Verified steps:

1. Submit a job with <hostRequires/> like this:
<hostRequires>
  <and>
    <hostname op="=" value="example.com"/>
    <system_type value="Prototype"/>
  </and>
</hostRequires>

2. Clone the job and the extra <system_type/> filter is not injected in the XML.

Comment 6 Dan Callaghan 2016-02-01 04:31:06 UTC
Beaker 22.1 has been released.


Note You need to log in before you can comment on or make changes to this bug.