Commit Graph

35 Commits

Author SHA1 Message Date
Will Woods 3a75b2e07d add 'systemctl' command and use it in postinstall
The 'systemctl' command can be used to enable, disable, or mask systemd
units inside the runtime being modified. Modify runtime-postinstall.tmpl
to use the 'systemctl' command.

We also no longer remove quota*.service or kexec*.service, since
these aren't enabled by default. And systemd-remount-api-vfs.service
should work correctly now, so we can leave it alone as well.
2012-06-19 20:00:00 -04:00
Will Woods 3fda56b499 Add some documentation to LoraxTemplateRunner 2012-06-19 19:59:59 -04:00
Will Woods daacb4465d fix '-runcmd' and improve logging
The '-cmd' functionality depends on the individual lorax template
commands raising errors, so they shouldn't do sys.exit().

Also, capture stderr along with stdout, and put both in the log.
2012-06-19 19:59:59 -04:00
Martin Gracik cbe001638e Verify the yum transaction
Check if all packages that were supposed to be installed,
ended up installed.
2012-06-04 16:14:38 +02:00
Martin Gracik 7446d0d1e2 Add a --required switch to installpkg
Some packages are critical to the compose. If --required
is specified in the template's installpkg command, lorax
will exit if the package is not available.
2012-06-04 16:14:38 +02:00
Martin Gracik b61927badc Log all removed files
This makes finding what glob removed some file easier.
2012-04-12 08:28:58 -07:00
Brian C. Lane ac6512a531 Fix missing CalledProcessError import 2012-02-17 08:32:00 -08:00
Dan Horák 17179f2120 use internal implementation of the addrsize utility
Anaconda dropped the addrsize utility in F-16, so we need to implement
it directly in lorax.
2012-02-09 14:08:56 +01:00
Martin Gracik 681f67f954 Log output of failed command
If we run a command from template with runcmd,
log it's output if it exits with non-zero return code.
2012-01-19 18:13:03 +01:00
Will Woods 5e411b09c0 consider %ghost files part of the filelists in templates
When considering a package's filelist (e.g. for things like removefrom
--allbut), we might need to also include the %ghost files, so make
_filelist() add them to its returned list.
2012-01-05 16:15:54 -05:00
Will Woods c8f06bd8ff ltmpl: be more careful about checking command names 2011-11-04 13:41:10 -04:00
Will Woods dfa7742a6d default to fatalerrors=True in LoraxTemplateRunner
This means that any (non-ignored) command error will cause lorax to
exit.

Do note, however, that some commands (e.g. remove, installpkg) don't
raise exceptions and therefore will not cause lorax to exit.
2011-10-26 13:09:50 -04:00
Will Woods 0e64f08ff8 Add '-cmd' syntax to ignore errors, drop copyif/moveif
Makefile-style "-cmd" syntax lets us run a command and ignore any
resulting errors. This is a more general version of what copyif/moveif
were trying to accomplish, so we can drop those commands.
2011-10-26 13:08:39 -04:00
Will Woods 305476eefe add comment about symlink root-escape problem 2011-10-25 16:19:23 -04:00
Will Woods cd1225c5fb minor comment cleanups 2011-10-24 16:27:36 -04:00
Will Woods 262a05e539 ltmpl: continue loop if installpkg can't find something
Otherwise, something like:
  installpkg missing-thingy kernel kernel-firmware
will leave you without a kernel.
2011-09-15 19:27:31 -04:00
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