Use a local config file only when it exists

This commit is contained in:
Kiall Mac Innes 2012-10-30 15:16:24 +00:00
parent e630a0628d
commit d210848580
3 changed files with 12 additions and 3 deletions

View File

@ -14,6 +14,7 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import os
import sys
import eventlet
from moniker.openstack.common import cfg
@ -25,7 +26,9 @@ eventlet.monkey_patch()
config_files = cfg.find_config_files(project='moniker',
prog='moniker-agent-bind9')
config_files.append('./etc/moniker-agent-bind9.conf')
if os.path.exists('./etc/moniker-agent-bind9.conf'):
config_files.append('./etc/moniker-agent-bind9.conf')
cfg.CONF(sys.argv[1:], project='moniker', prog='moniker-agent-bind9',
default_config_files=config_files)

View File

@ -14,6 +14,7 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import os
import sys
import eventlet
from moniker.openstack.common import cfg
@ -25,7 +26,9 @@ eventlet.monkey_patch()
config_files = cfg.find_config_files(project='moniker',
prog='moniker-api')
config_files.append('./etc/moniker-api.conf')
if os.path.exists('./etc/moniker-api.conf'):
config_files.append('./etc/moniker-api.conf')
cfg.CONF(sys.argv[1:], project='moniker', prog='moniker-api',
default_config_files=config_files)

View File

@ -14,6 +14,7 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import os
import sys
import eventlet
from moniker.openstack.common import cfg
@ -25,7 +26,9 @@ eventlet.monkey_patch()
config_files = cfg.find_config_files(project='moniker',
prog='moniker-central')
config_files.append('./etc/moniker-central.conf')
if os.path.exists('./etc/moniker-central.conf'):
config_files.append('./etc/moniker-central.conf')
cfg.CONF(sys.argv[1:], project='moniker', prog='moniker-central',
default_config_files=config_files)