-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Yuri Timofeev wrote: > Hi > > During development the prototype of the my new system (Webacula 5.5), > I tried to parse the bacula-dir.conf. > However, this is probably not possible with simple regexp's. > It turned out that some applications, for example, Webmin does this > with a regexp. > > But they're doing it wrong! > > For example, here is test configuration (which is written according to > "Bacula Main Reference: Customizing the Configuration Files") > contains no errors in terms of Bacula (I checked it) but it would be > wrong parsed (I have not tested it, but I'm sure of it) by 3rd parties > parsers (not native) : > > ----------------------------------------- > # comment1 > # comment2 > > c o n s o l e > { Name=name1; Password = "p; \\\a s s w o rd"; J o b A C L = *all\* > }Con sole { N a m e = "name 2"; Pass word = "password"; JobACL = > job/\1, job2, job3 > } > > ----------------------------------------- > > > I.e. in other words to parse with regexp any Bacula configuration will > be very difficult. Yes it is very difficult, at least with a RegEx. For the record, for an in-house interface I wrote, I did it by making bacula-dir.conf contain just: @|"sh -c 'for f in /etc/bacula/bacula-dir.d/*.conf ; do echo @${f} ; done'" and then maintain one file per stanza in /etc/bacula/bacula-dir.d. Each stanza is in a file named <type>.<name>.conf, so we end up with files like: client.wwsv01.conf job.wwsv01.conf job.restorefiles.conf pool.weekly.conf And I wrote some PHP code to parse an individual stanza into an internal data structure. From a web interface, modifying an individual object/stanza then becomes a matter of just rewriting the single config file, rather than having to parse/rewrite the entire bacula-dir config file. If the web interface doesn't have capability (or need) to write to a given stanza, then those files can be in whatever format is desired (with weird spacing etc). And if the web interface is writing to the files, it can write in a consistent easily parseable format that is valid for bacula, but makes it simpler for it to read later. It just kinda works; sure, an admin could screw it up, but when is that never a problem? That may not help if you're wanting to parse an existing bacula-dir.conf though, so I may be wasting my breath here :) - -- Craig Miskell Senior Systems Administrator Opus International Consultants Phone: +64 4 471 7209 That's why I love VoIP. You don't get people phoning up to complain that the network is down.- Peter Corlett, in the Monastery -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAky98osACgkQmDveRtxWqnbuRgCeLDlrmr+nIuTpMimfRA1GN+n5 aukAoLu5Plfkeaa5yLFDDb2Zq2WlMDVn =cct9 -----END PGP SIGNATURE----- ------------------------------------------------------------------------------ Download new Adobe(R) Flash(R) Builder(TM) 4 The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly Flex(R) Builder(TM)) enable the development of rich applications that run across multiple browsers and platforms. Download your free trials today! http://p.sf.net/sfu/adobe-dev2dev _______________________________________________ Bacula-users mailing list Bacula-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bacula-users