Skip to content

Commit

Permalink
MySQL (incompatible change): handle !include directives in the middle…
Browse files Browse the repository at this point in the history
… of sections

CentOS 6.6 (at least) ships with a mysql.conf that has a !include directive
in the middle of a section. To accomodate that, we pull !include directives
into the sections in which they appear rather than having htem end the
section. That's the incompatible change: these directives now appear
underneath /target/!include rather than at /!include

Fixes hercules-team#113
  • Loading branch information
lutter committed May 22, 2015
1 parent 49d0805 commit 4b1378a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
6 changes: 5 additions & 1 deletion lenses/mysql.aug
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ let comment = IniFile.comment IniFile.comment_re "#"

let sep = IniFile.sep IniFile.sep_re IniFile.sep_default

(* Like Rx.fspath, but we also disallow characters that start comments *)
let fspath = store /[^ \t\r\n#;]+/

let entry =
let bare =
Quote.do_dquote_opt_nil (store /[^#;" \t\r\n]+([ \t]+[^#;" \t\r\n]+)*/) in
Expand All @@ -23,6 +26,7 @@ let entry =
line (key IniFile.entry_re . sep . Sep.opt_space . bare)
| line (key IniFile.entry_re . sep . Sep.opt_space . quoted)
| line (key IniFile.entry_re . store //)
| line (key /!include(dir)?/ . Sep.space . fspath)
| comment

(************************************************************************
Expand All @@ -39,7 +43,7 @@ let record = IniFile.record title entry
let includedir = Build.key_value_line /!include(dir)?/ Sep.space (store Rx.fspath)
. (comment|IniFile.empty)*

let lns = (comment|IniFile.empty)* . (record|includedir)*
let lns = (comment|IniFile.empty)* . record*

let filter = (incl "/etc/mysql/my.cnf")
. (incl "/etc/mysql/conf.d/*.cnf")
Expand Down
10 changes: 4 additions & 6 deletions lenses/tests/test_mysql.aug
Original file line number Diff line number Diff line change
Expand Up @@ -274,10 +274,8 @@ key_buffer = 16M
{}
{ "#comment" = "* IMPORTANT: Additional settings that can override those from this file!" }
{}
{ "!includedir" = "/etc/mysql/conf.d/" }
{ "!include" = "/etc/mysql/other_conf.d/someconf.cnf" }
{ "#comment" = "Another comment" }
{ }
}
{ "!includedir" = "/etc/mysql/conf.d/" }
{ "!include" = "/etc/mysql/other_conf.d/someconf.cnf" }
{ "#comment" = "Another comment" }
{ }


0 comments on commit 4b1378a

Please sign in to comment.