upsert_job

Change-Id: I1f389baf1c530b6e04860569deb5aca51bf781c2
This commit is contained in:
Marcos Diez 2019-09-17 10:12:27 -03:00
parent 35f660a8b9
commit 722a303f9a
1 changed files with 12 additions and 0 deletions

View File

@ -1170,6 +1170,18 @@ class Jenkins(object):
if not self.job_exists(name):
raise JenkinsException(exception_message % name)
def upsert_job(self, name, config_xml):
'''Create a new Jenkins job or reconfigures it if it exists
:param name: Name of Jenkins job, ``str``
:param config_xml: config file text, ``str``
'''
if self.job_exists(name):
self.reconfig_job(name, config_xml)
else:
self.create_job(name, config_xml)
def create_job(self, name, config_xml):
'''Create a new Jenkins job