Merge lp:~larryprice/libertine/no-such-backend into lp:libertine
- no-such-backend
- Merge into devel
Status: | Merged |
---|---|
Approved by: | Stephen M. Webb |
Approved revision: | 412 |
Merged at revision: | 442 |
Proposed branch: | lp:~larryprice/libertine/no-such-backend |
Merge into: | lp:libertine |
Diff against target: |
166 lines (+38/-14) 2 files modified
tools/libertine-container-manager (+26/-12) tools/libertine-launch (+12/-2) |
To merge this branch: | bzr merge lp:~larryprice/libertine/no-such-backend |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Stephen M. Webb (community) | Approve | ||
Libertine CI Bot | continuous-integration | Approve | |
Review via email: mp+319724@code.launchpad.net |
Commit message
Gracefully handle creating a LibertineContainer object when the container backend is unavailable.
Description of the change
Gracefully handle creating a LibertineContainer object when the container backend is unavailable.
- 410. By Larry Price
-
also in libertine-launch
Libertine CI Bot (libertine-ci-bot) wrote : | # |
Libertine CI Bot (libertine-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:410
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Stephen M. Webb (bregma) wrote : | # |
Need to add i18n for the user-facing messages. See python/
- 411. By Larry Price
-
add gettext support for new strings
Libertine CI Bot (libertine-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:411
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Stephen M. Webb (bregma) wrote : | # |
Need to use positional {0} or named {container_id} substitution in the .format() strings.
- 412. By Larry Price
-
give names to format args
Libertine CI Bot (libertine-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:412
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Stephen M. Webb (bregma) : | # |
Preview Diff
1 | === modified file 'tools/libertine-container-manager' | |||
2 | --- tools/libertine-container-manager 2017-03-03 18:34:34 +0000 | |||
3 | +++ tools/libertine-container-manager 2017-03-14 15:31:47 +0000 | |||
4 | @@ -24,6 +24,10 @@ | |||
5 | 24 | import sys | 24 | import sys |
6 | 25 | import re | 25 | import re |
7 | 26 | 26 | ||
8 | 27 | import gettext | ||
9 | 28 | gettext.textdomain('libertine') | ||
10 | 29 | _ = gettext.gettext | ||
11 | 30 | |||
12 | 27 | from libertine import ContainerRunning, LibertineContainer | 31 | from libertine import ContainerRunning, LibertineContainer |
13 | 28 | from libertine.ContainersConfig import ContainersConfig | 32 | from libertine.ContainersConfig import ContainersConfig |
14 | 29 | from libertine.HostInfo import HostInfo | 33 | from libertine.HostInfo import HostInfo |
15 | @@ -35,6 +39,16 @@ | |||
16 | 35 | self.containers_config = ContainersConfig() | 39 | self.containers_config = ContainersConfig() |
17 | 36 | self.host_info = HostInfo() | 40 | self.host_info = HostInfo() |
18 | 37 | 41 | ||
19 | 42 | |||
20 | 43 | def _container(self, container_id): | ||
21 | 44 | try: | ||
22 | 45 | return LibertineContainer(container_id, self.containers_config) | ||
23 | 46 | except ImportError as e: | ||
24 | 47 | container_type = self.containers_config.get_container_type(container_id) | ||
25 | 48 | libertine.utils.get_logger().error(_("Backend for container '{id}' not installed. Install " | ||
26 | 49 | "'python3-libertine-{type}' and try again.").format(id=container_id, type=container_type)) | ||
27 | 50 | sys.exit(1) | ||
28 | 51 | |||
29 | 38 | def _get_updated_locale(self, container_id): | 52 | def _get_updated_locale(self, container_id): |
30 | 39 | host_locale = self.host_info.get_host_locale() | 53 | host_locale = self.host_info.get_host_locale() |
31 | 40 | 54 | ||
32 | @@ -99,7 +113,7 @@ | |||
33 | 99 | 113 | ||
34 | 100 | try: | 114 | try: |
35 | 101 | self.containers_config.update_container_locale(args.id, self.host_info.get_host_locale()) | 115 | self.containers_config.update_container_locale(args.id, self.host_info.get_host_locale()) |
37 | 102 | container = LibertineContainer(args.id) | 116 | container = LibertineContainer(args.id, self.containers_config) |
38 | 103 | self.containers_config.update_container_install_status(args.id, "installing") | 117 | self.containers_config.update_container_install_status(args.id, "installing") |
39 | 104 | if not container.create_libertine_container(password, args.multiarch): | 118 | if not container.create_libertine_container(password, args.multiarch): |
40 | 105 | libertine.utils.get_logger().error("Failed to create container") | 119 | libertine.utils.get_logger().error("Failed to create container") |
41 | @@ -130,7 +144,7 @@ | |||
42 | 130 | 144 | ||
43 | 131 | def destroy(self, args): | 145 | def destroy(self, args): |
44 | 132 | container_id = self.containers_config.check_container_id(args.id) | 146 | container_id = self.containers_config.check_container_id(args.id) |
46 | 133 | container = LibertineContainer(container_id, self.containers_config) | 147 | container = self._container(container_id) |
47 | 134 | 148 | ||
48 | 135 | self.destroy_container(container, args.force) | 149 | self.destroy_container(container, args.force) |
49 | 136 | 150 | ||
50 | @@ -138,7 +152,7 @@ | |||
51 | 138 | 152 | ||
52 | 139 | def install_package(self, args): | 153 | def install_package(self, args): |
53 | 140 | container_id = self.containers_config.check_container_id(args.id) | 154 | container_id = self.containers_config.check_container_id(args.id) |
55 | 141 | container = LibertineContainer(container_id, self.containers_config) | 155 | container = self._container(container_id) |
56 | 142 | failure = False | 156 | failure = False |
57 | 143 | 157 | ||
58 | 144 | with ContainerRunning(container.container): | 158 | with ContainerRunning(container.container): |
59 | @@ -193,7 +207,7 @@ | |||
60 | 193 | 207 | ||
61 | 194 | def remove_package(self, args): | 208 | def remove_package(self, args): |
62 | 195 | container_id = self.containers_config.check_container_id(args.id) | 209 | container_id = self.containers_config.check_container_id(args.id) |
64 | 196 | container = LibertineContainer(container_id) | 210 | container = self._container(container_id) |
65 | 197 | failure = False | 211 | failure = False |
66 | 198 | 212 | ||
67 | 199 | with ContainerRunning(container.container): | 213 | with ContainerRunning(container.container): |
68 | @@ -216,8 +230,8 @@ | |||
69 | 216 | 230 | ||
70 | 217 | def search_cache(self, args): | 231 | def search_cache(self, args): |
71 | 218 | container_id = self.containers_config.check_container_id(args.id) | 232 | container_id = self.containers_config.check_container_id(args.id) |
72 | 233 | container = self._container(container_id) | ||
73 | 219 | 234 | ||
74 | 220 | container = LibertineContainer(container_id) | ||
75 | 221 | if container.search_package_cache(args.search_string) is not 0: | 235 | if container.search_package_cache(args.search_string) is not 0: |
76 | 222 | libertine.utils.get_logger().error("Search for '{}' in container '{}' exited with non-zero status" | 236 | libertine.utils.get_logger().error("Search for '{}' in container '{}' exited with non-zero status" |
77 | 223 | .format(args.id, args.search_string)) | 237 | .format(args.id, args.search_string)) |
78 | @@ -225,10 +239,10 @@ | |||
79 | 225 | 239 | ||
80 | 226 | def update(self, args): | 240 | def update(self, args): |
81 | 227 | container_id = self.containers_config.check_container_id(args.id) | 241 | container_id = self.containers_config.check_container_id(args.id) |
82 | 242 | container = self._container(container_id) | ||
83 | 243 | |||
84 | 228 | new_locale = self._get_updated_locale(container_id) | 244 | new_locale = self._get_updated_locale(container_id) |
85 | 229 | 245 | ||
86 | 230 | container = LibertineContainer(container_id) | ||
87 | 231 | |||
88 | 232 | if not container.update_libertine_container(new_locale): | 246 | if not container.update_libertine_container(new_locale): |
89 | 233 | sys.exit(1) | 247 | sys.exit(1) |
90 | 234 | 248 | ||
91 | @@ -242,7 +256,7 @@ | |||
92 | 242 | def list_apps(self, args): | 256 | def list_apps(self, args): |
93 | 243 | container_id = self.containers_config.check_container_id(args.id) | 257 | container_id = self.containers_config.check_container_id(args.id) |
94 | 244 | 258 | ||
96 | 245 | app_ids = LibertineContainer(container_id).list_app_ids() | 259 | app_ids = self._container(container_id).list_app_ids() |
97 | 246 | if args.json: | 260 | if args.json: |
98 | 247 | print(json.dumps(app_ids)) | 261 | print(json.dumps(app_ids)) |
99 | 248 | else: | 262 | else: |
100 | @@ -252,7 +266,7 @@ | |||
101 | 252 | def exec(self, args): | 266 | def exec(self, args): |
102 | 253 | container_id = self.containers_config.check_container_id(args.id) | 267 | container_id = self.containers_config.check_container_id(args.id) |
103 | 254 | 268 | ||
105 | 255 | container = LibertineContainer(container_id) | 269 | container = self._container(container_id) |
106 | 256 | 270 | ||
107 | 257 | if not container.exec_command(args.command): | 271 | if not container.exec_command(args.command): |
108 | 258 | sys.exit(1) | 272 | sys.exit(1) |
109 | @@ -269,7 +283,7 @@ | |||
110 | 269 | 283 | ||
111 | 270 | def configure(self, args): | 284 | def configure(self, args): |
112 | 271 | container_id = self.containers_config.check_container_id(args.id) | 285 | container_id = self.containers_config.check_container_id(args.id) |
114 | 272 | container = LibertineContainer(container_id) | 286 | container = self._container(container_id) |
115 | 273 | 287 | ||
116 | 274 | if args.multiarch and self.host_info.get_host_architecture() == 'amd64': | 288 | if args.multiarch and self.host_info.get_host_architecture() == 'amd64': |
117 | 275 | multiarch = 'disabled' | 289 | multiarch = 'disabled' |
118 | @@ -377,7 +391,7 @@ | |||
119 | 377 | def fix_integrity(self, args): | 391 | def fix_integrity(self, args): |
120 | 378 | if 'containerList' in self.containers_config.container_list: | 392 | if 'containerList' in self.containers_config.container_list: |
121 | 379 | for container in self.containers_config.container_list['containerList']: | 393 | for container in self.containers_config.container_list['containerList']: |
123 | 380 | libertine_container = LibertineContainer(container['id']) | 394 | libertine_container = self._container(container['id']) |
124 | 381 | 395 | ||
125 | 382 | if 'installStatus' not in container or container['installStatus'] == 'removing': | 396 | if 'installStatus' not in container or container['installStatus'] == 'removing': |
126 | 383 | self.destroy_container(libertine_container) | 397 | self.destroy_container(libertine_container) |
127 | @@ -411,7 +425,7 @@ | |||
128 | 411 | libertine.utils.get_logger().error("The restart subcommand is only valid for LXC and LXD type containers.") | 425 | libertine.utils.get_logger().error("The restart subcommand is only valid for LXC and LXD type containers.") |
129 | 412 | sys.exit(1) | 426 | sys.exit(1) |
130 | 413 | 427 | ||
132 | 414 | container = LibertineContainer(container_id) | 428 | container = self._container(container_id) |
133 | 415 | 429 | ||
134 | 416 | container.restart_libertine_container() | 430 | container.restart_libertine_container() |
135 | 417 | 431 | ||
136 | 418 | 432 | ||
137 | === modified file 'tools/libertine-launch' | |||
138 | --- tools/libertine-launch 2017-02-23 18:18:29 +0000 | |||
139 | +++ tools/libertine-launch 2017-03-14 15:31:47 +0000 | |||
140 | @@ -19,6 +19,10 @@ | |||
141 | 19 | import os | 19 | import os |
142 | 20 | import sys | 20 | import sys |
143 | 21 | 21 | ||
144 | 22 | import gettext | ||
145 | 23 | gettext.textdomain('libertine') | ||
146 | 24 | _ = gettext.gettext | ||
147 | 25 | |||
148 | 22 | from libertine import launcher | 26 | from libertine import launcher |
149 | 23 | 27 | ||
150 | 24 | def main(): | 28 | def main(): |
151 | @@ -30,8 +34,14 @@ | |||
152 | 30 | utils.get_logger().error("No container with id '%s'" % config.container_id) | 34 | utils.get_logger().error("No container with id '%s'" % config.container_id) |
153 | 31 | sys.exit(1) | 35 | sys.exit(1) |
154 | 32 | 36 | ||
157 | 33 | from libertine import LibertineContainer | 37 | try: |
158 | 34 | container = LibertineContainer(container_id=config.container_id) | 38 | from libertine import LibertineContainer |
159 | 39 | container = LibertineContainer(container_id=config.container_id) | ||
160 | 40 | except ImportError as e: | ||
161 | 41 | container_type = self.containers_config.get_container_type(container_id) | ||
162 | 42 | libertine.utils.get_logger().error(_("Backend for container '{id}' not installed. Install " | ||
163 | 43 | "'python3-libertine-{type}' and try again.").format(id=config.container_id, type=container_type)) | ||
164 | 44 | sys.exit(1) | ||
165 | 35 | else: | 45 | else: |
166 | 36 | from libertine import NoContainer | 46 | from libertine import NoContainer |
167 | 37 | 47 |
PASSED: Continuous integration, rev:409 /jenkins. canonical. com/libertine/ job/lp- libertine- ci/466/ /jenkins. canonical. com/libertine/ job/build/ 855 /jenkins. canonical. com/libertine/ job/test- 0-autopkgtest/ label=amd64, release= xenial+ overlay, testname= default/ 705 /jenkins. canonical. com/libertine/ job/test- 0-autopkgtest/ label=amd64, release= zesty,testname= default/ 705 /jenkins. canonical. com/libertine/ job/test- 0-autopkgtest/ label=i386, release= xenial+ overlay, testname= default/ 705 /jenkins. canonical. com/libertine/ job/test- 0-autopkgtest/ label=i386, release= zesty,testname= default/ 705 /jenkins. canonical. com/libertine/ job/build- 0-fetch/ 865 /jenkins. canonical. com/libertine/ job/build- 2-binpkg/ arch=amd64, release= xenial+ overlay/ 857 /jenkins. canonical. com/libertine/ job/build- 2-binpkg/ arch=amd64, release= xenial+ overlay/ 857/artifact/ output/ *zip*/output. zip /jenkins. canonical. com/libertine/ job/build- 2-binpkg/ arch=amd64, release= zesty/857 /jenkins. canonical. com/libertine/ job/build- 2-binpkg/ arch=amd64, release= zesty/857/ artifact/ output/ *zip*/output. zip /jenkins. canonical. com/libertine/ job/build- 2-binpkg/ arch=i386, release= xenial+ overlay/ 857 /jenkins. canonical. com/libertine/ job/build- 2-binpkg/ arch=i386, release= xenial+ overlay/ 857/artifact/ output/ *zip*/output. zip /jenkins. canonical. com/libertine/ job/build- 2-binpkg/ arch=i386, release= zesty/857 /jenkins. canonical. com/libertine/ job/build- 2-binpkg/ arch=i386, release= zesty/857/ artifact/ output/ *zip*/output. zip
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild: /jenkins. canonical. com/libertine/ job/lp- libertine- ci/466/ rebuild
https:/