As pointed out by pylint, start_builder_thread was using a
dangerous default dictionary. Default dictionaries are
dangerous because they are initialized at the time that the
method is parsed, not at the time that it is invoked. This
means that if you call the method twice and manipulate the
dictionary within the method, it will manipulate the first
version of the dictionary, not a brand-new one. Luckily all
callers of the method passed the argument, so just remove the
default empty dictionary.
Signed-off-by: Chris Lalancette <clalance(a)redhat.com>
---
imgfac/BuildJob.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/imgfac/BuildJob.py b/imgfac/BuildJob.py
index aae87da..2fc4dbd 100644
--- a/imgfac/BuildJob.py
+++ b/imgfac/BuildJob.py
@@ -95,7 +95,7 @@ class BuildJob(object):
return builder_class(self.template, self.target)
- def _start_builder_thread(self, method_name, arg_dict={}):
+ def _start_builder_thread(self, method_name, arg_dict):
thread_name = "%s.%s()" % (self.new_image_id, method_name)
# using args to pass the method we want to call on the target object.
builder_thread = threading.Thread(target = self._builder, name=thread_name,
args=(method_name), kwargs=arg_dict)
--
1.7.4.4