Jelajahi Sumber

Account for unexpected comments in config parsing util.

Nashwan Azhari 6 tahun lalu
induk
melakukan
1d747d7d7d
1 mengubah file dengan 1 tambahan dan 1 penghapusan
  1. 1 1
      coriolis/utils.py

+ 1 - 1
coriolis/utils.py

@@ -654,7 +654,7 @@ def parse_ini_config(file_contents):
     returns a dict with the options/values within it.
     """
     config = {}
-    regex_expr = '(.*[^-\\s])\\s*=\\s*(?:"|\')?([^"\']*)(?:"|\')?\\s*'
+    regex_expr = '([^#]*[^-\\s#])\\s*=\\s*(?:"|\')?([^#"\']*)(?:"|\')?\\s*'
     for config_line in file_contents.splitlines():
         m = re.match(regex_expr, config_line)
         if m: