~jorge/charms/precise/mysql/fix-metadata

35.2.1 by Clint Byrum
- adding master/slave replication
1
(* MySQL module for Augeas                    *)
2
(* Author: Tim Stoop <tim@kumina.nl>          *)
3
(* Heavily based on php.aug by Raphael Pinson *)
4
(* <raphink@gmail.com>                        *)
5
(*                                            *)
6
7
module MySQL =
8
  autoload xfm
9
10
(************************************************************************
11
 * INI File settings
12
 *************************************************************************)
13
let comment  = IniFile.comment IniFile.comment_re "#"
14
15
let sep      = IniFile.sep IniFile.sep_re IniFile.sep_default
16
17
let entry    = [ key IniFile.entry_re . sep . IniFile.sto_to_comment . (comment|IniFile.eol) ] | 
18
               [ key IniFile.entry_re . store // . (comment|IniFile.eol) ] | 
19
               [ key /\![A-Za-z][A-Za-z0-9\._-]+/ . del / / " " . store /\/[A-Za-z0-9\.\/_-]+/ . (comment|IniFile.eol) ] |
20
               comment
21
22
(************************************************************************
23
 * sections, led by a "[section]" header
24
 * We can't use titles as node names here since they could contain "/"
25
 * We remove #comment from possible keys
26
 * since it is used as label for comments
27
 * We also remove / as first character
28
 * because augeas doesn't like '/' keys (although it is legal in INI Files)
29
 *************************************************************************)
30
let title   = IniFile.indented_title_label "target" IniFile.record_label_re
31
let record  = IniFile.record title entry
32
33
let lns    = IniFile.lns record comment
34
35
let filter = (incl "/etc/mysql/my.cnf")
36
             . (incl "/etc/mysql/conf.d/*.cnf")
37
             . Util.stdexcl
38
39
let xfm = transform lns filter
40