def setup_config(self, filename, images_dir=None, context_name=None): if images_dir is None: images_dir = fixtures.TempDir() self.useFixture(images_dir) build_log_dir = fixtures.TempDir() self.useFixture(build_log_dir) if filename.startswith('/'): path = filename else: configfile = os.path.join(os.path.dirname(__file__), 'fixtures', filename) (fd, path) = tempfile.mkstemp() with open(configfile, 'rb') as conf_fd: config = conf_fd.read().decode('utf8') data = config.format(images_dir=images_dir.path, build_log_dir=build_log_dir.path, context_name=context_name, zookeeper_host=self.zookeeper_host, zookeeper_port=self.zookeeper_port, zookeeper_chroot=self.zookeeper_chroot) os.write(fd, data.encode('utf8')) os.close(fd) self._config_images_dir = images_dir self._config_build_log_dir = build_log_dir validator = ConfigValidator(path) validator.validate() return path
def setup_config(self, filename, images_dir=None, context_name=None): if images_dir is None: images_dir = fixtures.TempDir() self.useFixture(images_dir) build_log_dir = fixtures.TempDir() self.useFixture(build_log_dir) if filename.startswith('/'): path = filename else: configfile = os.path.join(os.path.dirname(__file__), 'fixtures', filename) (fd, path) = tempfile.mkstemp() with open(configfile, 'rb') as conf_fd: config = conf_fd.read().decode('utf8') data = config.format(images_dir=images_dir.path, build_log_dir=build_log_dir.path, context_name=context_name, zookeeper_host=self.zookeeper_host, zookeeper_port=self.zookeeper_port, zookeeper_chroot=self.zookeeper_chroot) os.write(fd, data.encode('utf8')) os.close(fd) self._config_images_dir = images_dir self._config_build_log_dir = build_log_dir validator = ConfigValidator(path) validator.validate() return path
def setup_config(self, filename, images_dir=None): if images_dir is None: images_dir = fixtures.TempDir() self.useFixture(images_dir) configfile = os.path.join(os.path.dirname(__file__), 'fixtures', filename) (fd, path) = tempfile.mkstemp() with open(configfile) as conf_fd: config = conf_fd.read() os.write(fd, config.format(images_dir=images_dir.path, gearman_port=self.gearman_server.port, zookeeper_host=self.zookeeper_host, zookeeper_port=self.zookeeper_port, zookeeper_chroot=self.zookeeper_chroot)) os.close(fd) self._config_images_dir = images_dir validator = ConfigValidator(path) validator.validate() return path
def setup_config(self, filename, images_dir=None): if images_dir is None: images_dir = fixtures.TempDir() self.useFixture(images_dir) configfile = os.path.join(os.path.dirname(__file__), 'fixtures', filename) (fd, path) = tempfile.mkstemp() with open(configfile) as conf_fd: config = conf_fd.read() os.write( fd, config.format(images_dir=images_dir.path, gearman_port=self.gearman_server.port, zookeeper_host=self.zookeeper_host, zookeeper_port=self.zookeeper_port, zookeeper_chroot=self.zookeeper_chroot)) os.close(fd) self._config_images_dir = images_dir validator = ConfigValidator(path) validator.validate() return path
def config_validate(self): validator = ConfigValidator(self.args.config) validator.validate() log.info("Configuration validation complete")
def test_good_config(self): config = os.path.join(os.path.dirname(tests.__file__), 'fixtures', 'config_validate', 'good.yaml') validator = ConfigValidator(config) validator.validate()
def config_validate(self): validator = ConfigValidator(self.args.config) validator.validate() log.info("Configuration validation complete")
def test_good_config(self): config = os.path.join(os.path.dirname(tests.__file__), 'fixtures', 'config_validate', 'good.yaml') validator = ConfigValidator(config) validator.validate()