CS-14596: check existence of config file before loading

Check whether the config file to load cloudstack config is avvailable
in the specified path.
This commit is contained in:
Prasanna Santhanam 2012-04-23 18:50:38 +05:30
parent 0bd43e7cf5
commit aee89701e9
2 changed files with 4 additions and 1 deletions

View File

@ -380,7 +380,7 @@ def generate_setup_config(config, file=None):
def get_setup_config(file):
if not os.path.exists(file):
return None
raise IOError("config file %s not found. please specify a valid config file"%file)
config = cloudstackConfiguration()
fp = open(file, 'r')
config = json.load(fp)

View File

@ -15,6 +15,7 @@ import configGenerator
import cloudstackException
import cloudstackTestClient
import sys
import os
import logging
from cloudstackAPI import *
from optparse import OptionParser
@ -22,6 +23,8 @@ from optparse import OptionParser
class deployDataCenters():
def __init__(self, cfgFile):
if not os.path.exists(cfgFile):
raise IOError("config file %s not found. please specify a valid config file"%cfgFile)
self.configFile = cfgFile
def addHosts(self, hosts, zoneId, podId, clusterId, hypervisor):