From: Aron Podrigal Date: Thu, 14 Apr 2016 04:21:08 +0000 (-0400) Subject: Fixed python-lxc reference to var before assignment X-Git-Tag: lxc-2.1.0~445^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F974%2Fhead;p=thirdparty%2Flxc.git Fixed python-lxc reference to var before assignment ``` >>> c = lxc.Container('ct') >>> c.create('debian', args=('-r', 'jessie')) Traceback (most recent call last): File "", line 1, in File "/usr/lib/python3/dist-packages/lxc/__init__.py", line 229, in create template_args['args'] = tuple(tmp_args) UnboundLocalError: local variable 'tmp_args' referenced before assignment ``` Signed-off-by: Aron Podrigal --- diff --git a/src/python-lxc/lxc/__init__.py b/src/python-lxc/lxc/__init__.py index 30ebd1bd2..de0210284 100644 --- a/src/python-lxc/lxc/__init__.py +++ b/src/python-lxc/lxc/__init__.py @@ -222,11 +222,12 @@ class Container(_lxc.Container): for item in args.items(): tmp_args.append("--%s" % item[0]) tmp_args.append("%s" % item[1]) + args = tmp_args template_args = {} if template: template_args['template'] = template template_args['flags'] = flags - template_args['args'] = tuple(tmp_args) + template_args['args'] = tuple(args) if bdevtype: template_args['bdevtype'] = bdevtype return _lxc.Container.create(self, **template_args)