Skip to content

Commit

Permalink
add job existence check
Browse files Browse the repository at this point in the history
create_copy:
- template must exist
- new job must not already exist
  • Loading branch information
chaosblog committed Feb 6, 2013
1 parent 0e13dc5 commit 42a2545
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions autojenkins/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,12 @@ def create_copy(self, jobname, template_job, enable=True, **context):
"""
Create a job from a template job.
"""
if not self.job_exists(template_job):
raise Exception("Template job doesn't exists")

if self.job_exists(jobname):
raise Exception("Another job with this name already exists")

config = self.get_config_xml(template_job)

# remove stupid quotes added by Jenkins
Expand Down

0 comments on commit 42a2545

Please sign in to comment.