Update tfs to use convert_mapping_to_xml()

Change-Id: Iec3972d2f16e660759b9eeaedb26bddea2ff21a6
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
This commit is contained in:
Yolande Amate 2017-06-30 03:35:38 +01:00 committed by Thanh Ha
parent ec3de63dab
commit 4ee8581e38
No known key found for this signature in database
GPG Key ID: B0CB27E00DA095AA
4 changed files with 18 additions and 20 deletions

View File

@ -972,24 +972,22 @@ def tfs(registry, xml_parent, data):
tfs = XML.SubElement(xml_parent, 'scm',
{'class': 'hudson.plugins.tfs.'
'TeamFoundationServerScm'})
XML.SubElement(tfs, 'serverUrl').text = str(
data.get('server-url', ''))
XML.SubElement(tfs, 'projectPath').text = str(
data.get('project-path', ''))
XML.SubElement(tfs, 'localPath').text = str(
data.get('local-path', '.'))
XML.SubElement(tfs, 'workspaceName').text = str(
data.get('workspace', 'Hudson-${JOB_NAME}-${NODE_NAME}'))
# TODO: In the future, it would be nice to have a place that can pull
# passwords into JJB without having to commit them in plaintext. This
# could also integrate nicely with global configuration options.
XML.SubElement(tfs, 'userPassword')
XML.SubElement(tfs, 'userName').text = str(
data.get('login', ''))
XML.SubElement(tfs, 'useUpdate').text = str(
data.get('use-update', True))
mapping = [
('server-url', 'serverUrl', ''),
('project-path', 'projectPath', ''),
('local-path', 'localPath', '.'),
('workspace', 'workspaceName', 'Hudson-${JOB_NAME}-${NODE_NAME}'),
# TODO: In the future, it would be nice to have a place that can pull
# passwords into JJB without having to commit them in plaintext. This
# could also integrate nicely with global configuration options.
('', 'userPassword', ''),
('login', 'userName', ''),
('use-update', 'useUpdate', True),
]
convert_mapping_to_xml(tfs, data, mapping, fail_required=True)
store = data.get('web-access', None)
if 'web-access' in data and isinstance(store, list):
if isinstance(store, list):
web = XML.SubElement(tfs, 'repositoryBrowser',
{'class': 'hudson.plugins.tfs.browsers.'
'TeamSystemWebAccessBrowser'})

View File

@ -7,7 +7,7 @@
<workspaceName>Hudson-${JOB_NAME}</workspaceName>
<userPassword/>
<userName>mydomain\\jane</userName>
<useUpdate>False</useUpdate>
<useUpdate>false</useUpdate>
<repositoryBrowser class="hudson.plugins.tfs.browsers.TeamSystemWebAccessBrowser">
<url>http://TFSMachine:8080</url>
</repositoryBrowser>

View File

@ -7,7 +7,7 @@
<workspaceName>Hudson-${JOB_NAME}</workspaceName>
<userPassword/>
<userName>jane@mydomain</userName>
<useUpdate>False</useUpdate>
<useUpdate>false</useUpdate>
<repositoryBrowser class="hudson.plugins.tfs.browsers.TeamSystemWebAccessBrowser"/>
</scm>
</project>

View File

@ -7,6 +7,6 @@
<workspaceName>Hudson-${JOB_NAME}</workspaceName>
<userPassword/>
<userName>mydomain\\jane</userName>
<useUpdate>False</useUpdate>
<useUpdate>false</useUpdate>
</scm>
</project>