[apparmor] [patch] [2/3] Make ProfileStorage a class

Seth Arnold seth.arnold at canonical.com
Tue Jul 11 00:11:23 UTC 2017


On Sun, Jul 09, 2017 at 09:32:55PM +0200, Christian Boltz wrote:
> [ 03-ProfileStorage-class.diff ]

> +    def __getitem__(self, key):
> +        if key in self.data:
> +            return self.data[key]
> +        else:
> +            raise AppArmorBug('attemp to read unknown key %s' % key)

Change 'attemp' to 'attempt' everywhere in this series, and then...
Acked-by: Seth Arnold <seth.arnold at canonical.com>

Thanks

> +
> +    def __setitem__(self, key, value):
> +        # TODO: Most of the keys (containing *Ruleset, dict(), list() or hasher()) should be read-only.
> +        #       Their content needs to be changed, but the container shouldn't
> +        #       Note: serialize_profile_from_old_profile.write_prior_segments() and write_prior_segments() expect the container to be writeable!
> +        # TODO: check if value has the expected type
> +        if key in self.data:
> +            self.data[key] = value
> +        else:
> +            raise AppArmorBug('attemp to set unknown key %s' % key)
> +
> +    def get(self, key, fallback=None):
> +        if key in self.data:
> +            return self.data.get(key, fallback)
> +        else:
> +            raise AppArmorBug('attemp to read unknown key %s' % key)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <https://lists.ubuntu.com/archives/apparmor/attachments/20170710/d3b5e84a/attachment.pgp>


More information about the AppArmor mailing list