Merge lp:~joetalbott/charms/trusty/adt-cloud-service/add_basenode into lp:~canonical-ci-engineering/charms/trusty/adt-cloud-service/trunk

Proposed by Joe Talbott
Status: Merged
Approved by: Joe Talbott
Approved revision: 4
Merged at revision: 5
Proposed branch: lp:~joetalbott/charms/trusty/adt-cloud-service/add_basenode
Merge into: lp:~canonical-ci-engineering/charms/trusty/adt-cloud-service/trunk
Diff against target: 93 lines (+19/-5)
4 files modified
config.yaml (+5/-0)
hooks/actions.py (+12/-4)
hooks/services.py (+1/-0)
templates/upstart.conf (+1/-1)
To merge this branch: bzr merge lp:~joetalbott/charms/trusty/adt-cloud-service/add_basenode
Reviewer Review Type Date Requested Status
Francis Ginther Approve
Review via email: mp+253283@code.launchpad.net

Commit message

Add basenode support.

Description of the change

Add basenode support.

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

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-13 02:42:53 +0000
3+++ config.yaml 2015-03-17 21:47:00 +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:47:24 +0000
17+++ hooks/actions.py 2015-03-17 21:47:00 +0000
18@@ -8,24 +8,31 @@
19 host,
20 )
21 from charmhelpers.core.services import helpers
22-from charmhelpers.payload.archive import extract_tarfile
23+from charmhelpers.payload import (archive, execd)
24
25
26 REQUIRED_PACKAGES = [
27 'python-virtualenv', 'python3-dev',
28 ]
29-SERVICE_DIR = '/srv/adt-cloud-service'
30-LOG_DIR = os.path.join(SERVICE_DIR, 'logs')
31+
32 WSGI_USER = 'www-data'
33 WSGI_GROUP = 'www-data'
34
35 config = hookenv.config()
36
37+SERVICE_DIR = '/srv/{}/adt-cloud-service'.format(config['environment'])
38+LOG_DIR = os.path.join(SERVICE_DIR, 'logs')
39+
40
41 def log_start(service_name):
42 hookenv.log('adt-cloud-service starting')
43
44
45+def basenode(service_name):
46+ hookenv.log("Executing basenode")
47+ execd.execd_preinstall()
48+
49+
50 def install_packages(service_name):
51 hookenv.log('Installing dependencies...')
52 fetch.add_source('ppa:canonical-ci-engineering/ci-airline-phase-0')
53@@ -38,7 +45,7 @@
54 tarball = os.path.join(files_dir, 'adt-cloud-service.tgz')
55 if not os.path.exists(SERVICE_DIR):
56 hookenv.log('Installing the code for the first time from tarball')
57- extract_tarfile(tarball, '/srv/')
58+ archive.extract_tarfile(tarball, os.path.dirname(SERVICE_DIR))
59
60
61 def get_config_file(service_name):
62@@ -70,6 +77,7 @@
63 subprocess.check_call(['%s/bin/pip' % env_dir,
64 'install', '--no-deps', '-e', SERVICE_DIR])
65
66+
67 def prepare_for_wsgi(service_name):
68 host.adduser(WSGI_USER)
69 host.add_group(WSGI_GROUP)
70
71=== modified file 'hooks/services.py'
72--- hooks/services.py 2015-03-16 21:47:24 +0000
73+++ hooks/services.py 2015-03-17 21:47:00 +0000
74@@ -15,6 +15,7 @@
75 'provided_data': [actions.WebsiteRelation()],
76 'required_data': [config],
77 'data_ready': [
78+ actions.basenode,
79 actions.install_packages,
80 actions.get_cloud_service_from_tarball,
81 actions.install_python_packages,
82
83=== modified file 'templates/upstart.conf'
84--- templates/upstart.conf 2015-03-13 02:42:53 +0000
85+++ templates/upstart.conf 2015-03-17 21:47:00 +0000
86@@ -11,7 +11,7 @@
87 # unless it fails 15 times within 5 seconds
88 respawn limit 15 5
89
90-env SERVICE_DIR=/srv/adt-cloud-service
91+env SERVICE_DIR=/srv/{{ environment }}/adt-cloud-service
92
93 script
94

Subscribers

People subscribed via source and target branches