Merge lp:~larryprice/libertine/lxd-destroy-root into lp:libertine

Proposed by Larry Price
Status: Merged
Approved by: Christopher Townsend
Approved revision: 336
Merged at revision: 375
Proposed branch: lp:~larryprice/libertine/lxd-destroy-root
Merge into: lp:libertine
Diff against target: 96 lines (+18/-13)
3 files modified
python/libertine/ChrootContainer.py (+1/-7)
python/libertine/Libertine.py (+15/-4)
python/libertine/LxdContainer.py (+2/-2)
To merge this branch: bzr merge lp:~larryprice/libertine/lxd-destroy-root
Reviewer Review Type Date Requested Status
Libertine CI Bot continuous-integration Approve
Christopher Townsend Approve
Review via email: mp+314961@code.launchpad.net

Commit message

Remove the bind-mounted applications directories during lxd destroy.

Description of the change

Remove the bind-mounted applications directories during lxd destroy.

To post a comment you must log in.
Revision history for this message
Libertine CI Bot (libertine-ci-bot) wrote :

PASSED: Continuous integration, rev:333
https://jenkins.canonical.com/libertine/job/lp-libertine-ci/327/
Executed test runs:
    SUCCESS: https://jenkins.canonical.com/libertine/job/build/649
    SUCCESS: https://jenkins.canonical.com/libertine/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=default/531
    SUCCESS: https://jenkins.canonical.com/libertine/job/test-0-autopkgtest/label=amd64,release=zesty,testname=default/531
    SUCCESS: https://jenkins.canonical.com/libertine/job/test-0-autopkgtest/label=i386,release=xenial+overlay,testname=default/531
    SUCCESS: https://jenkins.canonical.com/libertine/job/test-0-autopkgtest/label=i386,release=zesty,testname=default/531
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-0-fetch/659
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=amd64,release=xenial+overlay/640
        deb: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=amd64,release=xenial+overlay/640/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=amd64,release=zesty/640
        deb: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=amd64,release=zesty/640/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=i386,release=xenial+overlay/640
        deb: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=i386,release=xenial+overlay/640/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=i386,release=zesty/640
        deb: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=i386,release=zesty/640/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://jenkins.canonical.com/libertine/job/lp-libertine-ci/327/rebuild

review: Approve (continuous-integration)
334. By Larry Price

use chroot logic

Revision history for this message
Libertine CI Bot (libertine-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
335. By Larry Price

missed one utils

336. By Larry Price

remove unneeded imports

Revision history for this message
Libertine CI Bot (libertine-ci-bot) wrote :

PASSED: Continuous integration, rev:335
https://jenkins.canonical.com/libertine/job/lp-libertine-ci/329/
Executed test runs:
    SUCCESS: https://jenkins.canonical.com/libertine/job/build/651
    SUCCESS: https://jenkins.canonical.com/libertine/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=default/532
    SUCCESS: https://jenkins.canonical.com/libertine/job/test-0-autopkgtest/label=amd64,release=zesty,testname=default/532
    SUCCESS: https://jenkins.canonical.com/libertine/job/test-0-autopkgtest/label=i386,release=xenial+overlay,testname=default/532
    SUCCESS: https://jenkins.canonical.com/libertine/job/test-0-autopkgtest/label=i386,release=zesty,testname=default/532
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-0-fetch/661
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=amd64,release=xenial+overlay/642
        deb: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=amd64,release=xenial+overlay/642/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=amd64,release=zesty/642
        deb: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=amd64,release=zesty/642/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=i386,release=xenial+overlay/642
        deb: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=i386,release=xenial+overlay/642/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=i386,release=zesty/642
        deb: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=i386,release=zesty/642/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://jenkins.canonical.com/libertine/job/lp-libertine-ci/329/rebuild

review: Approve (continuous-integration)
Revision history for this message
Christopher Townsend (townsend) wrote :

+1

review: Approve
Revision history for this message
Libertine CI Bot (libertine-ci-bot) wrote :

PASSED: Continuous integration, rev:336
https://jenkins.canonical.com/libertine/job/lp-libertine-ci/330/
Executed test runs:
    SUCCESS: https://jenkins.canonical.com/libertine/job/build/652
    SUCCESS: https://jenkins.canonical.com/libertine/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=default/533
    SUCCESS: https://jenkins.canonical.com/libertine/job/test-0-autopkgtest/label=amd64,release=zesty,testname=default/533
    SUCCESS: https://jenkins.canonical.com/libertine/job/test-0-autopkgtest/label=i386,release=xenial+overlay,testname=default/533
    SUCCESS: https://jenkins.canonical.com/libertine/job/test-0-autopkgtest/label=i386,release=zesty,testname=default/533
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-0-fetch/662
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=amd64,release=xenial+overlay/643
        deb: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=amd64,release=xenial+overlay/643/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=amd64,release=zesty/643
        deb: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=amd64,release=zesty/643/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=i386,release=xenial+overlay/643
        deb: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=i386,release=xenial+overlay/643/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=i386,release=zesty/643
        deb: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=i386,release=zesty/643/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://jenkins.canonical.com/libertine/job/lp-libertine-ci/330/rebuild

review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'python/libertine/ChrootContainer.py'
2--- python/libertine/ChrootContainer.py 2017-01-17 15:41:51 +0000
3+++ python/libertine/ChrootContainer.py 2017-01-17 20:36:46 +0000
4@@ -66,13 +66,7 @@
5 return cmd.wait()
6
7 def destroy_libertine_container(self):
8- container_root = os.path.join(utils.get_libertine_containers_dir_path(), self.container_id)
9- try:
10- shutil.rmtree(container_root)
11- return True
12- except Exception as e:
13- utils.get_logger().error("%s" % e)
14- return False
15+ return self._delete_rootfs()
16
17 def create_libertine_container(self, password=None, multiarch=False):
18 # Create the actual chroot
19
20=== modified file 'python/libertine/Libertine.py'
21--- python/libertine/Libertine.py 2017-01-17 15:41:51 +0000
22+++ python/libertine/Libertine.py 2017-01-17 20:36:46 +0000
23@@ -16,7 +16,6 @@
24 from gi.repository import Libertine
25 import abc
26 import contextlib
27-import libertine.utils
28 import os
29 import shutil
30
31@@ -88,7 +87,7 @@
32
33 self.container_type = 'unknown'
34 self.container_id = container_id
35- self.root_path = libertine.utils.get_libertine_container_rootfs_path(self.container_id)
36+ self.root_path = utils.get_libertine_container_rootfs_path(self.container_id)
37 self.locale = containers_config.get_container_locale(container_id)
38 self.language = self._get_language_from_locale()
39 self.default_packages = ['matchbox-window-manager',
40@@ -109,12 +108,24 @@
41 language = 'zh-hans'
42 else:
43 language = 'zh-hant'
44-
45+
46 return language
47
48 def _binary_exists(self, binary):
49 return self.run_in_container("bash -c \"which {} &> /dev/null\"".format(binary)) == 0
50
51+ def _delete_rootfs(self):
52+ container_root = os.path.join(utils.get_libertine_containers_dir_path(), self.container_id)
53+ if not os.path.exists(container_root):
54+ return True
55+
56+ try:
57+ shutil.rmtree(container_root)
58+ return True
59+ except Exception as e:
60+ utils.get_logger().error("%s" % e)
61+ return False
62+
63 def setup_window_manager(self, enable_toolbars=False):
64 if self._binary_exists('matchbox-window-manager'):
65 if enable_toolbars:
66@@ -123,7 +134,7 @@
67 return ['matchbox-window-manager', '-use_titlebar', 'no']
68 else:
69 return ['compiz']
70-
71+
72
73 def check_language_support(self):
74 if not self._binary_exists('check-language-support'):
75
76=== modified file 'python/libertine/LxdContainer.py'
77--- python/libertine/LxdContainer.py 2017-01-17 15:41:51 +0000
78+++ python/libertine/LxdContainer.py 2017-01-17 20:36:46 +0000
79@@ -289,7 +289,6 @@
80
81 self._client = pylxd.Client()
82 self._window_manager = None
83- self.root_path = '{}/containers/{}/rootfs'.format(os.getenv('LXD_DIR', '/var/lib/lxd'), name)
84
85 utils.set_session_dbus_env_var()
86 try:
87@@ -372,7 +371,8 @@
88 return False
89
90 self._container.delete()
91- return True
92+
93+ return self._delete_rootfs()
94
95 def _timezone_in_sync(self):
96 proc = subprocess.Popen(self._lxc_args('cat /etc/timezone'), stdout=subprocess.PIPE)

Subscribers

People subscribed via source and target branches