[lxc-devel] [pylxd/master] Remove code deprecated for 2.2

rockstar on Github lxc-bot at linuxcontainers.org
Wed Nov 23 15:48:34 UTC 2016


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 374 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20161123/74cc7f29/attachment.bin>
-------------- next part --------------
From dfc25aa2e714edc7a6c7dfd468f024065a1fd7cd Mon Sep 17 00:00:00 2001
From: Paul Hummer <paul.hummer at canonical.com>
Date: Fri, 18 Nov 2016 09:33:33 -0700
Subject: [PATCH 1/2] Rename Container.execute_with_result to Container.execute

---
 integration/test_containers.py | 6 ++++--
 pylxd/models/container.py      | 7 -------
 2 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/integration/test_containers.py b/integration/test_containers.py
index 88589df..75c6df8 100644
--- a/integration/test_containers.py
+++ b/integration/test_containers.py
@@ -149,9 +149,11 @@ def test_execute(self):
         self.container.start(wait=True)
         self.addCleanup(self.container.stop, wait=True)
 
-        stdout, stderr = self.container.execute(['echo', 'test'])
+        result = self.container.execute(['echo', 'test'])
 
-        self.assertEqual('test\n', stdout)
+        self.assertEqual(0, result.exit_code)
+        self.assertEqual('test\n', result.stdout)
+        self.assertEqual('', result.stderr)
 
     def test_publish(self):
         """A container is published."""
diff --git a/pylxd/models/container.py b/pylxd/models/container.py
index 460bc28..27552f8 100644
--- a/pylxd/models/container.py
+++ b/pylxd/models/container.py
@@ -25,7 +25,6 @@
     _ws4py_installed = False
 
 from pylxd import managers
-from pylxd.deprecation import deprecated
 from pylxd.models import _model as model
 from pylxd.models.operation import Operation
 
@@ -193,13 +192,7 @@ def unfreeze(self, timeout=30, force=True, wait=False):
                                force=force,
                                wait=wait)
 
-    @deprecated('execute will return a ContainerExecuteResult in pylxd 2.2')
     def execute(self, commands, environment={}):
-        """Execute a command on the container."""
-        result = self.execute_with_result(commands, environment)
-        return result.stdout, result.stderr
-
-    def execute_with_result(self, commands, environment={}):
         """Execute a command on the container.
 
         In pylxd 2.2, this method will be renamed `execute` and the existing

From c94ab1b26de6d905ece5e087ec99c50909bea9aa Mon Sep 17 00:00:00 2001
From: Paul Hummer <paul.hummer at canonical.com>
Date: Wed, 23 Nov 2016 08:47:43 -0700
Subject: [PATCH 2/2] Update tests

---
 pylxd/tests/models/test_container.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/pylxd/tests/models/test_container.py b/pylxd/tests/models/test_container.py
index 0a1a875..a32eb84 100644
--- a/pylxd/tests/models/test_container.py
+++ b/pylxd/tests/models/test_container.py
@@ -168,9 +168,10 @@ def test_execute(self, _CommandWebsocketClient, _StdinWebsocket):
         an_container = models.Container(
             self.client, name='an-container')
 
-        stdout, _ = an_container.execute(['echo', 'test'])
+        result = an_container.execute(['echo', 'test'])
 
-        self.assertEqual('test\n', stdout)
+        self.assertEqual(0, result.exit_code)
+        self.assertEqual('test\n', result.stdout)
 
     def test_execute_no_ws4py(self):
         """If ws4py is not installed, ValueError is raised."""


More information about the lxc-devel mailing list