fallback to ./jenkins_job.ini conf

When doing developement, we usually want to stick a jenkins_job.ini file
at the root of our working directory. The logic still look under /etc/
by default and --conf will override the config file.

Test plan:
* tox is all green

Change-Id: I28781653feb3ce60eb18b50e5b44383d4b544f5a
Reviewed-on: https://review.openstack.org/14285
Reviewed-by: Clark Boylan <clark.boylan@gmail.com>
Approved: Monty Taylor <mordred@inaugust.com>
Reviewed-by: Monty Taylor <mordred@inaugust.com>
Tested-by: Jenkins
This commit is contained in:
Antoine Musso 2012-10-10 15:11:10 +02:00 committed by Jenkins
parent 2736e14956
commit 64476daa7e
1 changed files with 7 additions and 1 deletions

View File

@ -4,6 +4,7 @@ import jenkins_jobs.builder
import argparse
import ConfigParser
import logging
import os
import sys
@ -40,10 +41,15 @@ def main():
logging.basicConfig(level=options.log_level)
logger = logging.getLogger()
conf = '/etc/jenkins_jobs/jenkins_jobs.ini'
if options.conf:
conf = options.conf
else:
conf = '/etc/jenkins_jobs/jenkins_jobs.ini'
# Fallback to script directory
localconf = os.path.join(os.path.dirname(__file__),
'jenkins_jobs.ini')
if os.path.isfile(localconf):
conf = localconf
if not options.command == 'test':
logger.debug("Reading config from {0}".format(conf))