Commit Graph

19 Commits

Author SHA1 Message Date
Will Woods 318c843e37 ltmpl: improve exception handling/reporting
- Log the error message (and the line causing the error) to console
- Log the whole exception (with some excess junk removed) to debuglog
- don't immediately SystemExit if the template won't parse
- clean up some comments
2011-09-15 19:24:35 -04:00
Will Woods 473f01c696 Add docstrings for the ltmpl commands in LoraxTemplateRunner 2011-09-14 18:33:30 -04:00
Will Woods faafd04dcb add '--allbut' flag to 'removefrom'
This lets us easily do whitelisting instead of blacklisting during
runtime cleanup. For example:
 removefrom xfsprogs --allbut /sbin/* /usr/sbin/xfs_admin
would remove everything from the xfsprogs package except files in /sbin
and /usr/sbin/xfs_admin.

A few things in runtime-cleanup have been converted to use --allbut. The
only difference in the created runtime image is that we're deleting
/usr/share/kde4 from fedora-logos.
2011-08-31 19:40:20 -04:00
Will Woods 916402b023 handle templatedir more cleanly in ltmpl/treebuilder
make sure that runner.templatedir gets set to a useful default if
initialized with None, and and make sure we pass templatedir to
LoraxTemplateRunner.__init__ (so it'll get initialized properly)
2011-08-08 19:01:38 -04:00
Will Woods 9f6393c58e better logging for removepkg/removefrom
emit a useful log message if we attempt to removepkg something that
isn't installed, or if a glob used in a removefrom line matches no
files.

this will help us keep the templates cleaner.
2011-08-01 17:24:20 -04:00
Will Woods f5164d6460 ltmpl: do brace expansion on the entire template
Handle brace expansion while parsing the template rather than
individually per-command. This is closer to how bash does things anyway.
2011-07-06 18:02:20 -04:00
Will Woods 416b7eef57 make glob() in templates return a list 2011-06-30 17:54:02 -04:00
Will Woods 2e8d5c78b8 move template 'exists' and 'glob' to self.builtins
otherwise, assigning to runner.defaults clobbers them. oops.
2011-06-30 16:59:55 -04:00
Will Woods b39d90c688 Move LoraxTemplateRunner (and helpers) to ltmpl 2011-06-30 13:24:07 -04:00
Will Woods 2096ebc551 remove unused LoraxTemplate.getdata() 2011-06-08 17:32:38 -04:00
Will Woods dde2b9ae62 Remove comments (lines starting with '#') from templates 2011-05-31 12:24:17 -04:00
Will Woods 17e5f9e19a Better tracebacks for LoraxTemplate 2011-05-26 14:08:01 -04:00
Will Woods a15c5ded9c Add "directories=[]" param to LoraxTemplate 2011-05-12 17:29:01 -04:00
Will Woods a82da40015 Add "getdata" method to LoraxTemplate
getdata(cmd) will return a generator that yields every token on every
line that starts with the token "cmd". getdata(cmd, mode="lines") will
yield a list for each line rather than every individual token.

this simplifies some things in __init__.py.
2011-05-09 15:33:55 -04:00
Martin Gracik 0a7f221bd5 Mako template returns unicode strings (#681003)
New mako template returns unicode strings, which are
a problem for shlex. We need to encode them to ascii.
2011-03-10 10:53:55 +01:00
Martin Gracik b7504823e0 Fixed pylint errors in ltmpl.py 2010-12-02 13:20:41 +01:00
Martin Gracik 2fc71cc74e Catch template exceptions 2010-10-29 14:41:23 +02:00
Martin Gracik 45c5ef566c Experimental single initrd image 2010-10-12 18:32:35 +02:00
Martin Gracik a4c638f132 New version 2010-02-23 14:20:05 +01:00