Bug 840734

Summary: AttributeError: 'JobConfig' object has no attribute 'jobxml_parsed'
Product: [Retired] Beaker Reporter: Honggang LI <honli>
Component: command lineAssignee: Nick Coghlan <ncoghlan>
Status: CLOSED CURRENTRELEASE QA Contact: Amit Saha <asaha>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 0.9CC: asaha, bpeck, davids, dcallagh, ebaak, mishin, rmancy, stl
Target Milestone: 0.10.0   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: CommandLineEnhancement
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-11-22 06:43:39 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Honggang LI 2012-07-17 06:13:41 UTC
Description of problem:

[lhg@lihg tmp]$ bkr workflow-xslt --dry-run demo-job.xml 
Traceback (most recent call last):
  File "/usr/bin/bkr", line 9, in <module>
    load_entry_point('bkr.client==0.9.0', 'console_scripts', 'bkr')()
  File "/usr/lib/python2.6/site-packages/bkr/client/main.py", line 45, in main
    return cmd.run(*cmd_args, **cmd_opts.__dict__)
  File "/usr/lib/python2.6/site-packages/bkr/client/commands/cmd_workflow_xslt.py", line 710, in run
    self.__job_cfg.ValidateArguments(kwargs)
  File "/usr/lib/python2.6/site-packages/bkr/client/commands/cmd_workflow_xslt.py", line 361, in ValidateArguments
    if self.jobxml_parsed is False:
AttributeError: 'JobConfig' object has no attribute 'jobxml_parsed'

[lhg@lihg tmp]$ cat demo-job.xml 
<?xml version="1.0"?>
<jobConfig>
  <name>Simple reserve workflow demonstration</name>
  <xslt>demon.xsl</xslt>
  <arguments>
    <arg section="recipe" type="string">
      <name short="a">arch</name>
      <metavar>ARCH</metavar>
      <tag type="attribute" attrname="arch">system</tag>
      <description>Arcitechture</description>
    </arg>
    <arg section="recipe" type="string" optional="1">
      <name short="r">reserve-time</name>
      <metavar>HOURS</metavar>
      <tag type="value">reservetime</tag>
      <description>How long we should reserve the box</description>
      <default>3</default>
    </arg>
  </arguments>
</jobConfig>
[lhg@lihg tmp]$ cat demon.xsl 
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
  <xsl:template match="/submit">
    <job>
      <whiteboard>Beaker workflow-xslt demonstration</whiteboard>
      <xsl:apply-templates select="recipe"/>
    </job>
  </xsl:template>
  <xsl:template match="/submit/recipe">
    <recipeSet>
      <recipe testrepo="devel" whiteboard="Reserve a test box">
        <hostRequires>
          <and>
            <arch op="=">
              <xsl:attribute name="value">
                <xsl:value-of select="system/@arch"/>
              </xsl:attribute>
            </arch>
          </and>
        </hostRequires>
        <distroRequires>
          <and>
            <distro_name op="=" value="RHEL-6.2"/>
            <distro_variant op="=" value="Server"/>
            <distro_method op="=" value="nfs"/>
            <distro_arch op="=">
              <xsl:attribute name="value">
                <xsl:value-of select="system/@arch"/>
              </xsl:attribute>
            </distro_arch>
          </and>
        </distroRequires>
        <task name="/distribution/install" role="STANDALONE"/>
        <task name="/distribution/reservesys" role="STANDALONE">
          <params>
            <param name="RESERVETIME">
              <xsl:attribute name="value">
                <xsl:value-of select="reservetime"/>
              </xsl:attribute>
            </param>
          </params>
        </task>
      </recipe>
    </recipeSet>
  </xsl:template>
</xsl:stylesheet>


[lhg@lihg tmp]$ rpm -qfi $(which bkr)
Name        : beaker-client                Relocations: (not relocatable)
Version     : 0.9.0                             Vendor: Red Hat, Inc.
Release     : 7.el6eng                      Build Date: Mon 02 Jul 2012 10:04:43 AM CST
Install Date: Tue 17 Jul 2012 10:40:32 AM CST      Build Host: s390-004.build.bos.redhat.com
Group       : Applications/Internet         Source RPM: beaker-0.9.0-7.el6eng.src.rpm
Size        : 419699                           License: GPLv2+
Signature   : (none)
Packager    : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>
URL         : http://fedorahosted.org/beaker
Summary     : Client component for talking to Beaker server
Description :
This is the command line interface used to interact with the Beaker Server.
[lhg@lihg tmp]$ 

Version-Release number of selected component (if applicable):


How reproducible:
always

Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results:


Additional info:

Comment 1 David Sommerseth 2012-07-17 08:45:18 UTC
Thanks a lot!  I've pushed out a patch for review: http://gerrit.beaker-project.org/#/c/1217/

Comment 2 Honggang LI 2012-07-18 02:38:35 UTC
Is there a new build of beaker-client that fixed this issue?

Comment 3 Dan Callaghan 2012-07-18 06:03:53 UTC
(In reply to comment #2)
> Is there a new build of beaker-client that fixed this issue?

David's patch is still being reviewed on Gerrit. This bug will transition to ON_QA when there is a build of beaker-client that includes the fix.

Comment 4 David Sommerseth 2012-07-18 08:52:22 UTC
(In reply to comment #2)
> Is there a new build of beaker-client that fixed this issue?

What this patch solves, is actually to provide a proper error message.  It will complain about missing --job-xml ... so you shouldn't be blocked by this issue if your command line says:

  $ bkr workflow-xslt --dry-run --job-xml demo-job.xml

Comment 6 Amit Saha 2012-11-09 05:09:03 UTC
Verified to be fixed using the reporter's example files.

# bkr workflow-xslt --dry-run demo-job.xml
Usage: bkr workflow-xslt [options]

bkr: error: Missing --job-xml <filename>.  See --help for more information.

Comment 7 Raymond Mancy 2012-11-22 06:43:39 UTC
This has now been released