]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
Fixed python-lxc reference to var before assignment 974/head
authorAron Podrigal <aronp@guaranteedplus.com>
Thu, 14 Apr 2016 04:21:08 +0000 (00:21 -0400)
committerAron Podrigal <aronp@guaranteedplus.com>
Thu, 14 Apr 2016 04:24:08 +0000 (00:24 -0400)
```
>>> c = lxc.Container('ct')
>>> c.create('debian', args=('-r', 'jessie'))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  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 <aronp@guaranteedplus.com>
src/python-lxc/lxc/__init__.py

index 30ebd1bd278d041545ebb175f7f9e03268b49a52..de02102845982916c52d008f79471589682935d6 100644 (file)
@@ -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)