Merge lp:~fginther/charms/trusty/adt-result-checker/add-basenode into lp:~canonical-ci-engineering/charms/trusty/adt-result-checker/trunk

Proposed by Francis Ginther
Status: Merged
Approved by: Francis Ginther
Approved revision: 3
Merged at revision: 3
Proposed branch: lp:~fginther/charms/trusty/adt-result-checker/add-basenode
Merge into: lp:~canonical-ci-engineering/charms/trusty/adt-result-checker/trunk
Diff against target: 80 lines (+16/-5)
4 files modified
config.yaml (+5/-0)
hooks/actions.py (+9/-4)
hooks/services.py (+1/-0)
templates/upstart.conf (+1/-1)
To merge this branch: bzr merge lp:~fginther/charms/trusty/adt-result-checker/add-basenode
Reviewer Review Type Date Requested Status
Celso Providelo (community) Approve
Review via email: mp+253461@code.launchpad.net

Commit message

Add basenode support and directory layout per IS guidelines.

Description of the change

Add basenode support and directory layout per IS guidelines.

To post a comment you must log in.
Revision history for this message
Celso Providelo (cprov) :
review: Approve
Revision history for this message
Francis Ginther (fginther) wrote :

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'config.yaml'
2--- config.yaml 2015-03-16 17:36:07 +0000
3+++ config.yaml 2015-03-19 03:48:56 +0000
4@@ -1,4 +1,9 @@
5 options:
6+ environment:
7+ type: string
8+ default: "production"
9+ description: |
10+ Environment (devel, staging, production, etc.) that we're running.
11 config-file:
12 type: string
13 description: |
14
15=== modified file 'hooks/actions.py'
16--- hooks/actions.py 2015-03-16 21:14:20 +0000
17+++ hooks/actions.py 2015-03-19 03:48:56 +0000
18@@ -6,21 +6,26 @@
19 from charmhelpers import fetch
20 from charmhelpers.core import hookenv
21 from charmhelpers.core.host import adduser
22-
23-from charmhelpers.payload.archive import extract_tarfile
24+from charmhelpers.payload import (archive, execd)
25
26
27 REQUIRED_PACKAGES = [
28 'python-virtualenv', 'python3-dev']
29-SERVICE_DIR = '/srv/adt-result-checker'
30
31 config = hookenv.config()
32
33+SERVICE_DIR = '/srv/{}/adt-result-checker'.format(config['environment'])
34+
35
36 def log_start(service_name):
37 hookenv.log('adt-result-checker starting')
38
39
40+def basenode(service_name):
41+ hookenv.log("Executing basenode")
42+ execd.execd_preinstall()
43+
44+
45 def install_packages(service_name):
46 hookenv.log('Installing dependencies...')
47 fetch.add_source('ppa:canonical-ci-engineering/ci-airline-phase-0')
48@@ -33,7 +38,7 @@
49 tarball = os.path.join(files_dir, 'adt-result-checker.tgz')
50 if not os.path.exists(SERVICE_DIR):
51 hookenv.log('Installing the code for the first time from tarball')
52- extract_tarfile(tarball, '/srv/')
53+ archive.extract_tarfile(tarball, os.path.dirname(SERVICE_DIR))
54
55
56 def get_config_file(service_name):
57
58=== modified file 'hooks/services.py'
59--- hooks/services.py 2015-03-16 17:36:07 +0000
60+++ hooks/services.py 2015-03-19 03:48:56 +0000
61@@ -14,6 +14,7 @@
62 'service': 'adt-result-checker',
63 'required_data': [config],
64 'data_ready': [
65+ actions.basenode,
66 actions.install_packages,
67 actions.get_result_checker_from_tarball,
68 actions.install_python_packages,
69
70=== modified file 'templates/upstart.conf'
71--- templates/upstart.conf 2015-03-16 21:14:20 +0000
72+++ templates/upstart.conf 2015-03-19 03:48:56 +0000
73@@ -11,7 +11,7 @@
74 # unless it fails 15 times within 5 seconds
75 respawn limit 15 5
76
77-env SERVICE_DIR=/srv/adt-result-checker
78+env SERVICE_DIR=/srv/{{ environment }}/adt-result-checker
79
80 script
81

Subscribers

People subscribed via source and target branches