[lxc-devel] [pylxd/master] Create busybox image at first create_container call

jpic on Github lxc-bot at linuxcontainers.org
Tue May 24 18:44:50 UTC 2016


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 320 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20160524/73f34529/attachment.bin>
-------------- next part --------------
From 12c93f21b509ed9e74938b895a0000f2b737c0be Mon Sep 17 00:00:00 2001
From: jpic <jamespic at gmail.com>
Date: Tue, 24 May 2016 20:41:34 +0200
Subject: [PATCH] Create busybox image at first create_container call

---
 integration/testing.py | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/integration/testing.py b/integration/testing.py
index e6e3cfe..3c50633 100644
--- a/integration/testing.py
+++ b/integration/testing.py
@@ -34,6 +34,20 @@ def generate_object_name(self):
 
     def create_container(self):
         """Create a container in lxd."""
+        if not getattr(type(self), '_busybox_ready', False):
+            path, fingerprint = create_busybox_image()
+
+            with open(path) as f:
+                image = self.client.images.create(f.read(), wait=True)
+
+            response = self.lxd.images.aliases.post(json={
+                'description': '',
+                'target': fingerprint,
+                'name': 'busybox',
+            })
+
+            type(self)._busybox_ready = True
+
         name = self.generate_object_name()
         machine = {
             'name': name,


More information about the lxc-devel mailing list