A full configuration file
let file = "# # Aliases in this file will NOT be expanded in the header from # Mail, but WILL be visible over networks or from /bin/mail. # Basic system aliases -- these MUST be present. mailer-daemon: postmaster postmaster: root # General redirections for pseudo accounts. bin: root , adm, bob daemon: root adm: root file: /var/foo pipe1: |/bin/ls pipe2 : |\"/usr/bin/ls args,\" "
a file begins with a / and get almost anything else after
let file_r = /\/[^ \t\n;]+/
let filesystem = [ label "filesystem" . store filesystem_kw ]
Regexps for filesystem
let filesystem_kw = "-" | "swap"
let filters = "<Chain \"PreCache\"> <Rule \"no_fqdn\"> <Match \"regex\"> Host \"^[^\.]*$\" Invert false </Match> Target \"stop\" </Rule> </Chain> "
Options without values
let flags = "dumponexit" | "generatecommandkey" | "lock_all" | "noclientlog" | "rtconutc" | "rtcsync"
let fs_option = [ key /createopts|tuneopts/ . Util.del_str "=\"" . store /[^"\n]*/ . Util.del_str "\"" ]
An array of fs_options
let fs_options =
let fspath = Rx.fspath
A filesystem path
let fspath = /[^ \t\n]+/
let full = "path ~ ^/file_(metadata|content)/user_files/ # Set environments environment production, development environment foo method find, search auth yes method save allow /^(.+\.)?example.com$/ allow_ip 192.168.100.0/24 # Added in Puppet 3.0.0 # This overrides the previous auth authenticated any "
let generic_entry_re = /[^# \t\n\/]+/ - entries_re
A generic key/value option
let generic_opt (type:string) (kw:regexp) = [ key type . Util.del_str ":" . store kw ]
A generic key/list option
let generic_opt_list (type:string) (kw:regexp) = [ key type . Util.del_str ":" . counter "locallist" . Build.opt_list [seq "locallist" . store kw] Sep.comma ]
let group_record = generic_record "group" (Util.del_str "@" . store name)
A hex value
let hex = /0x[0-9a-fA-F]+/
Hostname, FQDN or part of an FQDN possibly starting with a dot.
let hostname = /\.?[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?)*/
A valid RFC 1123 hostname
let hostname = /(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*( [A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])/
An example of an HTTP health checker
let http_check = "virtual_server 192.168.1.11 22 { real_server 10.20.40.10 22 { HTTP_GET { url { path /mrtg2/ digest 9b3a0c85a887a256d6939da88aabd8cd status_code 200 } connect_timeout 3 connect_port 8080 nb_get_retry 5 delay_before_retry 10 } SSL_GET { connect_port 8443 } } } " test Keepalived.lns get http_check = { "virtual_server" { "ip" = "192.168.1.11" } { "port" = "22" } { "real_server" { "ip" = "10.20.40.10" } { "port" = "22" } { "HTTP_GET" { "url" { "path" = "/mrtg2/" } { "digest" = "9b3a0c85a887a256d6939da88aabd8cd" } { "status_code" = "200" } } { "connect_timeout" = "3" } { "connect_port" = "8080" } { "nb_get_retry" = "5" } { "delay_before_retry" = "10" } } { "SSL_GET" { "connect_port" = "8443" } } } }
Regex for user/group identifiers
let identifier_re = /[A-Za-z0-9_.\\-]+/
An Util.indent
let indent = Util.indent
let indent = Util.indent
let indent = Util.indent
Delete indentation, including leading whitespace
let indent = del /[ \t]*/ ""
let indent = Util.indent
let input1 = "<?xml version=\"1.0\" encoding=\"UTF-8\"?> <html>\r <head> <title>Wiki</title> </head> <body> <h1>Augeas</h1> <p class=\"main\">Augeas is now able to parse XML files!</p> <ul> <li>Translate from XML to a tree syntax</li> <li>Translate from the tree back to XML</li> <!-- this is some comment --> <li>this</li> </ul> </body> </html> "
let int = /[0-9]+/
let integer = Rx.integer
One or more digits
let integer = /[0-9]+/
let ip = Rx.ip
An ipv4 or ipv6
let ip = ipv4 | ipv6
CIDR or ip+netmask
let ipaddr = /[0-9a-fA-F:.]+(\/[0-9]+|[ \t]+[0-9.]+)/
let ipv4 = let dot = "." in byte . dot . byte . dot . byte . dot . byte
let ipv6 = /(([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})/ | /(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})/ | /(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})/ | /(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})/ | /(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})/ | /(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})/ | ( /([0-9A-Fa-f]{1,4}:){6}/ . /((((25[0-5])|(1[0-9]{2})|(2[0-4][0-9])|([0-9]{1,2})))\.){3}/ . /(((25[0-5])|(1[0-9]{2})|(2[0-4][0-9])|([0-9]{1,2})))/ ) | ( /([0-9A-Fa-f]{1,4}:){0,5}:/ . /((((25[0-5])|(1[0-9]{2})|(2[0-4][0-9])|([0-9]{1,2})))\.){3}/ . /(((25[0-5])|(1[0-9]{2})|(2[0-4][0-9])|([0-9]{1,2})))/ ) | ( /::([0-9A-Fa-f]{1,4}:){0,5}/ . /((((25[0-5])|(1[0-9]{2})|(2[0-4][0-9])|([0-9]{1,2})))\.){3}/ . /(((25[0-5])|(1[0-9]{2})|(2[0-4][0-9])|([0-9]{1,2})))/ ) | ( /[0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}/ . /[0-9A-Fa-f]{1,4}/ ) | /(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})/ | /(([0-9A-Fa-f]{1,4}:){1,7}:)/
let key_re = /\$?[A-Za-z0-9_.-]+/
let key_re = /[^=# \t\n]+/
Match any possible key except commands and block names.
let keys = Rx.word - (commands | block_names)
let keys = "# Example keys, one of each type # ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDpWrKYsEsVUyuwMN4ReBN/TMGsaUWzDKDz/uQr6MlNNM95MDK/BPyJ+DiBiNMFVLpRt3gH3eCJBLJKMuUDaTNy5uym2zNgAaAIVct6M2GHI68W3iY3Ja8/MaRPbyTpMh1O74S+McpAW1SGL2YzFchYMjTnu/kOD3lxiWNiDLvdLFZu0wPOi7CYG37VXR4Thb0cC92zqnCjaP1TwfhpEYUZoowElYkoV2vG+19O6cRm/zduYcf8hmegZKB4GFUJTtZ2gZ18XJDSQd0ykK3KPt/+bKskdrtfiOwSZAmUZmd2YuAlY6+CBn1T3UBdQntueukd0z1xhd6SX7Bl8+qyqLQ3 user@example ssh-dsa AAAA user@example ecdsa-sha2-nistp256 AAAA user@example ssh-ed25519 AAAA user@example # Example comments ssh-dsa AAAA ssh-dsa AAAA user@example "
Format of an LDAP OID from RFC 2251
let ldapoid_re = /[0-9][0-9\.]*/
let list_empty = "keyword=; " test Up2date.lns get list_empty = { "1" = "keyword" { "values" } }
let list_nocomment_test = "test_ace = val1,val2,val3 \n"
let list_one = "keyword=foo; " test Up2date.lns get list_one = { "1" = "keyword" { "values" { "1" = "foo" } } }
let list_test = "test_ace = val1,val2,val3 # a comment\n"
Probably not useful, up2date throws “bar” away
let list_two = "keyword=foo;bar " test Up2date.lns get list_two = { "1" = "keyword" { "values" { "1" = "foo" } { "2" = "bar" } } }
let list_two_trailing = "keyword=foo;bar; " test Up2date.lns get list_two_trailing = { "1" = "keyword" { "values" { "1" = "foo" } { "2" = "bar" } } }
The disk_config lens
let lns = (disk_config|comment|empty)*
let lns_ace = IniFile.lns record_ace comment_ace
let lns_acf = IniFile.lns_noempty record_acf comment_acf
let lns_ade = IniFile.lns record_ade comment_ade
let lns_adf = IniFile.lns_noempty record_adf comment_adf
let lns_bce = IniFile.lns record_bce comment_bce
let lns_bcf = IniFile.lns_noempty record_bce comment_bcf
let lns_bde = IniFile.lns record_bde comment_bde
let lns_bdf = IniFile.lns_noempty record_bdf comment_bdf
log has a specific options list
let log_flags = /measurements|statistics|tracking|rtc|refclocks|tempcomp/
Matches a hostname, that is labels speparated by dots, labels can’t start or end with a “-”.
let loghost_r = /[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?)*/ | "[" . Rx.ipv6 . "]"
let lvmoption =