]> git.ipfire.org Git - collecty.git/commitdiff
Tolerate setting an empty environment
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 1 Dec 2021 21:42:00 +0000 (21:42 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 1 Dec 2021 21:42:00 +0000 (21:42 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/collecty/plugins/base.py

index 5fedb854b099e7ab5504435aaaa0968e1fd7bf24..561fa7b04c863754f05046a6091460eae05d8b44 100644 (file)
@@ -50,10 +50,12 @@ class Environment(object):
                self.old_environment = {}
 
                for k in self.new_environment:
+                       # Store the old value
                        self.old_environment[k] = os.environ.get(k, None)
 
-               # Apply the new one
-               os.environ.update(self.new_environment)
+                       # Apply the new one
+                       if self.new_environment[k]:
+                               os.environ.update(self.new_environment[k])
 
        def __exit__(self, type, value, traceback):
                # Roll back to the previous environment