[lxc-devel] [pylxd/master] Fix traceback when using when LXD 2.1

zulcss on Github lxc-bot at linuxcontainers.org
Thu Aug 18 14:01:28 UTC 2016


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 680 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20160818/8070a88d/attachment.bin>
-------------- next part --------------
From 0e172c958d6f2e6126f351f038fa4b3b16336efc Mon Sep 17 00:00:00 2001
From: Chuck Short <chuck.short at canonical.com>
Date: Thu, 18 Aug 2016 09:54:09 -0400
Subject: [PATCH] Fix traceback when using when LXD 2.1

Fix traceback when using pylxd with 2.1:

File "/opt/stack/pylxd/pylxd/model.py", line 105, in __init__
  setattr(self, key, val)
File "/opt/stack/pylxd/pylxd/model.py", line 126, in __setattr__
  return super(Model, self).__setattr__(name, value)
AttributeError: 'Container' object has no attribute 'last_used_at'

Signed-off-by: Chuck Short <chuck.short at canonical.com>
---
 pylxd/container.py      | 1 +
 pylxd/tests/mock_lxd.py | 1 +
 2 files changed, 2 insertions(+)

diff --git a/pylxd/container.py b/pylxd/container.py
index af7a115..116355a 100644
--- a/pylxd/container.py
+++ b/pylxd/container.py
@@ -48,6 +48,7 @@ class Container(model.Model):
     name = model.Attribute(readonly=True)
     profiles = model.Attribute()
     status = model.Attribute(readonly=True)
+    last_used_at = model.Attribute(readonly=True)
 
     status_code = model.Attribute(readonly=True)
     stateful = model.Attribute(readonly=True)
diff --git a/pylxd/tests/mock_lxd.py b/pylxd/tests/mock_lxd.py
index 42e6d8f..57b771e 100644
--- a/pylxd/tests/mock_lxd.py
+++ b/pylxd/tests/mock_lxd.py
@@ -184,6 +184,7 @@ def profile_GET(request, context):
                     'security.privileged': "true",
                 },
                 'created_at': "1983-06-16T00:00:00-00:00",
+                'last_used_at': "1983-06-16T00:00:00-00:00",
                 'devices': {
                     'root': {
                         'path': "/",


More information about the lxc-devel mailing list