Merge lp:~canonical-platform-qa/snappy-ecosystem-tests/dont-delete-ephemeral into lp:snappy-ecosystem-tests

Proposed by Omer Akram
Status: Merged
Approved by: Santiago Baldassin
Approved revision: 40
Merged at revision: 39
Proposed branch: lp:~canonical-platform-qa/snappy-ecosystem-tests/dont-delete-ephemeral
Merge into: lp:snappy-ecosystem-tests
Diff against target: 35 lines (+6/-11)
1 file modified
snappy_ecosystem_tests/environment/containers/lxd.py (+6/-11)
To merge this branch: bzr merge lp:~canonical-platform-qa/snappy-ecosystem-tests/dont-delete-ephemeral
Reviewer Review Type Date Requested Status
Santiago Baldassin (community) Approve
platform-qa-bot continuous-integration Approve
Review via email: mp+319539@code.launchpad.net

Commit message

Don't try to delete ephemeral container as they get deleted on stop.

Description of the change

Don't try to delete ephemeral container as they get deleted on stop.

Previously we were working around a bug in pylxd that is now fixed and available from pip.

To post a comment you must log in.
Revision history for this message
platform-qa-bot (platform-qa-bot) wrote :
review: Needs Fixing (continuous-integration)
40. By Omer Akram

pylint

Revision history for this message
platform-qa-bot (platform-qa-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Santiago Baldassin (sbaldassin) wrote :

Looks good

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'snappy_ecosystem_tests/environment/containers/lxd.py'
2--- snappy_ecosystem_tests/environment/containers/lxd.py 2017-03-09 12:40:49 +0000
3+++ snappy_ecosystem_tests/environment/containers/lxd.py 2017-03-10 09:32:30 +0000
4@@ -25,7 +25,7 @@
5 import time
6
7 from pylxd import Client
8-from pylxd.exceptions import LXDAPIException, NotFound
9+from pylxd.exceptions import LXDAPIException
10 from retrying import retry
11
12 from snappy_ecosystem_tests.environment.data.snapd import (
13@@ -50,17 +50,12 @@
14 for cont in containers:
15 if self.client.containers.exists(cont):
16 container = self.client.containers.get(cont)
17- try:
18- if container.status == "Running":
19- container.stop(wait=True)
20+ if container.status == 'Running':
21+ container.stop(wait=True)
22+ # Don't try to delete ephemeral container as its
23+ # deleted on stop.
24+ if not container.ephemeral:
25 container.delete(wait=True)
26- except NotFound:
27- # If using ephemeral stop will delete the container and try
28- # to sync which will fail because the container does not
29- # exist. container.delete will be only execute if stop did
30- # not raise an exception:
31- # https://github.com/lxc/pylxd/issues/221
32- pass
33 container_config = DEFAULT_CONTAINER_CONFIG.copy()
34 container_config['source']['alias'] = containers[cont]['release']
35 container_config['name'] = cont

Subscribers

People subscribed via source and target branches