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:
parent
2736e14956
commit
64476daa7e
@ -4,6 +4,7 @@ import jenkins_jobs.builder
|
|||||||
import argparse
|
import argparse
|
||||||
import ConfigParser
|
import ConfigParser
|
||||||
import logging
|
import logging
|
||||||
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
||||||
@ -40,10 +41,15 @@ def main():
|
|||||||
logging.basicConfig(level=options.log_level)
|
logging.basicConfig(level=options.log_level)
|
||||||
logger = logging.getLogger()
|
logger = logging.getLogger()
|
||||||
|
|
||||||
|
conf = '/etc/jenkins_jobs/jenkins_jobs.ini'
|
||||||
if options.conf:
|
if options.conf:
|
||||||
conf = options.conf
|
conf = options.conf
|
||||||
else:
|
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':
|
if not options.command == 'test':
|
||||||
logger.debug("Reading config from {0}".format(conf))
|
logger.debug("Reading config from {0}".format(conf))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user