diff options
author | Kien Ha <kienha9922@gmail.com> | 2016-07-14 18:51:10 -0400 |
---|---|---|
committer | Kien Ha <kienha9922@gmail.com> | 2016-07-14 18:51:10 -0400 |
commit | 739f90a65319041c1f2ad76a1d15447d3d01358e (patch) | |
tree | f78fa58743c1fb1cc453bc1a1d0e8bd21e50dc61 /jenkins_jobs | |
parent | d6add35e72c6c2beb44b1be57f589d79f98f5551 (diff) | |
download | python-jenkins-job-builder-739f90a65319041c1f2ad76a1d15447d3d01358e.tar.gz python-jenkins-job-builder-739f90a65319041c1f2ad76a1d15447d3d01358e.tar.xz python-jenkins-job-builder-739f90a65319041c1f2ad76a1d15447d3d01358e.zip |
Update MongoDB plugin
- Update to use convert xml
- Update doc options to have default values
- Rename test files to be more descriptive
Change-Id: I83ada14df074805333eb50d746a0bc90fd7b5619
Signed-off-by: Kien Ha <kienha9922@gmail.com>
Diffstat (limited to 'jenkins_jobs')
-rw-r--r-- | jenkins_jobs/modules/wrappers.py | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/jenkins_jobs/modules/wrappers.py b/jenkins_jobs/modules/wrappers.py index 3a7521d9..22333904 100644 --- a/jenkins_jobs/modules/wrappers.py +++ b/jenkins_jobs/modules/wrappers.py @@ -37,6 +37,7 @@ from jenkins_jobs.modules.helpers import artifactory_env_vars_patterns from jenkins_jobs.modules.helpers import artifactory_optional_props from jenkins_jobs.modules.helpers import artifactory_repository from jenkins_jobs.modules.helpers import config_file_provider_builder +from jenkins_jobs.modules.helpers import convert_mapping_to_xml logger = logging.getLogger(__name__) @@ -1473,33 +1474,34 @@ def mongo_db(parser, xml_parent, data): Initalizes a MongoDB database while running the build. Requires the Jenkins :jenkins-wiki:`MongoDB plugin <MongoDB+Plugin>`. - :arg str name: The name of the MongoDB install to use - :arg str data-directory: Data directory for the server (optional) - :arg int port: Port for the server (optional) - :arg str startup-params: Startup parameters for the server (optional) + :arg str name: The name of the MongoDB install to use (required) + :arg str data-directory: Data directory for the server (default '') + :arg int port: Port for the server (default '') + :arg str startup-params: Startup parameters for the server (default '') :arg int start-timeout: How long to wait for the server to start in - milliseconds. 0 means no timeout. (default '0') + milliseconds. 0 means no timeout. (default 0) - Example: + Full Example: + + .. literalinclude:: /../../tests/wrappers/fixtures/mongo-db-full.yaml - .. literalinclude:: /../../tests/wrappers/fixtures/mongo-db001.yaml + Minimal Example: + .. literalinclude:: /../../tests/wrappers/fixtures/mongo-db-minimal.yaml """ mongodb = XML.SubElement(xml_parent, 'org.jenkinsci.plugins.mongodb.' 'MongoBuildWrapper') mongodb.set('plugin', 'mongodb') - if not str(data.get('name', '')): - raise JenkinsJobsException('The mongo install name must be specified.') - XML.SubElement(mongodb, 'mongodbName').text = str(data.get('name', '')) - XML.SubElement(mongodb, 'port').text = str(data.get('port', '')) - XML.SubElement(mongodb, 'dbpath').text = str(data.get( - 'data-directory', '')) - XML.SubElement(mongodb, 'parameters').text = str(data.get( - 'startup-params', '')) - XML.SubElement(mongodb, 'startTimeout').text = str(data.get( - 'start-timeout', '0')) + mapping = [ + ('name', 'mongodbName', None), + ('port', 'port', ''), + ('data-directory', 'dbpath', ''), + ('startup-params', 'parameters', ''), + ('start-timeout', 'startTimeout', 0), + ] + convert_mapping_to_xml(mongodb, data, mapping, fail_required=True) def delivery_pipeline(parser, xml_parent, data): |