wrappers: fixed locks for empty collection

it caused "Locks" checkbox to be checked, and it picked up first lock
from selectbox as default.

Change-Id: I13fdf104c6c32b783fb539f8947e3e071cb9788c
Signed-off-by: Lukas Bednar <lbednar@redhat.com>
This commit is contained in:
Lukas Bednar 2014-07-15 17:01:10 +02:00
parent 2d74b16620
commit 90f4dc0dfe
5 changed files with 37 additions and 13 deletions

View File

@ -424,22 +424,21 @@ def locks(parser, xml_parent, data):
:arg: list of locks to use
Example::
Example:
wrappers:
- locks:
- FOO
- FOO2
.. literalinclude:: /../../tests/wrappers/fixtures/locks002.yaml
:language: yaml
"""
lw = XML.SubElement(xml_parent,
'hudson.plugins.locksandlatches.LockWrapper')
locktop = XML.SubElement(lw, 'locks')
locks = data
for lock in locks:
lockwrapper = XML.SubElement(locktop,
'hudson.plugins.locksandlatches.'
'LockWrapper_-LockWaitConfig')
XML.SubElement(lockwrapper, 'name').text = lock
if locks:
lw = XML.SubElement(xml_parent,
'hudson.plugins.locksandlatches.LockWrapper')
locktop = XML.SubElement(lw, 'locks')
for lock in locks:
lockwrapper = XML.SubElement(locktop,
'hudson.plugins.locksandlatches.'
'LockWrapper_-LockWaitConfig')
XML.SubElement(lockwrapper, 'name').text = lock
def copy_to_slave(parser, xml_parent, data):

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<buildWrappers/>
</project>

View File

@ -0,0 +1,2 @@
wrappers:
- locks:

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<buildWrappers>
<hudson.plugins.locksandlatches.LockWrapper>
<locks>
<hudson.plugins.locksandlatches.LockWrapper_-LockWaitConfig>
<name>FOO</name>
</hudson.plugins.locksandlatches.LockWrapper_-LockWaitConfig>
<hudson.plugins.locksandlatches.LockWrapper_-LockWaitConfig>
<name>FOO2</name>
</hudson.plugins.locksandlatches.LockWrapper_-LockWaitConfig>
</locks>
</hudson.plugins.locksandlatches.LockWrapper>
</buildWrappers>
</project>

View File

@ -0,0 +1,4 @@
wrappers:
- locks:
- FOO
- FOO2