Augeas - A Configuration API



Comments



Description

Augeas – a configuration APIDavid Lutterkort Red Hat, Inc. Configuration Management Sitewide configuration Local configuration Editing of Configuration Data (1) Keyhole aroache! (") #reenfield aroache! ($) %e&lating Missing pieces  Handle configuration data unifor&ly  'olicy(delegation  Re&ota)le *'I *ugea! lay! the foundation for addre!!ing the!e Design Goals (1) Deal with configuration data in it! current lace Design Goals (") +,o!e a)!tract tree view of configuration data Design Goals ($) 're!erve -uni&ortant. detail Design Goals (/) De!cri)e new file for&at! ea!ily and !afely Design Goals (0) Language neutral i&le&entation Design Goals (1) 2ocu! on configuration editing Overall architecture The Augeas Tree The Augeas Tree The public Augeas API  S&all nu&)er of call! to &odify tree ● init/close ● get/set value a!!ociated with a node ● match node! with ath e,re!!ion ● insert )efore(after e,i!ting node ● rm !u)tree ● save tree )ack to file The public Augeas API 3 *'I (libaugeas.so) 3o&&and line tool augtool Language )inding! for 'ython, Ru)y, 4ca&l, ... Eample! /etc/hosts 2or&at5 # ipaddr □ canonical (□ alias)* \n 127.0.0.1 □ localhost □ localhost.localdomain □ host.domain Sche&a5 /files/etc/hosts 1/ ipaddr 127.0.0.1 canonical localhost alias localhost.localdomain alias host.domain Eample! /etc/hosts augtool! set /files/etc/hosts/1/alias"2# m$host.domain Sche&a5 /files/etc/hosts 1/ ipaddr 127.0.0.1 canonical localhost alias localhost.localdomain alias m$host.domain Eample! /etc/hosts augtool! ins alias after /files/etc/hosts/1/alias"1# Sche&a5 /files/etc/hosts 1/ ipaddr 127.0.0.1 canonical localhost alias localhost.localdomain alias alias m$host.domain Eample! /etc/hosts augtool! set /files/etc/hosts/1/alias"2# m$host Sche&a5 /files/etc/hosts 1/ ipaddr 127.0.0.1 canonical localhost alias localhost.localdomain alias m$host alias m$host.domain Eample! /etc/hosts augtool! sa%e 6ew /etc/hosts5 # ipaddr □ canonical (□ alias)* \n 127.0.0.1 □ localhost □ localhost.localdomain □ m$host □ m$host.domain Eample! yu& configuration %ree! underneath /files/etc/$um.conf /files/etc/$um.repos.d/some.repo &chema /section/'e$ %alue Switch 2edora reo to internal &irror5 (/files/etc/$um.repos.d/fedora.repo augtool! rm )(/fedora/mirrorlist augtool! set )(/fedora/baseurl mirror1 augtool! ins baseurl after )(/fedora/baseurl augtool! set )(/fedora/baseurl"last()# mirror2 Overall architecture "chema description module *um autoload +fm let lns ... let filter (incl ,/etc/$um.conf,) . (incl ,/etc/$um.repos.d/*,) . -til.stde+cl let +fm transform lns filter "chema description module *um autoload +fm let lns ... let filter (incl ,/etc/$um.conf,) . (incl ,/etc/$um.repos.d/*,) . -til.stde+cl let +fm transform lns filter "chema description module *um autoload +fm let lns ... let filter (incl ,/etc/$um.conf,) . (incl ,/etc/$um.repos.d/*,) . -til.stde+cl let +fm transform lns filter "chema description module *um autoload +fm let lns ... let filter (incl ,/etc/$um.conf,) . (incl ,/etc/$um.repos.d/*,) . -til.stde+cl let +fm transform lns filter "chema description module *um autoload +fm let lns ... let filter (incl ,/etc/$um.conf,) . (incl ,/etc/$um.repos.d/*,) . -til.stde+cl let +fm transform lns filter #enses #enses 3oncrete 7iew↔*)!tract 7iew 8idirectional rogra&&ing 3oncrete 9*)!tract : *)!tract93oncrete  Har&ony (; 'enn) doe! it for tree!  8oo&erang (; 'enn) doe! it for !tring!  %heoretical groundwork )y 8. 'ierce, 6. 2o!ter et.al. #enses for Augeas String↔%ree get5 String 9%ree put5 %ree , String 9String #ens #a$s %he get and put of every len! &u!t fulfill5 put (get c) c c get (put a c) a ● 3ature intuitive notion! of -&ini&al. edit! ● 3on!traint! enforced )y tyechecker #ens primitives  %ree la)el! ● 'e$ re ● label str ● se. str  %ree value! ● store re  4&it fro& tree ● del re str #ens combinators  l1 . l2 5 Len! concatenation  l1 / l2 5 Len! union  l*0 l1 5 Len! iteration  " l # 5 Su)tree co&)inator #ens development  8uild u len!e! fro& !&all art!  Reu!e co&&on con!truct! ● 3o&&ent goe! fro& < to end of line  ;nit te!t facility in *ugea! language ● Run get direction ● Run get direction, &odify tree, run ut direction ● 3o&are to fi,ed value ● *!!ert e,cetion ● 'rint re!ult #ens development 'roce!! 2'e$%alue3 #ens development 'roce!! 2'e$%alue3 let e. del 23 23 #ens development 'roce!! 2'e$%alue3 let e. del 23 23 let lns " 'e$ /"a45#1/ . e. . store /.1/ # #ens development 'roce!! 2'e$%alue3 let e. del 23 23 let lns " 'e$ /"a45#1/ . e. . store /.1/ # #ens development 'roce!! 2'e$%alue3 let e. del 23 23 let lns " 'e$ /"a45#1/ . e. . store /.1/ # #ens development 'roce!! 2'e$%alue3 let e. del 23 23 let lns " 'e$ /"a45#1/ . e. . store /.1/ # test lns get 2foobar3 6 #ens development 'roce!! 2'e$%alue3 let e. del 23 23 let lns " 'e$ /"a45#1/ . e. . store /.1/ # test lns get 2foobar3 7 2foo3 2bar3 8 #ens development 'roce!! 2'e$%alue3 let e. del 23 23 let lns " 'e$ /"a45#1/ . e. . store /.1/ # test lns get 2foo2bar13 * #ens development 'roce!! 2'e$%alue3 let e. del 23 23 let lns "'e$ /"a45#1/ . e. . store /.1/ # test lns put 2foobar3 after set 2foo3 2ba53 6 #ens development 'roce!! 2'e$%alue3 let e. del 23 23 let lns "'e$ /"a45#1/ . e. . store /.1/ # test lns put 2foobar3 after set 2foo3 2ba53 6 #ens development 'roce!! 2'e$%alue3 let e. del 23 23 let lns "'e$ /"a45#1/ . e. . store /.1/ # test lns put 2foobar3 after set 2foo3 2ba53 2fooba53 #ens development 'roce!! 2'e$%alue3 let e. del /" \t#1" \t#1/ 23 let lns " 'e$ /"a45#1/ . e. . store /.1/ # #ens development 'roce!! 2'e$%alue3 let e. del /" \t#1" \t#1/ 23 let lns " 'e$ /"a45#1/ . e. . store /.1/ # #ens development 'roce!! 2'e$%alue3 let e. del /" \t#1" \t#1/ 23 let lns " 'e$ /"a45#1/ . e. . store /"a45#1/ # test lns put 2foo \t bar3 after set 2foo3 2ba53 2foo \t ba53 Arra%s – using seq hosts/ 1/ ipaddr canonical alias alias 2/ ipaddr canonical alias Arra%s – using identical labels hosts/ 1/ ipaddr canonical alias alias 2/ ipaddr canonical alias &andling comments let comment del /#.*\n/ 2#\n3 let lns (record/comment)* &andling comments let comment " del /#.*\n/ 2#\n3 # let lns (record/comment)* The lens t%pechec'er  +ach len! ha! a!!ociated ctype and atype ● Regular language!  3heck! during len! con!truction ● del re str 5 str &u!t &atch re ● l1 . l2 5 una&)iguou!ly !litta)le ● l1 | l2 5 di!=oint regular language!  libfa for finite auto&ata co&utation!  Re!trict! *ugea! to regular file for&at! "upported file formats (etc(ho!t! (etc(initta) yu& config (etc(f!ta) (etc(alia!e! (etc(!!h(!!hd>config !hell var! in (etc(!y!config( ifcfg?@ gru).conf ,inetd.d a&.d v!ftd.conf your contri)ution here (hat about httpd.conf )  Ao!tly tediou! )oilerlate  +,cet5 ... 9:f;odule mod<pro+$.c! ... 9/:f;odule! ...  *r)itrary ne!ting, not regular ● 6eed recur!ion : regular aro,i&ation A higher level service D)u! !ervice )acked )y *ugea! : 'olicyKit &echani!& for authentication B Local configuration !ervice ;I indeendent 2ile for&at indeendent 2ine grained er&i!!ioning Harald Hoyer ha! rototye for s$stem4config4boot "upported platforms  Red Hat Linu, flavor! ● 2edora, RH+L, 3ent4S, ...  4ther Linu, flavor! ● De)ian  2ree8SD  4S(C ort on the way Aini&al deendencie!  *nything with a #6; li)c (or eDuivalent gnuli) !uort) More information  'ro=ect we)!ite htt5((augea!.net( ● Read the -Euick %our. fir!t  Aailing li!t augea!?develFredhat.co&  IR3 <augea! on freenode
Copyright © 2024 DOKUMEN.SITE Inc.