| 1 |
# Copyright 2018 Openstack Foundation |
| 2 |
|
| 3 |
# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 |
# you may not use this file except in compliance with the License. |
| 5 |
# You may obtain a copy of the License at |
| 6 |
# |
| 7 |
# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 |
# |
| 9 |
# Unless required by applicable law or agreed to in writing, software |
| 10 |
# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 |
# See the License for the specific language governing permissions and |
| 13 |
# limitations under the License. |
| 14 |
|
| 15 |
""" |
| 16 |
View support for All view-type. |
| 17 |
|
| 18 |
To create an all view specify ``all`` in the ``view-type`` attribute |
| 19 |
to the :ref:`view_all` definition. |
| 20 |
|
| 21 |
Example: |
| 22 |
|
| 23 |
.. literalinclude:: |
| 24 |
/../../tests/views/fixtures/view-all-minimal.yaml |
| 25 |
""" |
| 26 |
|
| 27 |
import xml.etree.ElementTree as XML |
| 28 |
import jenkins_jobs.modules.base |
| 29 |
import jenkins_jobs.modules.helpers as helpers |
| 30 |
|
| 31 |
|
| 32 |
class All(jenkins_jobs.modules.base.Base): |
| 33 |
sequence = 0 |
| 34 |
|
| 35 |
def root_xml(self, data): |
| 36 |
root = XML.Element("hudson.model.AllView") |
| 37 |
|
| 38 |
mapping = [ |
| 39 |
("name", "name", None), |
| 40 |
("description", "description", ""), |
| 41 |
("filter-executors", "filterExecutors", False), |
| 42 |
("filter-queue", "filterQueue", False), |
| 43 |
] |
| 44 |
helpers.convert_mapping_to_xml(root, data, mapping, fail_required=True) |
| 45 |
|
| 46 |
XML.SubElement(root, "properties", {"class": "hudson.model.View$PropertyList"}) |
| 47 |
|
| 48 |
return root |