Merge lp:~james-page/charms/trusty/mongodb/vivid-fixes into lp:charms/trusty/mongodb

Proposed by James Page
Status: Merged
Merged at revision: 68
Proposed branch: lp:~james-page/charms/trusty/mongodb/vivid-fixes
Merge into: lp:charms/trusty/mongodb
Diff against target: 20 lines (+9/-1)
1 file modified
hooks/hooks.py (+9/-1)
To merge this branch: bzr merge lp:~james-page/charms/trusty/mongodb/vivid-fixes
Reviewer Review Type Date Requested Status
Liam Young (community) Approve
Review via email: mp+257086@code.launchpad.net

Description of the change

Auto-install python-yaml on Ubuntu systems where its not installed by default.

This includes >= vivid.

To post a comment you must log in.
68. By James Page

Deal with yaml import if need be

Revision history for this message
Liam Young (gnuoy) wrote :

Approve

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hooks/hooks.py'
2--- hooks/hooks.py 2015-02-25 00:26:31 +0000
3+++ hooks/hooks.py 2015-04-22 13:24:27 +0000
4@@ -13,7 +13,15 @@
5 import subprocess
6 import sys
7 import time
8-import yaml
9+
10+try:
11+ import yaml # flake8: noqa
12+except ImportError:
13+ if sys.version_info.major == 2:
14+ subprocess.check_call(['apt-get', 'install', '-y', 'python-yaml'])
15+ else:
16+ subprocess.check_call(['apt-get', 'install', '-y', 'python3-yaml'])
17+ import yaml # flake8: noqa
18
19 from os import chmod
20 from os import remove

Subscribers

People subscribed via source and target branches

to all changes: