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:
parent
2d74b16620
commit
90f4dc0dfe
@ -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):
|
||||
|
4
tests/wrappers/fixtures/locks001.xml
Normal file
4
tests/wrappers/fixtures/locks001.xml
Normal file
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<project>
|
||||
<buildWrappers/>
|
||||
</project>
|
2
tests/wrappers/fixtures/locks001.yaml
Normal file
2
tests/wrappers/fixtures/locks001.yaml
Normal file
@ -0,0 +1,2 @@
|
||||
wrappers:
|
||||
- locks:
|
15
tests/wrappers/fixtures/locks002.xml
Normal file
15
tests/wrappers/fixtures/locks002.xml
Normal 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>
|
4
tests/wrappers/fixtures/locks002.yaml
Normal file
4
tests/wrappers/fixtures/locks002.yaml
Normal file
@ -0,0 +1,4 @@
|
||||
wrappers:
|
||||
- locks:
|
||||
- FOO
|
||||
- FOO2
|
Loading…
Reference in New Issue
Block a user