Merge lp:~gz/juju-deployer/polite_juju_install_check into lp:juju-deployer

Proposed by Martin Packman
Status: Merged
Merged at revision: 88
Proposed branch: lp:~gz/juju-deployer/polite_juju_install_check
Merge into: lp:juju-deployer
Diff against target: 38 lines (+9/-1)
2 files modified
.bzrignore (+1/-0)
deployer/cli.py (+8/-1)
To merge this branch: bzr merge lp:~gz/juju-deployer/polite_juju_install_check
Reviewer Review Type Date Requested Status
Kapil Thangavelu Approve
Review via email: mp+199428@code.launchpad.net

Description of the change

Display a nice error if juju-deployer is run without juju installed.

A new juju-deployer user I was introducing to the tool got a python traceback on first attempt. This branch catches the executable not found exception when looking up the juju version and gives a hint to install it.

As a drive-by, also ignore the build directory created by setup.py script.

To post a comment you must log in.
Revision history for this message
Kapil Thangavelu (hazmat) wrote :

Thanks looks good

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '.bzrignore'
2--- .bzrignore 2013-11-12 14:09:56 +0000
3+++ .bzrignore 2013-12-18 10:08:28 +0000
4@@ -2,6 +2,7 @@
5 .emacs.desktop.lock
6 *.egg
7 _build
8+build
9 deployer.sublime-project
10 deployer.sublime-workspace
11 dist/
12
13=== modified file 'deployer/cli.py'
14--- deployer/cli.py 2013-11-21 03:19:56 +0000
15+++ deployer/cli.py 2013-12-18 10:08:28 +0000
16@@ -8,6 +8,7 @@
17
18
19 import argparse
20+import errno
21 import logging
22 import os
23 import sys
24@@ -138,7 +139,13 @@
25 log = logging.getLogger("deployer.cli")
26 start_time = time.time()
27
28- env = select_runtime(options.juju_env, options)
29+ try:
30+ env = select_runtime(options.juju_env, options)
31+ except OSError as e:
32+ if e.errno != errno.ENOENT:
33+ raise
34+ log.error("No juju binary found, have you installed juju?")
35+ sys.exit(1)
36 log.debug('Using runtime %s', env.__class__.__name__)
37
38 config = ConfigStack(options.configs or [])

Subscribers

People subscribed via source and target branches