debian-forge/stages
David Rheinsberg 2624be92dc osbuild: cleanup contextlib usage
Two cleanups for the context-managers we use:

  * Use `contextlib.AbstractContextManager` if possible. This class
    simply provides a default `__enter__` implementation which just
    returns `self`. So use it where applicable.
    Additionally, it provides an abstract `__exit__` method and thus
    allows static checks for an existance of `__exit__` in the dependent
    class. We might use that everywhere, but this is a separate
    decision, so not included here.

  * Explicitly return `None` from `__exit__`. The python docs state:

        If an exception is supplied, and the method wishes to suppress
        the exception (i.e., prevent it from being propagated), it
        should return a true value. Otherwise, the exception will be
        processed normally upon exit from this method.

    That is, unless we want exceptions to be suppressed, we should
    never return a `truthy` value. The python contextlib suggest using
    `None` as a default return value, so lets just do that.

    In particular, the explicit `return exc_type is None` that we use
    has no effect at all, since it only returns `True` if no exception
    was raised.

    This commit cleans this up and just follows what the `contextlib`
    module does and returns None everywhere (well, it returns nothing
    which apparently is the same as returning `None` in python). It is
    unlikely that we ever want to suppress any exceptions, anyway.
2020-04-21 16:02:20 +02:00
..
org.osbuild.chrony Add STAGE_DESC, STAGE_INFO, and STAGE_OPTS to stages 2019-11-13 21:47:03 +01:00
org.osbuild.debug-shell Add STAGE_DESC, STAGE_INFO, and STAGE_OPTS to stages 2019-11-13 21:47:03 +01:00
org.osbuild.error stages/error: fix json for stage options 2020-01-28 13:10:14 +01:00
org.osbuild.firewall Add STAGE_DESC, STAGE_INFO, and STAGE_OPTS to stages 2019-11-13 21:47:03 +01:00
org.osbuild.first-boot stage: add org.osbuild.first-boot 2020-04-15 16:07:34 +02:00
org.osbuild.fix-bls stages/fix-bls: support for different prefix 2020-01-19 23:01:36 +01:00
org.osbuild.fstab stages/fstab: support for using fs labels 2020-04-20 18:59:27 +02:00
org.osbuild.groups Add STAGE_DESC, STAGE_INFO, and STAGE_OPTS to stages 2019-11-13 21:47:03 +01:00
org.osbuild.grub2 stages/grub2: ensure grubenv file has size of 1024 2020-04-21 13:45:11 +02:00
org.osbuild.hostname Add STAGE_DESC, STAGE_INFO, and STAGE_OPTS to stages 2019-11-13 21:47:03 +01:00
org.osbuild.kernel-cmdline stages/kopts: new stage to set the kernel cmdline 2020-01-13 20:05:10 +01:00
org.osbuild.keymap Add STAGE_DESC, STAGE_INFO, and STAGE_OPTS to stages 2019-11-13 21:47:03 +01:00
org.osbuild.locale Add STAGE_DESC, STAGE_INFO, and STAGE_OPTS to stages 2019-11-13 21:47:03 +01:00
org.osbuild.noop Add STAGE_DESC, STAGE_INFO, and STAGE_OPTS to stages 2019-11-13 21:47:03 +01:00
org.osbuild.ostree osbuild: cleanup contextlib usage 2020-04-21 16:02:20 +02:00
org.osbuild.rpm stages/rpm: be a bit more verbose to give some progress indication 2020-02-06 19:01:12 +01:00
org.osbuild.rpm-ostree stages: add new org.osbuild.rpm-ostree stage 2020-04-15 15:39:45 +02:00
org.osbuild.script Add STAGE_DESC, STAGE_INFO, and STAGE_OPTS to stages 2019-11-13 21:47:03 +01:00
org.osbuild.selinux Add STAGE_DESC, STAGE_INFO, and STAGE_OPTS to stages 2019-11-13 21:47:03 +01:00
org.osbuild.systemd stages/systemd: add default_target 2019-11-27 22:22:13 +01:00
org.osbuild.test Add STAGE_DESC, STAGE_INFO, and STAGE_OPTS to stages 2019-11-13 21:47:03 +01:00
org.osbuild.timezone Add STAGE_DESC, STAGE_INFO, and STAGE_OPTS to stages 2019-11-13 21:47:03 +01:00
org.osbuild.users Add STAGE_DESC, STAGE_INFO, and STAGE_OPTS to stages 2019-11-13 21:47:03 +01:00
org.osbuild.zipl stage/zipl: new stage to configure zipl 2020-01-13 20:05:10 +01:00
osbuild stages/assemblers: symlink the osbulid python library 2019-07-25 21:28:23 +02:00