mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
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:
parent
0bd43e7cf5
commit
aee89701e9
@ -380,7 +380,7 @@ def generate_setup_config(config, file=None):
|
|||||||
|
|
||||||
def get_setup_config(file):
|
def get_setup_config(file):
|
||||||
if not os.path.exists(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()
|
config = cloudstackConfiguration()
|
||||||
fp = open(file, 'r')
|
fp = open(file, 'r')
|
||||||
config = json.load(fp)
|
config = json.load(fp)
|
||||||
|
|||||||
@ -15,6 +15,7 @@ import configGenerator
|
|||||||
import cloudstackException
|
import cloudstackException
|
||||||
import cloudstackTestClient
|
import cloudstackTestClient
|
||||||
import sys
|
import sys
|
||||||
|
import os
|
||||||
import logging
|
import logging
|
||||||
from cloudstackAPI import *
|
from cloudstackAPI import *
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
@ -22,6 +23,8 @@ from optparse import OptionParser
|
|||||||
class deployDataCenters():
|
class deployDataCenters():
|
||||||
|
|
||||||
def __init__(self, cfgFile):
|
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
|
self.configFile = cfgFile
|
||||||
|
|
||||||
def addHosts(self, hosts, zoneId, podId, clusterId, hypervisor):
|
def addHosts(self, hosts, zoneId, podId, clusterId, hypervisor):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user