S | |
section_re, Xorg | |
secton_re_obsolete, Xorg | |
semicolon | |
sep | |
sep_ace, Test_IniFile | |
sep_acf, Test_IniFile | |
sep_ade, Test_IniFile | |
sep_adf, Test_IniFile | |
sep_bce, Test_IniFile | |
sep_bcf, Test_IniFile | |
sep_bde, Test_IniFile | |
sep_bdf, Test_IniFile | |
sep_col, Sudoers | |
sep_com, Sudoers | |
sep_cont, Sudoers | |
sep_cont_opt, Sudoers | |
sep_cont_opt_build, Sudoers | |
sep_default, IniFile | |
sep_dquote | |
sep_eq | |
sep_noindent, IniFile | |
sep_re, IniFile | |
sep_spc | |
sep_tab | |
sep_tab_opt, Syslog | |
service_attr, Xinetd | |
set_operator, Solaris_System | |
shell_command_rx, Hosts_Access | |
short, Test_Tmpfiles | |
short_age, Test_Tmpfiles | |
short_age_tree, Test_Tmpfiles | |
short_gid, Test_Tmpfiles | |
short_gid_tree, Test_Tmpfiles | |
short_mode, Test_Tmpfiles | |
short_mode_tree, Test_Tmpfiles | |
short_tree, Test_Tmpfiles | |
short_uid, Test_Tmpfiles | |
short_uid_tree, Test_Tmpfiles | |
simple | |
simple_config, Test_FAI_DiskConfig | |
simple_keys, Chrony | |
simple_tree, Test_Tmpfiles | |
single_opt_re, Quote | |
size, FAI_DiskConfig | |
size_kw, FAI_DiskConfig | |
smtp_check, Test_Keepalived | |
space | |
space_equal, Sep | |
space_in, Rx | |
space_list_re, Subversion | |
space_or_eol_re, Postfix_Virtual | |
spare_missing, FAI_DiskConfig | |
squote, Quote | |
squote_opt, Quote | |
squote_opt_nil, Quote | |
std_re, Subversion | |
stdexcl, Util | |
sto_integer, Sudoers | |
sto_multiline, IniFile | |
sto_multiline_nocomment, IniFile | |
sto_to_com, Sudoers | |
sto_to_com_cmnd, Sudoers | |
sto_to_com_col, Sudoers | |
sto_to_com_dquot, Sudoers | |
sto_to_com_host, Sudoers | |
sto_to_com_user, Sudoers | |
sto_to_comment | |
sto_to_eol, IniFile | |
sto_to_eq, Sudoers | |
sto_to_spc, Sudoers | |
sto_to_spc_no_dquote, Sudoers | |
subnet, Sysconfig_Route |
Known values for Section names
let section_re = /(Extensions|Files|ServerFlags|Module|InputDevice|InputClass|Device|VideoAdaptor|Monitor|Modes|Screen|ServerLayout|DRI|Vendor)/
let semicolon = Util.del_str ";"
Deletes a semicolon and default to it
let semicolon = sep_tab_opt . Util.del_str ";" . sep_tab_opt
Only treat one space as the sep, extras are stripped by IniFile
let sep = Util.del_str " "
let sep = /[ \t]+/
Generic separator
let sep (pat:regexp) (default:string) = Sep.opt_space . del pat default
let sep_ace = IniFile.sep IniFile.sep_re IniFile.sep_default
let sep_acf = IniFile.sep IniFile.sep_re IniFile.sep_default
let sep_ade = IniFile.sep IniFile.sep_re IniFile.sep_default
let sep_adf = IniFile.sep IniFile.sep_re IniFile.sep_default
let sep_bce = IniFile.sep "=" "="
let sep_bcf = IniFile.sep "=" "="
let sep_bde = IniFile.sep "=" "="
let sep_bdf = IniFile.sep "=" "="
let sep_col = sep_cont_opt_build ":"
let sep_com = sep_cont_opt_build ","
let sep_cont = Sep.cl_or_space
let sep_cont_opt = Sep.cl_or_opt_space
let sep_cont_opt_build (sep:string) = del (Rx.cl_or_opt_space . sep . Rx.cl_or_opt_space) (" " . sep . " ")
The default separator value
let sep_default = "="
let sep_dquote = Util.del_str "\""
let sep_dquote = Util.del_str "\""
let sep_eq = Util.del_str "="
let sep_eq = sep_cont_opt_build "="
Generic separator, no indentation
let sep_noindent (pat:regexp) (default:string) = del pat default
The default regexp for a separator
let sep_re = /[=:]/
let sep_spc = Util.del_ws_spc
let sep_spc = Sep.space
let sep_spc = Util.del_ws_spc
let sep_tab = Sep.tab
let sep_tab = del /([ \t]+|[ \t]*\\\\\n[ \t]*)/ "\t"
let sep_tab_opt = del /([ \t]*|[ \t]*\\\\\n[ \t]*)/ ""
It is much faster to combine, for example, all the attr_one attributes into one regexp and pass that to a lens instead of using lens union (attr_one “a” | attr_one “b”|..)
let service_attr = attr_one (/socket_type|protocol|wait|user|group|server|instances/i |/rpc_version|rpc_number|id|port|nice|banner|bind|interface/i |/per_source|groups|banner_success|banner_fail|disable|max_load/i |/rlimit_as|rlimit_cpu|rlimit_data|rlimit_rss|rlimit_stack|v6only/i |/deny_time|umask|mdns|libwrap/i)
Valid set operators: equals, bitwise AND and OR
let set_operators = /[=&|]/
let shell_command_rx = /[^ \t\n:][^\n]*[^ \t\n]|[^ \t\n:\\\\]/ - ( option_kw . /.*/ )
Example with only type and path
let short = "A+ /tmp/foo\n"
Example with only 6 fields
let short_age = "H /var/tmp/fooBarFOO - jj jj ~10d\n"
Tree for short_age
let short_age_tree = { "1" { "type" = "H" } { "path" = "/var/tmp/fooBarFOO" } { "mode" = "-" } { "uid" = "jj" } { "gid" = "jj" } { "age" = "~10d" } }
Example with only 5 fields
let short_gid = "z /tmp/bar/foo -\t- augd\n"
Tree for short_gid
let short_gid_tree = { "1" { "type" = "z" } { "path" = "/tmp/bar/foo" } { "mode" = "-" } { "uid" = "-" } { "gid" = "augd" } }
Example with only 3 fields
let short_mode = "c+! /tmp/foo ~0755\n"
Tree for short_mode
let short_mode_tree = { "1" { "type" = "c+!" } { "path" = "/tmp/foo" } { "mode" = "~0755" } }
Tree for short
let short_tree = { "1" { "type" = "A+" } { "path" = "/tmp/foo" } }
Example with only 4 fields
let short_uid = "A+ /tmp/foo - 0\n"
Tree for short_uid
let short_uid_tree = { "1" { "type" = "A+" } { "path" = "/tmp/foo" } { "mode" = "-" } { "uid" = "0" } }
let simple = "LoadPlugin contextswitch LoadPlugin cpu FQDNLookup \"true\" Include \"/var/lib/puppet/modules/collectd/plugins/*.conf\" "
One line, simple example
let simple = "d /run/user 0755 root mysql 10d -\n"
A simple configuration file
let simple_config = "# A comment disk_config disk2 raw-disk - 0 - - disk_config lvm vg my_pv sda2 vg test disk1.9 my_pv-_swap swap 2048 swap sw my_pv-_root / 2048 ext3 rw,errors=remount-ro disk_config raid raid1 /boot disk1.1,disk2.1,disk3.1,disk4.1,disk5.1,disk6.1 ext3 rw raid1 swap disk1.2,disk2.2,disk3.2,disk4.2,disk5.2,disk6.2 swap sw raid5 /srv/data disk1.11,disk2.11,disk3.11,disk4.11,disk5.11,disk6.11 ext3 ro createopts=\"-m 0\" raid0 - disk2.2,sdc1,sde1:spare:missing ext2 default disk_config tmpfs tmpfs /var/opt/hosting/tmp 500 defaults "
Options with single values
let simple_keys = "acquisitionport" | "bindacqaddress" | "bindaddress" | "bindcmdaddress" | "clientloglimit" | "combinelimit" | "commandkey" | "cmdport" | "corrtimeratio" | "driftfile" | "dumpdir" | "hwclockfile" | "include" | "keyfile" | "leapsecmode" | "leapsectz" | "linux_freq_scale" | "linux_hz" | "logbanner" | "logchange" | "logdir" | "maxclockerror" | "maxdistance" | "maxdrift" | "maxjitter" | "maxsamples" | "maxslewrate" | "maxupdateskew" | "minsamples" | "minsources" | "ntpsigndsocket" | "pidfile" | "port" | "reselectdist" | "rtcautotrim" | "rtcdevice" | "rtcfile" | "sched_priority" | "stratumweight" | "user"
Tree for simple
let simple_tree = { "1" { "type" = "d" } { "path" = "/run/user" } { "mode" = "0755" } { "uid" = "root" } { "gid" = "mysql" } { "age" = "10d" } { "argument" = "-" } }
The regexp to store when value is optionally single-quoted
let single_opt_re = /[^\n\t ']([^\n']*[^\n\t '])?/
let size = [ label "size" . store size_kw . resize? ]
Regexps for size
let size_kw = /[0-9]+[kMGTP%]?(-([0-9]+[kMGTP%]?)?)?/ | /-[0-9]+[kMGTP%]?/
An example of an SMTP health checker
let smtp_check = "virtual_server 192.168.1.11 22 { real_server 10.20.40.10 22 { SMTP_CHECK { host { connect_ip 10.20.40.11 connect_port 587 bindto 192.168.1.1 } connect_timeout 3 retry 5 delay_before_retry 10 helo_name \"Testing Augeas\" } } } " test Keepalived.lns get smtp_check = { "virtual_server" { "ip" = "192.168.1.11" } { "port" = "22" } { "real_server" { "ip" = "10.20.40.10" } { "port" = "22" } { "SMTP_CHECK" { "host" { "connect_ip" = "10.20.40.11" } { "connect_port" = "587" } { "bindto" = "192.168.1.1" } } { "connect_timeout" = "3" } { "retry" = "5" } { "delay_before_retry" = "10" } { "helo_name" = "\"Testing Augeas\"" } } } }
let space = Sep.space
A mandatory space or tab
let space = /[ \t]+/
Deletes a Rx.space and default to a single space
let space = del Rx.space " "
let space_equal = Util.delim "="
A string which does not start or end with a space
let space_in = /[^ \r\t\n].*[^ \r\t\n]|[^ \t\n\r]/
let space_list_re = "global-ignores" | "preserved-conflict-file-exts"
let space_or_eol_re = /([ \t]*\n)?[ \t]+/
let spare_missing = tag /spare|missing/
A single quote
let squote = Util.del_str "'"
An optional single quote, default to single
let squote_opt = del /'?/ "'"
An optional single quote, default to nothing
let squote_opt_nil = del /'?/ ""
let std_re = /[^ \t\r\n\/=#]+/ - (comma_list_re | space_list_re)
Exclusion for files that are commonly not wanted/needed
let stdexcl = (excl "*~") . (excl "*.rpmnew") . (excl "*.rpmsave") . (excl "*.dpkg-old") . (excl "*.dpkg-new") . (excl "*.dpkg-bak") . (excl "*.dpkg-dist") . (excl "*.augsave") . (excl "*.augnew") . (excl "*.bak") . (excl "*.old") . (excl "#*#")
let sto_integer = store /[0-9]+/
Store multiline values
let sto_multiline = Sep.opt_space . store (to_comment_re . (/[ \t]*\n/ . Rx.space . to_comment_re)*)
Store multiline values without an end-of-line comment
let sto_multiline_nocomment = Sep.opt_space . store (Rx.space_in . (/[ \t]*\n/ . Rx.space . Rx.space_in)*)
There could be a \ in the middle of a command
let sto_to_com = store /([^,=:#() \t\n\\][^,=:#()\n]*[^,=:#() \t\n\\])|[^,=:#() \t\n\\]/
sto_to_com_cmnd does not begin or end with a space
let sto_to_com_cmnd = del_negate . negate_node? . ( let alias = Rx.word - /(NO)?(PASSWD|EXEC|SETENV)/ in let non_alias = /[\/a-z]([^,:#()\n\\]|\\\\[=:,\\])*[^,=:#() \t\n\\]|[^,=:#() \t\n\\]/ in store (alias | non_alias))
let sto_to_com_col = store to_com_chars
let sto_to_com_dquot = store (to_com_chars|to_com_dquot)
let sto_to_com_host = store /[^,=:#() \t\n\\]+/
Escaped spaces and NIS domains and allowed
let sto_to_com_user = let nis_re = /([A-Z]([-A-Z0-9]|(\\\\[ \t]))*+\\\\\\\\)/ in let user_re = /[%+@a-z]([-A-Za-z0-9._+]|(\\\\[ \t]))*/ in let alias_re = /[A-Z_]+/ in store ((nis_re? . user_re) | alias_re)
Store until comment
let sto_to_comment = Sep.opt_space . store /[^# \t\r\n][^#\r\n]*[^# \t\r\n]|[^# \t\r\n]/
Store until comment
let sto_to_comment = Sep.opt_space . store to_comment_re
Store until end of line
let sto_to_eol = Sep.opt_space . store Rx.space_in
let sto_to_eq = store /[^,=:#() \t\n\\]+/
let sto_to_spc = store /[^", \t\n\\]+|"[^", \t\n\\]+"/
let sto_to_spc_no_dquote = store /[^",# \t\n\\]+/ (* " relax emacs *)
Subnet specification
let subnet = Rx.ipv4 . "/" . cidr