Update hue light plugin to use convert xml
- Rename test file to be more descriptive - Update doc unnecessary new lines Change-Id: I78f75c5fa0ea8cacb8acd6f591f0c11a4416e4a5 Signed-off-by: Kien Ha <kienha9922@gmail.com>
This commit is contained in:
parent
2bf92c3ed7
commit
8a5fd48736
@ -223,35 +223,34 @@ def hue_light(parser, xml_parent, data):
|
|||||||
:arg string unstable-build: Colour of unstable state (default 'yellow')
|
:arg string unstable-build: Colour of unstable state (default 'yellow')
|
||||||
:arg string bad-build: Colour of unsuccessful state (default 'red')
|
:arg string bad-build: Colour of unsuccessful state (default 'red')
|
||||||
|
|
||||||
Example:
|
Full Example:
|
||||||
|
|
||||||
.. literalinclude::
|
.. literalinclude:: /../../tests/publishers/fixtures/hue-light-full.yaml
|
||||||
/../../tests/publishers/fixtures/hue-light-minimal.yaml
|
|
||||||
:language: yaml
|
:language: yaml
|
||||||
|
|
||||||
.. literalinclude::
|
Minimal Example:
|
||||||
/../../tests/publishers/fixtures/hue-light001.yaml
|
|
||||||
|
.. literalinclude:: /../../tests/publishers/fixtures/hue-light-minimal.yaml
|
||||||
:language: yaml
|
:language: yaml
|
||||||
"""
|
"""
|
||||||
|
|
||||||
hue_light = XML.SubElement(
|
hue_light = XML.SubElement(
|
||||||
xml_parent, 'org.jenkinsci.plugins.hue__light.LightNotifier')
|
xml_parent, 'org.jenkinsci.plugins.hue__light.LightNotifier')
|
||||||
hue_light.set('plugin', 'hue-light')
|
hue_light.set('plugin', 'hue-light')
|
||||||
|
|
||||||
if 'light-id' not in data:
|
|
||||||
raise MissingAttributeError('light-id')
|
|
||||||
lightId = XML.SubElement(hue_light, 'lightId')
|
lightId = XML.SubElement(hue_light, 'lightId')
|
||||||
XML.SubElement(lightId, 'string').text = str(data.get(
|
|
||||||
'light-id', ''))
|
|
||||||
|
|
||||||
XML.SubElement(hue_light, 'preBuild').text = data.get(
|
id_mapping = [('light-id', 'string', None)]
|
||||||
'pre-build', 'blue')
|
helpers.convert_mapping_to_xml(
|
||||||
XML.SubElement(hue_light, 'goodBuild').text = data.get(
|
lightId, data, id_mapping, fail_required=True)
|
||||||
'good-build', 'green')
|
|
||||||
XML.SubElement(hue_light, 'unstableBuild').text = data.get(
|
build_mapping = [
|
||||||
'unstable-build', 'yellow')
|
('pre-build', 'preBuild', 'blue'),
|
||||||
XML.SubElement(hue_light, 'badBuild').text = data.get(
|
('good-build', 'goodBuild', 'green'),
|
||||||
'bad-build', 'red')
|
('unstable-build', 'unstableBuild', 'yellow'),
|
||||||
|
('bad-build', 'badBuild', 'red'),
|
||||||
|
]
|
||||||
|
helpers.convert_mapping_to_xml(
|
||||||
|
hue_light, data, build_mapping, fail_required=True)
|
||||||
|
|
||||||
|
|
||||||
def campfire(parser, xml_parent, data):
|
def campfire(parser, xml_parent, data):
|
||||||
|
Loading…
Reference in New Issue
Block a user