Merge lp:~wesmason/charms/trusty/mongodb/merge-precise-patches into lp:charms/trusty/mongodb

Proposed by Wes Mason
Status: Merged
Merged at revision: 65
Proposed branch: lp:~wesmason/charms/trusty/mongodb/merge-precise-patches
Merge into: lp:charms/trusty/mongodb
Diff against target: 111 lines (+58/-1)
5 files modified
.bzrignore (+1/-0)
charm-helpers-sync.yaml (+1/-0)
hooks/charmhelpers/payload/__init__.py (+1/-0)
hooks/charmhelpers/payload/execd.py (+50/-0)
hooks/hooks.py (+5/-1)
To merge this branch: bzr merge lp:~wesmason/charms/trusty/mongodb/merge-precise-patches
Reviewer Review Type Date Requested Status
Matt Bruzek (community) Approve
Review Queue (community) automated testing Needs Fixing
Adam Israel (community) Approve
Review via email: mp+237694@code.launchpad.net

Commit message

Merge exec.d and volume relation_id patches from precise charm

Description of the change

This adds in the exec.d and volumes relation_id (MP#234670) patches from the precise mongodb charm.

To post a comment you must log in.
Revision history for this message
Ryan Beisner (1chb1n) wrote :

UOSCI bot says:
charm_lint_check #809 trusty-mongodb for wesmason mp237694
    LINT FAIL: lint-check missing

LINT Results not found.
Build: http://10.98.191.181:8080/job/charm_lint_check/809/

Revision history for this message
Ryan Beisner (1chb1n) wrote :

UOSCI bot says:
charm_unit_test #617 trusty-mongodb for wesmason mp237694
    UNIT FAIL: unit-test missing

UNIT Results not found.
Build: http://10.98.191.181:8080/job/charm_unit_test/617/

Revision history for this message
Adam Israel (aisrael) wrote :

Hi Wes,

Thanks for the work bringing over patches from the precise branch. I've had the opportunity to review this MP and am happy to report that it tests successfully. I'm adding my +1.

review: Approve
Revision history for this message
Review Queue (review-queue) wrote :

This items has failed automated testing! Results available here http://reports.vapour.ws/charm-tests/charm-bundle-test-10911-results

review: Needs Fixing (automated testing)
Revision history for this message
Matt Bruzek (mbruzek) wrote :

There were some lint errors that I took care of to avoid delaying this merge. In the future please resolve the lint errors in the files that you touch, even if you did not introduce them.

+1 LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file '.bzrignore'
--- .bzrignore 2014-07-10 18:38:27 +0000
+++ .bzrignore 2014-10-08 21:52:23 +0000
@@ -1,3 +1,4 @@
1.git1.git
2bin/*2bin/*
3scripts/charm-helpers-sync.py3scripts/charm-helpers-sync.py
4exec.d/*
45
=== modified file 'charm-helpers-sync.yaml'
--- charm-helpers-sync.yaml 2014-04-11 20:55:42 +0000
+++ charm-helpers-sync.yaml 2014-10-08 21:52:23 +0000
@@ -3,3 +3,4 @@
3include:3include:
4 - core4 - core
5 - fetch5 - fetch
6 - payload.execd
67
=== added directory 'exec.d'
=== added directory 'hooks/charmhelpers/payload'
=== added file 'hooks/charmhelpers/payload/__init__.py'
--- hooks/charmhelpers/payload/__init__.py 1970-01-01 00:00:00 +0000
+++ hooks/charmhelpers/payload/__init__.py 2014-10-08 21:52:23 +0000
@@ -0,0 +1,1 @@
1"Tools for working with files injected into a charm just before deployment."
02
=== added file 'hooks/charmhelpers/payload/execd.py'
--- hooks/charmhelpers/payload/execd.py 1970-01-01 00:00:00 +0000
+++ hooks/charmhelpers/payload/execd.py 2014-10-08 21:52:23 +0000
@@ -0,0 +1,50 @@
1#!/usr/bin/env python
2
3import os
4import sys
5import subprocess
6from charmhelpers.core import hookenv
7
8
9def default_execd_dir():
10 return os.path.join(os.environ['CHARM_DIR'], 'exec.d')
11
12
13def execd_module_paths(execd_dir=None):
14 """Generate a list of full paths to modules within execd_dir."""
15 if not execd_dir:
16 execd_dir = default_execd_dir()
17
18 if not os.path.exists(execd_dir):
19 return
20
21 for subpath in os.listdir(execd_dir):
22 module = os.path.join(execd_dir, subpath)
23 if os.path.isdir(module):
24 yield module
25
26
27def execd_submodule_paths(command, execd_dir=None):
28 """Generate a list of full paths to the specified command within exec_dir.
29 """
30 for module_path in execd_module_paths(execd_dir):
31 path = os.path.join(module_path, command)
32 if os.access(path, os.X_OK) and os.path.isfile(path):
33 yield path
34
35
36def execd_run(command, execd_dir=None, die_on_error=False, stderr=None):
37 """Run command for each module within execd_dir which defines it."""
38 for submodule_path in execd_submodule_paths(command, execd_dir):
39 try:
40 subprocess.check_call(submodule_path, shell=True, stderr=stderr)
41 except subprocess.CalledProcessError as e:
42 hookenv.log("Error ({}) running {}. Output: {}".format(
43 e.returncode, e.cmd, e.output))
44 if die_on_error:
45 sys.exit(e.returncode)
46
47
48def execd_preinstall(execd_dir=None):
49 """Run charm-pre-install for each module within execd_dir."""
50 execd_run('charm-pre-install', execd_dir=execd_dir)
051
=== modified file 'hooks/hooks.py'
--- hooks/hooks.py 2014-08-20 23:48:43 +0000
+++ hooks/hooks.py 2014-10-08 21:52:23 +0000
@@ -43,6 +43,8 @@
4343
44from charmhelpers.core.hookenv import log as juju_log44from charmhelpers.core.hookenv import log as juju_log
4545
46from charmhelpers.payload.execd import execd_preinstall
47
46from charmhelpers.core.host import (48from charmhelpers.core.host import (
47 service,49 service,
48)50)
@@ -724,6 +726,8 @@
724###############################################################################726###############################################################################
725@hooks.hook('install')727@hooks.hook('install')
726def install_hook():728def install_hook():
729 juju_log('Begin install hook.')
730 execd_preinstall()
727 juju_log("Installing mongodb")731 juju_log("Installing mongodb")
728 add_source(config('source'), config('key'))732 add_source(config('source'), config('key'))
729 apt_update(fatal=True)733 apt_update(fatal=True)
@@ -989,7 +993,7 @@
989def data_relation_joined():993def data_relation_joined():
990 juju_log("data_relation_joined")994 juju_log("data_relation_joined")
991995
992 return(relation_set(996 return(relation_set(relation_id(),
993 {997 {
994 'mountpoint': '/srv/juju/mongodb-data'998 'mountpoint': '/srv/juju/mongodb-data'
995 }))999 }))

Subscribers

People subscribed via source and target branches

to all changes: