Esempio n. 1
0
 def _get_fp(self, cfg_file):
     log.debug("Loading file: %s" % cfg_file)
     if os.path.exists(cfg_file):
         if not os.path.isfile(cfg_file):
             raise exception.ConfigError(
                 'config %s exists but is not a regular file' % cfg_file)
     else:
         raise exception.ConfigNotFound(
             "config file %s does not exist\n" % cfg_file, cfg_file)
     return open(cfg_file)
Esempio n. 2
0
 def _get_fp(self, cfg_file):
     if not os.path.isdir(static.STARCLUSTER_CFG_DIR):
         os.makedirs(static.STARCLUSTER_CFG_DIR)
     log.debug("Loading file: %s" % cfg_file)
     if os.path.exists(cfg_file):
         if not os.path.isfile(cfg_file):
             raise exception.ConfigError(
                 'config %s exists but is not a regular file' % cfg_file)
     else:
         raise exception.ConfigNotFound(
             ("config file %s does not exist\n") %
             cfg_file, cfg_file,
         )
     return open(cfg_file)