def _load_conf_dir(self, dirpath, must_exist=True):
     """Load Ganesha config files in dirpath in alphabetic order."""
     try:
         dirlist = os.listdir(dirpath)
     except OSError as e:
         if e.errno != errno.ENOENT or must_exist:
             raise
         dirlist = []
     LOG.info(_LI('Loading Ganesha config from %s.'), dirpath)
     conf_files = list(filter(self.confrx.search, dirlist))
     conf_files.sort()
     export_template = {}
     for conf_file in conf_files:
         with open(os.path.join(dirpath, conf_file)) as f:
             ganesha_utils.patch(export_template,
                                 ganesha_manager.parseconf(f.read()))
     return export_template
Beispiel #2
0
 def _load_conf_dir(self, dirpath, must_exist=True):
     """Load Ganesha config files in dirpath in alphabetic order."""
     try:
         dirlist = os.listdir(dirpath)
     except OSError as e:
         if e.errno != errno.ENOENT or must_exist:
             raise
         dirlist = []
     LOG.info(_LI('Loading Ganesha config from %s.'), dirpath)
     conf_files = list(filter(self._confrx.search, dirlist))
     conf_files.sort()
     export_template = {}
     for conf_file in conf_files:
         with open(os.path.join(dirpath, conf_file)) as f:
             ganesha_utils.patch(
                 export_template,
                 ganesha_manager.parseconf(f.read()))
     return export_template
Beispiel #3
0
 def test_parseconf_json_input(self):
     ret = manager.parseconf(jsonutils.dumps(test_dict_str))
     self.assertEqual(test_dict_unicode, ret)
Beispiel #4
0
 def test_parseconf_ganesha_cnf_input(self):
     ret = manager.parseconf(test_ganesha_cnf)
     self.assertEqual(test_dict_unicode, ret)
Beispiel #5
0
 def test_parseconf_json_input(self):
     ret = manager.parseconf(jsonutils.dumps(test_dict_str))
     self.assertEqual(test_dict_unicode, ret)
Beispiel #6
0
 def test_parseconf_ganesha_cnf_input(self):
     ret = manager.parseconf(test_ganesha_cnf)
     self.assertEqual(test_dict_unicode, ret)