Merge lp:~paulgear/charms/trusty/ntpmaster/fix-python3-on-trusty into lp:charms/trusty/ntpmaster

Proposed by Paul Gear
Status: Merged
Merged at revision: 17
Proposed branch: lp:~paulgear/charms/trusty/ntpmaster/fix-python3-on-trusty
Merge into: lp:charms/trusty/ntpmaster
Diff against target: 51 lines (+4/-25)
2 files modified
hooks/ntpmaster_hooks.py (+4/-4)
hooks/utils.py (+0/-21)
To merge this branch: bzr merge lp:~paulgear/charms/trusty/ntpmaster/fix-python3-on-trusty
Reviewer Review Type Date Requested Status
Stuart Bishop (community) Approve
Review via email: mp+297763@code.launchpad.net

Description of the change

Fix failure to install on trusty, due to installing the wrong python jinja2 package: http://pastebin.ubuntu.com/17430898/

To post a comment you must log in.
Revision history for this message
Stuart Bishop (stub) wrote :

Nice change.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hooks/ntpmaster_hooks.py'
2--- hooks/ntpmaster_hooks.py 2016-05-02 17:27:12 +0000
3+++ hooks/ntpmaster_hooks.py 2016-06-17 13:08:20 +0000
4@@ -8,8 +8,8 @@
5 import charmhelpers.core.host as host
6 from charmhelpers.core.hookenv import UnregisteredHookError
7 from charmhelpers.payload.execd import execd_preinstall
8-from utils import (
9- render_template,
10+from charmhelpers.contrib.templating.jinja import (
11+ render,
12 )
13
14 NTP_CONF = '/etc/ntp.conf'
15@@ -57,8 +57,8 @@
16 'servers': remote_sources,
17 }
18 with open(NTP_CONF, "w") as ntpconf:
19- ntpconf.write(render_template(os.path.basename(NTP_CONF),
20- ntp_context))
21+ ntpconf.write(render(os.path.basename(NTP_CONF),
22+ ntp_context))
23 else:
24 shutil.copy(NTP_CONF_ORIG, NTP_CONF)
25
26
27=== removed file 'hooks/utils.py'
28--- hooks/utils.py 2013-08-29 18:39:36 +0000
29+++ hooks/utils.py 1970-01-01 00:00:00 +0000
30@@ -1,21 +0,0 @@
31-from charmhelpers.fetch import (
32- apt_install,
33- filter_installed_packages
34-)
35-
36-
37-TEMPLATES_DIR = 'templates'
38-
39-try:
40- import jinja2
41-except ImportError:
42- apt_install(filter_installed_packages(['python-jinja2']),
43- fatal=True)
44- import jinja2
45-
46-
47-def render_template(template_name, context, template_dir=TEMPLATES_DIR):
48- templates = jinja2.Environment(
49- loader=jinja2.FileSystemLoader(template_dir))
50- template = templates.get_template(template_name)
51- return template.render(context)

Subscribers

People subscribed via source and target branches

to all changes: