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
=== modified file 'config.yaml'
--- config.yaml 2015-03-13 02:42:53 +0000
+++ config.yaml 2015-03-17 21:47:00 +0000
@@ -1,4 +1,9 @@
1options:1options:
2 environment:
3 type: string
4 default: "production"
5 description: |
6 Environment (devel, staging, production, etc.) that we're running.
2 config-file:7 config-file:
3 type: string8 type: string
4 description: |9 description: |
510
=== modified file 'hooks/actions.py'
--- hooks/actions.py 2015-03-16 21:47:24 +0000
+++ hooks/actions.py 2015-03-17 21:47:00 +0000
@@ -8,24 +8,31 @@
8 host,8 host,
9)9)
10from charmhelpers.core.services import helpers10from charmhelpers.core.services import helpers
11from charmhelpers.payload.archive import extract_tarfile11from charmhelpers.payload import (archive, execd)
1212
1313
14REQUIRED_PACKAGES = [14REQUIRED_PACKAGES = [
15 'python-virtualenv', 'python3-dev',15 'python-virtualenv', 'python3-dev',
16]16]
17SERVICE_DIR = '/srv/adt-cloud-service'17
18LOG_DIR = os.path.join(SERVICE_DIR, 'logs')
19WSGI_USER = 'www-data'18WSGI_USER = 'www-data'
20WSGI_GROUP = 'www-data'19WSGI_GROUP = 'www-data'
2120
22config = hookenv.config()21config = hookenv.config()
2322
23SERVICE_DIR = '/srv/{}/adt-cloud-service'.format(config['environment'])
24LOG_DIR = os.path.join(SERVICE_DIR, 'logs')
25
2426
25def log_start(service_name):27def log_start(service_name):
26 hookenv.log('adt-cloud-service starting')28 hookenv.log('adt-cloud-service starting')
2729
2830
31def basenode(service_name):
32 hookenv.log("Executing basenode")
33 execd.execd_preinstall()
34
35
29def install_packages(service_name):36def install_packages(service_name):
30 hookenv.log('Installing dependencies...')37 hookenv.log('Installing dependencies...')
31 fetch.add_source('ppa:canonical-ci-engineering/ci-airline-phase-0')38 fetch.add_source('ppa:canonical-ci-engineering/ci-airline-phase-0')
@@ -38,7 +45,7 @@
38 tarball = os.path.join(files_dir, 'adt-cloud-service.tgz')45 tarball = os.path.join(files_dir, 'adt-cloud-service.tgz')
39 if not os.path.exists(SERVICE_DIR):46 if not os.path.exists(SERVICE_DIR):
40 hookenv.log('Installing the code for the first time from tarball')47 hookenv.log('Installing the code for the first time from tarball')
41 extract_tarfile(tarball, '/srv/')48 archive.extract_tarfile(tarball, os.path.dirname(SERVICE_DIR))
4249
4350
44def get_config_file(service_name):51def get_config_file(service_name):
@@ -70,6 +77,7 @@
70 subprocess.check_call(['%s/bin/pip' % env_dir,77 subprocess.check_call(['%s/bin/pip' % env_dir,
71 'install', '--no-deps', '-e', SERVICE_DIR])78 'install', '--no-deps', '-e', SERVICE_DIR])
7279
80
73def prepare_for_wsgi(service_name):81def prepare_for_wsgi(service_name):
74 host.adduser(WSGI_USER)82 host.adduser(WSGI_USER)
75 host.add_group(WSGI_GROUP)83 host.add_group(WSGI_GROUP)
7684
=== modified file 'hooks/services.py'
--- hooks/services.py 2015-03-16 21:47:24 +0000
+++ hooks/services.py 2015-03-17 21:47:00 +0000
@@ -15,6 +15,7 @@
15 'provided_data': [actions.WebsiteRelation()],15 'provided_data': [actions.WebsiteRelation()],
16 'required_data': [config],16 'required_data': [config],
17 'data_ready': [17 'data_ready': [
18 actions.basenode,
18 actions.install_packages,19 actions.install_packages,
19 actions.get_cloud_service_from_tarball,20 actions.get_cloud_service_from_tarball,
20 actions.install_python_packages,21 actions.install_python_packages,
2122
=== modified file 'templates/upstart.conf'
--- templates/upstart.conf 2015-03-13 02:42:53 +0000
+++ templates/upstart.conf 2015-03-17 21:47:00 +0000
@@ -11,7 +11,7 @@
11# unless it fails 15 times within 5 seconds11# unless it fails 15 times within 5 seconds
12respawn limit 15 512respawn limit 15 5
1313
14env SERVICE_DIR=/srv/adt-cloud-service14env SERVICE_DIR=/srv/{{ environment }}/adt-cloud-service
1515
16script16script
1717

Subscribers

People subscribed via source and target branches