+ dot_local = glob(self.conf_dir + '/*.local') # *.local jail configurations files
+ dot_conf = glob(self.conf_dir + '/*.conf') # *.conf jail configuration files
+
+ if not any([dot_local, dot_conf]):
+ self.error('%s is empty or not readable' % self.conf_dir)
+ # According "man jail.conf" files could be *.local AND *.conf
+ # *.conf files parsed first. Changes in *.local overrides configuration in *.conf
+ if dot_conf:
+ dot_local.extend([conf for conf in dot_conf if conf[:-5] not in [local[:-6] for local in dot_local]])
+ # Make sure all files are readable
+ dot_local = [conf for conf in dot_local if is_accessible(conf, R_OK)]
+ if dot_local:
+ enabled_jails = list()
+ for jail_conf in dot_local:
+ with open(jail_conf, 'rt') as conf:
+ enabled_jails.extend(REGEX.findall(' '.join(conf.read().split())))
+ self.jails_list = list(set(enabled_jails))
+ else:
+ self.jails_list = list()
+ self.error('Files in %s not readable' % self.conf_dir)
+